VC200x resource compiler include paths are now project relative

This commit is contained in:
Jason Perkins 2012-02-22 16:20:21 -05:00
parent e0a6ca727c
commit 79e84920bd
4 changed files with 78 additions and 26 deletions

View File

@ -210,11 +210,8 @@
_p(4,'OmitFramePointers="%s"', bool(true))
end
vc200x.additionalIncludeDirectories(cfg)
if #cfg.defines > 0 then
_x(4,'PreprocessorDefinitions="%s"', table.concat(cfg.defines, ";"))
end
vc200x.additionalIncludeDirectories(cfg, cfg.includedirs)
vc200x.preprocessorDefinitions(cfg, cfg.defines)
if premake.config.isdebugbuild(cfg) and
cfg.debugformat ~= "c7" and
@ -324,11 +321,8 @@
_x(4,'AdditionalOptions="%s"', table.concat(buildoptions, " "))
end
vc200x.additionalIncludeDirectories(cfg)
if #cfg.defines > 0 then
_x(4,'PreprocessorDefinitions="%s"', table.concat(cfg.defines, ";"))
end
vc200x.additionalIncludeDirectories(cfg, cfg.includedirs)
vc200x.preprocessorDefinitions(cfg, cfg.defines)
_x(4,'ProgramDataBaseFileName="$(OutDir)\\%s.pdb"', config.gettargetinfo(cfg).basename)
@ -497,16 +491,9 @@
_x(4,'AdditionalOptions="%s"', table.concat(cfg.resoptions, " "))
end
if #cfg.defines > 0 or #cfg.resdefines > 0 then
local defines = table.join(cfg.defines, cfg.resdefines)
_x(4,'PreprocessorDefinitions="%s"', table.concat(defines, ";"))
end
if #cfg.includedirs > 0 or #cfg.resincludedirs > 0 then
local dirs = table.join(cfg.includedirs, cfg.resincludedirs)
_x(4,'AdditionalIncludeDirectories="%s"', path.translate(table.concat(dirs, ";")))
end
vc200x.additionalIncludeDirectories(cfg, table.join(cfg.includedirs, cfg.resincludedirs))
vc200x.preprocessorDefinitions(cfg, table.join(cfg.defines, cfg.resdefines))
_p(3,'/>')
end
@ -794,9 +781,9 @@
-- various compiler tool variations.
--
function vc200x.additionalIncludeDirectories(cfg)
if #cfg.includedirs > 0 then
local dirs = project.getrelative(cfg.project, cfg.includedirs)
function vc200x.additionalIncludeDirectories(cfg, includedirs)
if #includedirs > 0 then
local dirs = project.getrelative(cfg.project, includedirs)
_x(4,'AdditionalIncludeDirectories="%s"', path.translate(table.concat(dirs, ";")))
end
end
@ -881,6 +868,16 @@
end
--
-- Output the list of preprocessor symbols.
function vc200x.preprocessorDefinitions(cfg, defines)
if #defines > 0 then
_x(4,'PreprocessorDefinitions="%s"', table.concat(defines, ";"))
end
end
--
-- Output the correct project version attribute for the current action.
--

View File

@ -43,9 +43,6 @@
--
function project.eachconfig(prj, field, filename)
-- local buildconfigs = prj.solution.configurations or {}
-- local platforms = prj.solution.platforms or {}
local buildconfigs = prj.configurations or {}
local platforms = prj.platforms or {}

View File

@ -0,0 +1,57 @@
--
-- tests/actions/vstudio/vc200x/test_resource_compiler.lua
-- Validate generation the VCResourceCompilerTool element in Visual Studio 200x C/C++ projects.
-- Copyright (c) 2012 Jason Perkins and the Premake project
--
T.vs200x_resource_compiler = { }
local suite = T.vs200x_resource_compiler
local vc200x = premake.vstudio.vc200x
--
-- Setup/teardown
--
local sln, prj, cfg
function suite.setup()
_ACTION = "vs2008"
sln, prj = test.createsolution()
end
local function prepare()
cfg = premake5.project.getconfig(prj, "Debug")
vc200x.VCResourceCompilerTool_ng(cfg)
end
--
-- Verify the basic structure of the compiler block with no flags or settings.
--
function suite.looksGood_onDefaultSettings()
prepare()
test.capture [[
<Tool
Name="VCResourceCompilerTool"
/>
]]
end
--
-- Both includedirs and resincludedirs should be used.
--
function suite.usesBothIncludeAndResIncludeDirs()
includedirs { "../include" }
resincludedirs { "../res/include" }
prepare()
test.capture [[
<Tool
Name="VCResourceCompilerTool"
AdditionalIncludeDirectories="..\include;..\res\include"
/>
]]
end

View File

@ -120,6 +120,7 @@
dofile("actions/vstudio/vc200x/test_mfc.lua")
dofile("actions/vstudio/vc200x/test_platforms.lua")
dofile("actions/vstudio/vc200x/test_project.lua")
dofile("actions/vstudio/vc200x/test_resource_compiler.lua")
-- Visual Studio 2010 C/C++ projects
dofile("actions/vstudio/vc2010/test_compile_settings.lua")