From 10f9bd82ea12f6015543d334bf6ac9c06b19667f Mon Sep 17 00:00:00 2001 From: Oliver Wolff Date: Wed, 28 Nov 2018 12:32:00 +0100 Subject: ctest: Make cmake test pass if it has been run before We have to check if the directory exists before calling mkdir or the test will fail on every run but the first one. Change-Id: I36f10cfc18b3cb99990dc96190349ee00a0c1c4e Reviewed-by: Oswald Buddenhagen --- mkspecs/features/ctest_testcase_common.prf | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'mkspecs/features') diff --git a/mkspecs/features/ctest_testcase_common.prf b/mkspecs/features/ctest_testcase_common.prf index 63e31f5415..ea90bf89cd 100644 --- a/mkspecs/features/ctest_testcase_common.prf +++ b/mkspecs/features/ctest_testcase_common.prf @@ -65,7 +65,8 @@ for (MODULE_UNDER_TEST, CMAKE_QT_MODULES_UNDER_TEST) { CMAKE_MODULES_UNDER_TEST = $$join(CMAKE_MODULES_UNDER_TEST, ;) check.commands = \ - $(MKDIR) $$BUILD_DIR && $$QMAKE_CD $$BUILD_DIR && \ + $$sprintf($$QMAKE_MKDIR_CMD, $$BUILD_DIR) $$escape_expand(\\n\\t) \ + $$QMAKE_CD $$BUILD_DIR && \ cmake $$CMAKE_TEST_LOCATION $$CMAKE_GENERATOR \ -DCMAKE_C_COMPILER=$$QMAKE_CC \ -DCMAKE_CXX_COMPILER=$$QMAKE_CXX \ -- cgit v1.2.3 From 79e4fe54bfc1f36df6137cce84015dbb0a52639a Mon Sep 17 00:00:00 2001 From: Eskil Abrahamsen Blomfeldt Date: Fri, 23 Nov 2018 14:22:03 +0100 Subject: WebAssembly: Fix compilation of application on Windows host MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit When running configure on a Windows host, it would fail with the error that the copy statement was invalid, due to the forward slashes. This makes configure finish without errors. Task-number: QTBUG-72000 Change-Id: Id315d7436bbbfd2cd5c5f2dfcfe0c3dc3b9e34c2 Reviewed-by: Eskil Abrahamsen Blomfeldt Reviewed-by: Morten Johan Sørvig --- mkspecs/features/wasm/wasm.prf | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'mkspecs/features') diff --git a/mkspecs/features/wasm/wasm.prf b/mkspecs/features/wasm/wasm.prf index 278a6719c7..13ac43443d 100644 --- a/mkspecs/features/wasm/wasm.prf +++ b/mkspecs/features/wasm/wasm.prf @@ -41,14 +41,14 @@ contains(TEMPLATE, .*app) { appjs.name = application qtloader.js appjs.output = $$DESTDIR/qtloader.js - appjs.commands = $$QMAKE_COPY $$WASM_PLUGIN_PATH/qtloader.js $$DESTDIR + appjs.commands = $$QMAKE_COPY $$shell_path($$WASM_PLUGIN_PATH/qtloader.js) $$shell_path($$DESTDIR) appjs.input = $$WASM_PLUGIN_PATH/qtloader.js appjs.depends = $$appjs.input QMAKE_EXTRA_COMPILERS += appjs appsvg.name = application qtlogo.svg appsvg.output = $$DESTDIR/qtlogo.svg - appsvg.commands = $$QMAKE_COPY $$WASM_PLUGIN_PATH/qtlogo.svg $$DESTDIR + appsvg.commands = $$QMAKE_COPY $$shell_path($$WASM_PLUGIN_PATH/qtlogo.svg) $$shell_path($$DESTDIR) appsvg.input = $$WASM_PLUGIN_PATH/qtlogo.svg appsvg.depends = $$appsvg.input QMAKE_EXTRA_COMPILERS += appsvg -- cgit v1.2.3 From 46a2b44b2b7f50ced7f2c0731cc6224478d960c7 Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Fri, 12 Oct 2018 14:41:41 +0200 Subject: qmake: fix QMAKE_DEFAULT_LIBDIRS detection on android amazingly enough, android has different sysroots for the compiler (shared includes full of #ifdefs) and the linker (per-platform libraries). this patch supports only clang for non-darwin, which notably covers all supported android ndks. with this fixed, we also remove the hard-coded setting of QMAKE_DEFAULT_*DIRS from the specs. amends 353fb118c. Change-Id: Ie0513de0f7123d7f5b8ca1ffcc72c017cddd126c Reviewed-by: Joerg Bornemann Reviewed-by: Oswald Buddenhagen --- mkspecs/features/toolchain.prf | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'mkspecs/features') diff --git a/mkspecs/features/toolchain.prf b/mkspecs/features/toolchain.prf index 4ecfb8d889..6039c52bd0 100644 --- a/mkspecs/features/toolchain.prf +++ b/mkspecs/features/toolchain.prf @@ -128,8 +128,8 @@ isEmpty($${target_prefix}.INCDIRS) { # paths, so it can't just be used in place of the above code). # What's more, -print-search-dirs can't be used on clang on Apple because it # won't print all the library paths (only the clang-internal ones). - output = $$system("$$cmd_prefix $$QMAKE_CXX -print-search-dirs", lines, ec) - !equals(ec, 0): qtCompilerErrror($$QMAKE_CXX, $$output) + output = $$system("$$cmd_prefix $$QMAKE_LINK $$QMAKE_LFLAGS -print-search-dirs", lines, ec) + !equals(ec, 0): qtCompilerErrror($$QMAKE_LINK, $$output) for (line, output) { contains(line, "^libraries: .*") { -- cgit v1.2.3 From 521a85395da1a2728902816c072ec46bcb0ad380 Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Fri, 1 Dec 2017 20:13:08 +0100 Subject: configure: actually resolve libraries into full filepaths this considerably speeds up failures, as no doomed build is attempted, and produces more reliable results, as no second lookup (which would be subject to environment changes) is done any more during the build. in principle, this also opens up possibilities like selecting specific variants of dependencies, automatically extracting rpaths, etc. qt_helper_lib.prf also needs to create fully resolved library names now. Change-Id: I65f13564b635433030e40fa017427bbc72d1c130 Reviewed-by: Joerg Bornemann --- mkspecs/features/qmake_use.prf | 1 - mkspecs/features/qt_configure.prf | 171 +++++++++++++++++++++++++++++-------- mkspecs/features/qt_helper_lib.prf | 19 ++++- 3 files changed, 151 insertions(+), 40 deletions(-) (limited to 'mkspecs/features') diff --git a/mkspecs/features/qmake_use.prf b/mkspecs/features/qmake_use.prf index f81d1cece4..dba45de92a 100644 --- a/mkspecs/features/qmake_use.prf +++ b/mkspecs/features/qmake_use.prf @@ -9,7 +9,6 @@ for(ever) { error("Library '$$name' is not defined.") !contains(use, nolink) { - QMAKE_LIBDIR += $$eval(QMAKE_LIBDIR_$$nu) debug: \ LIBS$${suffix} += $$eval(QMAKE_LIBS_$${nu}_DEBUG) $$eval(QMAKE_LIBS_$$nu) else: \ diff --git a/mkspecs/features/qt_configure.prf b/mkspecs/features/qt_configure.prf index 65ee7df50b..44d8a3e639 100644 --- a/mkspecs/features/qt_configure.prf +++ b/mkspecs/features/qt_configure.prf @@ -365,9 +365,13 @@ defineTest(qtConfTest_linkerSupportsFlag) { } defineReplace(qtConfFindInPathList) { + # This nesting is consistent with Apple ld -search_paths_first, + # and presumably with GNU ld (no actual documentation found). for (dir, 2) { - exists("$$dir/$${1}"): \ - return("$$dir/$${1}") + for (file, 1) { + exists("$$dir/$$file"): \ + return("$$dir/$$file") + } } return() } @@ -488,6 +492,110 @@ defineTest(qtConfSetupLibraries) { } } +# libs-var, libs, in-paths, out-paths-var +defineTest(qtConfResolveLibs) { + ret = true + paths = $$3 + out = + copy = false + for (l, 2) { + $$copy { + copy = false + out += $$l + } else: equals(l, "-s") { + # em++ flag to link libraries from emscripten-ports; passed on literally. + copy = true + out += $$l + } else: contains(l, "^-L.*") { + lp = $$replace(l, "^-L", ) + !exists($$lp/.) { + qtLog("Library path $$val_escape(lp) is invalid.") + ret = false + } else { + paths += $$lp + } + } else: contains(l, "^-l.*") { + lib = $$replace(l, "^-l", ) + lcan = + unix { + # Under UNIX, we look for actual shared libraries, in addition + # to static ones. + lcan += \ + $${QMAKE_PREFIX_SHLIB}$${lib}.$${QMAKE_EXTENSION_SHLIB} \ + $${QMAKE_PREFIX_STATICLIB}$${lib}.$${QMAKE_EXTENSION_STATICLIB} + } else { + # Under Windows, we look only for static libraries, as even for DLLs + # one actually links against a static import library. + mingw { + lcan += \ + # MinGW supports UNIX-style library naming in addition to + # the MSVC style. + lib$${lib}.dll.a lib$${lib}.a \ + # Fun fact: prefix-less libraries are also supported. + $${lib}.dll.a $${lib}.a + } + lcan += $${lib}.lib + } + l = $$qtConfFindInPathList($$lcan, $$paths $$EXTRA_LIBDIR $$QMAKE_DEFAULT_LIBDIRS) + isEmpty(l) { + qtLog("None of [$$val_escape(lcan)] found in [$$val_escape(paths)] and global paths.") + ret = false + } else { + out += $$l + } + } else { + out += $$l + } + } + $$1 = $$out + export($$1) + !isEmpty(4) { + $$4 = $$paths + export($$4) + } + return($$ret) +} + +# source-var +defineTest(qtConfResolveAllLibs) { + ret = true + !qtConfResolveLibs($${1}.libs, $$eval($${1}.libs), , $${1}.libdirs): \ + ret = false + for (b, $${1}.builds._KEYS_): \ + !qtConfResolveLibs($${1}.builds.$${b}, $$eval($${1}.builds.$${b}), $$eval($${1}.libdirs), ): \ + ret = false + return($$ret) +} + +# libs-var, in-paths, libs +defineTest(qtConfResolvePathLibs) { + ret = true + for (libdir, 2) { + !exists($$libdir/.) { + qtLog("Library path $$val_escape(libdir) is invalid.") + ret = false + } + } + !qtConfResolveLibs($$1, $$3, $$2): \ + ret = false + return($$ret) +} + +# includes-var, includes +defineTest(qtConfResolvePathIncs) { + ret = true + for (incdir, 2) { + !exists($$incdir/.) { + qtLog("Include path $$val_escape(incdir) is invalid.") + ret = false + } + } + 2 -= $$QMAKE_DEFAULT_INCDIRS + $$1 = $$2 + export($$1) + return($$ret) +} + # the library is specified inline in a 'libs' field. # overrides from the command line are accepted. defineTest(qtConfLibrary_inline) { @@ -517,7 +625,6 @@ defineTest(qtConfLibrary_inline) { vars += $$eval(config.commandline.rev_assignments.$${iv}) defined(config.input.$${iv}, var) { eval($${1}.builds.$${b} = $$eval(config.input.$${iv})) - export($${1}.builds.$${b}) $${1}.builds._KEYS_ *= $${b} any = true } else { @@ -532,35 +639,30 @@ defineTest(qtConfLibrary_inline) { export($${1}.builds._KEYS_) # we also reset the generic libs, to avoid surprises. $${1}.libs = - export($${1}.libs) } # direct libs. overwrites inline libs. - defined(config.input.$${input}.libs, var) { + defined(config.input.$${input}.libs, var): \ eval($${1}.libs = $$eval(config.input.$${input}.libs)) - export($${1}.libs) - } + + includes = $$eval(config.input.$${input}.incdir) # prefix. prepends to (possibly overwritten) inline libs. prefix = $$eval(config.input.$${input}.prefix) !isEmpty(prefix) { - $${1}.includedir = $$prefix/include - export($${1}.includedir) + includes += $$prefix/include $${1}.libs = -L$$prefix/lib $$eval($${1}.libs) - export($${1}.libs) - } - - incdir = $$eval(config.input.$${input}.incdir) - !isEmpty(incdir) { - $${1}.includedir = $$incdir - export($${1}.includedir) } libdir = $$eval(config.input.$${input}.libdir) - !isEmpty(libdir) { + !isEmpty(libdir): \ $${1}.libs = -L$$libdir $$eval($${1}.libs) - export($${1}.libs) - } + + !qtConfResolveAllLibs($$1): \ + return(false) + + !qtConfResolvePathIncs($${1}.includedir, $$includes): \ + return(false) return(true) } @@ -572,17 +674,13 @@ defineTest(qtConfLibrary_makeSpec) { isEmpty(spec): \ error("makeSpec source in library '$$eval($${1}.library)' does not specify 'spec'.") - $${1}.includedir = $$eval(QMAKE_INCDIR_$$spec) - export($${1}.includedir) - $${1}.libs = - for (l, QMAKE_LIBDIR_$$spec): \ - $${1}.libs += -L$$l - $${1}.libs += $$eval(QMAKE_LIBS_$$spec) - export($${1}.libs) + !qtConfResolvePathLibs($${1}.libs, $$eval(QMAKE_LIBDIR_$$spec), $$eval(QMAKE_LIBS_$$spec)): \ + return(false) - # the library definition is always in scope, so no point in exporting it. - $${1}.export = false - export($${1}.export) + !qtConfResolvePathIncs($${1}.includedir, $$eval(QMAKE_INCDIR_$$spec)): \ + return(false) + + # note that the object is re-exported, because we resolve the libraries. return(true) } @@ -602,13 +700,15 @@ defineTest(qtConfLibrary_pkgConfig) { } qtRunLoggedCommand("$$pkg_config --modversion $$args", version)|return(false) - qtRunLoggedCommand("$$pkg_config --libs-only-L $$args", libpaths)|return(false) - qtRunLoggedCommand("$$pkg_config --libs-only-l $$args", libs)|return(false) version ~= s/[^0-9.].*$// $${1}.version = $$first(version) export($${1}.version) - eval($${1}.libs = $$libpaths $$libs) - export($${1}.libs) + + qtRunLoggedCommand("$$pkg_config --libs-only-L $$args", libpaths)|return(false) + qtRunLoggedCommand("$$pkg_config --libs-only-l $$args", libs)|return(false) + eval(libs = $$libpaths $$libs) + !qtConfResolveLibs($${1}.libs, $$libs): \ + return(false) qtRunLoggedCommand("$$pkg_config --cflags $$args", $${1}.cflags)|return(false) # Split CFLAGS into stuff that goes into DEFINES, INCLUDEPATH, and other stuff. @@ -633,10 +733,11 @@ defineTest(qtConfLibrary_pkgConfig) { } !isEmpty(ignored): \ qtLog("Note: Dropped compiler flags '$$ignored'.") + !qtConfResolvePathIncs($${1}.includedir, $$includes): \ + return(false) $${1}.defines = $$defines export($${1}.defines) - $${1}.includedir = $$includes - export($${1}.includedir) + return(true) } diff --git a/mkspecs/features/qt_helper_lib.prf b/mkspecs/features/qt_helper_lib.prf index b3e49e4626..1a8446acb4 100644 --- a/mkspecs/features/qt_helper_lib.prf +++ b/mkspecs/features/qt_helper_lib.prf @@ -34,19 +34,30 @@ THE_TARGET = $$qt5LibraryTarget($$TARGET) MODULE_PRI = $$MODULE_QMAKE_OUTDIR/mkspecs/modules/qt_ext_$${MODULE}.pri ucmodule = $$upper($$MODULE) + win32|CONFIG(static, static|shared) { + prefix = $$QMAKE_PREFIX_STATICLIB + suffix = $$QMAKE_EXTENSION_STATICLIB + } else { + prefix = $$QMAKE_PREFIX_SHLIB + suffix = $$QMAKE_EXTENSION_SHLIB + } MODULE_PRI_CONT = \ "QMAKE_INCDIR_$${ucmodule} = $$val_escape(MODULE_INCLUDEPATH)" \ "QMAKE_DEFINES_$${ucmodule} = $$val_escape(MODULE_DEFINES)" debug_and_release { - win32: MODULE_DEBUG_LIBS = -L$$DESTDIR -l$${TARGET}d - darwin: MODULE_DEBUG_LIBS = -L$$DESTDIR -l$${TARGET}_debug - MODULE_RELEASE_LIBS = -L$$DESTDIR -l$$TARGET + win32: \ + MODULE_DEBUG_LIBS = $$DESTDIR/$$prefix$${TARGET}d.$$suffix + else: darwin: \ + MODULE_DEBUG_LIBS = $$DESTDIR/$$prefix$${TARGET}_debug.$$suffix + else: \ + error("'$$QMAKE_PLATFORM' does not do debug_and_release.") + MODULE_RELEASE_LIBS = $$DESTDIR/$$prefix$${TARGET}.$$suffix MODULE_PRI_CONT += \ "QMAKE_LIBS_$${ucmodule} =" \ # Needed for the module to be recognized. "QMAKE_LIBS_$${ucmodule}_DEBUG = $$val_escape(MODULE_DEBUG_LIBS)" \ "QMAKE_LIBS_$${ucmodule}_RELEASE = $$val_escape(MODULE_RELEASE_LIBS)" } else { - MODULE_LIBS = -L$$DESTDIR -l$$THE_TARGET + MODULE_LIBS = $$DESTDIR/$$prefix$${THE_TARGET}.$$suffix MODULE_PRI_CONT += \ "QMAKE_LIBS_$${ucmodule} = $$val_escape(MODULE_LIBS)" } -- cgit v1.2.3 From 1314d2688c6eab24d33e2a558403fa6e2482f849 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tor=20Arne=20Vestb=C3=B8?= Date: Fri, 30 Nov 2018 15:28:13 +0100 Subject: macOS: Fix Objective-C namespaceing with Xcode 10 Xcode 10 ships version 921.0.1 of cctools, which otool is part of. The defaults have changed in that version to no longer print verbosely (symbolically), which we relied on. We now request it explicitly. Change-Id: Ifbe0c97462b9f78cf128c820847eff9c72f17065 Reviewed-by: Timur Pocheptsov Reviewed-by: Tim Blechmann --- mkspecs/features/data/mac/objc_namespace.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'mkspecs/features') diff --git a/mkspecs/features/data/mac/objc_namespace.sh b/mkspecs/features/data/mac/objc_namespace.sh index 6ac004fe2d..ceff2df324 100755 --- a/mkspecs/features/data/mac/objc_namespace.sh +++ b/mkspecs/features/data/mac/objc_namespace.sh @@ -146,7 +146,7 @@ inspect_binary() { echo "found namespaced class names, updating class entries..." fi - classes=$(otool -o "$target" | grep class_ro_t) + classes=$(otool -o -v "$target" | grep class_ro_t) while read -a class; do address="$(sanitize_address ${class[1]})" -- cgit v1.2.3