Merge branch 'systemversion' of https://github.com/redorav/premake-core into systemversion
This commit is contained in:
commit
61dae7b235
@ -234,3 +234,29 @@ cmd2</StartupCommands>
|
||||
</Completion>
|
||||
]]
|
||||
end
|
||||
|
||||
|
||||
---------------------------------------------------------------------------
|
||||
-- Setup/Teardown
|
||||
---------------------------------------------------------------------------
|
||||
|
||||
function suite.OnProjectCfg_UnsignedCharOn()
|
||||
unsignedchar "On"
|
||||
prepare()
|
||||
codelite.project.compiler(cfg)
|
||||
test.capture [[
|
||||
<Compiler Options="-funsigned-char" C_Options="-funsigned-char" Assembler="" Required="yes" PreCompiledHeader="" PCHInCommandLine="no" UseDifferentPCHFlags="no" PCHFlags="">
|
||||
</Compiler>
|
||||
]]
|
||||
end
|
||||
|
||||
|
||||
function suite.OnProjectCfg_UnsignedCharOff()
|
||||
unsignedchar "Off"
|
||||
prepare()
|
||||
codelite.project.compiler(cfg)
|
||||
test.capture [[
|
||||
<Compiler Options="-fno-unsigned-char" C_Options="-fno-unsigned-char" Assembler="" Required="yes" PreCompiledHeader="" PCHInCommandLine="no" UseDifferentPCHFlags="no" PCHFlags="">
|
||||
</Compiler>
|
||||
]]
|
||||
end
|
||||
|
@ -116,6 +116,17 @@
|
||||
tokens = true,
|
||||
}
|
||||
|
||||
p.api.register {
|
||||
name = "debuggerflavor",
|
||||
scope = "config",
|
||||
kind = "string",
|
||||
allowed = {
|
||||
"Local",
|
||||
"Remote",
|
||||
"WebBrowser",
|
||||
"WebService"
|
||||
}
|
||||
}
|
||||
|
||||
--
|
||||
-- Decide when the full module should be loaded.
|
||||
|
@ -1238,3 +1238,49 @@
|
||||
</ClCompile>
|
||||
]]
|
||||
end
|
||||
|
||||
--
|
||||
-- Check UnsignedChar.
|
||||
--
|
||||
|
||||
function suite.unsignedChar_On()
|
||||
unsignedchar "On"
|
||||
prepare()
|
||||
test.capture [[
|
||||
<ClCompile>
|
||||
<PrecompiledHeader>NotUsing</PrecompiledHeader>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<Optimization>Disabled</Optimization>
|
||||
<AdditionalOptions>/J %(AdditionalOptions)</AdditionalOptions>
|
||||
</ClCompile>
|
||||
]]
|
||||
end
|
||||
|
||||
function suite.unsignedChar_Off()
|
||||
unsignedchar "Off"
|
||||
prepare()
|
||||
test.capture [[
|
||||
<ClCompile>
|
||||
<PrecompiledHeader>NotUsing</PrecompiledHeader>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<Optimization>Disabled</Optimization>
|
||||
</ClCompile>
|
||||
]]
|
||||
end
|
||||
|
||||
--
|
||||
-- Check StructMemberAlignment
|
||||
--
|
||||
|
||||
function suite.structMemberAlignment()
|
||||
structmemberalign(1)
|
||||
prepare()
|
||||
test.capture [[
|
||||
<ClCompile>
|
||||
<PrecompiledHeader>NotUsing</PrecompiledHeader>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<Optimization>Disabled</Optimization>
|
||||
<StructMemberAlignment>1Byte</StructMemberAlignment>
|
||||
</ClCompile>
|
||||
]]
|
||||
end
|
||||
|
@ -101,3 +101,22 @@ foo=bar</LocalDebuggerEnvironment>
|
||||
]]
|
||||
end
|
||||
|
||||
--
|
||||
-- Test Debugger Flavor
|
||||
--
|
||||
|
||||
function suite.debuggerFlavor_OnWindowsLocal()
|
||||
debuggerflavor "Local"
|
||||
prepare()
|
||||
test.capture [[
|
||||
<DebuggerFlavor>WindowsLocalDebugger</DebuggerFlavor>
|
||||
]]
|
||||
end
|
||||
|
||||
function suite.debuggerFlavor_OnWindowsRemote()
|
||||
debuggerflavor "Remote"
|
||||
prepare()
|
||||
test.capture [[
|
||||
<DebuggerFlavor>WindowsRemoteDebugger</DebuggerFlavor>
|
||||
]]
|
||||
end
|
||||
|
@ -458,7 +458,7 @@
|
||||
|
||||
p.w('<WriteLinesToFile')
|
||||
p.w(' Condition="\'@(%s_tlog)\' != \'\' and \'%%(%s_tlog.ExcludedFromBuild)\' != \'true\'"', r.name, r.name)
|
||||
p.w(' File="$(IntDir)$(ProjectName).read.1.tlog"')
|
||||
p.w(' File="$(TLogLocation)%s.read.1.tlog"', r.name)
|
||||
p.w(' Lines="^%%(%s_tlog.Inputs);%s$(MSBuildProjectFullPath);%%(%s_tlog.Fullpath)" />', r.name, extra, r.name)
|
||||
end
|
||||
|
||||
@ -467,7 +467,7 @@
|
||||
function m.tlogWrite(r)
|
||||
p.w('<WriteLinesToFile')
|
||||
p.w(' Condition="\'@(%s_tlog)\' != \'\' and \'%%(%s_tlog.ExcludedFromBuild)\' != \'true\'"', r.name, r.name)
|
||||
p.w(' File="$(IntDir)$(ProjectName).write.1.tlog"')
|
||||
p.w(' File="$(TLogLocation)%s.write.1.tlog"', r.name)
|
||||
p.w(' Lines="^%%(%s_tlog.Source);%%(%s_tlog.Fullpath)" />', r.name, r.name)
|
||||
end
|
||||
|
||||
|
@ -376,6 +376,7 @@
|
||||
m.compileAs,
|
||||
m.callingConvention,
|
||||
m.languageStandard,
|
||||
m.structMemberAlignment,
|
||||
}
|
||||
|
||||
if cfg.kind == p.STATICLIB then
|
||||
@ -1373,6 +1374,20 @@
|
||||
end
|
||||
end
|
||||
|
||||
function m.structMemberAlignment(cfg)
|
||||
local map = {
|
||||
[1] = "1Byte",
|
||||
[2] = "2Bytes",
|
||||
[4] = "4Bytes",
|
||||
[8] = "8Bytes",
|
||||
[16] = "16Bytes"
|
||||
}
|
||||
|
||||
local value = map[cfg.structmemberalign]
|
||||
if value then
|
||||
m.element("StructMemberAlignment", nil, value)
|
||||
end
|
||||
end
|
||||
|
||||
function m.additionalCompileOptions(cfg, condition)
|
||||
local opts = cfg.buildoptions
|
||||
@ -1383,6 +1398,12 @@
|
||||
table.insert(opts, "/std:c++latest")
|
||||
end
|
||||
end
|
||||
|
||||
if cfg.toolset and cfg.toolset:startswith("msc") then
|
||||
local value = iif(cfg.unsignedchar, "On", "Off")
|
||||
table.insert(opts, p.tools.msc.shared.unsignedchar[value])
|
||||
end
|
||||
|
||||
if #opts > 0 then
|
||||
opts = table.concat(opts, " ")
|
||||
m.element("AdditionalOptions", condition, '%s %%(AdditionalOptions)', opts)
|
||||
|
@ -79,7 +79,17 @@
|
||||
|
||||
|
||||
function m.debuggerFlavor(cfg)
|
||||
if cfg.debugdir or cfg.debugcommand then
|
||||
local map = {
|
||||
Local = "WindowsLocalDebugger",
|
||||
Remote = "WindowsRemoteDebugger",
|
||||
WebBrowser = "WebBrowserDebugger",
|
||||
WebService = "WebServiceDebugger"
|
||||
}
|
||||
|
||||
local value = map[cfg.debuggerflavor]
|
||||
if value then
|
||||
p.w('<DebuggerFlavor>%s</DebuggerFlavor>', value)
|
||||
elseif cfg.debugdir or cfg.debugcommand then
|
||||
p.w('<DebuggerFlavor>WindowsLocalDebugger</DebuggerFlavor>')
|
||||
end
|
||||
end
|
||||
|
@ -2486,6 +2486,58 @@
|
||||
]]
|
||||
end
|
||||
|
||||
function suite.XCBuildConfigurationProject_OnUnsignedCharOn()
|
||||
workspace("MyWorkspace")
|
||||
unsignedchar "On"
|
||||
prepare()
|
||||
xcode.XCBuildConfiguration_Project(tr, tr.configs[1])
|
||||
test.capture [[
|
||||
[MyProject:Debug(2)] /* Debug */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
ARCHS = "$(NATIVE_ARCH_ACTUAL)";
|
||||
CONFIGURATION_BUILD_DIR = "$(SYMROOT)";
|
||||
CONFIGURATION_TEMP_DIR = "$(OBJROOT)";
|
||||
GCC_CHAR_IS_UNSIGNED_CHAR = YES;
|
||||
GCC_OPTIMIZATION_LEVEL = 0;
|
||||
GCC_SYMBOLS_PRIVATE_EXTERN = NO;
|
||||
GCC_WARN_ABOUT_RETURN_TYPE = YES;
|
||||
GCC_WARN_UNUSED_VARIABLE = YES;
|
||||
OBJROOT = obj/Debug;
|
||||
ONLY_ACTIVE_ARCH = NO;
|
||||
SYMROOT = bin/Debug;
|
||||
};
|
||||
name = Debug;
|
||||
};
|
||||
]]
|
||||
end
|
||||
|
||||
function suite.XCBuildConfigurationProject_OnUnsignedCharOff()
|
||||
workspace("MyWorkspace")
|
||||
unsignedchar "Off"
|
||||
prepare()
|
||||
xcode.XCBuildConfiguration_Project(tr, tr.configs[1])
|
||||
test.capture [[
|
||||
[MyProject:Debug(2)] /* Debug */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
ARCHS = "$(NATIVE_ARCH_ACTUAL)";
|
||||
CONFIGURATION_BUILD_DIR = "$(SYMROOT)";
|
||||
CONFIGURATION_TEMP_DIR = "$(OBJROOT)";
|
||||
GCC_CHAR_IS_UNSIGNED_CHAR = NO;
|
||||
GCC_OPTIMIZATION_LEVEL = 0;
|
||||
GCC_SYMBOLS_PRIVATE_EXTERN = NO;
|
||||
GCC_WARN_ABOUT_RETURN_TYPE = YES;
|
||||
GCC_WARN_UNUSED_VARIABLE = YES;
|
||||
OBJROOT = obj/Debug;
|
||||
ONLY_ACTIVE_ARCH = NO;
|
||||
SYMROOT = bin/Debug;
|
||||
};
|
||||
name = Debug;
|
||||
};
|
||||
]]
|
||||
end
|
||||
|
||||
---------------------------------------------------------------------------
|
||||
-- XCBuildConfigurationList tests
|
||||
---------------------------------------------------------------------------
|
||||
|
@ -1100,6 +1100,10 @@
|
||||
|
||||
settings["GCC_SYMBOLS_PRIVATE_EXTERN"] = 'NO'
|
||||
|
||||
if cfg.unsignedchar ~= nil then
|
||||
settings['GCC_CHAR_IS_UNSIGNED_CHAR'] = iif(cfg.unsignedchar, "YES", "NO")
|
||||
end
|
||||
|
||||
if cfg.flags.FatalWarnings then
|
||||
settings['GCC_TREAT_WARNINGS_AS_ERRORS'] = 'YES'
|
||||
end
|
||||
|
@ -1336,6 +1336,25 @@
|
||||
}
|
||||
}
|
||||
|
||||
api.register {
|
||||
name = "unsignedchar",
|
||||
scope = "config",
|
||||
kind = "boolean",
|
||||
}
|
||||
|
||||
p.api.register {
|
||||
name = "structmemberalign",
|
||||
scope = "config",
|
||||
kind = "integer",
|
||||
allowed = {
|
||||
"1",
|
||||
"2",
|
||||
"4",
|
||||
"8",
|
||||
"16",
|
||||
}
|
||||
}
|
||||
|
||||
-----------------------------------------------------------------------------
|
||||
--
|
||||
-- Field name aliases for backward compatibility
|
||||
|
@ -61,7 +61,8 @@
|
||||
vectorextensions = gcc.shared.vectorextensions,
|
||||
isaextensions = gcc.shared.isaextensions,
|
||||
warnings = gcc.shared.warnings,
|
||||
symbols = gcc.shared.symbols
|
||||
symbols = gcc.shared.symbols,
|
||||
unsignedchar = gcc.shared.unsignedchar
|
||||
}
|
||||
|
||||
clang.cflags = table.merge(gcc.cflags, {
|
||||
|
@ -96,6 +96,10 @@
|
||||
},
|
||||
symbols = {
|
||||
On = "-g"
|
||||
},
|
||||
unsignedchar = {
|
||||
On = "-funsigned-char",
|
||||
Off = "-fno-unsigned-char"
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -99,7 +99,11 @@
|
||||
},
|
||||
symbols = {
|
||||
On = "/Z7"
|
||||
},
|
||||
unsignedchar = {
|
||||
On = "/J",
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
msc.cflags = {
|
||||
|
@ -788,3 +788,23 @@
|
||||
test.contains({ "-std=gnu++17" }, gcc.getcxxflags(cfg))
|
||||
test.contains({ }, gcc.getcflags(cfg))
|
||||
end
|
||||
|
||||
--
|
||||
-- Test unsigned-char flags.
|
||||
--
|
||||
|
||||
function suite.sharedflags_onUnsignedChar()
|
||||
unsignedchar "On"
|
||||
|
||||
prepare()
|
||||
test.contains({ "-funsigned-char" }, gcc.getcxxflags(cfg))
|
||||
test.contains({ "-funsigned-char" }, gcc.getcflags(cfg))
|
||||
end
|
||||
|
||||
function suite.sharedflags_onNoUnsignedChar()
|
||||
unsignedchar "Off"
|
||||
|
||||
prepare()
|
||||
test.contains({ "-fno-unsigned-char" }, gcc.getcxxflags(cfg))
|
||||
test.contains({ "-fno-unsigned-char" }, gcc.getcflags(cfg))
|
||||
end
|
||||
|
@ -160,6 +160,25 @@
|
||||
end
|
||||
|
||||
|
||||
--
|
||||
-- Check the translation of unsignedchar.
|
||||
--
|
||||
|
||||
function suite.sharedflags_onUnsignedCharOn()
|
||||
unsignedchar "On"
|
||||
prepare()
|
||||
test.contains({ "/J" }, msc.getcflags(cfg))
|
||||
test.contains({ "/J" }, msc.getcxxflags(cfg))
|
||||
end
|
||||
|
||||
function suite.sharedflags_onUnsignedCharOff()
|
||||
unsignedchar "Off"
|
||||
prepare()
|
||||
test.excludes({ "/J" }, msc.getcflags(cfg))
|
||||
test.excludes({ "/J" }, msc.getcxxflags(cfg))
|
||||
end
|
||||
|
||||
|
||||
--
|
||||
-- Check handling of debugging support.
|
||||
--
|
||||
|
Loading…
Reference in New Issue
Block a user