From f71c4a0da5bf79534a11d837c447d8a167e5c53e Mon Sep 17 00:00:00 2001 From: Martin Straka Date: Tue, 20 Feb 2018 12:31:28 +0100 Subject: [PATCH 1/4] Updated project file --- mobile-datovka.pro | 26 ++++++++++++++++++++++---- 1 file changed, 22 insertions(+), 4 deletions(-) diff --git a/mobile-datovka.pro b/mobile-datovka.pro index 11ca7600..8f8ba734 100644 --- a/mobile-datovka.pro +++ b/mobile-datovka.pro @@ -69,7 +69,7 @@ command = $$LRELEASE mobile-datovka.pro system($$command)|error("Failed to run: $$command") # Copy translation files at qmake invocation. -win32|winphone|winrt|android { +win32|winphone|winrt { message(Copying Qt translation from $$shell_path($$[QT_INSTALL_DATA]).) system($$QMAKE_COPY $$shell_path($$[QT_INSTALL_DATA])\translations\qtbase_cs.qm res\locale\qtbase_cs.qm) system($$QMAKE_COPY $$shell_path($$[QT_INSTALL_DATA])\translations\qtbase_en.qm res\locale\qtbase_en.qm) @@ -77,6 +77,17 @@ win32|winphone|winrt|android { message(Copying Qt translation from $$[QT_INSTALL_DATA].) system($$QMAKE_COPY $$[QT_INSTALL_DATA]/translations/qtbase_cs.qm res/locale/qtbase_cs.qm) system($$QMAKE_COPY $$[QT_INSTALL_DATA]/translations/qtbase_en.qm res/locale/qtbase_en.qm) +} else:android { + contains(QMAKE_PLATFORM, win32) { + message(Copying Qt translation from $$shell_path($$[QT_INSTALL_DATA]).) + system($$QMAKE_COPY $$shell_path($$[QT_INSTALL_DATA])\translations\qtbase_cs.qm res\locale\qtbase_cs.qm) + system($$QMAKE_COPY $$shell_path($$[QT_INSTALL_DATA])\translations\qtbase_en.qm res\locale\qtbase_en.qm) + } + contains(QMAKE_PLATFORM, unix) { + message(Copying Qt translation from $$[QT_INSTALL_DATA].) + system($$QMAKE_COPY $$[QT_INSTALL_DATA]/translations/qtbase_cs.qm res/locale/qtbase_cs.qm) + system($$QMAKE_COPY $$[QT_INSTALL_DATA]/translations/qtbase_en.qm res/locale/qtbase_en.qm) + } } else { message(For this target you must copy Qt translation (qtbase_cs.qm) from $$[QT_INSTALL_DATA]/translations/.) } @@ -239,9 +250,16 @@ ios: system(sed -e "s/@VERSION@/$${VERSION}/g" "ios/Info.tmp" > "ios/Info.plist" ios: include(ios/ios.pri) # android target. -android: system(sed.exe -e "s/@VERSION@/$${VERSION}/g" "android/AndroidManifest.tmp" > "android/AndroidManifest.xml") -android: ANDROID_PACKAGE_SOURCE_DIR = $$PWD/android -android: include(android/android.pri) +android { + contains(QMAKE_PLATFORM, win32) { + system(sed.exe -e "s/@VERSION@/$${VERSION}/g" "android/AndroidManifest.tmp" > "android/AndroidManifest.xml") + } + contains(QMAKE_PLATFORM, unix) { + system(sed -e "s/@VERSION@/$${VERSION}/g" "android/AndroidManifest.tmp" > "android/AndroidManifest.xml") + } + ANDROID_PACKAGE_SOURCE_DIR = $$PWD/android + include(android/android.pri) +} # winphone|winrt target. winphone|winrt: include(winrt/winrt.pri) -- GitLab From cf9504179fe6b7e8cff8dfb5cc0e98d0f62ab703 Mon Sep 17 00:00:00 2001 From: Karel Slany Date: Tue, 20 Feb 2018 13:10:22 +0100 Subject: [PATCH 2/4] Fixed calling of lrelease from qtcreator on Windows. --- mobile-datovka.pro | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/mobile-datovka.pro b/mobile-datovka.pro index 8f8ba734..d132af69 100644 --- a/mobile-datovka.pro +++ b/mobile-datovka.pro @@ -63,8 +63,13 @@ SOURCES += qml/*.qml \ qml/pages/*.qml } -# run LRELEASE to generate the qm files +# Run lrelease to generate the qm files. qtPrepareTool(LRELEASE, lrelease) +contains(QMAKE_HOST.os, Windows) { + # Remove shell quotes and replace them with system quotes. + LRELEASE=$$replace(LRELEASE, "'", "") + LRELEASE=$$system_quote($$LRELEASE) +} command = $$LRELEASE mobile-datovka.pro system($$command)|error("Failed to run: $$command") -- GitLab From bc3a0fdfe7c777e69c03cb406e1f60251b81aa57 Mon Sep 17 00:00:00 2001 From: Martin Straka Date: Tue, 20 Feb 2018 13:22:46 +0100 Subject: [PATCH 3/4] Updated host detection in project file --- mobile-datovka.pro | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/mobile-datovka.pro b/mobile-datovka.pro index d132af69..4b83e31b 100644 --- a/mobile-datovka.pro +++ b/mobile-datovka.pro @@ -75,26 +75,26 @@ system($$command)|error("Failed to run: $$command") # Copy translation files at qmake invocation. win32|winphone|winrt { - message(Copying Qt translation from $$shell_path($$[QT_INSTALL_DATA]).) + message(Windows: Copying Qt translation from $$shell_path($$[QT_INSTALL_DATA]).) system($$QMAKE_COPY $$shell_path($$[QT_INSTALL_DATA])\translations\qtbase_cs.qm res\locale\qtbase_cs.qm) system($$QMAKE_COPY $$shell_path($$[QT_INSTALL_DATA])\translations\qtbase_en.qm res\locale\qtbase_en.qm) -} else:macx|osx|ios|unix { - message(Copying Qt translation from $$[QT_INSTALL_DATA].) - system($$QMAKE_COPY $$[QT_INSTALL_DATA]/translations/qtbase_cs.qm res/locale/qtbase_cs.qm) - system($$QMAKE_COPY $$[QT_INSTALL_DATA]/translations/qtbase_en.qm res/locale/qtbase_en.qm) } else:android { - contains(QMAKE_PLATFORM, win32) { - message(Copying Qt translation from $$shell_path($$[QT_INSTALL_DATA]).) + contains(QMAKE_HOST.os, Windows) { + message(Windows: Copying Qt translation from $$shell_path($$[QT_INSTALL_DATA]).) system($$QMAKE_COPY $$shell_path($$[QT_INSTALL_DATA])\translations\qtbase_cs.qm res\locale\qtbase_cs.qm) system($$QMAKE_COPY $$shell_path($$[QT_INSTALL_DATA])\translations\qtbase_en.qm res\locale\qtbase_en.qm) } - contains(QMAKE_PLATFORM, unix) { - message(Copying Qt translation from $$[QT_INSTALL_DATA].) + contains(QMAKE_HOST.os, Linux) { + message(Unix: Copying Qt translation from $$[QT_INSTALL_DATA].) system($$QMAKE_COPY $$[QT_INSTALL_DATA]/translations/qtbase_cs.qm res/locale/qtbase_cs.qm) system($$QMAKE_COPY $$[QT_INSTALL_DATA]/translations/qtbase_en.qm res/locale/qtbase_en.qm) } +} else:macx|osx|ios|unix { + message(Unix: Copying Qt translation from $$[QT_INSTALL_DATA].) + system($$QMAKE_COPY $$[QT_INSTALL_DATA]/translations/qtbase_cs.qm res/locale/qtbase_cs.qm) + system($$QMAKE_COPY $$[QT_INSTALL_DATA]/translations/qtbase_en.qm res/locale/qtbase_en.qm) } else { - message(For this target you must copy Qt translation (qtbase_cs.qm) from $$[QT_INSTALL_DATA]/translations/.) + message(Error: For this target you must copy Qt translation (qtbase_cs.qm) from $$[QT_INSTALL_DATA]/translations/.) } TRANSLATIONS_FILES += \ @@ -256,10 +256,10 @@ ios: include(ios/ios.pri) # android target. android { - contains(QMAKE_PLATFORM, win32) { + contains(QMAKE_HOST.os, Windows) { system(sed.exe -e "s/@VERSION@/$${VERSION}/g" "android/AndroidManifest.tmp" > "android/AndroidManifest.xml") } - contains(QMAKE_PLATFORM, unix) { + contains(QMAKE_HOST.os, Linux) { system(sed -e "s/@VERSION@/$${VERSION}/g" "android/AndroidManifest.tmp" > "android/AndroidManifest.xml") } ANDROID_PACKAGE_SOURCE_DIR = $$PWD/android -- GitLab From a1c27d5517939e83a83a2932814e77d171827528 Mon Sep 17 00:00:00 2001 From: Martin Straka Date: Tue, 20 Feb 2018 13:49:19 +0100 Subject: [PATCH 4/4] Used system_path macro in project file --- mobile-datovka.pro | 34 ++++++++++------------------------ 1 file changed, 10 insertions(+), 24 deletions(-) diff --git a/mobile-datovka.pro b/mobile-datovka.pro index 4b83e31b..8ea5bc4d 100644 --- a/mobile-datovka.pro +++ b/mobile-datovka.pro @@ -74,28 +74,9 @@ command = $$LRELEASE mobile-datovka.pro system($$command)|error("Failed to run: $$command") # Copy translation files at qmake invocation. -win32|winphone|winrt { - message(Windows: Copying Qt translation from $$shell_path($$[QT_INSTALL_DATA]).) - system($$QMAKE_COPY $$shell_path($$[QT_INSTALL_DATA])\translations\qtbase_cs.qm res\locale\qtbase_cs.qm) - system($$QMAKE_COPY $$shell_path($$[QT_INSTALL_DATA])\translations\qtbase_en.qm res\locale\qtbase_en.qm) -} else:android { - contains(QMAKE_HOST.os, Windows) { - message(Windows: Copying Qt translation from $$shell_path($$[QT_INSTALL_DATA]).) - system($$QMAKE_COPY $$shell_path($$[QT_INSTALL_DATA])\translations\qtbase_cs.qm res\locale\qtbase_cs.qm) - system($$QMAKE_COPY $$shell_path($$[QT_INSTALL_DATA])\translations\qtbase_en.qm res\locale\qtbase_en.qm) - } - contains(QMAKE_HOST.os, Linux) { - message(Unix: Copying Qt translation from $$[QT_INSTALL_DATA].) - system($$QMAKE_COPY $$[QT_INSTALL_DATA]/translations/qtbase_cs.qm res/locale/qtbase_cs.qm) - system($$QMAKE_COPY $$[QT_INSTALL_DATA]/translations/qtbase_en.qm res/locale/qtbase_en.qm) - } -} else:macx|osx|ios|unix { - message(Unix: Copying Qt translation from $$[QT_INSTALL_DATA].) - system($$QMAKE_COPY $$[QT_INSTALL_DATA]/translations/qtbase_cs.qm res/locale/qtbase_cs.qm) - system($$QMAKE_COPY $$[QT_INSTALL_DATA]/translations/qtbase_en.qm res/locale/qtbase_en.qm) -} else { - message(Error: For this target you must copy Qt translation (qtbase_cs.qm) from $$[QT_INSTALL_DATA]/translations/.) -} +message(Copying Qt translation from $$system_path($$[QT_INSTALL_DATA]).) +system($$QMAKE_COPY $$system_path($$[QT_INSTALL_DATA]/translations/qtbase_cs.qm) $$system_path(res/locale/qtbase_cs.qm)) +system($$QMAKE_COPY $$system_path($$[QT_INSTALL_DATA]/translations/qtbase_en.qm) $$system_path(res/locale/qtbase_en.qm)) TRANSLATIONS_FILES += \ res/locale/qtbase_cs.qm \ @@ -251,8 +232,10 @@ osx: ICON = res/datovka.icns linux: ICON = res/datovka.png # ios target. -ios: system(sed -e "s/@VERSION@/$${VERSION}/g" "ios/Info.tmp" > "ios/Info.plist") -ios: include(ios/ios.pri) +ios { + system(sed -e "s/@VERSION@/$${VERSION}/g" "ios/Info.tmp" > "ios/Info.plist") + include(ios/ios.pri) +} # android target. android { @@ -262,6 +245,9 @@ android { contains(QMAKE_HOST.os, Linux) { system(sed -e "s/@VERSION@/$${VERSION}/g" "android/AndroidManifest.tmp" > "android/AndroidManifest.xml") } + contains(QMAKE_HOST.os, Darwin) { + system(sed -e "s/@VERSION@/$${VERSION}/g" "android/AndroidManifest.tmp" > "android/AndroidManifest.xml") + } ANDROID_PACKAGE_SOURCE_DIR = $$PWD/android include(android/android.pri) } -- GitLab