diff options
author | Jake Petroules <jake.petroules@petroules.com> | 2013-06-05 16:46:12 -0400 |
---|---|---|
committer | Joerg Bornemann <joerg.bornemann@digia.com> | 2013-06-18 10:52:11 +0200 |
commit | f20c3e06bf517a6e23d20afddd0ba36bfd611244 (patch) | |
tree | 232280ae31b609e6d1369fd37ec1414285770da4 | |
parent | a213f293f525759342d5e73d497858d728168bae (diff) |
Change targetOS and hostOS to lists, and remove targetPlatform.
Change-Id: I33317c857a319e0fa25c9e0d0cc69abc4ad3fabb
Reviewed-by: Joerg Bornemann <joerg.bornemann@digia.com>
38 files changed, 237 insertions, 148 deletions
diff --git a/doc/items/group.qdoc b/doc/items/group.qdoc index 68e7ad983..2813f6ac2 100644 --- a/doc/items/group.qdoc +++ b/doc/items/group.qdoc @@ -46,12 +46,12 @@ } Group { name: "Windows files" - condition: targetOS === "windows" + condition: targetOS.contains("windows") files: "myclass_win_impl.cpp" } Group { name: "Linux files" - condition: targetOS === "linux" + condition: targetOS.contains("linux") files: "myclass_linux_impl.cpp" } Group { diff --git a/doc/items/properties.qdoc b/doc/items/properties.qdoc index 3f73f5d16..7bbe6e21e 100644 --- a/doc/items/properties.qdoc +++ b/doc/items/properties.qdoc @@ -43,7 +43,7 @@ \code Product { Properties { - condition: qbs.targetOS == "windows" + condition: qbs.targetOS.contains("windows") cpp.defines: ["ON_WINDOWS"] cpp.includePaths: ["extraWindowsIncludes"] } @@ -56,12 +56,12 @@ \code Product { Properties { - condition: qbs.targetOS == "windows" + condition: qbs.targetOS.contains("windows") cpp.defines: ["ON_WINDOWS"] cpp.includePaths: ["myWindowsIncludes"] } Properties { - condition: qbs.targetOS == "linux" + condition: qbs.targetOS.contains("linux") cpp.defines: ["ON_LINUX"] cpp.includePaths: ["myLinuxIncludes"] } @@ -72,16 +72,16 @@ \code Product { cpp.defines: { - if (qbs.targetOS == "windows") + if (qbs.targetOS.contains("windows")) return ["ON_WINDOWS"]; - if (qbs.targetOS == "linux") + if (qbs.targetOS.contains("linux")) return ["ON_LINUX"]; return ["ON_UNKNOWN_PLATFORM"]; } cpp.includePaths: { - if (qbs.targetOS == "windows") + if (qbs.targetOS.contains("windows")) return ["ON_WINDOWS"]; - if (qbs.targetOS == "linux") + if (qbs.targetOS.contains("linux")) return ["ON_LINUX"]; return undefined; } diff --git a/doc/qbs.qdoc b/doc/qbs.qdoc index 55184bc7b..4d35c6b16 100644 --- a/doc/qbs.qdoc +++ b/doc/qbs.qdoc @@ -503,7 +503,7 @@ be compiled on a certain platform. This is how you do it: \code Group { - condition: qbs.targetOS == "windows" + condition: qbs.targetOS.contains("windows") files: [ "harddiskdeleter_win.cpp", "blowupmonitor_win.cpp", @@ -511,7 +511,7 @@ ] } Group { - condition: qbs.targetOS == "linux" + condition: qbs.targetOS.contains("linux") files: [ "harddiskdeleter_linux.cpp", "blowupmonitor_linux.cpp", @@ -538,14 +538,17 @@ are valid values but the user can add more in a project file. \row \li hostOS - \li string + \li stringlist \li platform-dependent - \li The host operating system. Currently "windows", "linux" or "osx". + \li The host operating system. + May contain "windows", "linux", "osx", "darwin", "unix", etc. \row \li targetOS - \li string + \li stringlist \li platform-dependent - \li The target operating system. Currently "windows", "linux" or "osx". + \li The target operating system. + May contain "windows", "linux", "osx", "darwin", "unix", + "ios", "android", "blackberry", "qnx", etc. \endtable You can set these properties on the command line or by using a profile. The property \a @@ -856,22 +859,30 @@ \section1 hostOS \table - \row \li \b{Type:} \li \c{string} (read only) - \row \li \b{Possible Values:} \li \c{"windows"}, \c{"linux"}, \c{"osx"}, \c{"unix"} + \row \li \b{Type:} \li \c{Array} of \c{string}s (read only) \endtable - This property is set by qbs internally and contains the name of the OS qbs is running on. + This property is set by qbs internally and specifies the OS qbs is running on. + The possible values for this property are the values of \c targetOS, + though some may not be supported. \section1 targetOS \table - \row \li \b{Type:} \li \c{string} + \row \li \b{Type:} \li \c{Array} of \c{string}s + \row \li \b{Possible Values:} \li one or more of: + \c{"android"}, + \c{"darwin"}, + \c{"ios"}, + \c{"linux"}, + \c{"osx"}, + \c{"unix"}, + \c{"windows"} \endtable - Specifies the OS you want to build the project for. This is typically set in a profile. - The possible values for this property are the values of \c hostOS plus a growing number - of supported operating systems like \c{"ios"}. + Specifies the OS you want to build the project for. + This is typically set in a profile. \section1 architecture @@ -896,27 +907,6 @@ Specifies the endianness of the target platform's processor architecture. - \section1 targetPlatform - - \table - \row \li \b{Type:} \li \c{Array} of \c{string}s (read only) - \endtable - - Holds attributes of the target platform. Always contains the value of \c{targetOS}. - Additional values of this property are: - \table - \header - \li Value - \li Description - \row - \li \c{"unix"} - \li The platform is a Unix derivative. This is set for Linux, OS X, iOS and Android. - \row - \li \c{"darwin"} - \li The platform is derived from Darwin. This is set for OS X and iOS. - \endtable - - \section1 toolchain \table diff --git a/share/qbs/imports/qbs/base/Application.qbs b/share/qbs/imports/qbs/base/Application.qbs index 512547560..24b351499 100644 --- a/share/qbs/imports/qbs/base/Application.qbs +++ b/share/qbs/imports/qbs/base/Application.qbs @@ -1,4 +1,4 @@ Product { property string bundleExtension - type: qbs.targetPlatform.indexOf("darwin") !== -1 ? "applicationbundle" : "application" + type: qbs.targetOS.contains("darwin") ? "applicationbundle" : "application" } diff --git a/share/qbs/imports/qbs/base/QmlApp.qbs b/share/qbs/imports/qbs/base/QmlApp.qbs index a90ca04c8..73fc86477 100644 --- a/share/qbs/imports/qbs/base/QmlApp.qbs +++ b/share/qbs/imports/qbs/base/QmlApp.qbs @@ -1,7 +1,7 @@ import qbs 1.0 Product { - type: qbs.targetPlatform.indexOf("darwin") !== -1 ? "applicationbundle" : "application" + type: qbs.targetOS.contains("darwin") ? "applicationbundle" : "application" Depends { name: "Qt"; submodules: ["core", "declarative"] } Depends { name: "cpp" } property string appViewerPath: localPath + "/qmlapplicationviewer" diff --git a/share/qbs/modules/Qt/core/qtcore.qbs b/share/qbs/modules/Qt/core/qtcore.qbs index f126946d7..da77b3e10 100644 --- a/share/qbs/modules/Qt/core/qtcore.qbs +++ b/share/qbs/modules/Qt/core/qtcore.qbs @@ -46,7 +46,7 @@ Module { defines.push("QT_NO_DEBUG"); if (namespace) defines.push("QT_NAMESPACE=" + namespace); - if (qbs.targetOS === "ios") + if (qbs.targetOS.contains("ios")) defines = defines.concat(["DARWIN_NO_CARBON", "QT_NO_CORESERVICES", "QT_NO_PRINTER", "QT_NO_PRINTDIALOG", "main=qt_main"]); return defines; @@ -67,14 +67,14 @@ Module { return libPaths; } cpp.staticLibraries: { - if (qbs.targetOS === 'windows' && !product.consoleApplication) + if (qbs.targetOS.contains('windows') && !product.consoleApplication) return ["qtmain" + libInfix + (cpp.debugInformation ? "d" : "") + (!qbs.toolchain.contains("mingw") ? ".lib" : "")]; } cpp.dynamicLibraries: { var libs = []; if (!frameworkBuild) libs=[QtFunctions.getQtLibraryName('Core' + libInfix, qtcore, qbs)]; - if (qbs.targetOS === 'ios' && staticBuild) + if (qbs.targetOS.contains('ios') && staticBuild) libs = libs.concat(["z", "m", QtFunctions.getQtLibraryName("PlatformSupport", qtcore, qbs), QtFunctions.getPlatformLibraryName("qiosmain", qtcore, qbs)]); @@ -82,7 +82,7 @@ Module { return undefined; return libs; } - cpp.linkerFlags: ((qbs.targetOS === 'ios' && staticBuild) ? + cpp.linkerFlags: ((qbs.targetOS.contains('ios') && staticBuild) ? ["-force_load", pluginPath + "/platforms/" + QtFunctions.getPlatformLibraryName("libqios", qtcore, qbs) + ".a"] : undefined) cpp.frameworkPaths: frameworkBuild ? [libPath] : undefined @@ -90,13 +90,13 @@ Module { var frameworks = []; if (frameworkBuild) frameworks = [QtFunctions.getQtLibraryName('Core' + libInfix, qtcore, qbs)] - if (qbs.targetOS === 'ios' && staticBuild) + if (qbs.targetOS.contains('ios') && staticBuild) frameworks = frameworks.concat(["Foundation", "CoreFoundation"]); if (frameworks.length === 0) return undefined; return frameworks; } - cpp.rpaths: qbs.targetOS === 'linux' ? [libPath] : undefined + cpp.rpaths: qbs.targetOS.contains('linux') ? [libPath] : undefined cpp.positionIndependentCode: versionMajor >= 5 ? true : undefined cpp.cxxFlags: { var flags; @@ -129,7 +129,7 @@ Module { if (v.length > 0 && v.charAt(0) != ';') v = ';' + v var y = binPath - if (qbs.targetOS === 'windows') + if (qbs.targetOS.contains('windows')) v = FileInfo.toWindowsSeparators(y) + v else v = y + v diff --git a/share/qbs/modules/Qt/gui/qtgui.qbs b/share/qbs/modules/Qt/gui/qtgui.qbs index 6eec29b26..619d22ce6 100644 --- a/share/qbs/modules/Qt/gui/qtgui.qbs +++ b/share/qbs/modules/Qt/gui/qtgui.qbs @@ -33,7 +33,7 @@ QtModule { } Properties { - condition: Qt.core.staticBuild && qbs.targetOS == "ios" + condition: Qt.core.staticBuild && qbs.targetOS.contains("ios") cpp.frameworks: base.concat(["UIKit", "QuartzCore", "CoreText", "CoreGraphics", "Foundation", "CoreFoundation"]) } diff --git a/share/qbs/modules/Qt/opengl/opengl.qbs b/share/qbs/modules/Qt/opengl/opengl.qbs index c3a5c137d..e7934802e 100644 --- a/share/qbs/modules/Qt/opengl/opengl.qbs +++ b/share/qbs/modules/Qt/opengl/opengl.qbs @@ -4,7 +4,7 @@ import '../QtModule.qbs' as QtModule QtModule { qtModuleName: 'OpenGL' Properties { - condition: Qt.core.staticBuild && qbs.targetOS == "ios" + condition: Qt.core.staticBuild && qbs.targetOS.contains("ios") cpp.frameworks: base.concat(["OpenGLES", "QuartzCore", "CoreGraphics"]) } cpp.frameworks: base diff --git a/share/qbs/modules/Qt/qtfunctions.js b/share/qbs/modules/Qt/qtfunctions.js index e19c16901..7e54d1a1f 100644 --- a/share/qbs/modules/Qt/qtfunctions.js +++ b/share/qbs/modules/Qt/qtfunctions.js @@ -3,14 +3,14 @@ function getPlatformLibraryName(name, qtcore, qbs) { var libName = name; - if (qbs.targetOS === 'windows') { + if (qbs.targetOS.contains('windows')) { libName += (qbs.enableDebugCode ? 'd' : ''); if (qtcore.versionMajor < 5) libName += qtcore.versionMajor; if (!qbs.toolchain.contains("mingw")) libName += '.lib'; } - if (qbs.targetPlatform.indexOf("darwin") !== -1) { + if (qbs.targetOS.contains("darwin")) { if (!qtcore.frameworkBuild && qtcore.buildVariant.indexOf("debug") !== -1 && (qtcore.buildVariant.indexOf("release") === -1 || qbs.enableDebugCode)) libName += '_debug'; diff --git a/share/qbs/modules/cpp/DarwinGCC.qbs b/share/qbs/modules/cpp/DarwinGCC.qbs index 9c6fd53c4..5fd6213ce 100644 --- a/share/qbs/modules/cpp/DarwinGCC.qbs +++ b/share/qbs/modules/cpp/DarwinGCC.qbs @@ -58,10 +58,10 @@ UnixGCC { if (product.type.indexOf("applicationbundle") !== -1) dict["CFBundleIconFile"] = product.targetName; - if (qbs.targetOS === "osx" && minimumOsxVersion) + if (qbs.targetOS.contains("osx") && minimumOsxVersion) dict["LSMinimumSystemVersion"] = minimumOsxVersion; - if (qbs.targetOS === "ios") { + if (qbs.targetOS.contains("ios")) { dict["LSRequiresIPhoneOS"] = true; // architectures supported, to support iPhone 3G for example one has to add @@ -177,7 +177,7 @@ UnixGCC { aggregatePlist[key] = props[key]; } - if (product.moduleProperty("qbs", "targetOS") === "ios") { + if (product.moduleProperty("qbs", "targetOS").contains("ios")) { key = "UIDeviceFamily"; if (key in platformInfo && !(key in aggregatePlist)) aggregatePlist[key] = platformInfo[key]; @@ -237,7 +237,7 @@ UnixGCC { // Convert the written file to the format appropriate for the current platform process = new Process(); process.start("plutil", ["-convert", - product.moduleProperty("qbs", "targetOS") === "ios" + product.moduleProperty("qbs", "targetOS").contains("ios") ? "binary1" : "xml1", outputs.infoplist[0].fileName]); process.waitForFinished(); diff --git a/share/qbs/modules/cpp/GenericGCC.qbs b/share/qbs/modules/cpp/GenericGCC.qbs index f474e28fc..af87a26d0 100644 --- a/share/qbs/modules/cpp/GenericGCC.qbs +++ b/share/qbs/modules/cpp/GenericGCC.qbs @@ -68,7 +68,7 @@ CppModule { var i; var args = Gcc.configFlags(product); args.push('-shared'); - if (product.moduleProperty("qbs", "targetOS") === 'linux') { + if (product.moduleProperty("qbs", "targetOS").contains('linux')) { args = args.concat([ '-Wl,--hash-style=gnu', '-Wl,--as-needed', @@ -76,7 +76,7 @@ CppModule { '-Wl,--no-undefined', '-Wl,-soname=' + Gcc.soname() ]); - } else if (product.moduleProperty("qbs", "targetPlatform").indexOf('darwin') !== -1) { + } else if (product.moduleProperty("qbs", "targetOS").contains('darwin')) { var installNamePrefix = product.moduleProperty("cpp", "installNamePrefix"); if (installNamePrefix !== undefined) args.push("-Wl,-install_name," @@ -90,7 +90,7 @@ CppModule { args.push(inputs.obj[i].fileName); var sysroot = ModUtils.moduleProperty(product, "sysroot") if (sysroot) { - if (product.moduleProperty("qbs", "targetPlatform").indexOf('darwin') !== -1) + if (product.moduleProperty("qbs", "targetOS").contains('darwin')) args.push('-isysroot', sysroot); else args.push('--sysroot=' + sysroot); @@ -127,7 +127,7 @@ CppModule { // Create symlinks from {libfoo, libfoo.1, libfoo.1.0} to libfoo.1.0.0 if (product.version - && product.moduleProperty("qbs", "targetPlatform").indexOf("unix") !== -1) { + && product.moduleProperty("qbs", "targetOS").contains("unix")) { var versionParts = product.version.split('.'); var version = ""; var fname = FileInfo.fileName(output.fileName); @@ -213,7 +213,7 @@ CppModule { args.push(inputs.obj[i].fileName) var sysroot = ModUtils.moduleProperty(product, "sysroot") if (sysroot) { - if (product.moduleProperty("qbs", "targetPlatform").indexOf('darwin') !== -1) + if (product.moduleProperty("qbs", "targetOS").contains('darwin')) args.push('-isysroot', sysroot) else args.push('--sysroot=' + sysroot) @@ -271,7 +271,7 @@ CppModule { } } - if (product.moduleProperty("qbs", "targetOS") === 'linux') { + if (product.moduleProperty("qbs", "targetOS").contains('linux')) { var transitiveSOs = ModUtils.modulePropertiesFromArtifacts(product, inputs.dynamiclibrary, 'cpp', 'transitiveSOs') for (i in transitiveSOs) { args.push("-Wl,-rpath-link=" + FileInfo.path(transitiveSOs[i])) diff --git a/share/qbs/modules/cpp/bundle-tools.js b/share/qbs/modules/cpp/bundle-tools.js index e51c18928..32243a4d6 100644 --- a/share/qbs/modules/cpp/bundle-tools.js +++ b/share/qbs/modules/cpp/bundle-tools.js @@ -203,7 +203,7 @@ function scriptsFolderPath(product, version) // iOS tends to store the majority of files in its bundles in the main directory function isShallowBundle(product) { - return product.moduleProperty("qbs", "targetOS") === "ios" + return product.moduleProperty("qbs", "targetOS").contains("ios") && product.type.indexOf("applicationbundle") !== -1; } diff --git a/share/qbs/modules/cpp/gcc.js b/share/qbs/modules/cpp/gcc.js index 30b175dec..b7f4b1f60 100644 --- a/share/qbs/modules/cpp/gcc.js +++ b/share/qbs/modules/cpp/gcc.js @@ -101,7 +101,7 @@ function additionalCompilerFlags(product, includePaths, frameworkPaths, systemIn } var sysroot = ModUtils.moduleProperty(product, "sysroot") if (sysroot) { - if (product.moduleProperty("qbs", "targetPlatform").indexOf('darwin') !== -1) + if (product.moduleProperty("qbs", "targetOS").contains('darwin')) args.push('-isysroot', sysroot); else args.push('--sysroot=' + sysroot); @@ -126,7 +126,7 @@ function additionalCompilerFlags(product, includePaths, frameworkPaths, systemIn args.push('-iframework' + systemFrameworkPaths[i]); var minimumWindowsVersion = ModUtils.moduleProperty(product, "minimumWindowsVersion"); - if (minimumWindowsVersion && product.moduleProperty("qbs", "targetOS") === "windows") { + if (minimumWindowsVersion && product.moduleProperty("qbs", "targetOS").contains("windows")) { var hexVersion = Windows.getWindowsVersionInFormat(minimumWindowsVersion, 'hex'); if (hexVersion) { var versionDefs = [ 'WINVER', '_WIN32_WINNT', '_WIN32_WINDOWS' ]; @@ -148,12 +148,12 @@ function additionalCompilerAndLinkerFlags(product) { var args = [] var minimumOsxVersion = ModUtils.moduleProperty(product, "minimumOsxVersion"); - if (minimumOsxVersion && product.moduleProperty("qbs", "targetOS") === "osx") + if (minimumOsxVersion && product.moduleProperty("qbs", "targetOS").contains("osx")) args.push('-mmacosx-version-min=' + minimumOsxVersion); var minimumiOSVersion = ModUtils.moduleProperty(product, "minimumIosVersion"); - if (minimumiOSVersion && product.moduleProperty("qbs", "targetOS") === "ios") { - if (product.moduleProperty("qbs", "architecture") === "x86") + if (minimumiOSVersion && product.moduleProperty("qbs", "targetOS").contains("ios")) { + if (product.moduleProperty("qbs", "targetOS").contains("ios-simulator")) args.push('-mios-simulator-version-min=' + minimumiOSVersion); else args.push('-miphoneos-version-min=' + minimumiOSVersion); diff --git a/share/qbs/modules/cpp/genericunix-gcc.qbs b/share/qbs/modules/cpp/genericunix-gcc.qbs index 7ccdc7ebf..68589b469 100644 --- a/share/qbs/modules/cpp/genericunix-gcc.qbs +++ b/share/qbs/modules/cpp/genericunix-gcc.qbs @@ -1,5 +1,5 @@ import qbs 1.0 UnixGCC { - condition: qbs.targetOS === 'unix' && qbs.toolchain.contains('gcc') + condition: qbs.targetOS.contains('unix') && qbs.toolchain.contains('gcc') } diff --git a/share/qbs/modules/cpp/ios-gcc.qbs b/share/qbs/modules/cpp/ios-gcc.qbs index ef169911b..79b49e316 100644 --- a/share/qbs/modules/cpp/ios-gcc.qbs +++ b/share/qbs/modules/cpp/ios-gcc.qbs @@ -5,15 +5,17 @@ import 'darwin-tools.js' as DarwinTools import 'bundle-tools.js' as BundleTools DarwinGCC { - condition: qbs.hostOS === 'osx' && qbs.targetOS === 'ios' && qbs.toolchain.contains('gcc') + condition: qbs.hostOS.contains('osx') && qbs.targetOS.contains('ios') && qbs.toolchain.contains('gcc') property string signingIdentity property string provisionFile - property bool buildIpa: qbs.architecture.match("^arm") === "arm" + property bool buildIpa: !qbs.targetOS.contains('ios-simulator') visibility: "hidden" - optimization: ((qbs.buildVariant === "debug" ) ? "none" : - (qbs.architecture.match("^arm") === "arm") ? "small" : - "fast") + optimization: { + if (qbs.buildVariant === "debug") + return "none"; + return qbs.targetOS.contains('ios-simulator') ? "fast" : "small" + } platformCommonCompilerFlags: base.concat(["-fvisibility-inlines-hidden", "-g", "-gdwarf-2", "-fPIE"]) commonCompilerFlags: ["-fpascal-strings", "-fexceptions", "-fasm-blocks", "-fstrict-aliasing"] diff --git a/share/qbs/modules/cpp/linux-gcc.qbs b/share/qbs/modules/cpp/linux-gcc.qbs index 495f2cd7d..63281f7cb 100644 --- a/share/qbs/modules/cpp/linux-gcc.qbs +++ b/share/qbs/modules/cpp/linux-gcc.qbs @@ -1,7 +1,7 @@ import qbs 1.0 UnixGCC { - condition: qbs.targetOS === 'linux' && qbs.toolchain.contains('gcc') + condition: qbs.targetOS.contains('linux') && qbs.toolchain.contains('gcc') rpaths: ['$ORIGIN'] } diff --git a/share/qbs/modules/cpp/osx-gcc.qbs b/share/qbs/modules/cpp/osx-gcc.qbs index 563b81422..eb6fefc50 100644 --- a/share/qbs/modules/cpp/osx-gcc.qbs +++ b/share/qbs/modules/cpp/osx-gcc.qbs @@ -2,5 +2,5 @@ import qbs 1.0 import '../utils.js' as ModUtils DarwinGCC { - condition: qbs.hostOS === 'osx' && qbs.targetOS === 'osx' && qbs.toolchain.contains('gcc') + condition: qbs.hostOS.contains('osx') && qbs.targetOS.contains('osx') && qbs.toolchain.contains('gcc') } diff --git a/share/qbs/modules/cpp/path-tools.js b/share/qbs/modules/cpp/path-tools.js index 1a7071729..db45c89f6 100644 --- a/share/qbs/modules/cpp/path-tools.js +++ b/share/qbs/modules/cpp/path-tools.js @@ -42,7 +42,8 @@ function dynamicLibraryFileName(version) var fileName = ModUtils.moduleProperty(product, "dynamicLibraryPrefix") + product.targetName; // For Darwin platforms, append the version number if there is one (i.e. libqbs.1.0.0) - if (version && product.moduleProperty("qbs", "targetPlatform").indexOf("darwin") !== -1) { + var targetOS = product.moduleProperty("qbs", "targetOS"); + if (version && targetOS.contains("darwin")) { fileName += "." + version; version = undefined; } @@ -51,7 +52,7 @@ function dynamicLibraryFileName(version) fileName += ModUtils.moduleProperty(product, "dynamicLibrarySuffix"); // For non-Darwin Unix platforms, append the version number if there is one (i.e. libqbs.so.1.0.0) - if (version && product.moduleProperty("qbs", "targetPlatform").indexOf("unix") !== -1) + if (version && targetOS.contains("unix") && !targetOS.contains("darwin")) fileName += "." + version; return fileName; diff --git a/share/qbs/modules/cpp/windows-mingw.qbs b/share/qbs/modules/cpp/windows-mingw.qbs index a9d8e55d5..e01914097 100644 --- a/share/qbs/modules/cpp/windows-mingw.qbs +++ b/share/qbs/modules/cpp/windows-mingw.qbs @@ -3,7 +3,7 @@ import qbs.fileinfo as FileInfo import '../utils.js' as ModUtils GenericGCC { - condition: qbs.targetOS === "windows" && qbs.toolchain.contains("mingw") + condition: qbs.targetOS.contains("windows") && qbs.toolchain.contains("mingw") staticLibraryPrefix: "lib" dynamicLibraryPrefix: "" executablePrefix: "" diff --git a/share/qbs/modules/cpp/windows-msvc.qbs b/share/qbs/modules/cpp/windows-msvc.qbs index bb4f2d5aa..5d22d6eff 100644 --- a/share/qbs/modules/cpp/windows-msvc.qbs +++ b/share/qbs/modules/cpp/windows-msvc.qbs @@ -7,7 +7,7 @@ import "bundle-tools.js" as BundleTools // needed for path-tools.js import 'path-tools.js' as PathTools CppModule { - condition: qbs.hostOS === 'windows' && qbs.targetOS === 'windows' && qbs.toolchain.contains('msvc') + condition: qbs.hostOS.contains('windows') && qbs.targetOS.contains('windows') && qbs.toolchain.contains('msvc') id: module diff --git a/share/qbs/modules/qbs/common.qbs b/share/qbs/modules/qbs/common.qbs index 9c47a3b12..c650aadba 100644 --- a/share/qbs/modules/qbs/common.qbs +++ b/share/qbs/modules/qbs/common.qbs @@ -6,20 +6,10 @@ Module { property bool enableDebugCode: buildVariant == "debug" property bool debugInformation: (buildVariant == "debug") property string optimization: (buildVariant == "debug" ? "none" : "fast") - property string hostOS: getHostOS() - property string pathListSeparator: hostOS === "windows" ? ";" : ":" - property string pathSeparator: hostOS === "windows" ? "\\" : "/" - property string targetOS: hostOS - property var targetPlatform: { - var platforms = [targetOS]; - if (targetOS === "linux") - platforms.push("unix"); - else if (targetOS === "android") - platforms.push("linux", "unix"); - else if (targetOS === "osx" || targetOS === "ios") - platforms.push("darwin", "unix"); - return platforms - } + property stringList hostOS: getHostOS() + property stringList targetOS + property string pathListSeparator: hostOS.contains("windows") ? ";" : ":" + property string pathSeparator: hostOS.contains("windows") ? "\\" : "/" property string profile property stringList toolchain property string architecture diff --git a/src/app/detect-toolchains/msvcprobe.cpp b/src/app/detect-toolchains/msvcprobe.cpp index 4104f50b2..3639669a3 100644 --- a/src/app/detect-toolchains/msvcprobe.cpp +++ b/src/app/detect-toolchains/msvcprobe.cpp @@ -69,7 +69,7 @@ static void addMSVCPlatform(Settings *settings, QList<Profile> &profiles, const qbsInfo() << Tr::tr("Setting up profile '%1'.").arg(name); Profile p(name, settings); p.removeProfile(); - p.setValue("qbs.targetOS", "windows"); + p.setValue("qbs.targetOS", QStringList("windows")); p.setValue("cpp.toolchainInstallPath", installPath); p.setValue("qbs.toolchain", QStringList("msvc")); p.setValue("cpp.windowsSDKPath", winSDKPath); diff --git a/src/app/detect-toolchains/osxprobe.cpp b/src/app/detect-toolchains/osxprobe.cpp index c2a94d34e..43fc99290 100644 --- a/src/app/detect-toolchains/osxprobe.cpp +++ b/src/app/detect-toolchains/osxprobe.cpp @@ -192,14 +192,15 @@ void OsxProbe::setupDefaultToolchains(const QString &devPath, const QString &xCo .arg(fInfo.absoluteFilePath()); continue; } - QString targetOS; + QStringList targetOS; + targetOS << QLatin1String("darwin") << QLatin1String("unix"); QString name = infoSettings.value(QLatin1String("Name")).toString(); if (name == QLatin1String("macosx")) { - targetOS = QLatin1String("osx"); + targetOS << QLatin1String("osx"); } else if (name == QLatin1String("iphoneos")) { - targetOS = QLatin1String("ios"); + targetOS << QLatin1String("ios"); } else if (name == QLatin1String("iphonesimulator")) { - targetOS = QLatin1String("ios"); + targetOS << QLatin1String("ios") << QLatin1String("ios-simulator"); } else { qbsInfo() << indent << Tr::tr("Skipping unknown platform %1").arg(name); continue; diff --git a/src/app/detect-toolchains/probe.cpp b/src/app/detect-toolchains/probe.cpp index 7894e836e..18671bf9f 100644 --- a/src/app/detect-toolchains/probe.cpp +++ b/src/app/detect-toolchains/probe.cpp @@ -216,7 +216,7 @@ static void mingwProbe(Settings *settings, QList<Profile> &profiles) Profile profile(QString::fromLocal8Bit(gccMachineName), settings); qbsInfo() << Tr::tr("Platform '%1' detected in '%2'.").arg(profile.name(), mingwPath); - profile.setValue("qbs.targetOS", "windows"); + profile.setValue("qbs.targetOS", QStringList("windows")); profile.setValue("cpp.toolchainInstallPath", mingwBinPath); profile.setValue("qbs.toolchain", QStringList() << "mingw" << "gcc"); profiles << profile; diff --git a/src/app/setupmaddeplatforms/main.cpp b/src/app/setupmaddeplatforms/main.cpp index 7c58a1fd3..708e64453 100644 --- a/src/app/setupmaddeplatforms/main.cpp +++ b/src/app/setupmaddeplatforms/main.cpp @@ -149,10 +149,9 @@ SpecialPlatformsSetup::PlatformInfo MaddePlatformsSetup::gatherMaddePlatformInfo throw Exception(tr("Error: No sysroot information found for target '%1'.").arg(target)); platformInfo.name = target; - platformInfo.targetOS = QLatin1String("linux"); - platformInfo.targetPlatform << QLatin1String("unix") << QLatin1String("linux"); + platformInfo.targetOS << QLatin1String("unix") << QLatin1String("linux"); if (target.contains(QLatin1String("harmattan"))) - platformInfo.targetPlatform << QLatin1String("meego") << QLatin1String("maemo6"); + platformInfo.targetOS << QLatin1String("meego") << QLatin1String("maemo6"); platformInfo.toolchainDir = targetDir + QLatin1String("/bin"); platformInfo.compilerName = QLatin1String("g++"); platformInfo.qtBinDir = platformInfo.toolchainDir; diff --git a/src/app/shared/specialplatformssetup.cpp b/src/app/shared/specialplatformssetup.cpp index 8b7afa829..5725a042a 100644 --- a/src/app/shared/specialplatformssetup.cpp +++ b/src/app/shared/specialplatformssetup.cpp @@ -149,7 +149,6 @@ void SpecialPlatformsSetup::registerProfile(const PlatformInfo &platformInfo) profile.setValue(QLatin1String("qbs.toolchain"), QStringList(QLatin1String("gcc"))); profile.setValue(QLatin1String("qbs.endianness"), QLatin1String("little")); profile.setValue(QLatin1String("qbs.targetOS"), platformInfo.targetOS); - profile.setValue(QLatin1String("qbs.targetPlatform"), platformInfo.targetPlatform); profile.setValue(QLatin1String("qbs.sysroot"), platformInfo.sysrootDir); profile.setValue(QLatin1String("cpp.toolchainInstallPath"), platformInfo.toolchainDir); diff --git a/src/app/shared/specialplatformssetup.h b/src/app/shared/specialplatformssetup.h index b26b903d0..047bfce36 100644 --- a/src/app/shared/specialplatformssetup.h +++ b/src/app/shared/specialplatformssetup.h @@ -52,8 +52,7 @@ public: { public: QString name; - QString targetOS; - QStringList targetPlatform; + QStringList targetOS; QString toolchainDir; QString compilerName; QStringList cFlags; diff --git a/src/lib/api/project.cpp b/src/lib/api/project.cpp index 2e2bfa916..f496f41e6 100644 --- a/src/lib/api/project.cpp +++ b/src/lib/api/project.cpp @@ -327,8 +327,9 @@ ProjectData Project::projectData() const static bool isExecutable(const PropertyMapPtr &properties, const FileTags &tags) { return tags.contains("application") - || (properties->qbsPropertyValue(QLatin1String("targetOS")) - == QLatin1String("osx") && tags.contains("applicationbundle")); + || (properties->qbsPropertyValue(QLatin1String("targetOS")).toStringList() + .contains(QLatin1String("osx")) + && tags.contains("applicationbundle")); } /*! diff --git a/src/lib/language/evaluatorscriptclass.cpp b/src/lib/language/evaluatorscriptclass.cpp index 1d037a0e5..a1717c5ca 100644 --- a/src/lib/language/evaluatorscriptclass.cpp +++ b/src/lib/language/evaluatorscriptclass.cpp @@ -371,19 +371,126 @@ QScriptValue EvaluatorScriptClass::js_getenv(QScriptContext *context, QScriptEng QScriptValue EvaluatorScriptClass::js_getHostOS(QScriptContext *context, QScriptEngine *engine) { Q_UNUSED(context); - QString hostSystem; - -#if defined(Q_OS_WIN) - hostSystem = "windows"; -#elif defined(Q_OS_DARWIN) - hostSystem = "osx"; -#elif defined(Q_OS_LINUX) - hostSystem = "linux"; -#elif defined(Q_OS_UNIX) - hostSystem = "unix"; -#else -# error unknown host platform + QStringList hostSystem; + +#if defined(Q_OS_AIX) + hostSystem << "aix"; +#endif +#if defined(Q_OS_ANDROID) + hostSystem << "android"; +#endif +#if defined(Q_OS_BLACKBERRY) + hostSystem << "blackberry"; +#endif +#if defined(Q_OS_BSD4) + hostSystem << "bsd" << "bsd4"; +#endif +#if defined(Q_OS_BSDI) + hostSystem << "bsdi"; +#endif +#if defined(Q_OS_CYGWIN) + hostSystem << "cygwin"; +#endif +#if defined(Q_OS_DARWIN) + hostSystem << "darwin"; +#endif +#if defined(Q_OS_DGUX) + hostSystem << "dgux"; +#endif +#if defined(Q_OS_DYNIX) + hostSystem << "dynix"; +#endif +#if defined(Q_OS_FREEBSD) + hostSystem << "freebsd"; +#endif +#if defined(Q_OS_HPUX) + hostSystem << "hpux"; +#endif +#if defined(Q_OS_HURD) + hostSystem << "hurd"; +#endif +#if defined(Q_OS_INTEGRITY) + hostSystem << "integrity"; +#endif +#if defined(Q_OS_IOS) + hostSystem << "ios"; +#endif +#if defined(Q_OS_IRIX) + hostSystem << "irix"; +#endif +#if defined(Q_OS_LINUX) + hostSystem << "linux"; +#endif +#if defined(Q_OS_LYNX) + hostSystem << "lynx"; +#endif +#if defined(Q_OS_MACX) + hostSystem << "osx"; +#endif +#if defined(Q_OS_MSDOS) + hostSystem << "msdos"; +#endif +#if defined(Q_OS_NACL) + hostSystem << "nacl"; #endif +#if defined(Q_OS_NETBSD) + hostSystem << "netbsd"; +#endif +#if defined(Q_OS_OPENBSD) + hostSystem << "openbsd"; +#endif +#if defined(Q_OS_OS2) + hostSystem << "os2"; +#endif +#if defined(Q_OS_OS2EMX) + hostSystem << "os2emx"; +#endif +#if defined(Q_OS_OSF) + hostSystem << "osf"; +#endif +#if defined(Q_OS_QNX) + hostSystem << "qnx"; +#endif +#if defined(Q_OS_ONX6) + hostSystem << "qnx6"; +#endif +#if defined(Q_OS_RELIANT) + hostSystem << "reliant"; +#endif +#if defined(Q_OS_SCO) + hostSystem << "sco"; +#endif +#if defined(Q_OS_SOLARIS) + hostSystem << "solaris"; +#endif +#if defined(Q_OS_SYMBIAN) + hostSystem << "symbian"; +#endif +#if defined(Q_OS_ULTRIX) + hostSystem << "ultrix"; +#endif +#if defined(Q_OS_UNIX) + hostSystem << "unix"; +#endif +#if defined(Q_OS_UNIXWARE) + hostSystem << "unixware"; +#endif +#if defined(Q_OS_VXWORKS) + hostSystem << "vxworks"; +#endif +#if defined(Q_OS_WIN32) + hostSystem << "windows"; +#endif +#if defined(Q_OS_WINCE) + hostSystem << "windowsce"; +#endif +#if defined(Q_OS_WINPHONE) + hostSystem << "windowsphone"; +#endif +#if defined(Q_OS_WINRT) + hostSystem << "windowsrt"; +#endif + return engine->toScriptValue(hostSystem); } diff --git a/src/lib/language/testdata/productconditions.qbs b/src/lib/language/testdata/productconditions.qbs index 7a6ccfd70..336c41340 100644 --- a/src/lib/language/testdata/productconditions.qbs +++ b/src/lib/language/testdata/productconditions.qbs @@ -14,6 +14,6 @@ Project { } Product { name: "product_condition_dependent_of_module" - condition: qbs.targetOS !== (qbs.targetOS + "foo") + condition: qbs.endianness !== (qbs.endianness + "foo") } } diff --git a/src/lib/lib.qbs b/src/lib/lib.qbs index 56f72d8f8..2401e0de5 100644 --- a/src/lib/lib.qbs +++ b/src/lib/lib.qbs @@ -5,8 +5,8 @@ DynamicLibrary { Depends { name: "Qt"; submodules: ["core", "script", "test"] } Depends { condition: Qt.core.versionMajor >= 5; name: "Qt.concurrent" } name: "qbscore" - targetName: (qbs.enableDebugCode && qbs.targetOS === "windows") ? (name + 'd') : name - destinationDirectory: qbs.targetOS == "windows" ? "bin" : "lib" + targetName: (qbs.enableDebugCode && qbs.targetOS.contains("windows")) ? (name + 'd') : name + destinationDirectory: qbs.targetOS.contains("windows") ? "bin" : "lib" cpp.treatWarningsAsErrors: true cpp.includePaths: [ ".", @@ -22,7 +22,7 @@ DynamicLibrary { cpp.cxxFlags: ["/WX"] } Properties { - condition: qbs.toolchain.contains("gcc") && qbs.targetPlatform.indexOf("windows") === -1 + condition: qbs.toolchain.contains("gcc") && !qbs.targetOS.contains("windows") cpp.cxxFlags: ["-Werror"] } property string headerInstallPrefix: "/include/qbs" @@ -291,7 +291,7 @@ DynamicLibrary { qbs.installDir: headerInstallPrefix + "/tools" } Group { - condition: qbs.targetPlatform.indexOf("windows") != -1 + condition: qbs.targetOS.contains("windows") name: "tools (Windows)" prefix: "tools/" files: [ @@ -299,7 +299,7 @@ DynamicLibrary { ] } Group { - condition: qbs.targetPlatform.indexOf("unix") != -1 + condition: qbs.targetOS.contains("unix") name: "tools (Unix)" prefix: "tools/" files: [ @@ -321,12 +321,12 @@ DynamicLibrary { Group { fileTagsFilter: "dynamiclibrary" qbs.install: true - qbs.installDir: qbs.targetOS === "windows" ? "bin" : "lib" + qbs.installDir: qbs.targetOS.contains("windows") ? "bin" : "lib" } Export { Depends { name: "cpp" } Depends { name: "Qt"; submodules: ["script"]} - cpp.rpaths: qbs.targetOS === "linux" ? ["$ORIGIN/../lib"] : undefined + cpp.rpaths: qbs.targetOS.contains("linux") ? ["$ORIGIN/../lib"] : undefined cpp.includePaths: path } } diff --git a/tests/auto/blackbox/testdata/codegen/codegen.qbs b/tests/auto/blackbox/testdata/codegen/codegen.qbs index 29a3df8c1..6fdcbbb46 100644 --- a/tests/auto/blackbox/testdata/codegen/codegen.qbs +++ b/tests/auto/blackbox/testdata/codegen/codegen.qbs @@ -3,7 +3,7 @@ import qbs.fileinfo as FileInfo Project { property string name: 'codegen' - property string osSpecificName: name.toUpperCase() + '_' + qbs.targetOS.toUpperCase() + property string osSpecificName: name.toUpperCase() + '_' + qbs.targetOS[0].toUpperCase() Product { type: 'application' @@ -41,7 +41,7 @@ Project { } // check whether we can access project properties here - var expected = "CODEGEN_" + product.moduleProperty("qbs", "targetOS").toUpperCase(); + var expected = "CODEGEN_" + product.moduleProperty("qbs", "targetOS")[0].toUpperCase(); if (project.osSpecificName !== expected) throw "Wrong project property value: " + project.osSpecificName + "\nexpected: " + expected; @@ -50,7 +50,7 @@ Project { code = expandMacros(code, product.replacements); var args = ['echo ' + code + '>' + output.fileName] var cmd - if (product.moduleProperty("qbs", "hostOS") == 'windows') { + if (product.moduleProperty("qbs", "hostOS").contains('windows')) { cmd = new Command('cmd.exe', ['/C'].concat(args)); } else { args[0] = args[0].replace(/\(/g, '\\(') diff --git a/tests/auto/blackbox/testdata/sameBaseName/sameBaseName.qbs b/tests/auto/blackbox/testdata/sameBaseName/sameBaseName.qbs index 6802be30b..e9b4ba7a6 100644 --- a/tests/auto/blackbox/testdata/sameBaseName/sameBaseName.qbs +++ b/tests/auto/blackbox/testdata/sameBaseName/sameBaseName.qbs @@ -17,7 +17,7 @@ Project { ] Group { - condition: qbs.targetPlatform.indexOf("darwin") !== -1 + condition: qbs.targetOS.contains("darwin") files: [ "lib.m", "lib.mm" @@ -26,7 +26,7 @@ Project { Export { Depends { name: "cpp" } - cpp.frameworks: qbs.targetPlatform.indexOf("darwin") !== -1 ? "Foundation" : undefined + cpp.frameworks: qbs.targetOS.contains("darwin") ? "Foundation" : undefined } } } diff --git a/tests/manual/CocoaApplication/CocoaApplication.qbs b/tests/manual/CocoaApplication/CocoaApplication.qbs index d6812f650..80113c794 100644 --- a/tests/manual/CocoaApplication/CocoaApplication.qbs +++ b/tests/manual/CocoaApplication/CocoaApplication.qbs @@ -1,7 +1,7 @@ import qbs 1.0 CppApplication { - condition: qbs.targetOS === "osx" + condition: qbs.targetOS.contains("osx") type: "applicationbundle" name: "CocoaApplication" diff --git a/tests/manual/configure/modules/definition/module.qbs b/tests/manual/configure/modules/definition/module.qbs index 71b8ecf21..729656e96 100644 --- a/tests/manual/configure/modules/definition/module.qbs +++ b/tests/manual/configure/modules/definition/module.qbs @@ -9,7 +9,7 @@ Module { configure: { var cmd; var args; - if (qbs.targetOS === "windows") { + if (qbs.targetOS.contains("windows")) { cmd = "cmd"; args = ["/c", "date", "/t"]; } else { diff --git a/tests/manual/minimumSystemVersion/minimumSystemVersion.qbs b/tests/manual/minimumSystemVersion/minimumSystemVersion.qbs index 1f3430b0b..ddf8114e9 100644 --- a/tests/manual/minimumSystemVersion/minimumSystemVersion.qbs +++ b/tests/manual/minimumSystemVersion/minimumSystemVersion.qbs @@ -9,7 +9,7 @@ Project { files: "main.cpp" Properties { - condition: qbs.targetPlatform.indexOf("darwin") !== -1 + condition: qbs.targetOS.contains("darwin") cpp.frameworks: "Foundation" } } @@ -27,7 +27,7 @@ Project { cpp.minimumAndroidVersion: undefined Properties { - condition: qbs.targetPlatform.indexOf("darwin") !== -1 + condition: qbs.targetOS.contains("darwin") cpp.frameworks: "Foundation" } } @@ -38,17 +38,17 @@ Project { CppApplication { type: "application" Depends { name: "Qt.core" } - condition: qbs.targetOS === "windows" || qbs.targetOS === "osx" + condition: qbs.targetOS.contains("windows") || qbs.targetOS.contains("osx") name: "specific" files: "main.cpp" Properties { - condition: qbs.targetOS === "windows" + condition: qbs.targetOS.contains("windows") cpp.minimumWindowsVersion: "6.0" } Properties { - condition: qbs.targetOS === "osx" + condition: qbs.targetOS.contains("osx") cpp.frameworks: "Foundation" cpp.minimumOsxVersion: "10.6" } @@ -60,7 +60,7 @@ Project { CppApplication { type: "application" Depends { name: "Qt.core" } - condition: qbs.targetOS === "windows" + condition: qbs.targetOS.contains("windows") name: "fakewindows" files: "main.cpp" cpp.minimumWindowsVersion: "5.3" @@ -72,7 +72,7 @@ Project { CppApplication { type: "application" Depends { name: "Qt.core" } - condition: qbs.targetOS === "osx" + condition: qbs.targetOS.contains("osx") name: "macappstore" files: "main.cpp" cpp.frameworks: "Foundation" diff --git a/tests/manual/objc/objc.qbs b/tests/manual/objc/objc.qbs index c74595596..b878097c4 100644 --- a/tests/manual/objc/objc.qbs +++ b/tests/manual/objc/objc.qbs @@ -2,7 +2,7 @@ import qbs 1.0 Project { CppApplication { - condition: qbs.targetOS === "osx" + condition: qbs.targetOS.contains("osx") Depends { name: "Qt.core" } files: "main.mm" cpp.frameworks: [ "Foundation" ] diff --git a/tests/manual/propertiesblocks/propertiesblocks.qbs b/tests/manual/propertiesblocks/propertiesblocks.qbs index f04762e69..5fe02a103 100644 --- a/tests/manual/propertiesblocks/propertiesblocks.qbs +++ b/tests/manual/propertiesblocks/propertiesblocks.qbs @@ -15,7 +15,7 @@ Product { } Properties { - condition: qbs.targetOS == "weird" + condition: qbs.targetOS.contains("weird") cpp.staticLibraries: "abc" } |