From 84cb6550694a73f567a3aeccede7dfe62d330de6 Mon Sep 17 00:00:00 2001 From: Jason Perkins Date: Fri, 8 Jan 2016 06:52:47 -0500 Subject: [PATCH] Add missing Unicode/MBCS defines to MSC command line Note that the defines are showing up in CFLAGS rather than DEFINES. The tool adapter API needs to be modified before they can be placed in the defines list where they should be. --- src/_premake_init.lua | 1 + src/tools/msc.lua | 5 +++++ tests/tools/test_msc.lua | 23 +++++++++++++++++++++++ 3 files changed, 29 insertions(+) diff --git a/src/_premake_init.lua b/src/_premake_init.lua index 503d7356..a650b293 100644 --- a/src/_premake_init.lua +++ b/src/_premake_init.lua @@ -1364,6 +1364,7 @@ -- ----------------------------------------------------------------------------- + characterset "Default" clr "Off" editorintegration "Off" exceptionhandling "Default" diff --git a/src/tools/msc.lua b/src/tools/msc.lua index 113b827b..1f79c7e2 100644 --- a/src/tools/msc.lua +++ b/src/tools/msc.lua @@ -29,6 +29,11 @@ -- msc.cflags = { + characterset = { + Default = { '/D"_UNICODE"', '/D"UNICODE"' }, + MBCS = '/D"_MBCS"', + Unicode = { '/D"_UNICODE"', '/D"UNICODE"' }, + }, clr = { On = "/clr", Unsafe = "/clr", diff --git a/tests/tools/test_msc.lua b/tests/tools/test_msc.lua index e7f73ac0..9d9e925b 100644 --- a/tests/tools/test_msc.lua +++ b/tests/tools/test_msc.lua @@ -311,6 +311,28 @@ end +-- +-- Check handling of character set switches +-- + + function suite.cflags_onCharSetDefault() + prepare() + test.contains('/D"_UNICODE"', msc.getcflags(cfg)) + end + + function suite.cflags_onCharSetUnicode() + characterset "Unicode" + prepare() + test.contains('/D"_UNICODE"', msc.getcflags(cfg)) + end + + function suite.cflags_onCharSetMBCS() + characterset "MBCS" + prepare() + test.contains('/D"_MBCS"', msc.getcflags(cfg)) + end + + -- -- Check handling of system search paths. -- @@ -342,3 +364,4 @@ prepare() test.contains('/NODEFAULTLIB:lib1.lib', msc.getldflags(cfg)) end +