diff options
author | Jake Petroules <jake.petroules@petroules.com> | 2014-04-07 14:48:24 -0400 |
---|---|---|
committer | Jake Petroules <jake.petroules@petroules.com> | 2014-04-14 15:44:22 +0200 |
commit | 661de9d74ee8e74dbe85a5c52563094f63ee03c0 (patch) | |
tree | b992ccb3092d077617f8024ba22abaee5f13730f /share/qbs/modules/cpp | |
parent | 3adab080a030a841dcf096221a1317d951e08e4e (diff) |
Move several JS files in the cpp module to imports.
All of these files are generically useful and not specific to C++.
- BundleTools/DarwinTools are useful on OS X in general and are used by
both the C++ and Interface Builder modules.
PathTools also uses DarwinTools.
- PathTools is currently only used by the C++ module but contains
general filename functions that can be shared across multiple native
language modules, like C++, Go, etc.
- WindowsUtils contains functions general to the Windows OS.
These imports should not yet be documented as further refactoring is
necessary.
Change-Id: I503773af268eabf8a77ebfc8a5809b9ddcad7af2
Reviewed-by: Christian Kandeler <christian.kandeler@digia.com>
Diffstat (limited to 'share/qbs/modules/cpp')
-rw-r--r-- | share/qbs/modules/cpp/DarwinGCC.qbs | 6 | ||||
-rw-r--r-- | share/qbs/modules/cpp/GenericGCC.qbs | 2 | ||||
-rw-r--r-- | share/qbs/modules/cpp/bundle-tools.js | 330 | ||||
-rw-r--r-- | share/qbs/modules/cpp/darwin-tools.js | 115 | ||||
-rw-r--r-- | share/qbs/modules/cpp/gcc.js | 4 | ||||
-rw-r--r-- | share/qbs/modules/cpp/ios-gcc.qbs | 4 | ||||
-rw-r--r-- | share/qbs/modules/cpp/path-tools.js | 99 | ||||
-rw-r--r-- | share/qbs/modules/cpp/windows-mingw.qbs | 4 | ||||
-rw-r--r-- | share/qbs/modules/cpp/windows-msvc.qbs | 6 | ||||
-rw-r--r-- | share/qbs/modules/cpp/windows.js | 35 |
10 files changed, 13 insertions, 592 deletions
diff --git a/share/qbs/modules/cpp/DarwinGCC.qbs b/share/qbs/modules/cpp/DarwinGCC.qbs index 181e5902e..4f2149717 100644 --- a/share/qbs/modules/cpp/DarwinGCC.qbs +++ b/share/qbs/modules/cpp/DarwinGCC.qbs @@ -1,12 +1,12 @@ import qbs 1.0 +import qbs.BundleTools +import qbs.DarwinTools import qbs.File +import qbs.PathTools import qbs.Process import qbs.PropertyList import qbs.TextFile import qbs.ModUtils -import "bundle-tools.js" as BundleTools -import "darwin-tools.js" as DarwinTools -import 'path-tools.js' as PathTools UnixGCC { condition: false diff --git a/share/qbs/modules/cpp/GenericGCC.qbs b/share/qbs/modules/cpp/GenericGCC.qbs index 342a6b70c..dccadbde0 100644 --- a/share/qbs/modules/cpp/GenericGCC.qbs +++ b/share/qbs/modules/cpp/GenericGCC.qbs @@ -2,9 +2,9 @@ import qbs 1.0 import qbs.File import qbs.FileInfo import qbs.ModUtils +import qbs.PathTools import qbs.Process import 'gcc.js' as Gcc -import 'path-tools.js' as PathTools CppModule { condition: false diff --git a/share/qbs/modules/cpp/bundle-tools.js b/share/qbs/modules/cpp/bundle-tools.js deleted file mode 100644 index dca1b2c51..000000000 --- a/share/qbs/modules/cpp/bundle-tools.js +++ /dev/null @@ -1,330 +0,0 @@ -// NOTE: QBS and Xcode's "target" and "product" names are reversed - -var PropertyList = loadExtension("qbs.PropertyList"); - -function isBundleProduct(product) -{ - return product.type.contains("applicationbundle") - || product.type.contains("frameworkbundle") - || product.type.contains("bundle") - || product.type.contains("inapppurchase"); -} - -// Returns the package creator code for the given product based on its type -function packageType(product) -{ - if (product.type.contains("application") || product.type.contains("applicationbundle")) - return 'APPL'; - else if (product.type.contains("frameworkbundle")) - return 'FMWK'; - else if (product.type.contains("bundle")) - return 'BNDL'; - - throw ("Unsupported product type " + product.type + ". " - + "Must be in {application, applicationbundle, frameworkbundle, bundle}."); -} - -function infoPlistContents(infoPlistFilePath) -{ - if (infoPlistFilePath === undefined) - return undefined; - - var plist = new PropertyList(); - try { - plist.readFromFile(infoPlistFilePath); - return JSON.parse(plist.toJSONString()); - } finally { - plist.clear(); - } -} - -function infoPlistFormat(infoPlistFilePath) -{ - if (infoPlistFilePath === undefined) - return undefined; - - var plist = new PropertyList(); - try { - plist.readFromFile(infoPlistFilePath); - return plist.format(); - } finally { - plist.clear(); - } -} - -// CONTENTS_FOLDER_PATH -// Main bundle directory -// the version parameter is only used for framework bundles -function contentsFolderPath(product, version) -{ - var path = wrapperName(product); - - if (product.type.contains("frameworkbundle")) - path += "/Versions/" + (version || frameworkVersion(product)); - else if (!isShallowBundle(product)) - path += "/Contents"; - - return path; -} - -// DOCUMENTATION_FOLDER_PATH -// Directory for documentation files -// the version parameter is only used for framework bundles -function documentationFolderPath(product, localizationName, version) -{ - var path = localizedResourcesFolderPath(product, localizationName, version); - if (!product.type.contains("inapppurchase")) - path += "/Documentation"; - return path; -} - -// EXECUTABLES_FOLDER_PATH -// Destination directory for auxiliary executables -// the version parameter is only used for framework bundles -function executablesFolderPath(product, localizationName, version) -{ - if (product.type.contains("frameworkbundle")) - return localizedResourcesFolderPath(product, localizationName, version); - else - return _contentsFolderSubDirPath(product, "Executables", version); -} - -// EXECUTABLE_FOLDER_PATH -// Destination directory for the primary executable -// the version parameter is only used for framework bundles -function executableFolderPath(product, version) -{ - var path = contentsFolderPath(product, version); - if (!isShallowBundle(product) - && !product.type.contains("frameworkbundle") - && !product.type.contains("inapppurchase")) - path += "/MacOS"; - - return path; -} - -// EXECUTABLE_PATH -// Path to the bundle's primary executable file -// the version parameter is only used for framework bundles -function executablePath(product, version) -{ - return executableFolderPath(product, version) + "/" + productName(product); -} - -// FRAMEWORK_VERSION -// Major version number or letter corresponding to the bundle version -function frameworkVersion(product) -{ - if (!product.type.contains("frameworkbundle")) - throw "Product type must be a frameworkbundle, was " + product.type; - - var n = parseInt(product.version, 10); - return isNaN(n) ? 'A' : n; -} - -// FRAMEWORKS_FOLDER_PATH -// Directory containing frameworks used by the bundle's executables -// the version parameter is only used for framework bundles -function frameworksFolderPath(product, version) -{ - return _contentsFolderSubDirPath(product, "Frameworks", version); -} - -// INFOPLIST_PATH -// Path to the bundle's main information property list -// the version parameter is only used for framework bundles -function infoPlistPath(product, version) -{ - var path; - if (product.type.contains("application")) - path = ".tmp/" + product.name; - else if (product.type.contains("frameworkbundle")) - path = unlocalizedResourcesFolderPath(product, version); - else if (product.type.contains("inapppurchase")) - path = wrapperName(product); - else - path = contentsFolderPath(product, version); - - return path + "/" + _infoFileNames(product)[0]; -} - -// INFOSTRINGS_PATH -// Path to the strings file corresponding to the bundle's main information property list -// the version parameter is only used for framework bundles -function infoStringsPath(product, localizationName, version) -{ - return localizedResourcesFolderPath(product, localizationName, version) + "/" + _infoFileNames(product)[1]; -} - -// LOCALIZED_RESOURCES_FOLDER_PATH -// Path to the bundle's resources directory for the given localization -// the version parameter is only used for framework bundles -function localizedResourcesFolderPath(product, localizationName, version) -{ - if (typeof localizationName !== "string") - throw("'" + localizationName + "' is not a valid localization name"); - - return unlocalizedResourcesFolderPath(product, version) + "/" + localizationName + ".lproj"; -} - -// PKGINFO_PATH -// Path to the bundle's PkgInfo file -function pkgInfoPath(product) -{ - var path = (product.type.contains("frameworkbundle")) - ? wrapperName(product) - : contentsFolderPath(product); - return path + "/PkgInfo"; -} - -// PLUGINS_FOLDER_PATH -// Directory containing plugins used by the bundle's executables -// the version parameter is only used for framework bundles -function pluginsFolderPath(product, version) -{ - if (product.type.contains("frameworkbundle")) - return unlocalizedResourcesFolderPath(product, version); - - return _contentsFolderSubDirPath(product, "PlugIns", version); -} - -// PRIVATE_HEADERS_FOLDER_PATH -// Directory containing private header files for the framework -// the version parameter is only used for framework bundles -function privateHeadersFolderPath(product, version) -{ - return _contentsFolderSubDirPath(product, "PrivateHeaders", version); -} - -// PRODUCT_NAME -// The name of the product (in Xcode terms) which corresponds to the target name in QBS terms -function productName(product) -{ - return product.targetName; -} - -// PUBLIC_HEADERS_FOLDER_PATH -// Directory containing public header files for the framework -// the version parameter is only used for framework bundles -function publicHeadersFolderPath(product, version) -{ - return _contentsFolderSubDirPath(product, "Headers", version); -} - -// SCRIPTS_FOLDER_PATH -// Directory containing script files associated with the bundle -// the version parameter is only used for framework bundles -function scriptsFolderPath(product, version) -{ - return unlocalizedResourcesFolderPath(product, version) + "/Scripts"; -} - -// SHALLOW_BUNDLE -// Controls the presence or absence of the Contents, MacOS and Resources folders -// iOS tends to store the majority of files in its bundles in the main directory -function isShallowBundle(product) -{ - return product.moduleProperty("qbs", "targetOS").contains("ios") - && product.type.contains("applicationbundle"); -} - -// SHARED_FRAMEWORKS_FOLDER_PATH -// Directory containing sub-frameworks that may be shared with other applications -// the version parameter is only used for framework bundles -function sharedFrameworksFolderPath(product, version) -{ - return _contentsFolderSubDirPath(product, "SharedFrameworks", version); -} - -// SHARED_SUPPORT_FOLDER_PATH -// Directory containing supporting files that may be shared with other applications -// the version parameter is only used for framework bundles -function sharedSupportFolderPath(product, version) -{ - if (product.type.contains("frameworkbundle")) - return unlocalizedResourcesFolderPath(product, version); - - return _contentsFolderSubDirPath(product, "SharedSupport", version); -} - -// UNLOCALIZED_RESOURCES_FOLDER_PATH -// Directory containing resource files that are not specific to any given localization -function unlocalizedResourcesFolderPath(product, version) -{ - if (isShallowBundle(product)) - return contentsFolderPath(product, version); - - return _contentsFolderSubDirPath(product, "Resources", version); -} - -// VERSIONPLIST_PATH -// Directory containing the bundle's version.plist file -// the version parameter is only used for framework bundles -function versionPlistPath(product, version) -{ - var path = (product.type.contains("frameworkbundle")) - ? unlocalizedResourcesFolderPath(product, version) - : contentsFolderPath(product, version); - return path + "/version.plist"; -} - -// WRAPPER_EXTENSION -// The file extension of the bundle directory - app, framework, bundle, etc. -function wrapperExtension(product) -{ - if (product.type.contains("applicationbundle")) { - return "app"; - } else if (product.type.contains("frameworkbundle")) { - return "framework"; - } else if (product.type.contains("inapppurchase")) { - return ""; - } else if (product.type.contains("bundle")) { - // Potentially: kext, prefPane, qlgenerator, saver, mdimporter, or a custom extension - var bundleExtension = ModUtils.moduleProperty(product, "bundleExtension"); - - // default to bundle if none was specified by the user - return bundleExtension || "bundle"; - } else { - throw ("Unsupported bundle product type " + product.type + ". " - + "Must be in {applicationbundle, frameworkbundle, bundle, inapppurchase}."); - } -} - -// WRAPPER_NAME -// The name of the bundle directory - the product name plus the bundle extension -function wrapperName(product) -{ - return productName(product) + wrapperSuffix(product); -} - -// WRAPPER_SUFFIX -// The suffix of the bundle directory, that is, its extension prefixed with a '.', -// or an empty string if the extension is also an empty string -function wrapperSuffix(product) -{ - var ext = wrapperExtension(product); - return ext ? ("." + ext) : ""; -} - -// Private helper functions - -// In-App purchase content bundles use virtually no subfolders of Contents; -// this is a convenience method to avoid repeating that logic everywhere -// the version parameter is only used for framework bundles -function _contentsFolderSubDirPath(product, subdirectoryName, version) -{ - var path = contentsFolderPath(product, version); - if (!product.type.contains("inapppurchase")) - path += "/" + subdirectoryName; - return path; -} - -// Returns a list containing the filename of the bundle's main information -// property list and filename of the corresponding strings file -function _infoFileNames(product) -{ - if (product.type.contains("inapppurchase")) - return ["ContentInfo.plist", "ContentInfo.strings"]; - else - return ["Info.plist", "InfoPlist.strings"]; -} diff --git a/share/qbs/modules/cpp/darwin-tools.js b/share/qbs/modules/cpp/darwin-tools.js deleted file mode 100644 index ef99bc8ca..000000000 --- a/share/qbs/modules/cpp/darwin-tools.js +++ /dev/null @@ -1,115 +0,0 @@ -var FileInfo = loadExtension("qbs.FileInfo"); - -// replace chars non safe for a domain name (rfc1034) with a "-" -function rfc1034(inStr) -{ - return inStr.replace(/[^-A-Za-z0-9.]/g,'-'); -} - -// Returns the localization of a resource at the given path, -// or undefined if the path does not contain an {xx}.lproj path segment -function localizationKey(path) -{ - return _resourceFileProperties(path)[0]; -} - -// Returns the path of a localized resource at the given path, -// relative to its containing {xx}.lproj directory, or '.' -// if the resource is unlocalized (not contained in an lproj directory) -function relativeResourcePath(path) -{ - return _resourceFileProperties(path)[1]; -} - -function _resourceFileProperties(path) -{ - var lprojKey = ".lproj/"; - var lproj = path.indexOf(lprojKey); - if (lproj >= 0) { - // The slash preceding XX.lproj - var slashIndex = path.slice(0, lproj).lastIndexOf('/'); - if (slashIndex >= 0) { - var localizationKey = path.slice(slashIndex + 1, lproj); - var relativeResourcePath = FileInfo.path(path.slice(lproj + lprojKey.length)); - return [ localizationKey, relativeResourcePath ]; - } - } - - return [ undefined, '.' ]; -} - -// perform replacements in env recursively -// JSON.stringify(expandPlistEnvironmentVariables({a:"$(x)3$$(y)",b:{t:"%$(y) $(k)"}}, -// {x:"X",y:"Y"}, true)) -// Warning undefined variable k in variable expansion -// => {"a":"X3$Y","b":{"t":"%Y $(k)"}} -function expandPlistEnvironmentVariables(obj, env, warn) -{ - // Possible syntaxes for wrapping an environment variable name - var syntaxes = [ - {"open": "${", "close": "}"}, - {"open": "$(", "close": ")"}, - {"open": "@", "close": "@"} - ]; - - // Finds the first index of a replacement starting with one of the supported syntaxes - // This is needed so we don't do recursive substitutions - function indexOfReplacementStart(syntaxes, str, offset) { - var syntax; - var idx = str.length; - for (var i in syntaxes) { - var j = str.indexOf(syntaxes[i].open, offset); - if (j !== -1 && j < idx) { - syntax = syntaxes[i]; - idx = j; - } - } - return { "syntax": syntax, "index": idx === str.length ? -1 : idx }; - } - - function expandRecursive(obj, env, checked) { - checked.push(obj); - for (var key in obj) { - var value =obj[key]; - var type = typeof(value); - if (type === "object") { - if (checked.indexOf(value) !== -1) - continue; - expandRecursive(value, env, checked); - } - if (type !== "string") - continue; - var repl = indexOfReplacementStart(syntaxes, value); - var i = repl.index; - var changes = false; - while (i !== -1) { - var j = value.indexOf(repl.syntax.close, i + repl.syntax.open.length); - if (j === -1) - break; - var varParts = value.slice(i + repl.syntax.open.length, j).split(':'); - var varName = varParts[0]; - var varFormatter = varParts[1]; - var varValue = env[varName]; - if (undefined === varValue) { - // skip replacement - if (warn) - print("Warning undefined variable ",varName, " in variable expansion"); - } else { - changes = true; - varValue = String(varValue); - if (varFormatter === "rfc1034identifier") - varValue = rfc1034(varValue); - value = value.slice(0, i) + varValue + value.slice(j + repl.syntax.close.length); - // avoid recursive substitutions to avoid potentially infinite loops - i += varValue.length; - } - repl = indexOfReplacementStart(syntaxes, value, i + repl.syntax.close.length); - i = repl.index; - } - if (changes) - obj[key] = value; - } - } - expandRecursive(obj, env, []); - return obj; -} diff --git a/share/qbs/modules/cpp/gcc.js b/share/qbs/modules/cpp/gcc.js index 6fd5c49de..96488d930 100644 --- a/share/qbs/modules/cpp/gcc.js +++ b/share/qbs/modules/cpp/gcc.js @@ -1,4 +1,4 @@ -var Windows = loadFile("windows.js"); +var WindowsUtils = loadExtension("qbs.WindowsUtils"); function linkerFlags(product, inputs) { @@ -212,7 +212,7 @@ function additionalCompilerFlags(product, input, output) var minimumWindowsVersion = ModUtils.moduleProperty(product, "minimumWindowsVersion"); if (minimumWindowsVersion && product.moduleProperty("qbs", "targetOS").contains("windows")) { - var hexVersion = Windows.getWindowsVersionInFormat(minimumWindowsVersion, 'hex'); + var hexVersion = WindowsUtils.getWindowsVersionInFormat(minimumWindowsVersion, 'hex'); if (hexVersion) { var versionDefs = [ 'WINVER', '_WIN32_WINNT', '_WIN32_WINDOWS' ]; for (i in versionDefs) diff --git a/share/qbs/modules/cpp/ios-gcc.qbs b/share/qbs/modules/cpp/ios-gcc.qbs index fae3a21fa..aeb1ad767 100644 --- a/share/qbs/modules/cpp/ios-gcc.qbs +++ b/share/qbs/modules/cpp/ios-gcc.qbs @@ -1,8 +1,8 @@ import qbs 1.0 +import qbs.BundleTools +import qbs.DarwinTools import qbs.File import qbs.ModUtils -import 'darwin-tools.js' as DarwinTools -import 'bundle-tools.js' as BundleTools DarwinGCC { condition: qbs.hostOS.contains('osx') && qbs.targetOS.contains('ios') && qbs.toolchain.contains('gcc') diff --git a/share/qbs/modules/cpp/path-tools.js b/share/qbs/modules/cpp/path-tools.js deleted file mode 100644 index 17df91af5..000000000 --- a/share/qbs/modules/cpp/path-tools.js +++ /dev/null @@ -1,99 +0,0 @@ -var BundleTools = loadFile("bundle-tools.js"); - -function applicationFileName() -{ - return ModUtils.moduleProperty(product, "executablePrefix") - + product.targetName - + ModUtils.moduleProperty(product, "executableSuffix"); -} - -function applicationFilePath() -{ - if (BundleTools.isBundleProduct(product)) - return BundleTools.executablePath(product); - else - return applicationFileName(); -} - -function staticLibraryFileName() -{ - return ModUtils.moduleProperty(product, "staticLibraryPrefix") - + product.targetName - + ModUtils.moduleProperty(product, "staticLibrarySuffix"); -} - -function staticLibraryFilePath() -{ - if (BundleTools.isBundleProduct(product)) - return BundleTools.executablePath(product); - else - return staticLibraryFileName(); -} - -function dynamicLibraryFileName(version, maxParts) -{ - // If no override version was given, use the product's version - // We specifically want to differentiate between undefined and i.e. - // empty string as empty string should be taken to mean "no version" - // and undefined should be taken to mean "use the product's version" - // (which could still end up being "no version") - if (version === undefined) - version = product.moduleProperty("cpp", "internalVersion"); - - // If we have a version number, potentially strip off some components - maxParts = parseInt(maxParts, 10); - if (maxParts === 0) - version = undefined; - else if (maxParts && version) - version = version.split('.').slice(0, maxParts).join('.'); - - // Start with prefix + name (i.e. libqbs, qbs) - 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) - var targetOS = product.moduleProperty("qbs", "targetOS"); - if (version && targetOS.contains("darwin")) { - fileName += "." + version; - version = undefined; - } - - // Append the suffix (i.e. libqbs.1.0.0.dylib, libqbs.so, qbs.dll) - 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 && targetOS.contains("unix") && !targetOS.contains("darwin")) - fileName += "." + version; - - return fileName; -} - -function dynamicLibraryFilePath(version, maxParts) -{ - if (BundleTools.isBundleProduct(product)) - return BundleTools.executablePath(product, version); - else - return dynamicLibraryFileName(version, maxParts); -} - -function importLibraryFilePath() -{ - return ModUtils.moduleProperty(product, "dynamicLibraryPrefix") - + product.targetName - + ModUtils.moduleProperty(product, "dynamicLibraryImportSuffix"); -} - -// DWARF_DSYM_FILE_NAME -// Filename of the target's corresponding dSYM file -function dwarfDsymFileName() -{ - if (BundleTools.isBundleProduct(product)) - return BundleTools.wrapperName(product) + ".dSYM"; - else if (product.type.contains("application")) - return applicationFileName() + ".dSYM"; - else if (product.type.contains("dynamiclibrary")) - return dynamicLibraryFileName() + ".dSYM"; - else if (product.type.contains("staticlibrary")) - return staticLibraryFileName() + ".dSYM"; - else - return product.targetName + ".dSYM"; -} diff --git a/share/qbs/modules/cpp/windows-mingw.qbs b/share/qbs/modules/cpp/windows-mingw.qbs index 5e6fb40ae..6c0fdeeea 100644 --- a/share/qbs/modules/cpp/windows-mingw.qbs +++ b/share/qbs/modules/cpp/windows-mingw.qbs @@ -1,7 +1,7 @@ import qbs 1.0 import qbs.FileInfo import qbs.ModUtils -import "windows.js" as Windows +import qbs.WindowsUtils GenericGCC { condition: qbs.targetOS.contains("windows") && qbs.toolchain.contains("mingw") @@ -13,7 +13,7 @@ GenericGCC { dynamicLibrarySuffix: ".dll" executableSuffix: ".exe" windowsApiCharacterSet: "unicode" - platformDefines: base.concat(Windows.characterSetDefines(windowsApiCharacterSet)) + platformDefines: base.concat(WindowsUtils.characterSetDefines(windowsApiCharacterSet)) compilerDefines: ['__GNUC__', 'WIN32', '_WIN32'] property string windresName: 'windres' diff --git a/share/qbs/modules/cpp/windows-msvc.qbs b/share/qbs/modules/cpp/windows-msvc.qbs index 1896eb14c..60137f4f5 100644 --- a/share/qbs/modules/cpp/windows-msvc.qbs +++ b/share/qbs/modules/cpp/windows-msvc.qbs @@ -2,9 +2,9 @@ import qbs 1.0 import qbs.File import qbs.FileInfo import qbs.ModUtils -import 'windows.js' as Windows +import qbs.PathTools +import qbs.WindowsUtils import 'msvc.js' as MSVC -import 'path-tools.js' as PathTools CppModule { condition: qbs.hostOS.contains('windows') && qbs.targetOS.contains('windows') && qbs.toolchain.contains('msvc') @@ -12,7 +12,7 @@ CppModule { id: module windowsApiCharacterSet: "unicode" - platformDefines: base.concat(Windows.characterSetDefines(windowsApiCharacterSet)) + platformDefines: base.concat(WindowsUtils.characterSetDefines(windowsApiCharacterSet)) compilerDefines: ['_WIN32'] warningLevel: "default" compilerName: "cl.exe" diff --git a/share/qbs/modules/cpp/windows.js b/share/qbs/modules/cpp/windows.js deleted file mode 100644 index 35414eed7..000000000 --- a/share/qbs/modules/cpp/windows.js +++ /dev/null @@ -1,35 +0,0 @@ -function characterSetDefines(charset) { - var defines = []; - if (charset === "unicode") - defines.push("UNICODE", "_UNICODE"); - else if (charset === "mbcs") - defines.push("_MBCS"); - return defines; -} - -function isValidWindowsVersion(systemVersion) { - // Add new Windows versions to this list when they are released - var realVersions = [ '6.3', '6.2', '6.1', '6.0', '5.2', '5.1', '5.0', '4.0' ]; - for (i in realVersions) - if (systemVersion === realVersions[i]) - return true; - - return false; -} - -function getWindowsVersionInFormat(systemVersion, format) { - if (!isValidWindowsVersion(systemVersion)) - return undefined; - - var major = parseInt(systemVersion.split('.')[0]); - var minor = parseInt(systemVersion.split('.')[1]); - - if (format === 'hex') { - return '0x' + major + (minor < 10 ? '0' : '') + minor; - } else if (format === 'subsystem') { - // http://msdn.microsoft.com/en-us/library/fcc1zstk.aspx - return major + '.' + (minor < 10 ? '0' : '') + minor; - } else { - throw ("Unrecognized Windows version format " + format + ". Must be in {hex, subsystem}."); - } -} |