This repository has been archived on 2022-12-23. You can view files and clone it, but cannot push or open issues or pull requests.
fuck-premake-old2/modules/gmake2/tests/test_gmake2_perfile_flags.lua
2017-10-12 16:08:58 -07:00

76 lines
2.1 KiB
Lua

--
-- gmake2_perfile_flags.lua
-- Tests compiler and linker flags for Makefiles.
-- (c) 2016-2017 Jason Perkins, Blizzard Entertainment and the Premake project
--
local suite = test.declare("gmake2_perfile_flags")
local p = premake
local gmake2 = p.modules.gmake2
local project = p.project
--
-- Setup
--
local wks
function suite.setup()
wks = test.createWorkspace()
end
local function prepare()
local prj = p.workspace.getproject(wks, 1)
gmake2.cpp.outputPerFileConfigurationSection(prj)
end
--
-- Test per file settings.
--
function suite.perfile_buildOptions()
files { 'a.cpp', 'b.cpp', 'c.cpp' }
filter { 'files:a.cpp' }
buildoptions { '-msse', '-msse2', '-mfpmath=sse,387', '-msse3', '-mssse3', '-msse4.1', '-mpclmul' }
filter { 'files:b.cpp' }
buildoptions { '-msse', '-msse2', '-mfpmath=sse,387' }
filter { 'files:c.cpp' }
buildoptions { '-msse', '-msse2', '-mfpmath=sse,387', '-msse3', '-mssse3', '-msse4.1', '-maes' }
prepare()
test.capture [[
# Per File Configurations
# #############################################
PERFILE_FLAGS_0 = $(ALL_CXXFLAGS) -msse -msse2 -mfpmath=sse,387 -msse3 -mssse3 -msse4.1 -mpclmul
PERFILE_FLAGS_1 = $(ALL_CXXFLAGS) -msse -msse2 -mfpmath=sse,387
PERFILE_FLAGS_2 = $(ALL_CXXFLAGS) -msse -msse2 -mfpmath=sse,387 -msse3 -mssse3 -msse4.1 -maes
]]
end
function suite.perfile_mixedbuildOptions()
files { 'a.c', 'b.cpp', 'c.c' }
filter { 'files:a.c' }
buildoptions { '-msse', '-msse2', '-mfpmath=sse,387', '-msse3', '-mssse3', '-msse4.1', '-mpclmul' }
filter { 'files:b.cpp' }
buildoptions { '-msse', '-msse2', '-mfpmath=sse,387' }
filter { 'files:c.c' }
buildoptions { '-msse', '-msse2', '-mfpmath=sse,387', '-msse3', '-mssse3', '-msse4.1', '-maes' }
prepare()
test.capture [[
# Per File Configurations
# #############################################
PERFILE_FLAGS_0 = $(ALL_CFLAGS) -msse -msse2 -mfpmath=sse,387 -msse3 -mssse3 -msse4.1 -mpclmul
PERFILE_FLAGS_1 = $(ALL_CXXFLAGS) -msse -msse2 -mfpmath=sse,387
PERFILE_FLAGS_2 = $(ALL_CFLAGS) -msse -msse2 -mfpmath=sse,387 -msse3 -mssse3 -msse4.1 -maes
]]
end