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
|
|
|
|
|
|
|
|
|
|
CppApplication {
|
|
|
|
|
@if "%{TestFrameWork}" == "QtTest"
|
|
|
|
|
Depends { name: "Qt.testlib" }
|
|
|
|
|
@if "%{RequireGUI}" == "false"
|
|
|
|
|
consoleApplication: true
|
|
|
|
|
@else
|
|
|
|
|
Depends { name: "Qt.gui" }
|
|
|
|
|
@endif
|
|
|
|
|
files: [
|
|
|
|
|
"%{TestCaseFileWithCppSuffix}"
|
|
|
|
|
]
|
|
|
|
|
@else
|
|
|
|
|
consoleApplication: true
|
2017-03-17 09:15:49 +01:00
|
|
|
|
|
|
|
|
@if "%{TestFrameWork}" == "GTest"
|
|
|
|
|
property string googletestDir: {
|
|
|
|
|
if (typeof Environment.getEnv("GOOGLETEST_DIR") === 'undefined') {
|
|
|
|
|
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")
|
|
|
|
|
return "%{GTestRepository}"
|
|
|
|
|
} else {
|
|
|
|
|
return Environment.getEnv("GOOGLETEST_DIR")
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
@endif
|
|
|
|
|
|
2017-01-25 09:06:46 +01:00
|
|
|
@if "%{GTestCXX11}" == "true"
|
|
|
|
|
cpp.cxxLanguageVersion: "c++11"
|
|
|
|
|
cpp.defines: [ "GTEST_LANG_CXX11" ]
|
|
|
|
|
@endif
|
|
|
|
|
cpp.dynamicLibraries: [ "pthread" ]
|
|
|
|
|
|
|
|
|
|
|
2017-03-17 09:15:49 +01:00
|
|
|
cpp.includePaths: [].concat(googleCommon.getGTestIncludes(googletestDir))
|
|
|
|
|
.concat(googleCommon.getGMockIncludes(googletestDir))
|
2017-01-25 09:06:46 +01:00
|
|
|
|
|
|
|
|
files: [
|
|
|
|
|
"%{MainCppName}",
|
|
|
|
|
"%{TestCaseFileWithHeaderSuffix}",
|
2017-03-17 09:15:49 +01:00
|
|
|
].concat(googleCommon.getGTestAll(googletestDir))
|
|
|
|
|
.concat(googleCommon.getGMockAll(googletestDir))
|
2017-01-25 09:06:46 +01:00
|
|
|
@endif
|
|
|
|
|
}
|