Merge pull request #610 from mikisch81/vstudio-makefile-proj-includes-defines
Apply includedirs and defines for makefile projects in Visual Studio
This commit is contained in:
commit
e91bc6d57e
@ -237,6 +237,8 @@
|
||||
m.nmakeCommandLine(cfg, cfg.buildcommands, "Build")
|
||||
m.nmakeCommandLine(cfg, cfg.rebuildcommands, "ReBuild")
|
||||
m.nmakeCommandLine(cfg, cfg.cleancommands, "Clean")
|
||||
m.nmakePreprocessorDefinitions(cfg, cfg.defines, false, nil)
|
||||
m.nmakeIncludeDirs(cfg, cfg.includedirs)
|
||||
p.pop('</PropertyGroup>')
|
||||
end
|
||||
end
|
||||
@ -1671,7 +1673,25 @@
|
||||
m.element("NMakeOutput", nil, "$(OutDir)%s", cfg.buildtarget.name)
|
||||
end
|
||||
|
||||
function m.nmakePreprocessorDefinitions(cfg, defines, escapeQuotes, condition)
|
||||
if #defines > 0 then
|
||||
defines = table.concat(defines, ";")
|
||||
if escapeQuotes then
|
||||
defines = defines:gsub('"', '\\"')
|
||||
end
|
||||
defines = p.esc(defines) .. ";$(NMakePreprocessorDefinitions)"
|
||||
m.element('NMakePreprocessorDefinitions', condition, defines)
|
||||
end
|
||||
end
|
||||
|
||||
function m.nmakeIncludeDirs(cfg, includedirs)
|
||||
if #includedirs > 0 then
|
||||
local dirs = vstudio.path(cfg, includedirs)
|
||||
if #dirs > 0 then
|
||||
m.element("NMakeIncludeSearchPath", nil, "%s", table.concat(dirs, ";"))
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function m.objectFileName(fcfg)
|
||||
if fcfg.objname ~= fcfg.basename then
|
||||
|
@ -114,3 +114,25 @@ command 2</NMakeBuildCommandLine>
|
||||
</PropertyGroup>
|
||||
]]
|
||||
end
|
||||
|
||||
function suite.onDefines()
|
||||
defines { "DEBUG", "_DEBUG" }
|
||||
prepare()
|
||||
test.capture [[
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<NMakeOutput>$(OutDir)MyProject</NMakeOutput>
|
||||
<NMakePreprocessorDefinitions>DEBUG;_DEBUG;$(NMakePreprocessorDefinitions)</NMakePreprocessorDefinitions>
|
||||
</PropertyGroup>
|
||||
]]
|
||||
end
|
||||
|
||||
function suite.onIncludeDirs()
|
||||
includedirs { "include/lua", "include/zlib" }
|
||||
prepare()
|
||||
test.capture [[
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<NMakeOutput>$(OutDir)MyProject</NMakeOutput>
|
||||
<NMakeIncludeSearchPath>include\lua;include\zlib</NMakeIncludeSearchPath>
|
||||
</PropertyGroup>
|
||||
]]
|
||||
end
|
||||
|
Reference in New Issue
Block a user