Ported VC2010 resource compiler block
This commit is contained in:
parent
a01df4bc83
commit
7d7d95e8f2
@ -46,8 +46,10 @@
|
||||
for cfg in project.eachconfig(prj) do
|
||||
_p(1,'<ItemDefinitionGroup %s>', vc2010.condition(cfg))
|
||||
vc2010.clcompile_ng(cfg)
|
||||
vc2010.resourceCompile(cfg)
|
||||
|
||||
--[[
|
||||
|
||||
resource_compile(cfg)
|
||||
item_def_lib(cfg)
|
||||
vc2010.link(cfg)
|
||||
@ -216,16 +218,8 @@
|
||||
_p(3,'<TreatWarningAsError>true</TreatWarningAsError>')
|
||||
end
|
||||
|
||||
if #cfg.defines > 0 then
|
||||
local defines = table.concat(cfg.defines, ";")
|
||||
_x(3,'<PreprocessorDefinitions>%s;%%(PreprocessorDefinitions)</PreprocessorDefinitions>', defines)
|
||||
end
|
||||
|
||||
if #cfg.includedirs > 0 then
|
||||
local dirs = path.translate(table.concat(project.getrelative(cfg.project, cfg.includedirs), ";"))
|
||||
_x(3,'<AdditionalIncludeDirectories>%s;%%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>', dirs)
|
||||
end
|
||||
|
||||
vc2010.preprocessorDefinitions(cfg.defines)
|
||||
vc2010.additionalIncludeDirectories(cfg, cfg.includedirs)
|
||||
vc2010.debuginfo(cfg)
|
||||
|
||||
if cfg.flags.Symbols and cfg.debugformat ~= "c7" then
|
||||
@ -299,6 +293,31 @@
|
||||
_p(2,'</ClCompile>')
|
||||
end
|
||||
|
||||
--
|
||||
-- Write out the resource compiler block.
|
||||
--
|
||||
|
||||
function vc2010.resourceCompile(cfg)
|
||||
_p(2,'<ResourceCompile>')
|
||||
vc2010.preprocessorDefinitions(table.join(cfg.defines, cfg.resdefines))
|
||||
vc2010.additionalIncludeDirectories(cfg, table.join(cfg.includedirs, cfg.resincludedirs))
|
||||
_p(2,'</ResourceCompile>')
|
||||
end
|
||||
|
||||
|
||||
--
|
||||
-- Write out the <AdditionalIncludeDirectories> element, which is used by
|
||||
-- both the compiler and resource compiler blocks.
|
||||
--
|
||||
|
||||
function vc2010.additionalIncludeDirectories(cfg, includedirs)
|
||||
if #includedirs > 0 then
|
||||
local dirs = project.getrelative(cfg.project, includedirs)
|
||||
dirs = path.translate(table.concat(dirs, ";"))
|
||||
_x(3,'<AdditionalIncludeDirectories>%s;%%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>', dirs)
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
--
|
||||
-- Format and return a Visual Studio Condition attribute.
|
||||
@ -368,6 +387,19 @@
|
||||
end
|
||||
|
||||
|
||||
--
|
||||
-- Write out a <PreprocessorDefinitions> element, used by both the compiler
|
||||
-- and resource compiler blocks.
|
||||
--
|
||||
|
||||
function vc2010.preprocessorDefinitions(defines)
|
||||
if #defines > 0 then
|
||||
defines = table.concat(defines, ";")
|
||||
_x(3,'<PreprocessorDefinitions>%s;%%(PreprocessorDefinitions)</PreprocessorDefinitions>', defines)
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
|
||||
-----------------------------------------------------------------------------
|
||||
-- Everything below this point is a candidate for deprecation
|
||||
|
@ -1,6 +1,6 @@
|
||||
--
|
||||
-- tests/actions/vstudio/vc2010/test_compile_settings.lua
|
||||
-- Validate linker settings in Visual Studio 2010 C/C++ projects.
|
||||
-- Validate compiler settings in Visual Studio 2010 C/C++ projects.
|
||||
-- Copyright (c) 2011-2012 Jason Perkins and the Premake project
|
||||
--
|
||||
|
||||
|
68
tests/actions/vstudio/vc2010/test_resource_compile.lua
Executable file
68
tests/actions/vstudio/vc2010/test_resource_compile.lua
Executable file
@ -0,0 +1,68 @@
|
||||
--
|
||||
-- tests/actions/vstudio/vc2010/test_resource_compile.lua
|
||||
-- Validate resource compiler settings in Visual Studio 2010 C/C++ projects.
|
||||
-- Copyright (c) 2011-2012 Jason Perkins and the Premake project
|
||||
--
|
||||
|
||||
T.vstudio_vs2010_resource_compiler = { }
|
||||
local suite = T.vstudio_vs2010_resource_compiler
|
||||
local vc2010 = premake.vstudio.vc2010
|
||||
local project = premake5.project
|
||||
|
||||
|
||||
--
|
||||
-- Setup
|
||||
--
|
||||
|
||||
local sln, prj, cfg
|
||||
|
||||
function suite.setup()
|
||||
sln, prj = test.createsolution()
|
||||
end
|
||||
|
||||
local function prepare(platform)
|
||||
cfg = project.getconfig(prj, "Debug", platform)
|
||||
vc2010.resourceCompile(cfg)
|
||||
end
|
||||
|
||||
|
||||
--
|
||||
-- Check the basic element structure with default settings.
|
||||
--
|
||||
|
||||
function suite.defaultSettings()
|
||||
prepare()
|
||||
test.capture [[
|
||||
<ResourceCompile>
|
||||
</ResourceCompile>
|
||||
]]
|
||||
end
|
||||
|
||||
--
|
||||
-- If defines are specified, the <PreprocessorDefinitions> element should be added.
|
||||
--
|
||||
|
||||
function suite.preprocessorDefinitions_onDefines()
|
||||
defines { "DEBUG" }
|
||||
resdefines { "RESOURCES" }
|
||||
prepare()
|
||||
test.capture [[
|
||||
<ResourceCompile>
|
||||
<PreprocessorDefinitions>DEBUG;RESOURCES;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
]]
|
||||
end
|
||||
|
||||
|
||||
--
|
||||
-- If include directories are specified, the <AdditionalIncludeDirectories> should be added.
|
||||
--
|
||||
|
||||
function suite.additionalIncludeDirs_onIncludeDirs()
|
||||
includedirs { "include/lua" }
|
||||
resincludedirs { "include/zlib" }
|
||||
prepare()
|
||||
test.capture [[
|
||||
<ResourceCompile>
|
||||
<AdditionalIncludeDirectories>include\lua;include\zlib;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
]]
|
||||
end
|
@ -130,6 +130,7 @@
|
||||
dofile("actions/vstudio/vc2010/test_pch.lua")
|
||||
dofile("actions/vstudio/vc2010/test_project_configs.lua")
|
||||
dofile("actions/vstudio/vc2010/test_prop_sheet.lua")
|
||||
dofile("actions/vstudio/vc2010/test_resource_compile.lua")
|
||||
|
||||
-- Makefile tests
|
||||
dofile("actions/make/test_make_escaping.lua")
|
||||
|
Reference in New Issue
Block a user