diff options
author | Christian Kandeler <christian.kandeler@qt.io> | 2017-06-15 11:43:57 +0200 |
---|---|---|
committer | Christian Kandeler <christian.kandeler@qt.io> | 2017-06-15 15:59:54 +0000 |
commit | 2856d90378f1bef4cb9f26d0938b78bb6aefb17c (patch) | |
tree | dae68c0441ff8f9563dfe9984ae2cb48b4c44499 | |
parent | 81953b3a8a89a9de2b45b7b4ed538f0041381497 (diff) |
GCC: Fix performance regression
Have only one Probe for the binutils. It's too expensive to check for
each tool separately.
Change-Id: Iedad5e14a5c5a2c6d28b6bbe2982546af183a783
Reviewed-by: Jake Petroules <jake.petroules@qt.io>
-rw-r--r-- | share/qbs/modules/cpp/GenericGCC.qbs | 62 | ||||
-rw-r--r-- | share/qbs/modules/cpp/gcc.js | 19 |
2 files changed, 31 insertions, 50 deletions
diff --git a/share/qbs/modules/cpp/GenericGCC.qbs b/share/qbs/modules/cpp/GenericGCC.qbs index 5358d833f..2b7cc94e9 100644 --- a/share/qbs/modules/cpp/GenericGCC.qbs +++ b/share/qbs/modules/cpp/GenericGCC.qbs @@ -58,34 +58,10 @@ CppModule { } Probes.BinaryProbe { - id: asPathProbe - condition: !File.exists(assemblerPath) - names: Gcc.toolNames(assemblerName, toolchainPrefix) - } - Probes.BinaryProbe { - id: ldPathProbe - condition: !File.exists(linkerPath) - names: Gcc.toolNames(linkerName, toolchainPrefix) - } - Probes.BinaryProbe { - id: arPathProbe - condition: !File.exists(archiverPath) - names: Gcc.toolNames(archiverName, toolchainPrefix) - } - Probes.BinaryProbe { - id: nmPathProbe - condition: !File.exists(nmPath) - names: Gcc.toolNames(nmName, toolchainPrefix) - } - Probes.BinaryProbe { - id: objcopyPathProbe - condition: !File.exists(objcopyPath) - names: Gcc.toolNames(objcopyName, toolchainPrefix) - } - Probes.BinaryProbe { - id: stripPathProbe - condition: !File.exists(stripPath) - names: Gcc.toolNames(stripName, toolchainPrefix) + id: binutilsProbe + condition: File.exists(archiverPath) + names: Gcc.toolNames([archiverName, assemblerName, linkerName, nmName, + objcopyName, stripName], toolchainPrefix) } targetLinkerFlags: Gcc.targetFlags("linker", false, @@ -134,6 +110,8 @@ CppModule { property string toolchainPrefix property string toolchainInstallPath: compilerPathProbe.found ? compilerPathProbe.path : undefined + property string binutilsPath: binutilsProbe.found ? binutilsProbe.path : toolchainInstallPath + assemblerName: 'as' compilerName: cxxCompilerName linkerName: 'ld' @@ -173,17 +151,8 @@ CppModule { + "such as \"--no-undefined\", then you should set this property to \"strict\"." } - property string toolchainPathPrefix: { - var path = '' - if (toolchainInstallPath) { - path += toolchainInstallPath - if (path.substr(-1) !== '/') - path += '/' - } - if (toolchainPrefix) - path += toolchainPrefix - return path - } + property string toolchainPathPrefix: Gcc.pathPrefix(toolchainInstallPath, toolchainPrefix) + property string binutilsPathPrefix: Gcc.pathPrefix(binutilsPath, toolchainPrefix) property string compilerExtension: qbs.hostOS.contains("windows") ? ".exe" : "" property string cCompilerName: (qbs.toolchain.contains("clang") ? "clang" : "gcc") @@ -199,17 +168,14 @@ CppModule { "asm_cpp": toolchainPathPrefix + cCompilerName }) - assemblerPath: asPathProbe.found ? asPathProbe.filePath : toolchainPathPrefix + assemblerName + assemblerPath: binutilsPathPrefix + assemblerName compilerPath: toolchainPathPrefix + compilerName - linkerPath: ldPathProbe.found ? ldPathProbe.filePath : toolchainPathPrefix + linkerName - property string archiverPath: arPathProbe.found ? arPathProbe.filePath - : toolchainPathPrefix + archiverName - property string nmPath: nmPathProbe.found ? nmPathProbe.filePath : toolchainPathPrefix + nmName + linkerPath: binutilsPathPrefix + linkerName + property string archiverPath: binutilsPathPrefix + archiverName + property string nmPath: binutilsPathPrefix + nmName property bool _nmHasDynamicOption: nmProbe.hasDynamicOption - property string objcopyPath: objcopyPathProbe.found ? objcopyPathProbe.filePath - : toolchainPathPrefix + objcopyName - property string stripPath: stripPathProbe.found ? stripPathProbe.filePath - : toolchainPathPrefix + stripName + property string objcopyPath: binutilsPathPrefix + objcopyName + property string stripPath: binutilsPathPrefix + stripName property string dsymutilPath: toolchainPathPrefix + dsymutilName property string lipoPath: toolchainPathPrefix + lipoName property stringList dsymutilFlags diff --git a/share/qbs/modules/cpp/gcc.js b/share/qbs/modules/cpp/gcc.js index 713f2a403..b92dd0447 100644 --- a/share/qbs/modules/cpp/gcc.js +++ b/share/qbs/modules/cpp/gcc.js @@ -1317,7 +1317,22 @@ function targetFlags(tool, hasTargetOption, target, targetArch, machineType, tar return args; } -function toolNames(rawToolName, toolchainPrefix) +function toolNames(rawToolNames, toolchainPrefix) { - return [toolchainPrefix ? toolchainPrefix + rawToolName : rawToolName]; + return toolchainPrefix + ? rawToolNames.map(function(rawName) { return toolchainPrefix + rawName; }) + : rawToolNames; +} + +function pathPrefix(baseDir, prefix) +{ + var path = ''; + if (baseDir) { + path += baseDir; + if (path.substr(-1) !== '/') + path += '/'; + } + if (prefix) + path += prefix; + return path; } |