aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJake Petroules <jake.petroules@petroules.com>2013-06-24 08:59:30 -0400
committerJoerg Bornemann <joerg.bornemann@digia.com>2013-06-26 18:00:23 +0200
commit35087f946e10af028cdcb96fb8be180783ea3307 (patch)
tree730f1547981fd409033d9f869e39b8df2e930756
parent8fa6b40c272d5f10dde2f303d5a6f30893cc6df1 (diff)
Add support for setting the compiler character set.
Task-number: QBS-332 Change-Id: I7dda39be44c307071225c47de7141aec3e259f01 Reviewed-by: Joerg Bornemann <joerg.bornemann@digia.com>
-rw-r--r--doc/qbs.qdoc12
-rw-r--r--share/qbs/modules/cpp/CppModule.qbs2
-rw-r--r--share/qbs/modules/cpp/windows-mingw.qbs4
-rw-r--r--share/qbs/modules/cpp/windows-msvc.qbs3
-rw-r--r--share/qbs/modules/cpp/windows.js9
5 files changed, 28 insertions, 2 deletions
diff --git a/doc/qbs.qdoc b/doc/qbs.qdoc
index ef3f5529a..e8735e0c1 100644
--- a/doc/qbs.qdoc
+++ b/doc/qbs.qdoc
@@ -1409,6 +1409,18 @@
\section1 Properties Specific to Windows
+ \section2 windowsApiCharacterSet
+
+ \table
+ \row \li \b{Type:} \li \c{string}
+ \row \li \b{Allowed Values:} \li \c{"unicode"}, \c{"mbcs"}, \c{undefined}
+ \row \li \b{Default:} \li \c{"unicode"}
+ \endtable
+
+ Specifies the character set used in the Win32 API. "unicode" will define the
+ preprocessor symbols UNICODE and _UNICODE, "mbcs" will define _MBCS, and
+ setting the value to undefined will use the default character set.
+
\section2 minimumWindowsVersion
\table
diff --git a/share/qbs/modules/cpp/CppModule.qbs b/share/qbs/modules/cpp/CppModule.qbs
index 56e46de69..d088d4060 100644
--- a/share/qbs/modules/cpp/CppModule.qbs
+++ b/share/qbs/modules/cpp/CppModule.qbs
@@ -20,6 +20,8 @@ Module {
description: "preprocessor macros that are defined when using this particular compiler"
}
+ property string windowsApiCharacterSet
+
property string minimumWindowsVersion
PropertyOptions {
name: "minimumWindowsVersion"
diff --git a/share/qbs/modules/cpp/windows-mingw.qbs b/share/qbs/modules/cpp/windows-mingw.qbs
index 78ca21453..dc4347264 100644
--- a/share/qbs/modules/cpp/windows-mingw.qbs
+++ b/share/qbs/modules/cpp/windows-mingw.qbs
@@ -1,6 +1,7 @@
import qbs 1.0
import qbs.fileinfo as FileInfo
import '../utils.js' as ModUtils
+import "windows.js" as Windows
GenericGCC {
condition: qbs.targetOS.contains("windows") && qbs.toolchain.contains("mingw")
@@ -10,7 +11,8 @@ GenericGCC {
staticLibrarySuffix: ".a"
dynamicLibrarySuffix: ".dll"
executableSuffix: ".exe"
- platformDefines: base.concat(['UNICODE'])
+ windowsApiCharacterSet: "unicode"
+ platformDefines: base.concat(Windows.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 4895d2ced..68ced1a45 100644
--- a/share/qbs/modules/cpp/windows-msvc.qbs
+++ b/share/qbs/modules/cpp/windows-msvc.qbs
@@ -11,7 +11,8 @@ CppModule {
id: module
- platformDefines: base.concat(['UNICODE'])
+ windowsApiCharacterSet: "unicode"
+ platformDefines: base.concat(Windows.characterSetDefines(windowsApiCharacterSet))
compilerDefines: ['_WIN32']
warningLevel: "default"
diff --git a/share/qbs/modules/cpp/windows.js b/share/qbs/modules/cpp/windows.js
index 710b9f304..ac33d45de 100644
--- a/share/qbs/modules/cpp/windows.js
+++ b/share/qbs/modules/cpp/windows.js
@@ -1,3 +1,12 @@
+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.2', '6.1', '6.0', '5.2', '5.1', '5.0', '4.0' ];