From 743754a36d25c3f529603b1f404a131982c897f6 2014-04-11 09:55:56 From: Andy Shaw Date: 2014-04-11 09:55:56 Subject: [PATCH] Fix build for iOS and for building the QtQuick 2 plugin statically When building statically then static will be set not staticlib, therefore we need to ensure we check for static in those cases. And also protect against Mac specific flags when building for iOS. Task-number: QTRD-3036 Change-Id: Ib2c534974ad9292e3634b8b692344c71e26e56cd Reviewed-by: Miikka Heikkinen --- diff --git a/config.pri b/config.pri index 2cdcaf9..de6ec0f 100644 --- a/config.pri +++ b/config.pri @@ -1,6 +1,7 @@ ##################### LIB ################################################# LIBRARY_NAME = QtCommercialChart +ios:CONFIG(iphonesimulator, iphonesimulator|iphoneos):LIBRARY_NAME = $$join(LIBRARY_NAME,,,_iphonesimulator) CONFIG(debug, debug|release) { mac: LIBRARY_NAME = $$join(LIBRARY_NAME,,,_debug) win32: LIBRARY_NAME = $$join(LIBRARY_NAME,,,d) @@ -10,7 +11,7 @@ LIBS += -l$$LIBRARY_NAME # This will undefine Q_DECL_EXPORT/Q_DECL_IMPORT at qchartglobal.h # They should not be used for staticlib builds. -staticlib:DEFINES+=QTCOMMERCIALCHART_STATICLIB +static|staticlib:DEFINES+=QTCOMMERCIALCHART_STATICLIB #################### COVERAGE ################################################################# coverage: CONFIG += debug @@ -78,7 +79,7 @@ contains(QMAKE_HOST.os, Windows) { CHART_BUILD_LIB_DIR = $$replace(CHART_BUILD_LIB_DIR, "/","\\") } -macx: { +macx:!ios { # Some Qt versions use an incompatible configuration on OSX which makes the build fail. # As a work-around, set the minimum OSX version to 10.5. QMAKE_CXXFLAGS *= -mmacosx-version-min=10.5 diff --git a/demos/demos.pri b/demos/demos.pri index 5f3df14..e96d687 100644 --- a/demos/demos.pri +++ b/demos/demos.pri @@ -3,11 +3,12 @@ } DESTDIR = $$CHART_BUILD_BIN_DIR +!ios { OBJECTS_DIR = $$CHART_BUILD_DIR/demos/$$TARGET MOC_DIR = $$CHART_BUILD_DIR/demos/$$TARGET UI_DIR = $$CHART_BUILD_DIR/demos/$$TARGET RCC_DIR = $$CHART_BUILD_DIR/demos/$$TARGET - +} TEMPLATE = app QT += core gui greaterThan(QT_MAJOR_VERSION, 4): QT += widgets diff --git a/examples/examples.pri b/examples/examples.pri index 9744a3a..ea89d8b 100644 --- a/examples/examples.pri +++ b/examples/examples.pri @@ -3,11 +3,12 @@ } DESTDIR = $$CHART_BUILD_BIN_DIR +!ios { OBJECTS_DIR = $$CHART_BUILD_DIR/examples/$$TARGET MOC_DIR = $$CHART_BUILD_DIR/examples/$$TARGET UI_DIR = $$CHART_BUILD_DIR/examples/$$TARGET RCC_DIR = $$CHART_BUILD_DIR/examples/$$TARGET - +} TEMPLATE = app QT += core gui greaterThan(QT_MAJOR_VERSION, 4): QT += widgets diff --git a/plugins/declarative/declarative.pri b/plugins/declarative/declarative.pri index e862809..e652c7c 100644 --- a/plugins/declarative/declarative.pri +++ b/plugins/declarative/declarative.pri @@ -9,7 +9,7 @@ contains(DEFINES, CHARTS_FOR_QUICK2) { } INCLUDEPATH += $$CHART_BUILD_PRIVATE_HEADER_DIR - +ios:CONFIG(iphonesimulator, iphonesimulator|iphoneos):TARGET = $$join(TARGET,,,_iphonesimulator) CONFIG(debug, debug|release) { mac: TARGET = $$join(TARGET,,,_debug) win32: TARGET = $$join(TARGET,,,d) diff --git a/plugins/declarative/plugin.cpp b/plugins/declarative/plugin.cpp index c801a32..01de104 100644 --- a/plugins/declarative/plugin.cpp +++ b/plugins/declarative/plugin.cpp @@ -241,10 +241,10 @@ public: } }; -#include "plugin.moc" - QTCOMMERCIALCHART_END_NAMESPACE +#include "plugin.moc" + QTCOMMERCIALCHART_USE_NAMESPACE #if (QT_VERSION < QT_VERSION_CHECK(5, 0, 0)) diff --git a/plugins/quick2/qmldir b/plugins/quick2/qmldir index 90d4edb..d0035f7 100644 --- a/plugins/quick2/qmldir +++ b/plugins/quick2/qmldir @@ -1,2 +1,3 @@ module QtCommercial.Chart plugin qtcommercialchartqml2 +classname ChartQmlPlugin diff --git a/plugins/quick2/quick2.pro b/plugins/quick2/quick2.pro index 12e9d45..235ebc2 100644 --- a/plugins/quick2/quick2.pro +++ b/plugins/quick2/quick2.pro @@ -7,4 +7,5 @@ DEFINES += CHARTS_FOR_QUICK2 error( "Couldn't find the declarative.pri file!" ) } qmldir.files += plugins.qmltypes - +TARGETPATH = QtCommercial.Chart +QMAKE_MOC_OPTIONS += -Muri=$$TARGETPATH diff --git a/src/src.pro b/src/src.pro index 7890c17..d4386d1 100644 --- a/src/src.pro +++ b/src/src.pro @@ -186,7 +186,7 @@ win32:{ INSTALLS += target } -mac: !staticlib: { +mac: !static:!staticlib { # Update the name (id) of the library on OSX to point to the lib path MAC_CHARTS_LIB_NAME = "lib"$$LIBRARY_NAME".1.dylib" QMAKE_POST_LINK += "install_name_tool -id $$CHART_BUILD_LIB_DIR"/"$$MAC_CHARTS_LIB_NAME $$CHART_BUILD_LIB_DIR"/"$$MAC_CHARTS_LIB_NAME"