Add vectorextensions(); deprecate EnableSSE and EnableSSE2
This commit is contained in:
parent
13fa20a5f5
commit
df428a72d7
@ -217,18 +217,18 @@
|
||||
"Component", -- DEPRECATED
|
||||
"DebugEnvsDontMerge",
|
||||
"DebugEnvsInherit",
|
||||
"EnableSSE",
|
||||
"EnableSSE2",
|
||||
"EnableSSE", -- DEPRECATED
|
||||
"EnableSSE2", -- DEPRECATED
|
||||
"ExcludeFromBuild",
|
||||
"ExtraWarnings",
|
||||
"ExtraWarnings", -- DEPRECATED
|
||||
"FatalWarnings",
|
||||
"FloatFast",
|
||||
"FloatStrict",
|
||||
"FloatFast", -- DEPRECATED
|
||||
"FloatStrict", -- DEPRECATED
|
||||
"LinkTimeOptimization",
|
||||
"Managed",
|
||||
"MFC",
|
||||
"MultiProcessorCompile",
|
||||
"NativeWChar",
|
||||
"NativeWChar", -- DEPRECATED
|
||||
"No64BitChecks",
|
||||
"NoCopyLocal",
|
||||
"NoEditAndContinue",
|
||||
@ -239,15 +239,15 @@
|
||||
"NoIncrementalLink",
|
||||
"NoManifest",
|
||||
"NoMinimalRebuild",
|
||||
"NoNativeWChar",
|
||||
"NoNativeWChar", -- DEPRECATED
|
||||
"NoPCH",
|
||||
"NoRuntimeChecks",
|
||||
"NoRTTI",
|
||||
"NoBufferSecurityCheck",
|
||||
"NoWarnings",
|
||||
"Optimize",
|
||||
"OptimizeSize",
|
||||
"OptimizeSpeed",
|
||||
"NoWarnings", -- DEPRECATED
|
||||
"Optimize", -- DEPRECATED
|
||||
"OptimizeSize", -- DEPRECATED
|
||||
"OptimizeSpeed", -- DEPRECATED
|
||||
"ReleaseRuntime",
|
||||
"SEH",
|
||||
"StaticRuntime",
|
||||
@ -593,6 +593,17 @@
|
||||
end
|
||||
}
|
||||
|
||||
api.register {
|
||||
name = "vectorextensions",
|
||||
scope = "config",
|
||||
kind = "string",
|
||||
allowed = {
|
||||
"Default",
|
||||
"SSE",
|
||||
"SSE2",
|
||||
}
|
||||
}
|
||||
|
||||
api.register {
|
||||
name = "vpaths",
|
||||
scope = "project",
|
||||
@ -600,6 +611,7 @@
|
||||
}
|
||||
|
||||
|
||||
|
||||
-----------------------------------------------------------------------------
|
||||
--
|
||||
-- Handlers for deprecated fields and values.
|
||||
@ -624,48 +636,13 @@
|
||||
return "https://bitbucket.org/premake/premake-dev/wiki/buildaction"
|
||||
end)
|
||||
|
||||
-- 26 Sep 2013
|
||||
|
||||
-----------------------------------------------------------------------------
|
||||
--
|
||||
-- Set up the global environment for the systems I know about. I would like
|
||||
-- to see at least some if not all of this moved into add-ons in the future.
|
||||
--
|
||||
-----------------------------------------------------------------------------
|
||||
api.deprecateValue("flags", { "EnableSSE", "EnableSSE2" }, function(value)
|
||||
vectorextensions(value:sub(7))
|
||||
return "https://bitbucket.org/premake/premake-dev/wiki/vectorextensions"
|
||||
end)
|
||||
|
||||
-- Use Posix-style target naming by default, since it is the most common.
|
||||
|
||||
configuration { "SharedLib" }
|
||||
targetprefix "lib"
|
||||
targetextension ".so"
|
||||
|
||||
configuration { "StaticLib" }
|
||||
targetprefix "lib"
|
||||
targetextension ".a"
|
||||
|
||||
-- Add variations for other Posix-like systems.
|
||||
|
||||
configuration { "MacOSX", "SharedLib" }
|
||||
targetextension ".dylib"
|
||||
|
||||
configuration { "PS3", "ConsoleApp" }
|
||||
targetextension ".elf"
|
||||
|
||||
-- Windows and friends.
|
||||
|
||||
configuration { "Windows or C#", "ConsoleApp or WindowedApp" }
|
||||
targetextension ".exe"
|
||||
|
||||
configuration { "Xbox360", "ConsoleApp or WindowedApp" }
|
||||
targetextension ".exe"
|
||||
|
||||
configuration { "Windows or Xbox360 or C#", "SharedLib" }
|
||||
targetprefix ""
|
||||
targetextension ".dll"
|
||||
implibextension ".lib"
|
||||
|
||||
configuration { "Windows or Xbox360 or C#", "StaticLib" }
|
||||
targetprefix ""
|
||||
targetextension ".lib"
|
||||
|
||||
|
||||
-----------------------------------------------------------------------------
|
||||
@ -746,3 +723,46 @@
|
||||
trigger = "version",
|
||||
description = "Display version information"
|
||||
}
|
||||
|
||||
|
||||
-----------------------------------------------------------------------------
|
||||
--
|
||||
-- Set up the global environment for the systems I know about. I would like
|
||||
-- to see at least some if not all of this moved into add-ons in the future.
|
||||
--
|
||||
-----------------------------------------------------------------------------
|
||||
|
||||
-- Use Posix-style target naming by default, since it is the most common.
|
||||
|
||||
configuration { "SharedLib" }
|
||||
targetprefix "lib"
|
||||
targetextension ".so"
|
||||
|
||||
configuration { "StaticLib" }
|
||||
targetprefix "lib"
|
||||
targetextension ".a"
|
||||
|
||||
-- Add variations for other Posix-like systems.
|
||||
|
||||
configuration { "MacOSX", "SharedLib" }
|
||||
targetextension ".dylib"
|
||||
|
||||
configuration { "PS3", "ConsoleApp" }
|
||||
targetextension ".elf"
|
||||
|
||||
-- Windows and friends.
|
||||
|
||||
configuration { "Windows or C#", "ConsoleApp or WindowedApp" }
|
||||
targetextension ".exe"
|
||||
|
||||
configuration { "Xbox360", "ConsoleApp or WindowedApp" }
|
||||
targetextension ".exe"
|
||||
|
||||
configuration { "Windows or Xbox360 or C#", "SharedLib" }
|
||||
targetprefix ""
|
||||
targetextension ".dll"
|
||||
implibextension ".lib"
|
||||
|
||||
configuration { "Windows or Xbox360 or C#", "StaticLib" }
|
||||
targetprefix ""
|
||||
targetextension ".lib"
|
||||
|
@ -14,6 +14,13 @@
|
||||
local fileconfig = premake.fileconfig
|
||||
|
||||
|
||||
---
|
||||
-- Add namespace for element definition lists for premake.callarray()
|
||||
---
|
||||
|
||||
vc200x.elements = {}
|
||||
|
||||
|
||||
---
|
||||
-- Generate a Visual Studio 200x C++ or Makefile project.
|
||||
---
|
||||
@ -388,6 +395,10 @@
|
||||
end
|
||||
|
||||
|
||||
vc200x.elements.builtInCompilerTool = {
|
||||
"enableEnhancedInstructionSet"
|
||||
}
|
||||
|
||||
function vc200x.VCCLBuiltInCompilerTool(cfg)
|
||||
vc200x.VCCLCompilerTool_additionalOptions(cfg)
|
||||
|
||||
@ -419,13 +430,7 @@
|
||||
|
||||
_p(4,'EnableFunctionLevelLinking="%s"', vc200x.bool(true))
|
||||
|
||||
if _ACTION > "vs2003" and cfg.system ~= "Xbox360" and cfg.architecture ~= "x64" then
|
||||
if cfg.flags.EnableSSE then
|
||||
_p(4,'EnableEnhancedInstructionSet="1"')
|
||||
elseif cfg.flags.EnableSSE2 then
|
||||
_p(4,'EnableEnhancedInstructionSet="2"')
|
||||
end
|
||||
end
|
||||
premake.callarray(vc200x, vc200x.elements.builtInCompilerTool, cfg)
|
||||
|
||||
if _ACTION < "vs2005" then
|
||||
if cfg.flags.FloatFast then
|
||||
@ -924,6 +929,15 @@
|
||||
end
|
||||
|
||||
|
||||
function vc200x.enableEnhancedInstructionSet(cfg)
|
||||
local map = { SSE = "1", SSE2 = "2" }
|
||||
local value = map[cfg.vectorextensions]
|
||||
if value and cfg.system ~= "Xbox360" and cfg.architecture ~= "x64" then
|
||||
_p(4,'EnableEnhancedInstructionSet="%d"', value)
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
function vc200x.wholeProgramOptimization(cfg)
|
||||
if cfg.flags.LinkTimeOptimization then
|
||||
_x(4,'WholeProgramOptimization="true"')
|
||||
|
@ -755,10 +755,13 @@
|
||||
|
||||
|
||||
function vc2010.enableEnhancedInstructionSet(cfg)
|
||||
if cfg.flags.EnableSSE2 then
|
||||
_p(3,'<EnableEnhancedInstructionSet>StreamingSIMDExtensions2</EnableEnhancedInstructionSet>')
|
||||
elseif cfg.flags.EnableSSE then
|
||||
_p(3,'<EnableEnhancedInstructionSet>StreamingSIMDExtensions</EnableEnhancedInstructionSet>')
|
||||
local map = {
|
||||
SSE = "StreamingSIMDExtensions",
|
||||
SSE2 = "StreamingSIMDExtensions2"
|
||||
}
|
||||
local value = map[cfg.vectorextensions]
|
||||
if value then
|
||||
_p(3,'<EnableEnhancedInstructionSet>%s</EnableEnhancedInstructionSet>', value)
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -512,3 +512,30 @@
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
--
|
||||
-- Map the values contained in the configuration to an array of flags.
|
||||
--
|
||||
-- @param cfg
|
||||
-- The configuration to map.
|
||||
-- @param mappings
|
||||
-- A mapping from configuration fields and values to flags. See
|
||||
-- the GCC tool interface for examples of these mappings.
|
||||
-- @return
|
||||
-- An array containing the translated flags.
|
||||
--
|
||||
|
||||
function config.mapFlags(cfg, mappings)
|
||||
local flags = {}
|
||||
for field, map in pairs(mappings) do
|
||||
local value = cfg[field]
|
||||
table.foreachi(value, function(v)
|
||||
local flag = map[v]
|
||||
if flag then
|
||||
table.insert(flags, flag)
|
||||
end
|
||||
end)
|
||||
end
|
||||
return flags
|
||||
end
|
||||
|
@ -113,11 +113,14 @@
|
||||
--
|
||||
|
||||
function table.foreachi(arr, func)
|
||||
local n = #arr
|
||||
for i = 1, n do
|
||||
local v = arr[i]
|
||||
if v then
|
||||
func(v)
|
||||
if arr then
|
||||
if type(arr) == "string" then arr = { arr } end
|
||||
local n = #arr
|
||||
for i = 1, n do
|
||||
local v = arr[i]
|
||||
if v then
|
||||
func(v)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@ -20,12 +20,10 @@
|
||||
},
|
||||
|
||||
x32 = {
|
||||
cflags = "-m32",
|
||||
ldflags = { "-m32", "-L/usr/lib32" }
|
||||
},
|
||||
|
||||
x64 = {
|
||||
cflags = "-m64",
|
||||
ldflags = { "-m64", "-L/usr/lib64" }
|
||||
},
|
||||
|
||||
@ -93,25 +91,34 @@
|
||||
--
|
||||
|
||||
gcc.cflags = {
|
||||
EnableSSE = "-msse",
|
||||
EnableSSE2 = "-msse2",
|
||||
ExtraWarnings = "-Wall -Wextra",
|
||||
FatalWarnings = "-Werror",
|
||||
NoWarnings = "-w",
|
||||
FloatFast = "-ffast-math",
|
||||
FloatStrict = "-ffloat-store",
|
||||
NoFramePointer = "-fomit-frame-pointer",
|
||||
Optimize = "-O2",
|
||||
OptimizeSize = "-Os",
|
||||
OptimizeSpeed = "-O3",
|
||||
Symbols = "-g",
|
||||
architecture = {
|
||||
x32 = "-m32",
|
||||
x64 = "-m64",
|
||||
},
|
||||
flags = {
|
||||
ExtraWarnings = "-Wall -Wextra",
|
||||
FatalWarnings = "-Werror",
|
||||
NoWarnings = "-w",
|
||||
FloatFast = "-ffast-math",
|
||||
FloatStrict = "-ffloat-store",
|
||||
NoFramePointer = "-fomit-frame-pointer",
|
||||
Optimize = "-O2",
|
||||
OptimizeSize = "-Os",
|
||||
OptimizeSpeed = "-O3",
|
||||
Symbols = "-g"
|
||||
},
|
||||
vectorextensions = {
|
||||
SSE = "-msse",
|
||||
SSE2 = "-msse2"
|
||||
}
|
||||
}
|
||||
|
||||
function gcc.getcflags(cfg)
|
||||
local flags = table.translate(cfg.flags, gcc.cflags)
|
||||
local flags = config.mapFlags(cfg, gcc.cflags)
|
||||
|
||||
local sysflags = gcc.getsysflags(cfg, 'cflags')
|
||||
flags = table.join(flags, sysflags)
|
||||
-- TODO: Would love to see this as a configuration
|
||||
-- configuration { "SharedLib", "not Windows" }
|
||||
-- flags { "PIC" }
|
||||
|
||||
if cfg.system ~= premake.WINDOWS and cfg.kind == premake.SHAREDLIB then
|
||||
table.insert(flags, "-fPIC")
|
||||
|
@ -349,7 +349,7 @@
|
||||
--
|
||||
|
||||
function suite.instructionSet_onSSE()
|
||||
flags "EnableSSE"
|
||||
vectorextensions "SSE"
|
||||
prepare()
|
||||
test.capture [[
|
||||
<ClCompile>
|
||||
@ -361,7 +361,7 @@
|
||||
end
|
||||
|
||||
function suite.instructionSet_onSSE2()
|
||||
flags "EnableSSE2"
|
||||
vectorextensions "SSE2"
|
||||
prepare()
|
||||
test.capture [[
|
||||
<ClCompile>
|
||||
|
@ -73,11 +73,17 @@
|
||||
--
|
||||
|
||||
function suite.cflags_onEnableSSE()
|
||||
flags { "EnableSSE" }
|
||||
vectorextensions "SSE"
|
||||
prepare()
|
||||
test.isequal({ "-msse" }, gcc.getcflags(cfg))
|
||||
end
|
||||
|
||||
function suite.cflags_onEnableSSE2()
|
||||
vectorextensions "SSE2"
|
||||
prepare()
|
||||
test.isequal({ "-msse2" }, gcc.getcflags(cfg))
|
||||
end
|
||||
|
||||
function suite.cflags_onFatalWarnings()
|
||||
flags { "FatalWarnings" }
|
||||
prepare()
|
||||
|
Loading…
Reference in New Issue
Block a user