forked from qt-creator/qt-creator
Fix qbs build when no llvm is present
Some defines were set conditionally, but accessed unconditionally, which of course breaks the build. Make sure the defines are always set. Also gather them in a module, instead of copying the code all over the place. Change-Id: Iac628da64fb3934872d912510936aeccd0e20247 Reviewed-by: Ivan Donchevskii <ivan.donchevskii@qt.io> Reviewed-by: Christian Stenger <christian.stenger@qt.io>
This commit is contained in:
18
qbs/modules/clang_defines/clang_defines.qbs
Normal file
18
qbs/modules/clang_defines/clang_defines.qbs
Normal file
@@ -0,0 +1,18 @@
|
||||
import qbs
|
||||
import qbs.FileInfo
|
||||
|
||||
Module {
|
||||
Depends { name: "cpp" }
|
||||
Depends { name: "libclang"; required: false }
|
||||
|
||||
cpp.defines: libclang.present ? [
|
||||
'CLANG_VERSION="' + libclang.llvmVersion + '"',
|
||||
'CLANG_RESOURCE_DIR="' + FileInfo.joinPaths(libclang.llvmLibDir, "clang",
|
||||
libclang.llvmVersion, "include") + '"',
|
||||
'CLANG_BINDIR="' + libclang.llvmBinDir + '"',
|
||||
] : [
|
||||
'CLANG_VERSION=""',
|
||||
'CLANG_RESOURCE_DIR=""',
|
||||
'CLANG_BINDIR=""',
|
||||
]
|
||||
}
|
||||
@@ -11,7 +11,9 @@ QtcPlugin {
|
||||
Depends { name: "TextEditor" }
|
||||
Depends { name: "Utils" }
|
||||
Depends { name: "ClangSupport" }
|
||||
|
||||
Depends { name: "libclang"; required: false }
|
||||
Depends { name: "clang_defines" }
|
||||
|
||||
pluginTestDepends: [
|
||||
"CppEditor",
|
||||
@@ -20,17 +22,6 @@ QtcPlugin {
|
||||
|
||||
condition: libclang.present
|
||||
|
||||
cpp.defines: {
|
||||
var defines = base;
|
||||
// The following defines are used to determine the clang include path for intrinsics.
|
||||
defines.push('CLANG_VERSION="' + libclang.llvmVersion + '"');
|
||||
var resourceDir = FileInfo.joinPaths(libclang.llvmLibDir, "clang", libclang.llvmVersion,
|
||||
"include");
|
||||
defines.push('CLANG_RESOURCE_DIR="' + resourceDir + '"');
|
||||
defines.push('CLANG_BINDIR="' + libclang.llvmBinDir + '"');
|
||||
return defines;
|
||||
}
|
||||
|
||||
files: [
|
||||
"clangactivationsequencecontextprocessor.cpp",
|
||||
"clangactivationsequencecontextprocessor.h",
|
||||
|
||||
@@ -5,6 +5,7 @@ QtcPlugin {
|
||||
name: "ClangPchManager"
|
||||
|
||||
Depends { name: "libclang"; required: false }
|
||||
Depends { name: "clang_defines" }
|
||||
condition: libclang.present && libclang.toolingEnabled
|
||||
|
||||
Depends { name: "ClangSupport" }
|
||||
@@ -14,19 +15,7 @@ QtcPlugin {
|
||||
Depends { name: "CppTools" }
|
||||
Depends { name: "ProjectExplorer" }
|
||||
|
||||
cpp.defines: {
|
||||
var defines = base;
|
||||
defines.push("CLANGPCHMANAGER_LIB");
|
||||
|
||||
// The following defines are used to determine the clang include path for intrinsics.
|
||||
defines.push('CLANG_VERSION="' + libclang.llvmVersion + '"');
|
||||
var resourceDir = FileInfo.joinPaths(libclang.llvmLibDir, "clang", libclang.llvmVersion,
|
||||
"include");
|
||||
defines.push('CLANG_RESOURCE_DIR="' + resourceDir + '"');
|
||||
defines.push('CLANG_BINDIR="' + libclang.llvmBinDir + '"');
|
||||
return defines;
|
||||
}
|
||||
|
||||
cpp.defines: base.concat("CLANGPCHMANAGER_LIB")
|
||||
cpp.includePaths: ["."]
|
||||
|
||||
files: [
|
||||
|
||||
@@ -5,6 +5,7 @@ QtcPlugin {
|
||||
name: "ClangRefactoring"
|
||||
|
||||
Depends { name: "libclang"; required: false }
|
||||
Depends { name: "clang_defines" }
|
||||
condition: libclang.present && libclang.toolingEnabled
|
||||
|
||||
Depends { name: "ClangSupport" }
|
||||
@@ -16,19 +17,7 @@ QtcPlugin {
|
||||
Depends { name: "ProjectExplorer" }
|
||||
Depends { name: "TextEditor" }
|
||||
|
||||
cpp.defines: {
|
||||
var defines = base;
|
||||
defines.push("CLANGPCHMANAGER_LIB");
|
||||
|
||||
// The following defines are used to determine the clang include path for intrinsics.
|
||||
defines.push('CLANG_VERSION="' + libclang.llvmVersion + '"');
|
||||
var resourceDir = FileInfo.joinPaths(libclang.llvmLibDir, "clang", libclang.llvmVersion,
|
||||
"include");
|
||||
defines.push('CLANG_RESOURCE_DIR="' + resourceDir + '"');
|
||||
defines.push('CLANG_BINDIR="' + libclang.llvmBinDir + '"');
|
||||
return defines;
|
||||
}
|
||||
|
||||
cpp.defines: base.concat("CLANGPCHMANAGER_LIB")
|
||||
cpp.includePaths: ["."]
|
||||
|
||||
files: [
|
||||
|
||||
@@ -12,7 +12,9 @@ QtcPlugin {
|
||||
Depends { name: "ProjectExplorer" }
|
||||
Depends { name: "QtcSsh" }
|
||||
Depends { name: "Utils" }
|
||||
|
||||
Depends { name: "libclang"; required: false }
|
||||
Depends { name: "clang_defines" }
|
||||
|
||||
Depends { name: "Qt.widgets" }
|
||||
|
||||
@@ -23,24 +25,12 @@ QtcPlugin {
|
||||
|
||||
condition: libclang.present
|
||||
|
||||
cpp.defines: base.concat("CLANGPCHMANAGER_LIB")
|
||||
cpp.includePaths: base.concat(libclang.llvmIncludeDir)
|
||||
cpp.libraryPaths: base.concat(libclang.llvmLibDir)
|
||||
cpp.dynamicLibraries: base.concat(libclang.llvmLibs)
|
||||
cpp.rpaths: base.concat(libclang.llvmLibDir)
|
||||
|
||||
cpp.defines: {
|
||||
var defines = base;
|
||||
defines.push("CLANGPCHMANAGER_LIB");
|
||||
|
||||
// The following defines are used to determine the clang include path for intrinsics.
|
||||
defines.push('CLANG_VERSION="' + libclang.llvmVersion + '"');
|
||||
var resourceDir = FileInfo.joinPaths(libclang.llvmLibDir, "clang", libclang.llvmVersion,
|
||||
"include");
|
||||
defines.push('CLANG_RESOURCE_DIR="' + resourceDir + '"');
|
||||
defines.push('CLANG_BINDIR="' + libclang.llvmBinDir + '"');
|
||||
return defines;
|
||||
}
|
||||
|
||||
files: [
|
||||
"clangfileinfo.h",
|
||||
"clangfixitsrefactoringchanges.cpp",
|
||||
|
||||
@@ -14,17 +14,9 @@ Project {
|
||||
Depends { name: "Core" }
|
||||
Depends { name: "TextEditor" }
|
||||
Depends { name: "app_version_header" }
|
||||
|
||||
Depends { name: "libclang"; required: false }
|
||||
|
||||
Properties {
|
||||
condition: libclang.present
|
||||
|
||||
cpp.defines: {
|
||||
var defines = base;
|
||||
defines.push('CLANG_BINDIR="' + libclang.llvmBinDir + '"');
|
||||
return defines;
|
||||
}
|
||||
}
|
||||
Depends { name: "clang_defines" }
|
||||
|
||||
Group {
|
||||
name: "General"
|
||||
|
||||
Reference in New Issue
Block a user