diff options
author | Christian Kandeler <christian.kandeler@qt.io> | 2019-07-22 15:51:50 +0200 |
---|---|---|
committer | Christian Kandeler <christian.kandeler@qt.io> | 2019-08-14 11:44:51 +0000 |
commit | 18a3b64ab07ade6bfc9bb068956beed2032d9b58 (patch) | |
tree | 7bcb18c36f05508457074d783197cdd3f37f9fd6 /tests/auto/blackbox/testdata | |
parent | 5320c8578b600081d9c5174f4024b726c5bdefa0 (diff) |
C++: Add support for clang on Windows
This is about clang in "mingw mode", not clang-cl.
When targeting Windows, clang is a lot like mingw, so factor out the
common parts into a new base module.
Testing uncovered a number of invalid assumptions in our autotests,
which are also fixed in this patch. In addition, minor adjustments had
to be made to the Qt.core module and to the qbscore lib.
Change-Id: I73085dc62a65e2a9d0397cf234c8641989246f22
Reviewed-by: Ivan Komissarov <ABBAPOH@gmail.com>
Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
Diffstat (limited to 'tests/auto/blackbox/testdata')
6 files changed, 59 insertions, 4 deletions
diff --git a/tests/auto/blackbox/testdata/autotest-timeout/autotests-timeout.qbs b/tests/auto/blackbox/testdata/autotest-timeout/autotests-timeout.qbs index 270fc9eaf..d4f01895f 100644 --- a/tests/auto/blackbox/testdata/autotest-timeout/autotests-timeout.qbs +++ b/tests/auto/blackbox/testdata/autotest-timeout/autotests-timeout.qbs @@ -4,7 +4,16 @@ Project { type: ["application", "autotest"] Depends { name: "autotest" } cpp.cxxLanguageVersion: "c++11" + Properties { + condition: qbs.toolchain.contains("gcc") + cpp.driverFlags: "-pthread" + } files: "test-main.cpp" } - AutotestRunner {} + AutotestRunner { + Depends { + name: "cpp" // Make sure build environment is set up properly. + condition: qbs.hostOS.contains("windows") && qbs.toolchain.contains("gcc") + } + } } diff --git a/tests/auto/blackbox/testdata/autotest-with-dependencies/autotest-with-dependencies.qbs b/tests/auto/blackbox/testdata/autotest-with-dependencies/autotest-with-dependencies.qbs index 92d5ec6dd..7ae6cef73 100644 --- a/tests/auto/blackbox/testdata/autotest-with-dependencies/autotest-with-dependencies.qbs +++ b/tests/auto/blackbox/testdata/autotest-with-dependencies/autotest-with-dependencies.qbs @@ -21,6 +21,10 @@ Project { } AutotestRunner { + Depends { + name: "cpp" // Make sure build environment is set up properly. + condition: qbs.hostOS.contains("windows") && qbs.toolchain.contains("gcc") + } arguments: FileInfo.joinPaths(qbs.installRoot, qbs.installPrefix, "bin") auxiliaryInputs: "test-helper" } diff --git a/tests/auto/blackbox/testdata/autotests/autotests.qbs b/tests/auto/blackbox/testdata/autotests/autotests.qbs index a2c2646dc..10334156e 100644 --- a/tests/auto/blackbox/testdata/autotests/autotests.qbs +++ b/tests/auto/blackbox/testdata/autotests/autotests.qbs @@ -1,4 +1,9 @@ Project { references: ["test1", "test2", "test3"] - AutotestRunner {} + AutotestRunner { + Depends { + name: "cpp" // Make sure build environment is set up properly. + condition: qbs.hostOS.contains("windows") && qbs.toolchain.contains("gcc") + } + } } diff --git a/tests/auto/blackbox/testdata/lexyacc/one-grammar/one-grammar.qbs b/tests/auto/blackbox/testdata/lexyacc/one-grammar/one-grammar.qbs index 61f76f4be..6cd334247 100644 --- a/tests/auto/blackbox/testdata/lexyacc/one-grammar/one-grammar.qbs +++ b/tests/auto/blackbox/testdata/lexyacc/one-grammar/one-grammar.qbs @@ -8,6 +8,23 @@ CppApplication { cpp.cxxLanguageVersion: "c++11" cpp.minimumMacosVersion: "10.7" consoleApplication: true + Probe { + id: pathCheck + property string theDir: { + if (qbs.targetOS.contains("windows")) { + if (qbs.toolchain.contains("mingw")) + return cpp.toolchainInstallPath; + if (qbs.toolchain.contains("clang") && qbs.sysroot) + return qbs.sysroot + "/bin"; + } + } + configure: { + if (theDir) + console.info("add to PATH: " + theDir); + found = true; + } + } + files: [ "lexer.l", "parser.y", diff --git a/tests/auto/blackbox/testdata/separate-debug-info/separate-debug-info.qbs b/tests/auto/blackbox/testdata/separate-debug-info/separate-debug-info.qbs index 48bdff904..0b16d1984 100644 --- a/tests/auto/blackbox/testdata/separate-debug-info/separate-debug-info.qbs +++ b/tests/auto/blackbox/testdata/separate-debug-info/separate-debug-info.qbs @@ -4,6 +4,15 @@ Project { type: ["application"] files: ["main.cpp"] cpp.separateDebugInformation: true + + Probe { + id: osProbe + property stringList targetOS: qbs.targetOS + configure: { + console.info("is windows: " + (targetOS.contains("windows") ? "yes" : "no")); + console.info("is darwin: " + (targetOS.contains("darwin") ? "yes" : "no")); + } + } } DynamicLibrary { Depends { name: "cpp" } diff --git a/tests/auto/blackbox/testdata/setup-run-environment/setup-run-environment.qbs b/tests/auto/blackbox/testdata/setup-run-environment/setup-run-environment.qbs index b5ac8b289..d2d47b767 100644 --- a/tests/auto/blackbox/testdata/setup-run-environment/setup-run-environment.qbs +++ b/tests/auto/blackbox/testdata/setup-run-environment/setup-run-environment.qbs @@ -61,6 +61,16 @@ Project { bundle.isBundle: false } + // Testing shows that clang (8.0) does not find dynamic libraries via + // the -L<dir> and -l<libname> mechanism unless the name is "lib<libname>.a". + Properties { + condition: qbs.hostOS.contains("windows") && qbs.toolchain.contains("clang") + cpp.dynamicLibraryPrefix: "lib" + cpp.dynamicLibraryImportSuffix: ".a" + } + cpp.dynamicLibraryPrefix: original + cpp.dynamicLibraryImportSuffix: original + install: true installImportLib: true installDir: "lib4" @@ -91,8 +101,9 @@ Project { property string fullInstallPrefix: FileInfo.joinPaths(qbs.installRoot, qbs.installPrefix) property string lib3FilePath: FileInfo.joinPaths(fullInstallPrefix, "lib3", - cpp.dynamicLibraryPrefix + "lib3" + (qbs.toolchain.contains("msvc") - ? ".lib" : cpp.dynamicLibrarySuffix)) + cpp.dynamicLibraryPrefix + "lib3" + (qbs.targetOS.contains("windows") + ? cpp.dynamicLibraryImportSuffix + : cpp.dynamicLibrarySuffix)) cpp.dynamicLibraries: [lib3FilePath, "lib4"] cpp.libraryPaths: FileInfo.joinPaths(fullInstallPrefix, "lib4") } |