aboutsummaryrefslogtreecommitdiffstats
path: root/share
diff options
context:
space:
mode:
authorChristian Kandeler <christian.kandeler@qt.io>2017-06-13 18:25:05 +0200
committerChristian Kandeler <christian.kandeler@qt.io>2017-06-14 15:03:45 +0000
commit773804101f0a6cdf1e03582421e13067e611fcd2 (patch)
treea48056db121d145ac9c8b417402993f06382751e /share
parentbf851f8a42b27d2a1fa9d384be18407ef9344250 (diff)
GCC: Try harder to find binutils binaries
Our basic assumption is that tools like nm, strip and so on are located alongside the compiler. However, this is not always the case, e.g. when using the icecream tool. Let's not annoy users of such tools by forcing them to manually set properties, but look up the tools in the PATH if they are not present alongside the compiler. Change-Id: I4533dae8fe472eb82e6a4507e5c976e547ce80e7 Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
Diffstat (limited to 'share')
-rw-r--r--share/qbs/modules/cpp/GenericGCC.qbs46
-rw-r--r--share/qbs/modules/cpp/gcc.js5
2 files changed, 45 insertions, 6 deletions
diff --git a/share/qbs/modules/cpp/GenericGCC.qbs b/share/qbs/modules/cpp/GenericGCC.qbs
index ff2e6d679..5358d833f 100644
--- a/share/qbs/modules/cpp/GenericGCC.qbs
+++ b/share/qbs/modules/cpp/GenericGCC.qbs
@@ -57,6 +57,37 @@ CppModule {
_sysroot: sysroot
}
+ 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)
+ }
+
targetLinkerFlags: Gcc.targetFlags("linker", false,
target, targetArch, machineType, qbs.targetOS)
targetAssemblerFlags: Gcc.targetFlags("assembler", assemblerHasTargetOption,
@@ -168,14 +199,17 @@ CppModule {
"asm_cpp": toolchainPathPrefix + cCompilerName
})
- assemblerPath: toolchainPathPrefix + assemblerName
+ assemblerPath: asPathProbe.found ? asPathProbe.filePath : toolchainPathPrefix + assemblerName
compilerPath: toolchainPathPrefix + compilerName
- linkerPath: toolchainPathPrefix + linkerName
- property string archiverPath: toolchainPathPrefix + archiverName
- property string nmPath: toolchainPathPrefix + nmName
+ 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
property bool _nmHasDynamicOption: nmProbe.hasDynamicOption
- property string objcopyPath: toolchainPathPrefix + objcopyName
- property string stripPath: toolchainPathPrefix + stripName
+ property string objcopyPath: objcopyPathProbe.found ? objcopyPathProbe.filePath
+ : toolchainPathPrefix + objcopyName
+ property string stripPath: stripPathProbe.found ? stripPathProbe.filePath
+ : toolchainPathPrefix + 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 1534deedc..713f2a403 100644
--- a/share/qbs/modules/cpp/gcc.js
+++ b/share/qbs/modules/cpp/gcc.js
@@ -1316,3 +1316,8 @@ function targetFlags(tool, hasTargetOption, target, targetArch, machineType, tar
}
return args;
}
+
+function toolNames(rawToolName, toolchainPrefix)
+{
+ return [toolchainPrefix ? toolchainPrefix + rawToolName : rawToolName];
+}