Improved extensibility of VC2010 generator
This commit is contained in:
parent
f625e01848
commit
309a76cb8a
@ -92,14 +92,16 @@
|
|||||||
-- Studio compatible identifier.
|
-- Studio compatible identifier.
|
||||||
--
|
--
|
||||||
|
|
||||||
|
vstudio.architectures =
|
||||||
|
{
|
||||||
|
x64 = "x64",
|
||||||
|
xbox360 = "Xbox 360",
|
||||||
|
}
|
||||||
|
|
||||||
function vstudio.architecture(cfg)
|
function vstudio.architecture(cfg)
|
||||||
if cfg.system == premake.XBOX360 then
|
return vstudio.architectures[cfg.architecture] or
|
||||||
return "Xbox 360"
|
vstudio.architectures[cfg.system] or
|
||||||
end
|
"Win32"
|
||||||
if cfg.architecture == "x32" then
|
|
||||||
return "Win32"
|
|
||||||
end
|
|
||||||
return cfg.architecture or "Win32"
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
@ -45,9 +45,9 @@
|
|||||||
|
|
||||||
for cfg in project.eachconfig(prj) do
|
for cfg in project.eachconfig(prj) do
|
||||||
_p(1,'<ItemDefinitionGroup %s>', vc2010.condition(cfg))
|
_p(1,'<ItemDefinitionGroup %s>', vc2010.condition(cfg))
|
||||||
vc2010.clcompile_ng(cfg)
|
vc2010.clCompile(cfg)
|
||||||
vc2010.resourceCompile(cfg)
|
vc2010.resourceCompile(cfg)
|
||||||
vc2010.link_ng(cfg)
|
vc2010.link(cfg)
|
||||||
vc2010.buildEvents(cfg)
|
vc2010.buildEvents(cfg)
|
||||||
_p(1,'</ItemDefinitionGroup>')
|
_p(1,'</ItemDefinitionGroup>')
|
||||||
end
|
end
|
||||||
@ -191,7 +191,7 @@
|
|||||||
-- Write the the <ClCompile> compiler settings block.
|
-- Write the the <ClCompile> compiler settings block.
|
||||||
--
|
--
|
||||||
|
|
||||||
function vc2010.clcompile_ng(cfg)
|
function vc2010.clCompile(cfg)
|
||||||
_p(2,'<ClCompile>')
|
_p(2,'<ClCompile>')
|
||||||
|
|
||||||
if not cfg.flags.NoPCH and cfg.pchheader then
|
if not cfg.flags.NoPCH and cfg.pchheader then
|
||||||
@ -303,7 +303,7 @@
|
|||||||
-- Write out the linker tool block.
|
-- Write out the linker tool block.
|
||||||
--
|
--
|
||||||
|
|
||||||
function vc2010.link_ng(cfg)
|
function vc2010.link(cfg)
|
||||||
_p(2,'<Link>')
|
_p(2,'<Link>')
|
||||||
|
|
||||||
local subsystem = iif(cfg.kind == premake.CONSOLEAPP, "Console", "Windows")
|
local subsystem = iif(cfg.kind == premake.CONSOLEAPP, "Console", "Windows")
|
||||||
@ -328,17 +328,8 @@
|
|||||||
end
|
end
|
||||||
|
|
||||||
function vc2010.link_dynamic(cfg)
|
function vc2010.link_dynamic(cfg)
|
||||||
local links = config.getlinks(cfg, "system", "fullpath")
|
vc2010.additionalDependencies(cfg)
|
||||||
if #links > 0 then
|
vc2010.additionalLibraryDirectories(cfg)
|
||||||
links = path.translate(table.concat(links, ";"))
|
|
||||||
_x(3,'<AdditionalDependencies>%s;%%(AdditionalDependencies)</AdditionalDependencies>', links)
|
|
||||||
end
|
|
||||||
|
|
||||||
if #cfg.libdirs > 0 then
|
|
||||||
local dirs = project.getrelative(cfg.project, cfg.libdirs)
|
|
||||||
dirs = path.translate(table.concat(dirs, ";"))
|
|
||||||
_x(3,'<AdditionalLibraryDirectories>%s;%%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>', dirs)
|
|
||||||
end
|
|
||||||
|
|
||||||
if vc2010.config_type(cfg) == "Application" and not cfg.flags.WinMain and not cfg.flags.Managed then
|
if vc2010.config_type(cfg) == "Application" and not cfg.flags.WinMain and not cfg.flags.Managed then
|
||||||
_p(3,'<EntryPointSymbol>mainCRTStartup</EntryPointSymbol>')
|
_p(3,'<EntryPointSymbol>mainCRTStartup</EntryPointSymbol>')
|
||||||
@ -463,6 +454,19 @@
|
|||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
--
|
||||||
|
-- Write out the linker's additionalDependencies element.
|
||||||
|
--
|
||||||
|
|
||||||
|
function vc2010.additionalDependencies(cfg)
|
||||||
|
local links = config.getlinks(cfg, "system", "fullpath")
|
||||||
|
if #links > 0 then
|
||||||
|
links = path.translate(table.concat(links, ";"))
|
||||||
|
_x(3,'<AdditionalDependencies>%s;%%(AdditionalDependencies)</AdditionalDependencies>', links)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
--
|
--
|
||||||
-- Write out the <AdditionalIncludeDirectories> element, which is used by
|
-- Write out the <AdditionalIncludeDirectories> element, which is used by
|
||||||
-- both the compiler and resource compiler blocks.
|
-- both the compiler and resource compiler blocks.
|
||||||
@ -477,6 +481,19 @@
|
|||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
--
|
||||||
|
-- Write out the linker's <AdditionalLibraryDirectories> element.
|
||||||
|
--
|
||||||
|
|
||||||
|
function vc2010.additionalLibraryDirectories(cfg)
|
||||||
|
if #cfg.libdirs > 0 then
|
||||||
|
local dirs = project.getrelative(cfg.project, cfg.libdirs)
|
||||||
|
dirs = path.translate(table.concat(dirs, ";"))
|
||||||
|
_x(3,'<AdditionalLibraryDirectories>%s;%%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>', dirs)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
--
|
--
|
||||||
-- Write out the <AdditionalOptions> element for the linker blocks.
|
-- Write out the <AdditionalOptions> element for the linker blocks.
|
||||||
--
|
--
|
||||||
@ -806,7 +823,7 @@
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
function vc2010.clcompile(cfg)
|
function vc2010.clcompile_old(cfg)
|
||||||
_p(2,'<ClCompile>')
|
_p(2,'<ClCompile>')
|
||||||
|
|
||||||
if #cfg.buildoptions > 0 then
|
if #cfg.buildoptions > 0 then
|
||||||
@ -935,7 +952,7 @@
|
|||||||
-- Generate the <Link> element and its children.
|
-- Generate the <Link> element and its children.
|
||||||
--
|
--
|
||||||
|
|
||||||
function vc2010.link(cfg)
|
function vc2010.link_old(cfg)
|
||||||
_p(2,'<Link>')
|
_p(2,'<Link>')
|
||||||
_p(3,'<SubSystem>%s</SubSystem>', iif(cfg.kind == "ConsoleApp", "Console", "Windows"))
|
_p(3,'<SubSystem>%s</SubSystem>', iif(cfg.kind == "ConsoleApp", "Console", "Windows"))
|
||||||
_p(3,'<GenerateDebugInformation>%s</GenerateDebugInformation>', tostring(cfg.flags.Symbols ~= nil))
|
_p(3,'<GenerateDebugInformation>%s</GenerateDebugInformation>', tostring(cfg.flags.Symbols ~= nil))
|
||||||
@ -946,7 +963,7 @@
|
|||||||
end
|
end
|
||||||
|
|
||||||
if cfg.kind ~= 'StaticLib' then
|
if cfg.kind ~= 'StaticLib' then
|
||||||
vc2010.additionalDependencies(cfg)
|
vc2010.additionalDependencies_old(cfg)
|
||||||
_p(3,'<OutputFile>$(OutDir)%s</OutputFile>', cfg.buildtarget.name)
|
_p(3,'<OutputFile>$(OutDir)%s</OutputFile>', cfg.buildtarget.name)
|
||||||
|
|
||||||
if #cfg.libdirs > 0 then
|
if #cfg.libdirs > 0 then
|
||||||
@ -973,7 +990,7 @@
|
|||||||
-- by an <ItemGroup/ProjectReference>).
|
-- by an <ItemGroup/ProjectReference>).
|
||||||
--
|
--
|
||||||
|
|
||||||
function vc2010.additionalDependencies(cfg)
|
function vc2010.additionalDependencies_old(cfg)
|
||||||
local links = premake.getlinks(cfg, "system", "fullpath")
|
local links = premake.getlinks(cfg, "system", "fullpath")
|
||||||
if #links > 0 then
|
if #links > 0 then
|
||||||
_p(3,'<AdditionalDependencies>%s;%%(AdditionalDependencies)</AdditionalDependencies>',
|
_p(3,'<AdditionalDependencies>%s;%%(AdditionalDependencies)</AdditionalDependencies>',
|
||||||
@ -987,10 +1004,10 @@
|
|||||||
local cfg = premake.getconfig(prj, cfginfo.src_buildcfg, cfginfo.src_platform)
|
local cfg = premake.getconfig(prj, cfginfo.src_buildcfg, cfginfo.src_platform)
|
||||||
_p(1,'<ItemDefinitionGroup ' ..if_config_and_platform() ..'>'
|
_p(1,'<ItemDefinitionGroup ' ..if_config_and_platform() ..'>'
|
||||||
,premake.esc(cfginfo.name))
|
,premake.esc(cfginfo.name))
|
||||||
vc2010.clcompile(cfg)
|
vc2010.clcompile_old(cfg)
|
||||||
resource_compile(cfg)
|
resource_compile(cfg)
|
||||||
item_def_lib(cfg)
|
item_def_lib(cfg)
|
||||||
vc2010.link(cfg)
|
vc2010.link_old(cfg)
|
||||||
event_hooks(cfg)
|
event_hooks(cfg)
|
||||||
_p(1,'</ItemDefinitionGroup>')
|
_p(1,'</ItemDefinitionGroup>')
|
||||||
|
|
||||||
|
@ -22,7 +22,7 @@
|
|||||||
|
|
||||||
local function prepare(platform)
|
local function prepare(platform)
|
||||||
cfg = project.getconfig(prj, "Debug", platform)
|
cfg = project.getconfig(prj, "Debug", platform)
|
||||||
vc2010.clcompile_ng(cfg)
|
vc2010.clCompile(cfg)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
@ -24,7 +24,7 @@
|
|||||||
|
|
||||||
local function prepare(platform)
|
local function prepare(platform)
|
||||||
cfg = project.getconfig(prj, "Debug", platform)
|
cfg = project.getconfig(prj, "Debug", platform)
|
||||||
vc2010.link_ng(cfg)
|
vc2010.link(cfg)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user