diff options
Diffstat (limited to 'share/qbs/modules/cpp/cpp.js')
-rw-r--r-- | share/qbs/modules/cpp/cpp.js | 32 |
1 files changed, 23 insertions, 9 deletions
diff --git a/share/qbs/modules/cpp/cpp.js b/share/qbs/modules/cpp/cpp.js index 846a4cfad..9f907580a 100644 --- a/share/qbs/modules/cpp/cpp.js +++ b/share/qbs/modules/cpp/cpp.js @@ -42,7 +42,7 @@ function languageVersion(versionArray, knownValues, lang) { return versions[0]; for (var i = 0; i < knownValues.length; ++i) { var candidate = knownValues[i]; - if (versions.contains(candidate)) + if (versions.includes(candidate)) return candidate; } var version = versions[0]; @@ -134,7 +134,7 @@ function assemblerOutputArtifacts(input) { } function compilerOutputArtifacts(input, inputs) { - var objTags = input.fileTags.contains("cpp_intermediate_object") + var objTags = input.fileTags.includes("cpp_intermediate_object") ? ["intermediate_obj"] : ["obj"]; if (inputs) { @@ -220,6 +220,7 @@ function precompiledHeaderOutputArtifacts(input, product, lang, generateObjects) function collectLibraryDependencies(product) { var seen = {}; + var seenObjectFiles = []; var result = []; function addFilePath(filePath, wholeArchive, productName) { @@ -232,7 +233,7 @@ function collectLibraryDependencies(product) { var artifactFilePaths = artifacts.map(function(a) { return a.filePath; }); var wholeArchive = dep.parameters.cpp && dep.parameters.cpp.linkWholeArchive; var artifactsAreImportLibs = artifacts.length > 0 - && artifacts[0].fileTags.contains("dynamiclibrary_import"); + && artifacts[0].fileTags.includes("dynamiclibrary_import"); for (var i = 0; i < artifactFilePaths.length; ++i) { addFilePath(artifactFilePaths[i], wholeArchive, artifactsAreImportLibs ? dep.name : undefined); @@ -248,16 +249,23 @@ function collectLibraryDependencies(product) { function sanitizedModuleListProperty(obj, moduleName, propertyName) { return ensureArray(ModUtils.sanitizedModuleProperty(obj, moduleName, propertyName)); } - function handleExternalLibraries(tag, suffix) { + function handleExternalLibraries(tag, libSuffix, objSuffix) { var externalLibs = sanitizedModuleListProperty(obj, "cpp", tag) || []; externalLibs.forEach(function(libName) { - if (!libName.endsWith(suffix) && !libName.startsWith('@')) - libName += suffix; + var isObjectFile = objSuffix && libName.endsWith(objSuffix); + if (isObjectFile) { + if (seenObjectFiles.includes(libName)) + return; + seenObjectFiles.push(libName); + } + if (!libName.endsWith(libSuffix) && !isObjectFile && !libName.startsWith('@')) + libName += libSuffix; addFilePath(libName, false); }); } handleExternalLibraries("staticLibraries", - obj.moduleProperty("cpp", "staticLibrarySuffix")); + obj.moduleProperty("cpp", "staticLibrarySuffix"), + obj.moduleProperty("cpp", "objectSuffix")); handleExternalLibraries("dynamicLibraries", obj.moduleProperty("cpp", "dynamicLibraryImportSuffix")); } @@ -319,7 +327,10 @@ function collectIncludePaths(input) { var includePaths = input.cpp.includePaths; if (includePaths) allIncludePaths = allIncludePaths.uniqueConcat(includePaths); - return allIncludePaths; + var builtIns = input.cpp.compilerIncludePaths; + return allIncludePaths.filter(function(p) { + return !builtIns.includes(p); + }); } function collectSystemIncludePaths(input) { @@ -330,7 +341,10 @@ function collectSystemIncludePaths(input) { var distributionIncludePaths = input.cpp.distributionIncludePaths; if (distributionIncludePaths) allIncludePaths = allIncludePaths.uniqueConcat(distributionIncludePaths); - return allIncludePaths; + var builtIns = input.cpp.compilerIncludePaths; + return allIncludePaths.filter(function(p) { + return !builtIns.includes(p); + }); } function collectPreincludePaths(input) { |