summaryrefslogtreecommitdiffstats
path: root/tests/tests.pri
diff options
context:
space:
mode:
authorMiikka Heikkinen <miikka.heikkinen@digia.com>2014-01-10 15:08:47 +0200
committerMiikka Heikkinen <miikka.heikkinen@digia.com>2014-01-13 08:17:56 +0200
commit99d7cbbb8887382ea17dcbeb90a8d768bb9ebdb5 (patch)
treece0563bbde0c8a5f391479d180755ca212cfbcff /tests/tests.pri
parentb05e4498bdb82a32ba9d82fd6fc65727b99e745d (diff)
Improve static build support.
Now qml plugin can also be built statically. Change-Id: Id37f565ab9e02529fafaffa024acd69560b3703a Reviewed-by: Mika Salmela <mika.salmela@digia.com>
Diffstat (limited to 'tests/tests.pri')
-rw-r--r--tests/tests.pri65
1 files changed, 50 insertions, 15 deletions
diff --git a/tests/tests.pri b/tests/tests.pri
index fd17b360..d374ea3b 100644
--- a/tests/tests.pri
+++ b/tests/tests.pri
@@ -19,6 +19,15 @@ TEMPLATE = app
QT += datavisualization
+!static:android {
+ # Add Qt library to be loaded in shared android build
+ vis_lib_name = DataVisualization
+ vis_src_lib = lib$${vis_lib_name}.so
+ vis_lib_dir = $$OUT_PWD/../../lib/$$vis_src_lib
+ vis_lib_formatted = $$replace(vis_lib_dir, /, $$QMAKE_DIR_SEP)
+ ANDROID_EXTRA_LIBS = $$vis_lib_formatted
+}
+
contains(TARGET, qml.*) {
uri = QtDataVisualization
lib_name = datavisualizationqml2
@@ -29,46 +38,72 @@ contains(TARGET, qml.*) {
make_qmldir_target = \"$$replace(make_qmldir_path, /, $$QMAKE_DIR_SEP)\"
system($$QMAKE_MKDIR $$make_qmldir_target)
}
- copy_qmldir_examples.target = $$make_qmldir_path/qmldir
- copy_qmldir_examples.depends = $$_PRO_FILE_PWD_/../../src/$$lib_name/qmldir
- copy_qmldir_examples.commands = $(COPY_FILE) \"$$replace(copy_qmldir_examples.depends, /, $$QMAKE_DIR_SEP)\" \"$$replace(copy_qmldir_examples.target, /, $$QMAKE_DIR_SEP)\"
- QMAKE_EXTRA_TARGETS += copy_qmldir_examples
- PRE_TARGETDEPS += $$copy_qmldir_examples.target
+ copy_qmldir.target = $$make_qmldir_path/qmldir
+ copy_qmldir.depends = $$_PRO_FILE_PWD_/../../src/$$lib_name/qmldir
+ copy_qmldir_formatted = \"$$replace(copy_qmldir.depends, /, $$QMAKE_DIR_SEP)\" \"$$replace(copy_qmldir.target, /, $$QMAKE_DIR_SEP)\"
+ copy_qmldir.commands = $(COPY_FILE) $$copy_qmldir_formatted
+ QMAKE_EXTRA_TARGETS += copy_qmldir
+ PRE_TARGETDEPS += $$copy_qmldir.target
+
+ static:contains(QT_CONFIG, static) {
+ # Make import scan find our copied qmldir & statically built qml lib
+ LIB_EXTENSION = lib
+ QMLPATHS += $$DESTDIR
+ # We need to copy the qmldir & lib already at qmake run stage as import scan is done then
+ exists($$copy_qmldir.depends): system($$QMAKE_COPY $$copy_qmldir_formatted)
+ } else {
+ win32 {
+ LIB_EXTENSION = dll
+ } else {
+ mac {
+ LIB_EXTENSION = dylib
+ } else {
+ LIB_EXTENSION = so
+ }
+ }
+ }
win32 {
CONFIG(debug, release|debug) {
src_dir = debug
- src_lib = $${lib_name}d.dll
+ src_lib = $${lib_name}d.$$LIB_EXTENSION
}
CONFIG(release, release|debug){
src_dir = release
- src_lib = $${lib_name}.dll
+ src_lib = $${lib_name}.$$LIB_EXTENSION
}
} else {
src_dir = .
mac {
CONFIG(debug, release|debug) {
- src_lib = lib$${lib_name}_debug.dylib
+ src_lib = lib$${lib_name}_debug.$$LIB_EXTENSION
}
CONFIG(release, release|debug){
- src_lib = lib$${lib_name}.dylib
+ src_lib = lib$${lib_name}.$$LIB_EXTENSION
}
} else {
# linux, android
- src_lib = lib$${lib_name}.so
+ src_lib = lib$${lib_name}.$$LIB_EXTENSION
}
}
copy_lib.target = $$make_qmldir_path/$$src_lib
copy_lib.depends = $$OUT_PWD/../../src/$$lib_name/$$src_dir/$$src_lib
- copy_lib.commands = $(COPY_FILE) \"$$replace(copy_lib.depends, /, $$QMAKE_DIR_SEP)\" \"$$replace(copy_lib.target, /, $$QMAKE_DIR_SEP)\"
+ copy_lib_formatted = \"$$replace(copy_lib.depends, /, $$QMAKE_DIR_SEP)\" \"$$replace(copy_lib.target, /, $$QMAKE_DIR_SEP)\"
+ copy_lib.commands = $(COPY_FILE) $$copy_lib_formatted
QMAKE_EXTRA_TARGETS += copy_lib
PRE_TARGETDEPS += $$copy_lib.target
android {
- android_qmldir.files = $$copy_qmldir_examples.target
+ system($$QMAKE_COPY $$copy_qmldir_formatted)
+ android_qmldir.files = $$copy_qmldir.target
android_qmldir.path = /assets/qml/$$uri_replaced
- android_qmlplugin.files = $$copy_lib.target
- android_qmlplugin.path = $$target.path
- INSTALLS += android_qmldir android_qmlplugin
+ INSTALLS += android_qmldir
+ # No need to do custom install for qml plugin lib when it is statically built into app
+ !static|!contains(QT_CONFIG, static) {
+ system($$QMAKE_COPY $$copy_lib_formatted)
+ android_qmlplugin.files = $$copy_lib.target
+ android_qmlplugin.path = $$target.path
+ INSTALLS += android_qmlplugin
+ }
}
}