diff options
| author | Joerg Bornemann <joerg.bornemann@digia.com> | 2013-11-11 09:25:31 +0100 |
|---|---|---|
| committer | Joerg Bornemann <joerg.bornemann@digia.com> | 2013-11-11 09:25:48 +0100 |
| commit | 7e2df73a397743777e4119e3646af17b5561b1a3 (patch) | |
| tree | b8a60540da740aa707bac318e973b6c0a3dcddc0 /share | |
| parent | d9c0be935136b3e26e7d7a47d89d28541462d83a (diff) | |
| parent | d6e99112cc72c4e67c2c620c9ca1a71ad3e4eec5 (diff) | |
| download | qbs-7e2df73a397743777e4119e3646af17b5561b1a3.tar.gz | |
Merge remote-tracking branch 'origin/1.1'
Change-Id: I597280483f7477856152f434249d8ee830d5ea40
Diffstat (limited to 'share')
| -rw-r--r-- | share/qbs/imports/qbs/Probes/PkgConfigProbe.qbs | 52 | ||||
| -rw-r--r-- | share/qbs/modules/cpp/DarwinGCC.qbs | 12 | ||||
| -rw-r--r-- | share/qbs/modules/cpp/GenericGCC.qbs | 19 | ||||
| -rw-r--r-- | share/qbs/modules/cpp/bundle-tools.js | 31 | ||||
| -rw-r--r-- | share/qbs/modules/cpp/gcc.js | 12 | ||||
| -rw-r--r-- | share/qbs/modules/utils.js | 2 |
6 files changed, 82 insertions, 46 deletions
diff --git a/share/qbs/imports/qbs/Probes/PkgConfigProbe.qbs b/share/qbs/imports/qbs/Probes/PkgConfigProbe.qbs index 33b539d1f..07509034d 100644 --- a/share/qbs/imports/qbs/Probes/PkgConfigProbe.qbs +++ b/share/qbs/imports/qbs/Probes/PkgConfigProbe.qbs @@ -19,32 +19,36 @@ Probe { if (!name) throw '"name" must be specified'; var p = new Process(); - var args = [ name ]; - if (minVersion !== undefined) - args.push(name + ' >= ' + minVersion); - if (exactVersion !== undefined) - args.push(name + ' = ' + exactVersion); - if (maxVersion !== undefined) - args.push(name + ' <= ' + maxVersion); - if (p.exec(executable, args.concat([ '--cflags' ])) === 0) { - cflags = p.readStdOut().trim(); - if (cflags === "") - cflags = undefined; - else - cflags = cflags.split(/\s/); - if (p.exec(executable, args.concat([ '--libs' ])) === 0) { - libs = p.readStdOut().trim(); - if (libs === "") - libs = undefined; + try { + var args = [ name ]; + if (minVersion !== undefined) + args.push(name + ' >= ' + minVersion); + if (exactVersion !== undefined) + args.push(name + ' = ' + exactVersion); + if (maxVersion !== undefined) + args.push(name + ' <= ' + maxVersion); + if (p.exec(executable, args.concat([ '--cflags' ])) === 0) { + cflags = p.readStdOut().trim(); + if (cflags === "") + cflags = undefined; else - libs = libs.split(/\s/); - found = true; - print("PkgConfigProbe: found library " + name); - return; + cflags = cflags.split(/\s/); + if (p.exec(executable, args.concat([ '--libs' ])) === 0) { + libs = p.readStdOut().trim(); + if (libs === "") + libs = undefined; + else + libs = libs.split(/\s/); + found = true; + print("PkgConfigProbe: found library " + name); + return; + } } + found = false; + cflags = undefined; + libs = undefined; + } finally { + p.close(); } - found = false; - cflags = undefined; - libs = undefined; } } diff --git a/share/qbs/modules/cpp/DarwinGCC.qbs b/share/qbs/modules/cpp/DarwinGCC.qbs index be5c2ae45..bbe4cf5cb 100644 --- a/share/qbs/modules/cpp/DarwinGCC.qbs +++ b/share/qbs/modules/cpp/DarwinGCC.qbs @@ -180,6 +180,7 @@ UnixGCC { process.exec("plutil", ["-convert", "json", "-o", "-", platformInfoPlist], true); platformInfo = JSON.parse(process.readStdOut()); + process.close(); var additionalProps = platformInfo["AdditionalInfo"]; for (key in additionalProps) { @@ -210,6 +211,7 @@ UnixGCC { process.exec("plutil", ["-convert", "json", "-o", "-", sdkSettingsPlist], true); sdkSettings = JSON.parse(process.readStdOut()); + process.close(); } else { print("warning: sysroot (SDK path) given but no SDKSettings.plist found"); } @@ -223,13 +225,16 @@ UnixGCC { process.exec("plutil", ["-convert", "json", "-o", "-", toolchainInfoPlist], true); toolchainInfo = JSON.parse(process.readStdOut()); + process.close(); } else { print("could not find a ToolchainInfo.plist near the toolchain install path"); } process = new Process(); process.exec("sw_vers", ["-buildVersion"], true); - aggregatePlist["BuildMachineOSBuild"] = process.readStdOut().trim(); + var osBuildVersion = process.readStdOut().trim(); + aggregatePlist["BuildMachineOSBuild"] = osBuildVersion; + process.close(); // setup env env = { @@ -240,9 +245,7 @@ UnixGCC { "XCODE_PRODUCT_BUILD_VERSION": platformInfo["DTPlatformBuild"], "PLATFORM_PRODUCT_BUILD_VERSION": platformInfo["ProductBuildVersion"], } - process = new Process(); - process.exec("sw_vers", ["-buildVersion"], true); - env["MAC_OS_X_PRODUCT_BUILD_VERSION"] = process.readStdOut().trim(); + env["MAC_OS_X_PRODUCT_BUILD_VERSION"] = osBuildVersion; for (key in buildEnv) env[key] = buildEnv[key]; @@ -266,6 +269,7 @@ UnixGCC { // Convert the written file to the format appropriate for the current platform process = new Process(); process.exec("plutil", ["-convert", infoPlistFormat, outputs.infoplist[0].fileName], true); + process.close(); } return cmd; } diff --git a/share/qbs/modules/cpp/GenericGCC.qbs b/share/qbs/modules/cpp/GenericGCC.qbs index 6186d90eb..35821fdeb 100644 --- a/share/qbs/modules/cpp/GenericGCC.qbs +++ b/share/qbs/modules/cpp/GenericGCC.qbs @@ -148,7 +148,7 @@ CppModule { for (var i = 0; i < symlinkCount; ++i) { cmd = new Command("ln", ["-sf", FileInfo.fileName(libFilePath), links[i].fileName]); - cmd.description = "filegen"; + cmd.highlight = "filegen"; cmd.description = "creating symbolic link '" + FileInfo.fileName(links[i].fileName) + "'"; cmd.workingDirectory = FileInfo.path(libFilePath); @@ -272,7 +272,7 @@ CppModule { Rule { id: compiler - inputs: ["cpp", "c", "objcpp", "objc"] + inputs: ["cpp", "c", "objcpp", "objc", "asm", "asm_cpp"] auxiliaryInputs: ["hpp"] explicitlyDependsOn: ["c_pch", "cpp_pch", "objc_pch", "objcpp_pch"] @@ -333,4 +333,19 @@ CppModule { return Gcc.prepareCompiler.apply(this, arguments); } } + + FileTagger { + pattern: "*.s" + fileTags: ["asm"] + } + + FileTagger { + pattern: "*.S" + fileTags: ["asm_cpp"] + } + + FileTagger { + pattern: "*.sx" + fileTags: ["asm_cpp"] + } } diff --git a/share/qbs/modules/cpp/bundle-tools.js b/share/qbs/modules/cpp/bundle-tools.js index 6ce48c38c..4e2bf361b 100644 --- a/share/qbs/modules/cpp/bundle-tools.js +++ b/share/qbs/modules/cpp/bundle-tools.js @@ -28,12 +28,16 @@ function infoPlistContents(infoPlistFilePath) return undefined; var process = new Process(); - process.start("plutil", ["-convert", "json", "-o", "-", infoPlistFilePath]); - process.waitForFinished(); - if (process.exitCode() != 0) - throw("plutil: " + (process.readStdErr().trim() || process.readStdOut().trim())); - - return JSON.parse(process.readStdOut()); + try { + process.start("plutil", ["-convert", "json", "-o", "-", infoPlistFilePath]); + process.waitForFinished(); + if (process.exitCode() !== 0) + throw("plutil: " + (process.readStdErr().trim() || process.readStdOut().trim())); + + return JSON.parse(process.readStdOut()); + } finally { + process.close(); + } } function infoPlistFormat(infoPlistFilePath) @@ -43,21 +47,26 @@ function infoPlistFormat(infoPlistFilePath) // Verify that the Info.plist format is actually valid in the first place var process = new Process(); - process.start("plutil", ["-lint", infoPlistFilePath]); - process.waitForFinished(); - if (process.exitCode() != 0) - throw("plutil: " + (process.readStdErr().trim() || process.readStdOut().trim())); + try { + process.start("plutil", ["-lint", infoPlistFilePath]); + process.waitForFinished(); + if (process.exitCode() !== 0) + throw("plutil: " + (process.readStdErr().trim() || process.readStdOut().trim())); + } finally { + process.close(); + } process = new Process(); process.start("file", ["-bI", infoPlistFilePath]); process.waitForFinished(); var magic = process.readStdOut().trim(); + process.close(); if (magic.indexOf("application/octet-stream;") === 0) return "binary1"; else if (magic.indexOf("application/xml;") === 0) return "xml1"; - else if (magic.indexOf("text/plain;") == 0) + else if (magic.indexOf("text/plain;") === 0) return "json"; return undefined; diff --git a/share/qbs/modules/cpp/gcc.js b/share/qbs/modules/cpp/gcc.js index 453b2b31e..6dc75a041 100644 --- a/share/qbs/modules/cpp/gcc.js +++ b/share/qbs/modules/cpp/gcc.js @@ -145,11 +145,11 @@ function additionalCompilerFlags(product, input, output) } var args = [] + var positionIndependentCode = product.moduleProperty('cpp', 'positionIndependentCode') if (effectiveType === EffectiveTypeEnum.LIB) { - if (!product.moduleProperty("qbs", "toolchain").contains("mingw")) + if (positionIndependentCode !== false && !product.moduleProperty("qbs", "toolchain").contains("mingw")) args.push('-fPIC'); } else if (effectiveType === EffectiveTypeEnum.APP) { - var positionIndependentCode = product.moduleProperty('cpp', 'positionIndependentCode') if (positionIndependentCode && !product.moduleProperty("qbs", "toolchain").contains("mingw")) args.push('-fPIE'); } else { @@ -249,6 +249,10 @@ function languageName(fileTag) return 'objective-c'; else if (fileTag === 'objcpp') return 'objective-c++'; + else if (fileTag === 'asm') + return 'assembler'; + else if (fileTag === 'asm_cpp') + return 'assembler-with-cpp'; } function prepareCompiler(project, product, inputs, outputs, input, output) @@ -257,8 +261,8 @@ function prepareCompiler(project, product, inputs, outputs, input, output) // Determine which C-language we're compiling var tag = ModUtils.fileTagForTargetLanguage(input.fileTags.concat(output.fileTags)); - if (!["c", "cpp", "objc", "objcpp"].contains(tag)) - throw ("unsupported source language"); + if (!["c", "cpp", "objc", "objcpp", "asm", "asm_cpp"].contains(tag)) + throw ("unsupported source language: " + tag); // Whether we're compiling a precompiled header or normal source file var pchOutput = outputs[tag + "_pch"] ? outputs[tag + "_pch"][0] : undefined; diff --git a/share/qbs/modules/utils.js b/share/qbs/modules/utils.js index 5b3349ca6..9ec02d8db 100644 --- a/share/qbs/modules/utils.js +++ b/share/qbs/modules/utils.js @@ -11,7 +11,7 @@ */ function fileTagForTargetLanguage(fileTags) { - var srcTags = ["c", "cpp", "objc", "objcpp"]; + var srcTags = ["c", "cpp", "objc", "objcpp", "asm", "asm_cpp"]; var pchTags = ["c_pch", "cpp_pch", "objc_pch", "objcpp_pch"]; var canonicalTag = undefined; |
