Initial community commit
This commit is contained in:
16
Src/external_dependencies/openmpt-trunk/include/premake/modules/gmake2/tests/_tests.lua
vendored
Normal file
16
Src/external_dependencies/openmpt-trunk/include/premake/modules/gmake2/tests/_tests.lua
vendored
Normal file
@@ -0,0 +1,16 @@
|
||||
require ("gmake2")
|
||||
|
||||
return {
|
||||
"test_gmake2_buildcmds.lua",
|
||||
"test_gmake2_clang.lua",
|
||||
"test_gmake2_file_rules.lua",
|
||||
"test_gmake2_flags.lua",
|
||||
"test_gmake2_ldflags.lua",
|
||||
"test_gmake2_linking.lua",
|
||||
"test_gmake2_makefile.lua",
|
||||
"test_gmake2_objects.lua",
|
||||
"test_gmake2_pch.lua",
|
||||
"test_gmake2_perfile_flags.lua",
|
||||
"test_gmake2_target_rules.lua",
|
||||
"test_gmake2_tools.lua",
|
||||
}
|
||||
@@ -0,0 +1,48 @@
|
||||
|
||||
|
||||
|
||||
local suite = test.declare("gmake2_buildcommands")
|
||||
local gmake2 = premake.modules.gmake2
|
||||
|
||||
local wks, prj, cfg
|
||||
|
||||
function suite.setup()
|
||||
wks = workspace("MyWorkspace")
|
||||
configurations { "Debug", "Release" }
|
||||
prj = test.createProject(wks)
|
||||
end
|
||||
|
||||
|
||||
local function prepare()
|
||||
wks = test.getWorkspace(wks)
|
||||
prj = test.getproject(wks, 1)
|
||||
cfg = test.getconfig(prj, "Debug")
|
||||
|
||||
local toolset = gmake2.getToolSet(cfg)
|
||||
gmake2.postBuildCmds(cfg, toolset)
|
||||
end
|
||||
|
||||
|
||||
function suite.postbuildcommands()
|
||||
targetname "blink"
|
||||
kind "StaticLib"
|
||||
language "C++"
|
||||
|
||||
postbuildcommands
|
||||
{
|
||||
"mkdir lib/www",
|
||||
"mkdir lib/www"
|
||||
}
|
||||
|
||||
prepare()
|
||||
|
||||
test.capture [[
|
||||
define POSTBUILDCMDS
|
||||
@echo Running postbuild commands
|
||||
mkdir lib/www
|
||||
mkdir lib/www
|
||||
endef
|
||||
]]
|
||||
end
|
||||
|
||||
|
||||
@@ -0,0 +1,46 @@
|
||||
--
|
||||
-- test_gmake2_clang.lua
|
||||
-- Test Clang support in Makefiles.
|
||||
-- (c) 2016-2017 Jason Perkins, Blizzard Entertainment and the Premake project
|
||||
--
|
||||
|
||||
local suite = test.declare("gmake2_clang")
|
||||
|
||||
local p = premake
|
||||
local gmake2 = p.modules.gmake2
|
||||
|
||||
--
|
||||
-- Setup
|
||||
--
|
||||
|
||||
local wks, prj
|
||||
|
||||
function suite.setup()
|
||||
wks = test.createWorkspace()
|
||||
toolset "clang"
|
||||
prj = p.workspace.getproject(wks, 1)
|
||||
end
|
||||
|
||||
|
||||
--
|
||||
-- Make sure that the correct compilers are used.
|
||||
--
|
||||
|
||||
function suite.usesCorrectCompilers()
|
||||
gmake2.cpp.outputConfigurationSection(prj)
|
||||
test.capture [[
|
||||
# Configurations
|
||||
# #############################################
|
||||
|
||||
ifeq ($(origin CC), default)
|
||||
CC = clang
|
||||
endif
|
||||
ifeq ($(origin CXX), default)
|
||||
CXX = clang++
|
||||
endif
|
||||
ifeq ($(origin AR), default)
|
||||
AR = ar
|
||||
endif
|
||||
]]
|
||||
end
|
||||
|
||||
@@ -0,0 +1,379 @@
|
||||
--
|
||||
-- test_gmake2_file_rules.lua
|
||||
-- Validate the makefile source building rules.
|
||||
-- (c) 2016-2017 Jason Perkins, Blizzard Entertainment and the Premake project
|
||||
--
|
||||
|
||||
local suite = test.declare("gmake2_file_rules")
|
||||
|
||||
local p = premake
|
||||
local gmake2 = p.modules.gmake2
|
||||
|
||||
--
|
||||
-- Setup
|
||||
--
|
||||
|
||||
local wks, prj
|
||||
|
||||
function suite.setup()
|
||||
p.escaper(gmake2.esc)
|
||||
gmake2.cpp.initialize()
|
||||
|
||||
rule "TestRule"
|
||||
display "Test Rule"
|
||||
fileextension ".rule"
|
||||
|
||||
propertydefinition {
|
||||
name = "TestProperty",
|
||||
kind = "boolean",
|
||||
value = false,
|
||||
switch = "-p"
|
||||
}
|
||||
|
||||
propertydefinition {
|
||||
name = "TestProperty2",
|
||||
kind = "boolean",
|
||||
value = false,
|
||||
switch = "-p2"
|
||||
}
|
||||
|
||||
propertydefinition {
|
||||
name = "TestListProperty",
|
||||
kind = "list"
|
||||
}
|
||||
propertydefinition {
|
||||
name = "TestListPropertyWithSwitch",
|
||||
kind = "list",
|
||||
switch = "-S"
|
||||
}
|
||||
propertydefinition {
|
||||
name = "TestListPropertySeparator",
|
||||
kind = "list",
|
||||
separator = ","
|
||||
}
|
||||
propertydefinition {
|
||||
name = "TestListPropertySeparatorWithSwitch",
|
||||
kind = "list",
|
||||
separator = ",",
|
||||
switch = "-O"
|
||||
}
|
||||
propertydefinition {
|
||||
name = "TestEnumProperty",
|
||||
values = { [0] = "V0", [1] = "V1"},
|
||||
switch = { [0] = "S0", [1] = "S1"},
|
||||
value = 0
|
||||
}
|
||||
|
||||
buildmessage 'Rule-ing %{file.name}'
|
||||
buildcommands 'dorule %{TestProperty} %{TestProperty2} %{TestListProperty} %{TestListPropertyWithSwitch} %{TestListPropertySeparator} %{TestListPropertySeparatorWithSwitch} %{TestEnumProperty} "%{file.path}"'
|
||||
buildoutputs { "%{file.basename}.obj" }
|
||||
|
||||
wks = test.createWorkspace()
|
||||
end
|
||||
|
||||
local function prepare()
|
||||
prj = p.workspace.getproject(wks, 1)
|
||||
p.oven.bake()
|
||||
|
||||
gmake2.cpp.createRuleTable(prj)
|
||||
gmake2.cpp.createFileTable(prj)
|
||||
gmake2.cpp.outputFileRuleSection(prj)
|
||||
end
|
||||
|
||||
|
||||
--
|
||||
-- Two files with the same base name should have different object files.
|
||||
--
|
||||
|
||||
function suite.uniqueObjNames_onBaseNameCollision()
|
||||
files { "src/hello.cpp", "src/greetings/hello.cpp" }
|
||||
prepare()
|
||||
test.capture [[
|
||||
# File Rules
|
||||
# #############################################
|
||||
|
||||
$(OBJDIR)/hello.o: src/greetings/hello.cpp
|
||||
@echo $(notdir $<)
|
||||
$(SILENT) $(CXX) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<"
|
||||
$(OBJDIR)/hello1.o: src/hello.cpp
|
||||
@echo $(notdir $<)
|
||||
$(SILENT) $(CXX) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<"
|
||||
|
||||
]]
|
||||
end
|
||||
|
||||
|
||||
--
|
||||
-- C files in C++ projects should been compiled as c
|
||||
--
|
||||
|
||||
function suite.cFilesGetsCompiledWithCCWhileInCppProject()
|
||||
files { "src/hello.c", "src/test.cpp" }
|
||||
prepare()
|
||||
test.capture [[
|
||||
# File Rules
|
||||
# #############################################
|
||||
|
||||
$(OBJDIR)/hello.o: src/hello.c
|
||||
@echo $(notdir $<)
|
||||
$(SILENT) $(CC) $(ALL_CFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<"
|
||||
$(OBJDIR)/test.o: src/test.cpp
|
||||
@echo $(notdir $<)
|
||||
$(SILENT) $(CXX) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<"
|
||||
|
||||
]]
|
||||
end
|
||||
|
||||
--
|
||||
-- C files in C++ projects can be compiled as C++ with compileas
|
||||
--
|
||||
|
||||
function suite.cFilesGetsCompiledWithCXXWithCompileas()
|
||||
files { "src/hello.c", "src/test.c" }
|
||||
filter { "files:src/hello.c" }
|
||||
compileas "C++"
|
||||
prepare()
|
||||
test.capture [[
|
||||
# File Rules
|
||||
# #############################################
|
||||
|
||||
$(OBJDIR)/hello.o: src/hello.c
|
||||
@echo $(notdir $<)
|
||||
$(SILENT) $(CXX) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<"
|
||||
$(OBJDIR)/test.o: src/test.c
|
||||
@echo $(notdir $<)
|
||||
$(SILENT) $(CC) $(ALL_CFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<"
|
||||
]]
|
||||
end
|
||||
|
||||
--
|
||||
-- C files in C++ projects can be compiled as C++ with 'compileas' on a configuration basis
|
||||
--
|
||||
|
||||
function suite.cFilesGetsCompiledWithCXXWithCompileasDebugOnly()
|
||||
files { "src/hello.c", "src/test.c" }
|
||||
filter { "configurations:Debug", "files:src/hello.c" }
|
||||
compileas "C++"
|
||||
prepare()
|
||||
test.capture [[
|
||||
# File Rules
|
||||
# #############################################
|
||||
|
||||
$(OBJDIR)/test.o: src/test.c
|
||||
@echo $(notdir $<)
|
||||
$(SILENT) $(CC) $(ALL_CFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<"
|
||||
|
||||
ifeq ($(config),debug)
|
||||
$(OBJDIR)/hello.o: src/hello.c
|
||||
@echo $(notdir $<)
|
||||
$(SILENT) $(CXX) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<"
|
||||
|
||||
else ifeq ($(config),release)
|
||||
$(OBJDIR)/hello.o: src/hello.c
|
||||
@echo $(notdir $<)
|
||||
$(SILENT) $(CC) $(ALL_CFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<"
|
||||
|
||||
endif
|
||||
]]
|
||||
end
|
||||
|
||||
|
||||
--
|
||||
-- If a custom build rule is supplied, it should be used.
|
||||
--
|
||||
|
||||
function suite.customBuildRule()
|
||||
files { "hello.x" }
|
||||
filter "files:**.x"
|
||||
buildmessage "Compiling %{file.name}"
|
||||
buildcommands {
|
||||
'cxc -c "%{file.path}" -o "%{cfg.objdir}/%{file.basename}.xo"',
|
||||
'c2o -c "%{cfg.objdir}/%{file.basename}.xo" -o "%{cfg.objdir}/%{file.basename}.obj"'
|
||||
}
|
||||
buildoutputs { "%{cfg.objdir}/%{file.basename}.obj" }
|
||||
prepare()
|
||||
test.capture [[
|
||||
# File Rules
|
||||
# #############################################
|
||||
|
||||
ifeq ($(config),debug)
|
||||
obj/Debug/hello.obj: hello.x
|
||||
@echo Compiling hello.x
|
||||
$(SILENT) cxc -c "hello.x" -o "obj/Debug/hello.xo"
|
||||
$(SILENT) c2o -c "obj/Debug/hello.xo" -o "obj/Debug/hello.obj"
|
||||
|
||||
else ifeq ($(config),release)
|
||||
obj/Release/hello.obj: hello.x
|
||||
@echo Compiling hello.x
|
||||
$(SILENT) cxc -c "hello.x" -o "obj/Release/hello.xo"
|
||||
$(SILENT) c2o -c "obj/Release/hello.xo" -o "obj/Release/hello.obj"
|
||||
|
||||
endif
|
||||
]]
|
||||
end
|
||||
|
||||
function suite.customBuildRuleWithAdditionalInputs()
|
||||
files { "hello.x" }
|
||||
filter "files:**.x"
|
||||
buildmessage "Compiling %{file.name}"
|
||||
buildcommands {
|
||||
'cxc -c "%{file.path}" -o "%{cfg.objdir}/%{file.basename}.xo"',
|
||||
'c2o -c "%{cfg.objdir}/%{file.basename}.xo" -o "%{cfg.objdir}/%{file.basename}.obj"'
|
||||
}
|
||||
buildoutputs { "%{cfg.objdir}/%{file.basename}.obj" }
|
||||
buildinputs { "%{file.path}.inc", "%{file.path}.inc2" }
|
||||
prepare()
|
||||
test.capture [[
|
||||
# File Rules
|
||||
# #############################################
|
||||
|
||||
ifeq ($(config),debug)
|
||||
obj/Debug/hello.obj: hello.x hello.x.inc hello.x.inc2
|
||||
@echo Compiling hello.x
|
||||
$(SILENT) cxc -c "hello.x" -o "obj/Debug/hello.xo"
|
||||
$(SILENT) c2o -c "obj/Debug/hello.xo" -o "obj/Debug/hello.obj"
|
||||
|
||||
else ifeq ($(config),release)
|
||||
obj/Release/hello.obj: hello.x hello.x.inc hello.x.inc2
|
||||
@echo Compiling hello.x
|
||||
$(SILENT) cxc -c "hello.x" -o "obj/Release/hello.xo"
|
||||
$(SILENT) c2o -c "obj/Release/hello.xo" -o "obj/Release/hello.obj"
|
||||
|
||||
endif
|
||||
]]
|
||||
end
|
||||
|
||||
function suite.customBuildRuleWithAdditionalOutputs()
|
||||
files { "hello.x" }
|
||||
filter "files:**.x"
|
||||
buildmessage "Compiling %{file.name}"
|
||||
buildcommands {
|
||||
'cxc -c "%{file.path}" -o "%{cfg.objdir}/%{file.basename}.xo"',
|
||||
'c2o -c "%{cfg.objdir}/%{file.basename}.xo" -o "%{cfg.objdir}/%{file.basename}.obj"'
|
||||
}
|
||||
buildoutputs { "%{cfg.objdir}/%{file.basename}.obj", "%{cfg.objdir}/%{file.basename}.other", "%{cfg.objdir}/%{file.basename}.another" }
|
||||
prepare()
|
||||
test.capture [[
|
||||
# File Rules
|
||||
# #############################################
|
||||
|
||||
ifeq ($(config),debug)
|
||||
obj/Debug/hello.obj: hello.x
|
||||
@echo Compiling hello.x
|
||||
$(SILENT) cxc -c "hello.x" -o "obj/Debug/hello.xo"
|
||||
$(SILENT) c2o -c "obj/Debug/hello.xo" -o "obj/Debug/hello.obj"
|
||||
obj/Debug/hello.other obj/Debug/hello.another: obj/Debug/hello.obj
|
||||
|
||||
else ifeq ($(config),release)
|
||||
obj/Release/hello.obj: hello.x
|
||||
@echo Compiling hello.x
|
||||
$(SILENT) cxc -c "hello.x" -o "obj/Release/hello.xo"
|
||||
$(SILENT) c2o -c "obj/Release/hello.xo" -o "obj/Release/hello.obj"
|
||||
obj/Release/hello.other obj/Release/hello.another: obj/Release/hello.obj
|
||||
|
||||
endif
|
||||
]]
|
||||
end
|
||||
|
||||
function suite.customRuleWithProps()
|
||||
|
||||
rules { "TestRule" }
|
||||
|
||||
files { "test.rule", "test2.rule" }
|
||||
|
||||
testRuleVars {
|
||||
TestProperty = true
|
||||
}
|
||||
|
||||
filter "files:test2.rule"
|
||||
testRuleVars {
|
||||
TestProperty2 = true
|
||||
}
|
||||
|
||||
prepare()
|
||||
test.capture [[
|
||||
# File Rules
|
||||
# #############################################
|
||||
|
||||
test.obj: test.rule
|
||||
@echo Rule-ing test.rule
|
||||
$(SILENT) dorule -p "test.rule"
|
||||
test2.obj: test2.rule
|
||||
@echo Rule-ing test2.rule
|
||||
$(SILENT) dorule -p -p2 "test2.rule"
|
||||
]]
|
||||
end
|
||||
|
||||
function suite.propertydefinitionSeparator()
|
||||
|
||||
rules { "TestRule" }
|
||||
|
||||
files { "test.rule", "test2.rule", "test3.rule", "test4.rule" }
|
||||
|
||||
filter "files:test.rule"
|
||||
testRuleVars {
|
||||
TestListProperty = { "testValue1", "testValue2" }
|
||||
}
|
||||
|
||||
filter "files:test2.rule"
|
||||
testRuleVars {
|
||||
TestListPropertyWithSwitch = { "testValue1", "testValue2" }
|
||||
}
|
||||
|
||||
filter "files:test3.rule"
|
||||
testRuleVars {
|
||||
TestListPropertySeparator = { "testValue1", "testValue2" }
|
||||
}
|
||||
filter "files:test4.rule"
|
||||
testRuleVars {
|
||||
TestListPropertySeparatorWithSwitch = { "testValue1", "testValue2" }
|
||||
}
|
||||
|
||||
prepare()
|
||||
test.capture [[
|
||||
# File Rules
|
||||
# #############################################
|
||||
|
||||
test.obj: test.rule
|
||||
@echo Rule-ing test.rule
|
||||
$(SILENT) dorule testValue1\ testValue2 "test.rule"
|
||||
test2.obj: test2.rule
|
||||
@echo Rule-ing test2.rule
|
||||
$(SILENT) dorule -StestValue1\ -StestValue2 "test2.rule"
|
||||
test3.obj: test3.rule
|
||||
@echo Rule-ing test3.rule
|
||||
$(SILENT) dorule testValue1,testValue2 "test3.rule"
|
||||
test4.obj: test4.rule
|
||||
@echo Rule-ing test4.rule
|
||||
$(SILENT) dorule -OtestValue1,testValue2 "test4.rule"
|
||||
]]
|
||||
end
|
||||
|
||||
function suite.customRuleWithPropertyDefinitionEnum()
|
||||
|
||||
rules { "TestRule" }
|
||||
|
||||
files { "test.rule", "test2.rule" }
|
||||
|
||||
testRuleVars {
|
||||
TestEnumProperty = "V0"
|
||||
}
|
||||
|
||||
filter "files:test2.rule"
|
||||
testRuleVars {
|
||||
TestEnumProperty = "V1"
|
||||
}
|
||||
|
||||
prepare()
|
||||
test.capture [[
|
||||
# File Rules
|
||||
# #############################################
|
||||
|
||||
test.obj: test.rule
|
||||
@echo Rule-ing test.rule
|
||||
$(SILENT) dorule S0 "test.rule"
|
||||
test2.obj: test2.rule
|
||||
@echo Rule-ing test2.rule
|
||||
$(SILENT) dorule S1 "test2.rule"
|
||||
]]
|
||||
end
|
||||
145
Src/external_dependencies/openmpt-trunk/include/premake/modules/gmake2/tests/test_gmake2_flags.lua
vendored
Normal file
145
Src/external_dependencies/openmpt-trunk/include/premake/modules/gmake2/tests/test_gmake2_flags.lua
vendored
Normal file
@@ -0,0 +1,145 @@
|
||||
--
|
||||
-- test_gmake2_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_flags")
|
||||
|
||||
local p = premake
|
||||
local gmake2 = p.modules.gmake2
|
||||
|
||||
local project = p.project
|
||||
|
||||
|
||||
--
|
||||
-- Setup
|
||||
--
|
||||
|
||||
local wks, prj
|
||||
|
||||
function suite.setup()
|
||||
wks, prj = test.createWorkspace()
|
||||
end
|
||||
|
||||
local function prepare(calls)
|
||||
local cfg = test.getconfig(prj, "Debug")
|
||||
local toolset = p.tools.gcc
|
||||
p.callarray(gmake2.cpp, calls, cfg, toolset)
|
||||
end
|
||||
|
||||
|
||||
--
|
||||
-- Include directories should be relative and space separated.
|
||||
--
|
||||
|
||||
function suite.includeDirs()
|
||||
includedirs { "src/include", "../include" }
|
||||
prepare { "includes" }
|
||||
test.capture [[
|
||||
INCLUDES += -Isrc/include -I../include
|
||||
]]
|
||||
end
|
||||
|
||||
--
|
||||
-- symbols "on" should produce -g
|
||||
--
|
||||
function suite.symbols_on()
|
||||
symbols "on"
|
||||
prepare { "cFlags", "cxxFlags" }
|
||||
test.capture [[
|
||||
ALL_CFLAGS += $(CFLAGS) $(ALL_CPPFLAGS) -g
|
||||
ALL_CXXFLAGS += $(CXXFLAGS) $(ALL_CPPFLAGS) -g
|
||||
]]
|
||||
end
|
||||
|
||||
--
|
||||
-- symbols default to 'off'
|
||||
--
|
||||
function suite.symbols_default()
|
||||
symbols "default"
|
||||
prepare { "cFlags", "cxxFlags" }
|
||||
test.capture [[
|
||||
ALL_CFLAGS += $(CFLAGS) $(ALL_CPPFLAGS)
|
||||
ALL_CXXFLAGS += $(CXXFLAGS) $(ALL_CPPFLAGS)
|
||||
]]
|
||||
end
|
||||
|
||||
--
|
||||
-- symbols "off" should not produce -g
|
||||
--
|
||||
function suite.symbols_off()
|
||||
symbols "off"
|
||||
prepare { "cFlags", "cxxFlags" }
|
||||
test.capture [[
|
||||
ALL_CFLAGS += $(CFLAGS) $(ALL_CPPFLAGS)
|
||||
ALL_CXXFLAGS += $(CXXFLAGS) $(ALL_CPPFLAGS)
|
||||
]]
|
||||
end
|
||||
|
||||
--
|
||||
-- All other symbols flags also produce -g
|
||||
--
|
||||
function suite.symbols_fastlink()
|
||||
symbols "FastLink"
|
||||
prepare { "cFlags", "cxxFlags" }
|
||||
test.capture [[
|
||||
ALL_CFLAGS += $(CFLAGS) $(ALL_CPPFLAGS) -g
|
||||
ALL_CXXFLAGS += $(CXXFLAGS) $(ALL_CPPFLAGS) -g
|
||||
]]
|
||||
end
|
||||
|
||||
function suite.symbols_full()
|
||||
symbols "full"
|
||||
prepare { "cFlags", "cxxFlags" }
|
||||
test.capture [[
|
||||
ALL_CFLAGS += $(CFLAGS) $(ALL_CPPFLAGS) -g
|
||||
ALL_CXXFLAGS += $(CXXFLAGS) $(ALL_CPPFLAGS) -g
|
||||
]]
|
||||
end
|
||||
|
||||
--
|
||||
-- symbols "on" with a proper debugformat should produce a corresponding -g
|
||||
--
|
||||
function suite.symbols_on_default()
|
||||
symbols "on"
|
||||
debugformat "Default"
|
||||
prepare { "cFlags", "cxxFlags" }
|
||||
test.capture [[
|
||||
ALL_CFLAGS += $(CFLAGS) $(ALL_CPPFLAGS) -g
|
||||
ALL_CXXFLAGS += $(CXXFLAGS) $(ALL_CPPFLAGS) -g
|
||||
]]
|
||||
end
|
||||
|
||||
function suite.symbols_on_dwarf()
|
||||
symbols "on"
|
||||
debugformat "Dwarf"
|
||||
prepare { "cFlags", "cxxFlags" }
|
||||
test.capture [[
|
||||
ALL_CFLAGS += $(CFLAGS) $(ALL_CPPFLAGS) -gdwarf
|
||||
ALL_CXXFLAGS += $(CXXFLAGS) $(ALL_CPPFLAGS) -gdwarf
|
||||
]]
|
||||
end
|
||||
|
||||
function suite.symbols_on_split_dwarf()
|
||||
symbols "on"
|
||||
debugformat "SplitDwarf"
|
||||
prepare { "cFlags", "cxxFlags" }
|
||||
test.capture [[
|
||||
ALL_CFLAGS += $(CFLAGS) $(ALL_CPPFLAGS) -gsplit-dwarf
|
||||
ALL_CXXFLAGS += $(CXXFLAGS) $(ALL_CPPFLAGS) -gsplit-dwarf
|
||||
]]
|
||||
end
|
||||
|
||||
--
|
||||
-- symbols "off" with a proper debugformat should not produce -g
|
||||
--
|
||||
function suite.symbols_off_dwarf()
|
||||
symbols "off"
|
||||
debugformat "Dwarf"
|
||||
prepare { "cFlags", "cxxFlags" }
|
||||
test.capture [[
|
||||
ALL_CFLAGS += $(CFLAGS) $(ALL_CPPFLAGS)
|
||||
ALL_CXXFLAGS += $(CXXFLAGS) $(ALL_CPPFLAGS)
|
||||
]]
|
||||
end
|
||||
@@ -0,0 +1,79 @@
|
||||
--
|
||||
-- test_gmake2_ldflags.lua
|
||||
-- Tests compiler and linker flags for Makefiles.
|
||||
-- (c) 2016-2017 Jason Perkins, Blizzard Entertainment and the Premake project
|
||||
--
|
||||
|
||||
local suite = test.declare("gmake2_ldflags")
|
||||
|
||||
local p = premake
|
||||
local gmake2 = p.modules.gmake2
|
||||
|
||||
|
||||
--
|
||||
-- Setup
|
||||
--
|
||||
|
||||
local wks, prj
|
||||
|
||||
function suite.setup()
|
||||
wks, prj = test.createWorkspace()
|
||||
symbols "On"
|
||||
end
|
||||
|
||||
local function prepare(calls)
|
||||
local cfg = test.getconfig(prj, "Debug")
|
||||
local toolset = p.tools.gcc
|
||||
gmake2.cpp.ldFlags(cfg, toolset)
|
||||
end
|
||||
|
||||
|
||||
--
|
||||
-- Check the output from default project values.
|
||||
--
|
||||
|
||||
function suite.checkDefaultValues()
|
||||
prepare()
|
||||
test.capture [[
|
||||
ALL_LDFLAGS += $(LDFLAGS)
|
||||
]]
|
||||
end
|
||||
|
||||
--
|
||||
-- Check addition of library search directores.
|
||||
--
|
||||
|
||||
function suite.checkLibDirs()
|
||||
libdirs { "../libs", "libs" }
|
||||
prepare()
|
||||
test.capture [[
|
||||
ALL_LDFLAGS += $(LDFLAGS) -L../libs -Llibs
|
||||
]]
|
||||
end
|
||||
|
||||
function suite.checkLibDirs_X86_64()
|
||||
architecture ("x86_64")
|
||||
system (p.LINUX)
|
||||
prepare()
|
||||
test.capture [[
|
||||
ALL_LDFLAGS += $(LDFLAGS) -L/usr/lib64 -m64
|
||||
]]
|
||||
end
|
||||
|
||||
function suite.checkLibDirs_X86()
|
||||
architecture ("x86")
|
||||
system (p.LINUX)
|
||||
prepare()
|
||||
test.capture [[
|
||||
ALL_LDFLAGS += $(LDFLAGS) -L/usr/lib32 -m32
|
||||
]]
|
||||
end
|
||||
|
||||
function suite.checkLibDirs_X86_64_MacOSX()
|
||||
architecture ("x86_64")
|
||||
system (p.MACOSX)
|
||||
prepare()
|
||||
test.capture [[
|
||||
ALL_LDFLAGS += $(LDFLAGS) -m64
|
||||
]]
|
||||
end
|
||||
272
Src/external_dependencies/openmpt-trunk/include/premake/modules/gmake2/tests/test_gmake2_linking.lua
vendored
Normal file
272
Src/external_dependencies/openmpt-trunk/include/premake/modules/gmake2/tests/test_gmake2_linking.lua
vendored
Normal file
@@ -0,0 +1,272 @@
|
||||
--
|
||||
-- test_gmake2_linking.lua
|
||||
-- Validate the link step generation for makefiles.
|
||||
-- (c) 2016-2017 Jason Perkins, Blizzard Entertainment and the Premake project
|
||||
--
|
||||
|
||||
local suite = test.declare("gmake2_linking")
|
||||
|
||||
local p = premake
|
||||
local gmake2 = p.modules.gmake2
|
||||
|
||||
local project = p.project
|
||||
|
||||
|
||||
--
|
||||
-- Setup and teardown
|
||||
--
|
||||
|
||||
local wks, prj
|
||||
|
||||
function suite.setup()
|
||||
_OS = "linux"
|
||||
wks, prj = test.createWorkspace()
|
||||
end
|
||||
|
||||
local function prepare(calls)
|
||||
local cfg = test.getconfig(prj, "Debug")
|
||||
local toolset = p.tools.gcc
|
||||
p.callarray(gmake2.cpp, calls, cfg, toolset)
|
||||
end
|
||||
|
||||
|
||||
--
|
||||
-- Check link command for a shared C++ library.
|
||||
--
|
||||
|
||||
function suite.links_onCppSharedLib()
|
||||
kind "SharedLib"
|
||||
prepare { "ldFlags", "linkCmd" }
|
||||
test.capture [[
|
||||
ALL_LDFLAGS += $(LDFLAGS) -shared -Wl,-soname=libMyProject.so -s
|
||||
LINKCMD = $(CXX) -o "$@" $(OBJECTS) $(RESOURCES) $(ALL_LDFLAGS) $(LIBS)
|
||||
]]
|
||||
end
|
||||
|
||||
function suite.links_onMacOSXCppSharedLib()
|
||||
_OS = "macosx"
|
||||
kind "SharedLib"
|
||||
prepare { "ldFlags", "linkCmd" }
|
||||
test.capture [[
|
||||
ALL_LDFLAGS += $(LDFLAGS) -dynamiclib -Wl,-install_name,@rpath/libMyProject.dylib -Wl,-x
|
||||
LINKCMD = $(CXX) -o "$@" $(OBJECTS) $(RESOURCES) $(ALL_LDFLAGS) $(LIBS)
|
||||
]]
|
||||
end
|
||||
|
||||
--
|
||||
-- Check link command for a shared C library.
|
||||
--
|
||||
|
||||
function suite.links_onCSharedLib()
|
||||
language "C"
|
||||
kind "SharedLib"
|
||||
prepare { "ldFlags", "linkCmd" }
|
||||
test.capture [[
|
||||
ALL_LDFLAGS += $(LDFLAGS) -shared -Wl,-soname=libMyProject.so -s
|
||||
LINKCMD = $(CC) -o "$@" $(OBJECTS) $(RESOURCES) $(ALL_LDFLAGS) $(LIBS)
|
||||
]]
|
||||
end
|
||||
|
||||
|
||||
--
|
||||
-- Check link command for a static library.
|
||||
--
|
||||
|
||||
function suite.links_onStaticLib()
|
||||
kind "StaticLib"
|
||||
prepare { "ldFlags", "linkCmd" }
|
||||
test.capture [[
|
||||
ALL_LDFLAGS += $(LDFLAGS) -s
|
||||
LINKCMD = $(AR) -rcs "$@" $(OBJECTS)
|
||||
]]
|
||||
end
|
||||
|
||||
|
||||
--
|
||||
-- Check link command for the Utility kind.
|
||||
--
|
||||
-- Utility projects should only run custom commands, and perform no linking.
|
||||
--
|
||||
|
||||
function suite.links_onUtility()
|
||||
kind "Utility"
|
||||
prepare { "linkCmd" }
|
||||
test.capture [[
|
||||
LINKCMD =
|
||||
]]
|
||||
end
|
||||
|
||||
|
||||
--
|
||||
-- Check link command for a Mac OS X universal static library.
|
||||
--
|
||||
|
||||
function suite.links_onMacUniversalStaticLib()
|
||||
architecture "universal"
|
||||
kind "StaticLib"
|
||||
prepare { "ldFlags", "linkCmd" }
|
||||
test.capture [[
|
||||
ALL_LDFLAGS += $(LDFLAGS) -s
|
||||
LINKCMD = libtool -o "$@" $(OBJECTS)
|
||||
]]
|
||||
end
|
||||
|
||||
|
||||
--
|
||||
-- Check a linking to a sibling static library.
|
||||
--
|
||||
|
||||
function suite.links_onSiblingStaticLib()
|
||||
links "MyProject2"
|
||||
|
||||
test.createproject(wks)
|
||||
kind "StaticLib"
|
||||
location "build"
|
||||
|
||||
prepare { "ldFlags", "libs", "ldDeps" }
|
||||
test.capture [[
|
||||
ALL_LDFLAGS += $(LDFLAGS) -s
|
||||
LIBS += build/bin/Debug/libMyProject2.a
|
||||
LDDEPS += build/bin/Debug/libMyProject2.a
|
||||
]]
|
||||
end
|
||||
|
||||
|
||||
--
|
||||
-- Check a linking to a sibling shared library.
|
||||
--
|
||||
|
||||
function suite.links_onSiblingSharedLib()
|
||||
links "MyProject2"
|
||||
|
||||
test.createproject(wks)
|
||||
kind "SharedLib"
|
||||
location "build"
|
||||
|
||||
prepare { "ldFlags", "libs", "ldDeps" }
|
||||
test.capture [[
|
||||
ALL_LDFLAGS += $(LDFLAGS) -Wl,-rpath,'$$ORIGIN/../../build/bin/Debug' -s
|
||||
LIBS += build/bin/Debug/libMyProject2.so
|
||||
LDDEPS += build/bin/Debug/libMyProject2.so
|
||||
]]
|
||||
end
|
||||
|
||||
--
|
||||
-- Check a linking to a sibling shared library using -l and -L.
|
||||
--
|
||||
|
||||
function suite.links_onSiblingSharedLibRelativeLinks()
|
||||
links "MyProject2"
|
||||
flags { "RelativeLinks" }
|
||||
|
||||
test.createproject(wks)
|
||||
kind "SharedLib"
|
||||
location "build"
|
||||
|
||||
prepare { "ldFlags", "libs", "ldDeps" }
|
||||
test.capture [[
|
||||
ALL_LDFLAGS += $(LDFLAGS) -Lbuild/bin/Debug -Wl,-rpath,'$$ORIGIN/../../build/bin/Debug' -s
|
||||
LIBS += -lMyProject2
|
||||
LDDEPS += build/bin/Debug/libMyProject2.so
|
||||
]]
|
||||
end
|
||||
|
||||
function suite.links_onMacOSXSiblingSharedLib()
|
||||
_OS = "macosx"
|
||||
links "MyProject2"
|
||||
flags { "RelativeLinks" }
|
||||
|
||||
test.createproject(wks)
|
||||
kind "SharedLib"
|
||||
location "build"
|
||||
|
||||
prepare { "ldFlags", "libs", "ldDeps" }
|
||||
test.capture [[
|
||||
ALL_LDFLAGS += $(LDFLAGS) -Lbuild/bin/Debug -Wl,-rpath,'@loader_path/../../build/bin/Debug' -Wl,-x
|
||||
LIBS += -lMyProject2
|
||||
LDDEPS += build/bin/Debug/libMyProject2.dylib
|
||||
]]
|
||||
end
|
||||
|
||||
--
|
||||
-- Check a linking multiple siblings.
|
||||
--
|
||||
|
||||
function suite.links_onMultipleSiblingStaticLib()
|
||||
links "MyProject2"
|
||||
links "MyProject3"
|
||||
|
||||
test.createproject(wks)
|
||||
kind "StaticLib"
|
||||
location "build"
|
||||
|
||||
test.createproject(wks)
|
||||
kind "StaticLib"
|
||||
location "build"
|
||||
|
||||
prepare { "ldFlags", "libs", "ldDeps" }
|
||||
test.capture [[
|
||||
ALL_LDFLAGS += $(LDFLAGS) -s
|
||||
LIBS += build/bin/Debug/libMyProject2.a build/bin/Debug/libMyProject3.a
|
||||
LDDEPS += build/bin/Debug/libMyProject2.a build/bin/Debug/libMyProject3.a
|
||||
]]
|
||||
end
|
||||
|
||||
--
|
||||
-- Check a linking multiple siblings with link groups enabled.
|
||||
--
|
||||
|
||||
function suite.links_onSiblingStaticLibWithLinkGroups()
|
||||
links "MyProject2"
|
||||
links "MyProject3"
|
||||
linkgroups "On"
|
||||
|
||||
test.createproject(wks)
|
||||
kind "StaticLib"
|
||||
location "build"
|
||||
|
||||
test.createproject(wks)
|
||||
kind "StaticLib"
|
||||
location "build"
|
||||
|
||||
prepare { "ldFlags", "libs", "ldDeps" }
|
||||
test.capture [[
|
||||
ALL_LDFLAGS += $(LDFLAGS) -s
|
||||
LIBS += -Wl,--start-group build/bin/Debug/libMyProject2.a build/bin/Debug/libMyProject3.a -Wl,--end-group
|
||||
LDDEPS += build/bin/Debug/libMyProject2.a build/bin/Debug/libMyProject3.a
|
||||
]]
|
||||
end
|
||||
|
||||
--
|
||||
-- When referencing an external library via a path, the directory
|
||||
-- should be added to the library search paths, and the library
|
||||
-- itself included via an -l flag.
|
||||
--
|
||||
|
||||
function suite.onExternalLibraryWithPath()
|
||||
location "MyProject"
|
||||
links { "libs/SomeLib" }
|
||||
prepare { "ldFlags", "libs" }
|
||||
test.capture [[
|
||||
ALL_LDFLAGS += $(LDFLAGS) -L../libs -s
|
||||
LIBS += -lSomeLib
|
||||
]]
|
||||
end
|
||||
|
||||
|
||||
|
||||
--
|
||||
-- When referencing an external library with a period in the
|
||||
-- file name make sure it appears correctly in the LIBS
|
||||
-- directive. Currently the period and everything after it
|
||||
-- is stripped
|
||||
--
|
||||
|
||||
function suite.onExternalLibraryWithPathAndVersion()
|
||||
location "MyProject"
|
||||
links { "libs/SomeLib-1.1" }
|
||||
prepare { "libs", }
|
||||
test.capture [[
|
||||
LIBS += -lSomeLib-1.1
|
||||
]]
|
||||
end
|
||||
@@ -0,0 +1,101 @@
|
||||
--
|
||||
-- test_gmake2_makefile.lua
|
||||
-- Validate the makefile projects.
|
||||
-- (c) 2016-2017 Jason Perkins, Blizzard Entertainment and the Premake project
|
||||
--
|
||||
|
||||
local p = premake
|
||||
local suite = test.declare("gmake2_makefile")
|
||||
|
||||
local p = premake
|
||||
local gmake2 = p.modules.gmake2
|
||||
|
||||
local project = p.project
|
||||
|
||||
|
||||
--
|
||||
-- Setup
|
||||
--
|
||||
|
||||
local wks, prj
|
||||
|
||||
function suite.setup()
|
||||
wks, prj = test.createWorkspace()
|
||||
kind "Makefile"
|
||||
end
|
||||
|
||||
local function prepare()
|
||||
prj = test.getproject(wks, 1)
|
||||
gmake2.makefile.configs(prj)
|
||||
end
|
||||
|
||||
|
||||
--
|
||||
-- Check rules for Makefile projects.
|
||||
--
|
||||
|
||||
function suite.makefile_configs_empty()
|
||||
prepare()
|
||||
test.capture [[
|
||||
ifeq ($(config),debug)
|
||||
TARGETDIR = bin/Debug
|
||||
TARGET = $(TARGETDIR)/MyProject
|
||||
define BUILDCMDS
|
||||
endef
|
||||
define CLEANCMDS
|
||||
endef
|
||||
|
||||
else ifeq ($(config),release)
|
||||
TARGETDIR = bin/Release
|
||||
TARGET = $(TARGETDIR)/MyProject
|
||||
define BUILDCMDS
|
||||
endef
|
||||
define CLEANCMDS
|
||||
endef
|
||||
|
||||
else
|
||||
$(error "invalid configuration $(config)")
|
||||
endif
|
||||
]]
|
||||
end
|
||||
|
||||
function suite.makefile_configs_commands()
|
||||
buildcommands {
|
||||
"touch source"
|
||||
}
|
||||
|
||||
cleancommands {
|
||||
"rm -f source"
|
||||
}
|
||||
|
||||
prepare()
|
||||
test.capture [[
|
||||
ifeq ($(config),debug)
|
||||
TARGETDIR = bin/Debug
|
||||
TARGET = $(TARGETDIR)/MyProject
|
||||
define BUILDCMDS
|
||||
@echo Running build commands
|
||||
touch source
|
||||
endef
|
||||
define CLEANCMDS
|
||||
@echo Running clean commands
|
||||
rm -f source
|
||||
endef
|
||||
|
||||
else ifeq ($(config),release)
|
||||
TARGETDIR = bin/Release
|
||||
TARGET = $(TARGETDIR)/MyProject
|
||||
define BUILDCMDS
|
||||
@echo Running build commands
|
||||
touch source
|
||||
endef
|
||||
define CLEANCMDS
|
||||
@echo Running clean commands
|
||||
rm -f source
|
||||
endef
|
||||
|
||||
else
|
||||
$(error "invalid configuration $(config)")
|
||||
endif
|
||||
]]
|
||||
end
|
||||
474
Src/external_dependencies/openmpt-trunk/include/premake/modules/gmake2/tests/test_gmake2_objects.lua
vendored
Normal file
474
Src/external_dependencies/openmpt-trunk/include/premake/modules/gmake2/tests/test_gmake2_objects.lua
vendored
Normal file
@@ -0,0 +1,474 @@
|
||||
--
|
||||
-- test_gmake2_objects.lua
|
||||
-- Validate the list of objects for a makefile.
|
||||
-- (c) 2016-2017 Jason Perkins, Blizzard Entertainment and the Premake project
|
||||
--
|
||||
|
||||
local suite = test.declare("gmake2_objects")
|
||||
|
||||
local p = premake
|
||||
local gmake2 = p.modules.gmake2
|
||||
|
||||
|
||||
--
|
||||
-- Setup
|
||||
--
|
||||
|
||||
local wks, prj
|
||||
|
||||
function suite.setup()
|
||||
gmake2.cpp.initialize()
|
||||
wks = test.createWorkspace()
|
||||
end
|
||||
|
||||
local function prepare()
|
||||
prj = test.getproject(wks, 1)
|
||||
gmake2.cpp.createRuleTable(prj)
|
||||
gmake2.cpp.createFileTable(prj)
|
||||
gmake2.cpp.outputFilesSection(prj)
|
||||
end
|
||||
|
||||
|
||||
--
|
||||
-- If a file is listed at the project level, it should get listed in
|
||||
-- the project level objects list.
|
||||
--
|
||||
|
||||
function suite.listFileInProjectObjects()
|
||||
files { "src/hello.cpp" }
|
||||
prepare()
|
||||
test.capture [[
|
||||
# File sets
|
||||
# #############################################
|
||||
|
||||
GENERATED :=
|
||||
OBJECTS :=
|
||||
|
||||
GENERATED += $(OBJDIR)/hello.o
|
||||
OBJECTS += $(OBJDIR)/hello.o
|
||||
|
||||
]]
|
||||
end
|
||||
|
||||
|
||||
--
|
||||
-- Only buildable files should be listed.
|
||||
--
|
||||
|
||||
function suite.onlyListBuildableFiles()
|
||||
files { "include/gl.h", "src/hello.cpp" }
|
||||
prepare()
|
||||
test.capture [[
|
||||
# File sets
|
||||
# #############################################
|
||||
|
||||
GENERATED :=
|
||||
OBJECTS :=
|
||||
|
||||
GENERATED += $(OBJDIR)/hello.o
|
||||
OBJECTS += $(OBJDIR)/hello.o
|
||||
|
||||
]]
|
||||
end
|
||||
|
||||
|
||||
--
|
||||
-- A file should only be listed in the configurations to which it belongs.
|
||||
--
|
||||
|
||||
function suite.configFilesAreConditioned()
|
||||
filter "Debug"
|
||||
files { "src/hello_debug.cpp" }
|
||||
filter "Release"
|
||||
files { "src/hello_release.cpp" }
|
||||
prepare()
|
||||
test.capture [[
|
||||
# File sets
|
||||
# #############################################
|
||||
|
||||
GENERATED :=
|
||||
OBJECTS :=
|
||||
|
||||
ifeq ($(config),debug)
|
||||
GENERATED += $(OBJDIR)/hello_debug.o
|
||||
OBJECTS += $(OBJDIR)/hello_debug.o
|
||||
|
||||
else ifeq ($(config),release)
|
||||
GENERATED += $(OBJDIR)/hello_release.o
|
||||
OBJECTS += $(OBJDIR)/hello_release.o
|
||||
|
||||
endif
|
||||
|
||||
]]
|
||||
end
|
||||
|
||||
|
||||
--
|
||||
-- Two files with the same base name should have different object files.
|
||||
--
|
||||
|
||||
function suite.uniqueObjNames_onBaseNameCollision()
|
||||
files { "src/hello.cpp", "src/greetings/hello.cpp" }
|
||||
prepare()
|
||||
test.capture [[
|
||||
# File sets
|
||||
# #############################################
|
||||
|
||||
GENERATED :=
|
||||
OBJECTS :=
|
||||
|
||||
GENERATED += $(OBJDIR)/hello.o
|
||||
GENERATED += $(OBJDIR)/hello1.o
|
||||
OBJECTS += $(OBJDIR)/hello.o
|
||||
OBJECTS += $(OBJDIR)/hello1.o
|
||||
|
||||
]]
|
||||
end
|
||||
|
||||
function suite.uniqueObjNames_onBaseNameCollision2()
|
||||
files { "a/hello.cpp", "b/hello.cpp", "c/hello1.cpp" }
|
||||
prepare()
|
||||
test.capture [[
|
||||
# File sets
|
||||
# #############################################
|
||||
|
||||
GENERATED :=
|
||||
OBJECTS :=
|
||||
|
||||
GENERATED += $(OBJDIR)/hello.o
|
||||
GENERATED += $(OBJDIR)/hello1.o
|
||||
GENERATED += $(OBJDIR)/hello11.o
|
||||
OBJECTS += $(OBJDIR)/hello.o
|
||||
OBJECTS += $(OBJDIR)/hello1.o
|
||||
OBJECTS += $(OBJDIR)/hello11.o
|
||||
|
||||
]]
|
||||
end
|
||||
|
||||
function suite.uniqueObjectNames_onBaseNameCollision_Release()
|
||||
files { "a/hello.cpp", "b/hello.cpp", "c/hello1.cpp", "d/hello11.cpp" }
|
||||
filter "configurations:Debug"
|
||||
excludes {"b/hello.cpp"}
|
||||
filter "configurations:Release"
|
||||
excludes {"d/hello11.cpp"}
|
||||
|
||||
prepare()
|
||||
test.capture [[
|
||||
# File sets
|
||||
# #############################################
|
||||
|
||||
GENERATED :=
|
||||
OBJECTS :=
|
||||
|
||||
GENERATED += $(OBJDIR)/hello.o
|
||||
GENERATED += $(OBJDIR)/hello11.o
|
||||
OBJECTS += $(OBJDIR)/hello.o
|
||||
OBJECTS += $(OBJDIR)/hello11.o
|
||||
|
||||
ifeq ($(config),debug)
|
||||
GENERATED += $(OBJDIR)/hello111.o
|
||||
OBJECTS += $(OBJDIR)/hello111.o
|
||||
|
||||
else ifeq ($(config),release)
|
||||
GENERATED += $(OBJDIR)/hello1.o
|
||||
OBJECTS += $(OBJDIR)/hello1.o
|
||||
|
||||
endif
|
||||
|
||||
]]
|
||||
end
|
||||
|
||||
--
|
||||
-- Test that changes in case are treated as if multiple files of the same name are being built
|
||||
--
|
||||
|
||||
function suite.uniqueObjNames_ignoreCase1()
|
||||
files { "a/hello.cpp", "b/Hello.cpp" }
|
||||
prepare()
|
||||
test.capture [[
|
||||
# File sets
|
||||
# #############################################
|
||||
|
||||
GENERATED :=
|
||||
OBJECTS :=
|
||||
|
||||
GENERATED += $(OBJDIR)/Hello1.o
|
||||
GENERATED += $(OBJDIR)/hello.o
|
||||
OBJECTS += $(OBJDIR)/Hello1.o
|
||||
OBJECTS += $(OBJDIR)/hello.o
|
||||
|
||||
]]
|
||||
end
|
||||
|
||||
function suite.uniqueObjNames_ignoreCase2()
|
||||
files { "a/hello.cpp", "b/hello.cpp", "c/Hello1.cpp" }
|
||||
prepare()
|
||||
test.capture [[
|
||||
# File sets
|
||||
# #############################################
|
||||
|
||||
GENERATED :=
|
||||
OBJECTS :=
|
||||
|
||||
GENERATED += $(OBJDIR)/Hello11.o
|
||||
GENERATED += $(OBJDIR)/hello.o
|
||||
GENERATED += $(OBJDIR)/hello1.o
|
||||
OBJECTS += $(OBJDIR)/Hello11.o
|
||||
OBJECTS += $(OBJDIR)/hello.o
|
||||
OBJECTS += $(OBJDIR)/hello1.o
|
||||
|
||||
]]
|
||||
end
|
||||
|
||||
function suite.uniqueObjectNames_ignoreCase_Release()
|
||||
files { "a/hello.cpp", "b/hello.cpp", "c/Hello1.cpp", "d/Hello11.cpp" }
|
||||
filter "configurations:Debug"
|
||||
excludes {"b/hello.cpp"}
|
||||
filter "configurations:Release"
|
||||
excludes {"d/Hello11.cpp"}
|
||||
|
||||
prepare()
|
||||
test.capture [[
|
||||
# File sets
|
||||
# #############################################
|
||||
|
||||
GENERATED :=
|
||||
OBJECTS :=
|
||||
|
||||
GENERATED += $(OBJDIR)/Hello11.o
|
||||
GENERATED += $(OBJDIR)/hello.o
|
||||
OBJECTS += $(OBJDIR)/Hello11.o
|
||||
OBJECTS += $(OBJDIR)/hello.o
|
||||
|
||||
ifeq ($(config),debug)
|
||||
GENERATED += $(OBJDIR)/Hello111.o
|
||||
OBJECTS += $(OBJDIR)/Hello111.o
|
||||
|
||||
else ifeq ($(config),release)
|
||||
GENERATED += $(OBJDIR)/hello1.o
|
||||
OBJECTS += $(OBJDIR)/hello1.o
|
||||
|
||||
endif
|
||||
|
||||
]]
|
||||
end
|
||||
|
||||
|
||||
--
|
||||
-- If there's a custom rule which generate C++ sources build outputs should be placed
|
||||
-- in separate list so they can be cleaned up properly.
|
||||
--
|
||||
|
||||
function suite.customBuildCommand_generatedCpp()
|
||||
files { "interface.pkg","source.cpp" }
|
||||
filter "files:**.pkg"
|
||||
buildmessage "Binding pkg: %{file.name}"
|
||||
buildcommands './tolua -o %{file.basename}.cpp -H %{file.basename}.h -n %{file.basename}} %{file.abspath}'
|
||||
buildoutputs { '%{file.basename}.cpp','%{file.basename}.h' }
|
||||
prepare()
|
||||
test.capture [[
|
||||
# File sets
|
||||
# #############################################
|
||||
|
||||
CUSTOM :=
|
||||
GENERATED :=
|
||||
OBJECTS :=
|
||||
SOURCES :=
|
||||
|
||||
CUSTOM += interface.h
|
||||
GENERATED += $(OBJDIR)/interface.o
|
||||
GENERATED += $(OBJDIR)/source.o
|
||||
GENERATED += interface.cpp
|
||||
GENERATED += interface.h
|
||||
OBJECTS += $(OBJDIR)/interface.o
|
||||
OBJECTS += $(OBJDIR)/source.o
|
||||
SOURCES += interface.cpp
|
||||
]]
|
||||
end
|
||||
|
||||
--
|
||||
-- If there's a custom rule for a non-C++ file extension, make sure that those
|
||||
-- files are included in the build.
|
||||
--
|
||||
|
||||
function suite.customBuildCommand_onCustomFileType()
|
||||
files { "hello.lua" }
|
||||
filter "files:**.lua"
|
||||
buildmessage "Compiling %{file.name}"
|
||||
buildcommands {
|
||||
'luac "%{file.path}" -o "%{cfg.objdir}/%{file.basename}.luac"',
|
||||
}
|
||||
buildoutputs { "%{cfg.objdir}/%{file.basename}.luac" }
|
||||
prepare()
|
||||
test.capture [[
|
||||
# File sets
|
||||
# #############################################
|
||||
|
||||
CUSTOM :=
|
||||
GENERATED :=
|
||||
|
||||
ifeq ($(config),debug)
|
||||
CUSTOM += obj/Debug/hello.luac
|
||||
GENERATED += obj/Debug/hello.luac
|
||||
|
||||
else ifeq ($(config),release)
|
||||
CUSTOM += obj/Release/hello.luac
|
||||
GENERATED += obj/Release/hello.luac
|
||||
|
||||
endif
|
||||
]]
|
||||
end
|
||||
|
||||
|
||||
--
|
||||
-- If a custom rule builds to an object file, include it in the
|
||||
-- link automatically to match the behavior of Visual Studio
|
||||
--
|
||||
|
||||
function suite.linkBuildOutputs_onNotSpecified()
|
||||
files { "hello.x" }
|
||||
filter "files:**.x"
|
||||
buildmessage "Compiling %{file.name}"
|
||||
buildcommands {
|
||||
'cxc -c "%{file.path}" -o "%{cfg.objdir}/%{file.basename}.xo"',
|
||||
'c2o -c "%{cfg.objdir}/%{file.basename}.xo" -o "%{cfg.objdir}/%{file.basename}.obj"'
|
||||
}
|
||||
buildoutputs { "%{cfg.objdir}/%{file.basename}.obj" }
|
||||
prepare()
|
||||
test.capture [[
|
||||
# File sets
|
||||
# #############################################
|
||||
|
||||
GENERATED :=
|
||||
OBJECTS :=
|
||||
|
||||
ifeq ($(config),debug)
|
||||
GENERATED += obj/Debug/hello.obj
|
||||
OBJECTS += obj/Debug/hello.obj
|
||||
|
||||
else ifeq ($(config),release)
|
||||
GENERATED += obj/Release/hello.obj
|
||||
OBJECTS += obj/Release/hello.obj
|
||||
|
||||
endif
|
||||
]]
|
||||
end
|
||||
|
||||
|
||||
--
|
||||
-- Also include it in the link step if we explicitly specified so with
|
||||
-- linkbuildoutputs.
|
||||
--
|
||||
|
||||
function suite.linkBuildOutputs_onOn()
|
||||
files { "hello.x" }
|
||||
filter "files:**.x"
|
||||
buildmessage "Compiling %{file.name}"
|
||||
buildcommands {
|
||||
'cxc -c "%{file.path}" -o "%{cfg.objdir}/%{file.basename}.xo"',
|
||||
'c2o -c "%{cfg.objdir}/%{file.basename}.xo" -o "%{cfg.objdir}/%{file.basename}.obj"'
|
||||
}
|
||||
buildoutputs { "%{cfg.objdir}/%{file.basename}.obj" }
|
||||
linkbuildoutputs "On"
|
||||
prepare()
|
||||
test.capture [[
|
||||
# File sets
|
||||
# #############################################
|
||||
|
||||
GENERATED :=
|
||||
OBJECTS :=
|
||||
|
||||
ifeq ($(config),debug)
|
||||
GENERATED += obj/Debug/hello.obj
|
||||
OBJECTS += obj/Debug/hello.obj
|
||||
|
||||
else ifeq ($(config),release)
|
||||
GENERATED += obj/Release/hello.obj
|
||||
OBJECTS += obj/Release/hello.obj
|
||||
|
||||
endif
|
||||
]]
|
||||
end
|
||||
|
||||
|
||||
--
|
||||
-- If linkbuildoutputs says that we shouldn't include it in the link however,
|
||||
-- don't do it.
|
||||
--
|
||||
|
||||
function suite.linkBuildOutputs_onOff()
|
||||
files { "hello.x" }
|
||||
filter "files:**.x"
|
||||
buildmessage "Compiling %{file.name}"
|
||||
buildcommands {
|
||||
'cxc -c "%{file.path}" -o "%{cfg.objdir}/%{file.basename}.xo"',
|
||||
'c2o -c "%{cfg.objdir}/%{file.basename}.xo" -o "%{cfg.objdir}/%{file.basename}.obj"'
|
||||
}
|
||||
buildoutputs { "%{cfg.objdir}/%{file.basename}.obj" }
|
||||
linkbuildoutputs "Off"
|
||||
prepare()
|
||||
test.capture [[
|
||||
# File sets
|
||||
# #############################################
|
||||
|
||||
CUSTOM :=
|
||||
GENERATED :=
|
||||
|
||||
ifeq ($(config),debug)
|
||||
CUSTOM += obj/Debug/hello.obj
|
||||
GENERATED += obj/Debug/hello.obj
|
||||
|
||||
else ifeq ($(config),release)
|
||||
CUSTOM += obj/Release/hello.obj
|
||||
GENERATED += obj/Release/hello.obj
|
||||
|
||||
endif
|
||||
]]
|
||||
end
|
||||
|
||||
|
||||
--
|
||||
-- If a file is excluded from a configuration, it should not be listed.
|
||||
--
|
||||
|
||||
function suite.excludedFromBuild_onExcludedFile()
|
||||
files { "hello.cpp" }
|
||||
filter "Debug"
|
||||
removefiles { "hello.cpp" }
|
||||
prepare()
|
||||
test.capture [[
|
||||
# File sets
|
||||
# #############################################
|
||||
|
||||
GENERATED :=
|
||||
OBJECTS :=
|
||||
|
||||
ifeq ($(config),release)
|
||||
GENERATED += $(OBJDIR)/hello.o
|
||||
OBJECTS += $(OBJDIR)/hello.o
|
||||
|
||||
endif
|
||||
|
||||
]]
|
||||
end
|
||||
|
||||
function suite.excludedFromBuild_onExcludeFlag()
|
||||
files { "hello.cpp" }
|
||||
filter { "Debug", "files:hello.cpp" }
|
||||
flags { "ExcludeFromBuild" }
|
||||
prepare()
|
||||
test.capture [[
|
||||
# File sets
|
||||
# #############################################
|
||||
|
||||
GENERATED :=
|
||||
OBJECTS :=
|
||||
|
||||
ifeq ($(config),release)
|
||||
GENERATED += $(OBJDIR)/hello.o
|
||||
OBJECTS += $(OBJDIR)/hello.o
|
||||
|
||||
endif
|
||||
|
||||
]]
|
||||
end
|
||||
224
Src/external_dependencies/openmpt-trunk/include/premake/modules/gmake2/tests/test_gmake2_pch.lua
vendored
Normal file
224
Src/external_dependencies/openmpt-trunk/include/premake/modules/gmake2/tests/test_gmake2_pch.lua
vendored
Normal file
@@ -0,0 +1,224 @@
|
||||
--
|
||||
-- test_gmake2_pch.lua
|
||||
-- Validate the setup for precompiled headers in makefiles.
|
||||
-- (c) 2016-2017 Jason Perkins, Blizzard Entertainment and the Premake project
|
||||
--
|
||||
|
||||
local p = premake
|
||||
local suite = test.declare("gmake2_pch")
|
||||
|
||||
local p = premake
|
||||
local gmake2 = p.modules.gmake2
|
||||
|
||||
local project = p.project
|
||||
|
||||
|
||||
|
||||
--
|
||||
-- Setup and teardown
|
||||
--
|
||||
|
||||
local wks, prj
|
||||
function suite.setup()
|
||||
os.chdir(_TESTS_DIR)
|
||||
gmake2.cpp.initialize()
|
||||
wks, prj = test.createWorkspace()
|
||||
end
|
||||
|
||||
local function prepareVars()
|
||||
local cfg = test.getconfig(prj, "Debug")
|
||||
gmake2.cpp.pch(cfg)
|
||||
end
|
||||
|
||||
local function prepareRules()
|
||||
local cfg = test.getconfig(prj, "Debug")
|
||||
gmake2.cpp.pchRules(cfg.project)
|
||||
end
|
||||
|
||||
local function prepareFlags()
|
||||
local project = test.getproject(wks, 1)
|
||||
gmake2.cpp.createRuleTable(project)
|
||||
gmake2.cpp.createFileTable(project)
|
||||
gmake2.cpp.outputFileRuleSection(project)
|
||||
end
|
||||
|
||||
--
|
||||
-- If no header has been set, nothing should be output.
|
||||
--
|
||||
|
||||
function suite.noConfig_onNoHeaderSet()
|
||||
prepareVars()
|
||||
test.isemptycapture()
|
||||
end
|
||||
|
||||
|
||||
--
|
||||
-- If a header is set, but the NoPCH flag is also set, then
|
||||
-- nothing should be output.
|
||||
--
|
||||
|
||||
function suite.noConfig_onHeaderAndNoPCHFlag()
|
||||
pchheader "include/myproject.h"
|
||||
flags "NoPCH"
|
||||
|
||||
files { 'a.cpp', 'b.cpp' }
|
||||
|
||||
prepareFlags()
|
||||
test.capture [[
|
||||
# File Rules
|
||||
# #############################################
|
||||
|
||||
$(OBJDIR)/a.o: a.cpp
|
||||
@echo $(notdir $<)
|
||||
$(SILENT) $(CXX) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<"
|
||||
$(OBJDIR)/b.o: b.cpp
|
||||
@echo $(notdir $<)
|
||||
$(SILENT) $(CXX) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<"
|
||||
]]
|
||||
end
|
||||
|
||||
|
||||
--
|
||||
-- If a header is specified and the NoPCH flag is not set, then
|
||||
-- the header can be used.
|
||||
--
|
||||
|
||||
function suite.config_onPchEnabled()
|
||||
pchheader "include/myproject.h"
|
||||
prepareVars()
|
||||
test.capture [[
|
||||
PCH = include/myproject.h
|
||||
PCH_PLACEHOLDER = $(OBJDIR)/$(notdir $(PCH))
|
||||
GCH = $(PCH_PLACEHOLDER).gch
|
||||
]]
|
||||
end
|
||||
|
||||
|
||||
--
|
||||
-- The PCH can be specified relative the an includes search path.
|
||||
--
|
||||
|
||||
function suite.pch_searchesIncludeDirs()
|
||||
pchheader "premake.h"
|
||||
includedirs { "../../../src/host" }
|
||||
prepareVars()
|
||||
test.capture [[
|
||||
PCH = ../../../src/host/premake.h
|
||||
]]
|
||||
end
|
||||
|
||||
|
||||
--
|
||||
-- Verify the format of the PCH rules block for a C++ file.
|
||||
--
|
||||
|
||||
function suite.buildRules_onCpp()
|
||||
pchheader "include/myproject.h"
|
||||
prepareRules()
|
||||
test.capture [[
|
||||
ifneq (,$(PCH))
|
||||
$(OBJECTS): $(GCH) | $(PCH_PLACEHOLDER)
|
||||
$(GCH): $(PCH) | prebuild
|
||||
@echo $(notdir $<)
|
||||
$(SILENT) $(CXX) -x c++-header $(ALL_CXXFLAGS) -o "$@" -MF "$(@:%.gch=%.d)" -c "$<"
|
||||
$(PCH_PLACEHOLDER): $(GCH) | $(OBJDIR)
|
||||
ifeq (posix,$(SHELLTYPE))
|
||||
$(SILENT) touch "$@"
|
||||
else
|
||||
$(SILENT) echo $null >> "$@"
|
||||
endif
|
||||
else
|
||||
$(OBJECTS): | prebuild
|
||||
endif
|
||||
]]
|
||||
end
|
||||
|
||||
|
||||
--
|
||||
-- Verify the format of the PCH rules block for a C file.
|
||||
--
|
||||
|
||||
function suite.buildRules_onC()
|
||||
language "C"
|
||||
pchheader "include/myproject.h"
|
||||
prepareRules()
|
||||
test.capture [[
|
||||
ifneq (,$(PCH))
|
||||
$(OBJECTS): $(GCH) | $(PCH_PLACEHOLDER)
|
||||
$(GCH): $(PCH) | prebuild
|
||||
@echo $(notdir $<)
|
||||
$(SILENT) $(CC) -x c-header $(ALL_CFLAGS) -o "$@" -MF "$(@:%.gch=%.d)" -c "$<"
|
||||
$(PCH_PLACEHOLDER): $(GCH) | $(OBJDIR)
|
||||
ifeq (posix,$(SHELLTYPE))
|
||||
$(SILENT) touch "$@"
|
||||
else
|
||||
$(SILENT) echo $null >> "$@"
|
||||
endif
|
||||
else
|
||||
$(OBJECTS): | prebuild
|
||||
endif
|
||||
]]
|
||||
end
|
||||
|
||||
|
||||
|
||||
--
|
||||
-- If the header is located on one of the include file
|
||||
-- search directories, it should get found automatically.
|
||||
--
|
||||
|
||||
function suite.findsPCH_onIncludeDirs()
|
||||
location "MyProject"
|
||||
pchheader "premake.h"
|
||||
includedirs { "../../../src/host" }
|
||||
prepareVars()
|
||||
test.capture [[
|
||||
PCH = ../../../../src/host/premake.h
|
||||
]]
|
||||
end
|
||||
|
||||
--
|
||||
-- If the header is located on one of the include file
|
||||
-- search directories, it should get found automatically.
|
||||
--
|
||||
|
||||
function suite.PCHFlag()
|
||||
pchheader "include/myproject.h"
|
||||
|
||||
files { 'a.cpp', 'b.cpp' }
|
||||
|
||||
prepareFlags()
|
||||
test.capture [[
|
||||
# File Rules
|
||||
# #############################################
|
||||
|
||||
$(OBJDIR)/a.o: a.cpp
|
||||
@echo $(notdir $<)
|
||||
$(SILENT) $(CXX) -include $(PCH_PLACEHOLDER) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<"
|
||||
$(OBJDIR)/b.o: b.cpp
|
||||
@echo $(notdir $<)
|
||||
$(SILENT) $(CXX) -include $(PCH_PLACEHOLDER) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<"
|
||||
]]
|
||||
end
|
||||
|
||||
function suite.PCHFlag_PerFile()
|
||||
pchheader "include/myproject.h"
|
||||
|
||||
files { 'a.cpp', 'b.cpp' }
|
||||
|
||||
filter { "files:a.cpp" }
|
||||
flags "NoPCH"
|
||||
|
||||
prepareFlags()
|
||||
test.capture [[
|
||||
# File Rules
|
||||
# #############################################
|
||||
|
||||
$(OBJDIR)/a.o: a.cpp
|
||||
@echo $(notdir $<)
|
||||
$(SILENT) $(CXX) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<"
|
||||
$(OBJDIR)/b.o: b.cpp
|
||||
@echo $(notdir $<)
|
||||
$(SILENT) $(CXX) -include $(PCH_PLACEHOLDER) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<"
|
||||
]]
|
||||
end
|
||||
@@ -0,0 +1,110 @@
|
||||
--
|
||||
-- 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
|
||||
|
||||
function suite.perfile_cxxApi()
|
||||
files { 'a.cpp', 'b.cpp', 'c.cpp' }
|
||||
|
||||
visibility "Hidden"
|
||||
|
||||
filter { 'files:b.cpp' }
|
||||
visibility "Protected"
|
||||
|
||||
prepare()
|
||||
test.capture [[
|
||||
# Per File Configurations
|
||||
# #############################################
|
||||
|
||||
PERFILE_FLAGS_0 = $(ALL_CXXFLAGS) -fvisibility=protected
|
||||
]]
|
||||
end
|
||||
|
||||
function suite.perfile_compileas()
|
||||
files { 'a.c', 'b.cpp' }
|
||||
|
||||
filter { 'files:a.c' }
|
||||
compileas "Objective-C"
|
||||
filter { 'files:b.cpp' }
|
||||
compileas "Objective-C++"
|
||||
|
||||
prepare()
|
||||
test.capture [[
|
||||
# Per File Configurations
|
||||
# #############################################
|
||||
|
||||
PERFILE_FLAGS_0 = $(ALL_CFLAGS) -x objective-c
|
||||
PERFILE_FLAGS_1 = $(ALL_CXXFLAGS) -x objective-c++
|
||||
]]
|
||||
end
|
||||
@@ -0,0 +1,60 @@
|
||||
--
|
||||
-- test_gmake2_target_rules.lua
|
||||
-- Validate the makefile target building rules.
|
||||
-- (c) 2016-2017 Jason Perkins, Blizzard Entertainment and the Premake project
|
||||
--
|
||||
|
||||
local p = premake
|
||||
local suite = test.declare("gmake2_target_rules")
|
||||
|
||||
local p = premake
|
||||
local gmake2 = p.modules.gmake2
|
||||
|
||||
local project = p.project
|
||||
|
||||
|
||||
--
|
||||
-- Setup
|
||||
--
|
||||
|
||||
local wks, prj
|
||||
|
||||
function suite.setup()
|
||||
wks, prj = test.createWorkspace()
|
||||
end
|
||||
|
||||
local function prepare()
|
||||
local cfg = test.getconfig(prj, "Debug")
|
||||
gmake2.cpp.allRules(cfg)
|
||||
end
|
||||
|
||||
|
||||
--
|
||||
-- Check the default, normal format of the rules.
|
||||
--
|
||||
|
||||
function suite.defaultRules()
|
||||
prepare()
|
||||
test.capture [[
|
||||
all: $(TARGET)
|
||||
@:
|
||||
]]
|
||||
end
|
||||
|
||||
|
||||
--
|
||||
-- Check rules for an OS X Cocoa application.
|
||||
--
|
||||
|
||||
function suite.osxWindowedAppRules()
|
||||
system "MacOSX"
|
||||
kind "WindowedApp"
|
||||
prepare()
|
||||
test.capture [[
|
||||
all: $(TARGET) $(dir $(TARGETDIR))PkgInfo $(dir $(TARGETDIR))Info.plist
|
||||
@:
|
||||
|
||||
$(dir $(TARGETDIR))PkgInfo:
|
||||
$(dir $(TARGETDIR))Info.plist:
|
||||
]]
|
||||
end
|
||||
@@ -0,0 +1,36 @@
|
||||
--
|
||||
-- test_gmake2_tools.lua
|
||||
-- Tests for tools support in makefiles.
|
||||
-- (c) 2016-2017 Jason Perkins, Blizzard Entertainment and the Premake project
|
||||
--
|
||||
|
||||
local suite = test.declare("gmake2_tools")
|
||||
|
||||
local p = premake
|
||||
local gmake2 = p.modules.gmake2
|
||||
|
||||
local project = premake.project
|
||||
|
||||
|
||||
--
|
||||
-- Setup
|
||||
--
|
||||
|
||||
local cfg
|
||||
|
||||
function suite.setup()
|
||||
local wks, prj = test.createWorkspace()
|
||||
cfg = test.getconfig(prj, "Debug")
|
||||
end
|
||||
|
||||
|
||||
--
|
||||
-- Make sure that the correct tools are used.
|
||||
--
|
||||
|
||||
function suite.usesCorrectTools()
|
||||
gmake2.cpp.tools(cfg, p.tools.gcc)
|
||||
test.capture [[
|
||||
RESCOMP = windres
|
||||
]]
|
||||
end
|
||||
Reference in New Issue
Block a user