2017-01-25 09:06:46 +01:00
|
|
|
import qbs
|
|
|
|
|
@if "%{TestFrameWork}" == "GTest"
|
2017-03-17 09:15:49 +01:00
|
|
|
import qbs.Environment
|
|
|
|
|
import "googlecommon.js" as googleCommon
|
2017-01-25 09:06:46 +01:00
|
|
|
@endif
|
2019-05-20 10:31:53 +02:00
|
|
|
@if "%{TestFrameWork}" == "BoostTest"
|
|
|
|
|
import qbs.Environment
|
|
|
|
|
import qbs.File
|
|
|
|
|
@endif
|
2017-01-25 09:06:46 +01:00
|
|
|
|
|
|
|
|
CppApplication {
|
|
|
|
|
@if "%{TestFrameWork}" == "QtTest"
|
|
|
|
|
Depends { name: "Qt.testlib" }
|
|
|
|
|
@if "%{RequireGUI}" == "false"
|
|
|
|
|
consoleApplication: true
|
|
|
|
|
@else
|
|
|
|
|
Depends { name: "Qt.gui" }
|
|
|
|
|
@endif
|
|
|
|
|
files: [
|
|
|
|
|
"%{TestCaseFileWithCppSuffix}"
|
|
|
|
|
]
|
|
|
|
|
@else
|
|
|
|
|
consoleApplication: true
|
2018-01-12 14:10:27 +01:00
|
|
|
@endif
|
2017-03-17 09:15:49 +01:00
|
|
|
|
|
|
|
|
@if "%{TestFrameWork}" == "GTest"
|
|
|
|
|
property string googletestDir: {
|
|
|
|
|
if (typeof Environment.getEnv("GOOGLETEST_DIR") === 'undefined') {
|
2019-08-21 13:54:19 +02:00
|
|
|
if ("%{GTestRepository}" === "" && googleCommon.getGTestDir(qbs, undefined) !== "") {
|
|
|
|
|
console.warn("Using googletest from system")
|
|
|
|
|
} else {
|
|
|
|
|
console.warn("Using googletest src dir specified at Qt Creator wizard")
|
|
|
|
|
console.log("set GOOGLETEST_DIR as environment variable or Qbs property to get rid of this message")
|
|
|
|
|
}
|
2017-03-17 09:15:49 +01:00
|
|
|
return "%{GTestRepository}"
|
|
|
|
|
} else {
|
|
|
|
|
return Environment.getEnv("GOOGLETEST_DIR")
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2017-01-25 09:06:46 +01:00
|
|
|
@if "%{GTestCXX11}" == "true"
|
|
|
|
|
cpp.cxxLanguageVersion: "c++11"
|
|
|
|
|
cpp.defines: [ "GTEST_LANG_CXX11" ]
|
|
|
|
|
@endif
|
2018-01-08 12:35:00 +01:00
|
|
|
cpp.dynamicLibraries: {
|
|
|
|
|
if (qbs.hostOS.contains("windows")) {
|
|
|
|
|
return [];
|
|
|
|
|
} else {
|
|
|
|
|
return [ "pthread" ];
|
|
|
|
|
}
|
|
|
|
|
}
|
2017-01-25 09:06:46 +01:00
|
|
|
|
|
|
|
|
|
2018-03-09 14:10:57 +01:00
|
|
|
cpp.includePaths: [].concat(googleCommon.getGTestIncludes(qbs, googletestDir))
|
|
|
|
|
.concat(googleCommon.getGMockIncludes(qbs, googletestDir))
|
2017-01-25 09:06:46 +01:00
|
|
|
|
|
|
|
|
files: [
|
|
|
|
|
"%{MainCppName}",
|
|
|
|
|
"%{TestCaseFileWithHeaderSuffix}",
|
2018-03-09 14:10:57 +01:00
|
|
|
].concat(googleCommon.getGTestAll(qbs, googletestDir))
|
|
|
|
|
.concat(googleCommon.getGMockAll(qbs, googletestDir))
|
2017-01-25 09:06:46 +01:00
|
|
|
@endif
|
2018-01-12 14:10:27 +01:00
|
|
|
@if "%{TestFrameWork}" == "QtQuickTest"
|
|
|
|
|
Depends { name: "cpp" }
|
|
|
|
|
Depends { name: "Qt.core" }
|
|
|
|
|
Depends {
|
|
|
|
|
condition: Qt.core.versionMajor > 4
|
|
|
|
|
name: "Qt.qmltest"
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Group {
|
|
|
|
|
name: "main application"
|
|
|
|
|
files: [ "%{MainCppName}" ]
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Group {
|
|
|
|
|
name: "qml test files"
|
|
|
|
|
files: "%{TestCaseFileWithQmlSuffix}"
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
cpp.defines: base.concat("QUICK_TEST_SOURCE_DIR=\\"" + path + "\\"")
|
|
|
|
|
@endif
|
2019-05-20 10:31:53 +02:00
|
|
|
@if "%{TestFrameWork}" == "BoostTest"
|
|
|
|
|
type: "application"
|
|
|
|
|
|
|
|
|
|
property string boostIncDir: {
|
|
|
|
|
if (typeof Environment.getEnv("BOOST_INCLUDE_DIR") !== 'undefined')
|
|
|
|
|
return Environment.getEnv("BOOST_INCLUDE_DIR");
|
|
|
|
|
return "%{BoostIncDir}"; // set by Qt Creator wizard
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Properties {
|
|
|
|
|
condition: boostIncDir && File.exists(boostIncDir)
|
|
|
|
|
cpp.includePaths: [boostIncDir];
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
condition: {
|
|
|
|
|
if (!boostIncDir)
|
|
|
|
|
console.log("BOOST_INCLUDE_DIR is not set, assuming Boost can be "
|
|
|
|
|
+ "found automatically in your system");
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
files: [ "%{MainCppName}" ]
|
|
|
|
|
|
|
|
|
|
@endif
|
2017-01-25 09:06:46 +01:00
|
|
|
}
|