2012-08-01 19:28:21 +00:00
|
|
|
--
|
|
|
|
-- vs2010_vcxproj.lua
|
|
|
|
-- Generate a Visual Studio 201x C/C++ project.
|
2014-02-08 15:44:57 +00:00
|
|
|
-- Copyright (c) 2009-2014 Jason Perkins and the Premake project
|
2012-08-01 19:28:21 +00:00
|
|
|
--
|
|
|
|
|
2012-11-27 15:18:06 +00:00
|
|
|
premake.vstudio.vc2010 = {}
|
2013-07-12 15:07:26 +00:00
|
|
|
|
2014-02-08 15:44:57 +00:00
|
|
|
local p = premake
|
|
|
|
local vc2010 = p.vstudio.vc2010
|
|
|
|
local vstudio = p.vstudio
|
|
|
|
local project = p.project
|
|
|
|
local config = p.config
|
|
|
|
local fileconfig = p.fileconfig
|
|
|
|
local tree = p.tree
|
2012-08-01 19:28:21 +00:00
|
|
|
|
|
|
|
|
2013-04-25 15:45:44 +00:00
|
|
|
---
|
2013-08-11 18:27:17 +00:00
|
|
|
-- Add namespace for element definition lists for premake.callarray()
|
2013-04-25 15:45:44 +00:00
|
|
|
---
|
|
|
|
|
|
|
|
vc2010.elements = {}
|
|
|
|
|
|
|
|
|
2012-08-01 19:28:21 +00:00
|
|
|
--
|
|
|
|
-- Generate a Visual Studio 201x C++ project, with support for the new platforms API.
|
|
|
|
--
|
|
|
|
|
2013-02-11 18:25:33 +00:00
|
|
|
function vc2010.generate(prj)
|
2012-12-23 22:41:49 +00:00
|
|
|
io.utf8()
|
2012-08-01 19:28:21 +00:00
|
|
|
|
2014-01-07 22:08:51 +00:00
|
|
|
vc2010.xmlDeclaration()
|
2013-02-11 18:25:33 +00:00
|
|
|
vc2010.project("Build")
|
2012-08-01 19:28:21 +00:00
|
|
|
vc2010.projectConfigurations(prj)
|
|
|
|
vc2010.globals(prj)
|
|
|
|
|
|
|
|
_p(1,'<Import Project="$(VCTargetsPath)\\Microsoft.Cpp.Default.props" />')
|
|
|
|
|
|
|
|
for cfg in project.eachconfig(prj) do
|
|
|
|
vc2010.configurationProperties(cfg)
|
|
|
|
end
|
|
|
|
|
|
|
|
_p(1,'<Import Project="$(VCTargetsPath)\\Microsoft.Cpp.props" />')
|
|
|
|
_p(1,'<ImportGroup Label="ExtensionSettings">')
|
|
|
|
_p(1,'</ImportGroup>')
|
|
|
|
|
|
|
|
for cfg in project.eachconfig(prj) do
|
2013-02-11 18:25:33 +00:00
|
|
|
vc2010.propertySheets(cfg)
|
2012-08-01 19:28:21 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
_p(1,'<PropertyGroup Label="UserMacros" />')
|
|
|
|
|
|
|
|
for cfg in project.eachconfig(prj) do
|
|
|
|
vc2010.outputProperties(cfg)
|
2013-04-03 15:53:00 +00:00
|
|
|
vc2010.nmakeProperties(cfg)
|
2012-08-01 19:28:21 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
for cfg in project.eachconfig(prj) do
|
2013-04-03 15:53:00 +00:00
|
|
|
vc2010.itemDefinitionGroup(cfg)
|
2012-08-01 19:28:21 +00:00
|
|
|
end
|
|
|
|
|
2013-03-04 16:45:27 +00:00
|
|
|
vc2010.assemblyReferences(prj)
|
2013-02-11 18:25:33 +00:00
|
|
|
vc2010.files(prj)
|
|
|
|
vc2010.projectReferences(prj)
|
2012-08-01 19:28:21 +00:00
|
|
|
|
2013-02-11 18:25:33 +00:00
|
|
|
vc2010.import(prj)
|
2013-01-17 18:19:49 +00:00
|
|
|
|
2014-02-08 15:44:57 +00:00
|
|
|
p.out('</Project>')
|
2012-08-01 19:28:21 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
--
|
|
|
|
-- Output the XML declaration and opening <Project> tag.
|
|
|
|
--
|
|
|
|
|
2013-02-11 18:25:33 +00:00
|
|
|
function vc2010.project(target)
|
2012-08-01 19:28:21 +00:00
|
|
|
local defaultTargets = ""
|
|
|
|
if target then
|
|
|
|
defaultTargets = string.format(' DefaultTargets="%s"', target)
|
|
|
|
end
|
|
|
|
|
|
|
|
_p('<Project%s ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">', defaultTargets)
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
--
|
|
|
|
-- Write out the list of project configurations, which pairs build
|
|
|
|
-- configurations with architectures.
|
|
|
|
--
|
|
|
|
|
|
|
|
function vc2010.projectConfigurations(prj)
|
2013-04-03 15:53:00 +00:00
|
|
|
|
2012-08-01 19:28:21 +00:00
|
|
|
-- build a list of all architectures used in this project
|
|
|
|
local platforms = {}
|
|
|
|
for cfg in project.eachconfig(prj) do
|
2012-11-17 20:49:06 +00:00
|
|
|
local arch = vstudio.archFromConfig(cfg, true)
|
2012-08-01 19:28:21 +00:00
|
|
|
if not table.contains(platforms, arch) then
|
|
|
|
table.insert(platforms, arch)
|
|
|
|
end
|
|
|
|
end
|
2013-01-12 16:52:59 +00:00
|
|
|
|
2012-11-17 20:49:06 +00:00
|
|
|
local configs = {}
|
2012-08-01 19:28:21 +00:00
|
|
|
_p(1,'<ItemGroup Label="ProjectConfigurations">')
|
|
|
|
for cfg in project.eachconfig(prj) do
|
|
|
|
for _, arch in ipairs(platforms) do
|
2012-11-17 20:49:06 +00:00
|
|
|
local prjcfg = vstudio.projectConfig(cfg, arch)
|
|
|
|
if not configs[prjcfg] then
|
|
|
|
configs[prjcfg] = prjcfg
|
|
|
|
_x(2,'<ProjectConfiguration Include="%s">', vstudio.projectConfig(cfg, arch))
|
|
|
|
_x(3,'<Configuration>%s</Configuration>', vstudio.projectPlatform(cfg))
|
|
|
|
_p(3,'<Platform>%s</Platform>', arch)
|
|
|
|
_p(2,'</ProjectConfiguration>')
|
|
|
|
end
|
2012-08-01 19:28:21 +00:00
|
|
|
end
|
|
|
|
end
|
|
|
|
_p(1,'</ItemGroup>')
|
|
|
|
end
|
|
|
|
|
|
|
|
|
2013-09-30 14:53:16 +00:00
|
|
|
--
|
|
|
|
-- Write out the TargetFrameworkVersion property.
|
|
|
|
--
|
|
|
|
|
|
|
|
function vc2010.targetFramework(prj)
|
|
|
|
local framework = prj.framework or "4.0"
|
|
|
|
_p(2,'<TargetFrameworkVersion>v%s</TargetFrameworkVersion>', framework)
|
|
|
|
end
|
|
|
|
|
2012-08-01 19:28:21 +00:00
|
|
|
--
|
|
|
|
-- Write out the Globals property group.
|
|
|
|
--
|
|
|
|
|
|
|
|
function vc2010.globals(prj)
|
2013-02-11 18:25:33 +00:00
|
|
|
vc2010.propertyGroup(nil, "Globals")
|
|
|
|
vc2010.projectGuid(prj)
|
2013-01-12 16:52:59 +00:00
|
|
|
|
|
|
|
-- try to determine what kind of targets we're building here
|
2013-04-03 15:53:00 +00:00
|
|
|
local isWin, isManaged, isMakefile
|
2013-01-12 16:52:59 +00:00
|
|
|
for cfg in project.eachconfig(prj) do
|
|
|
|
if cfg.system == premake.WINDOWS then
|
|
|
|
isWin = true
|
|
|
|
end
|
|
|
|
if cfg.flags.Managed then
|
|
|
|
isManaged = true
|
|
|
|
end
|
2013-06-26 11:28:57 +00:00
|
|
|
if vstudio.isMakefile(cfg) then
|
2013-04-03 15:53:00 +00:00
|
|
|
isMakefile = true
|
|
|
|
end
|
2012-08-01 19:28:21 +00:00
|
|
|
end
|
2013-01-12 16:52:59 +00:00
|
|
|
|
|
|
|
if isWin then
|
2013-04-03 15:53:00 +00:00
|
|
|
if isMakefile then
|
|
|
|
_p(2,'<Keyword>MakeFileProj</Keyword>')
|
2013-01-12 16:52:59 +00:00
|
|
|
else
|
2013-04-03 15:53:00 +00:00
|
|
|
if isManaged then
|
2013-10-16 17:47:09 +00:00
|
|
|
vc2010.targetFramework(prj)
|
2013-04-03 15:53:00 +00:00
|
|
|
_p(2,'<Keyword>ManagedCProj</Keyword>')
|
|
|
|
else
|
|
|
|
_p(2,'<Keyword>Win32Proj</Keyword>')
|
|
|
|
end
|
|
|
|
_p(2,'<RootNamespace>%s</RootNamespace>', prj.name)
|
2013-01-12 16:52:59 +00:00
|
|
|
end
|
2012-08-01 19:28:21 +00:00
|
|
|
end
|
|
|
|
|
2013-05-01 16:08:41 +00:00
|
|
|
vc2010.projectName(prj)
|
2012-08-01 19:28:21 +00:00
|
|
|
_p(1,'</PropertyGroup>')
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
--
|
2013-01-12 16:52:59 +00:00
|
|
|
-- Write out the configuration property group: what kind of binary it
|
2012-08-01 19:28:21 +00:00
|
|
|
-- produces, and some global settings.
|
|
|
|
--
|
|
|
|
|
2013-04-25 15:45:44 +00:00
|
|
|
vc2010.elements.configurationProperties = {
|
|
|
|
"configurationType",
|
|
|
|
"useDebugLibraries",
|
|
|
|
"useOfMfc",
|
|
|
|
"clrSupport",
|
|
|
|
"characterSet",
|
2013-08-21 09:58:08 +00:00
|
|
|
"wholeProgramOptimization",
|
2013-04-25 15:45:44 +00:00
|
|
|
"nmakeOutDirs",
|
|
|
|
}
|
|
|
|
|
2012-08-01 19:28:21 +00:00
|
|
|
function vc2010.configurationProperties(cfg)
|
2013-02-11 18:25:33 +00:00
|
|
|
vc2010.propertyGroup(cfg, "Configuration")
|
2013-04-25 20:05:08 +00:00
|
|
|
premake.callarray(vc2010, vc2010.elements.configurationProperties, cfg)
|
2012-08-01 19:28:21 +00:00
|
|
|
_p(1,'</PropertyGroup>')
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
--
|
|
|
|
-- Write out the default property sheets for a configuration.
|
|
|
|
--
|
|
|
|
|
2013-02-11 18:25:33 +00:00
|
|
|
function vc2010.propertySheets(cfg)
|
2012-08-01 19:28:21 +00:00
|
|
|
_p(1,'<ImportGroup Label="PropertySheets" %s>', vc2010.condition(cfg))
|
|
|
|
_p(2,'<Import Project="$(UserRootDir)\\Microsoft.Cpp.$(Platform).user.props" Condition="exists(\'$(UserRootDir)\\Microsoft.Cpp.$(Platform).user.props\')" Label="LocalAppDataPlatform" />')
|
|
|
|
_p(1,'</ImportGroup>')
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
--
|
2013-04-03 15:53:00 +00:00
|
|
|
-- Write the output property group, which includes the output and intermediate
|
2012-08-01 19:28:21 +00:00
|
|
|
-- directories, manifest, etc.
|
|
|
|
--
|
|
|
|
|
2013-04-25 20:05:08 +00:00
|
|
|
vc2010.elements.outputProperties = {
|
|
|
|
"propertyGroup",
|
|
|
|
"linkIncremental",
|
|
|
|
"ignoreImportLibrary",
|
|
|
|
"outDir",
|
|
|
|
"outputFile",
|
|
|
|
"intDir",
|
|
|
|
"targetName",
|
|
|
|
"targetExt",
|
|
|
|
"imageXexOutput",
|
|
|
|
"generateManifest",
|
|
|
|
}
|
|
|
|
|
2012-08-01 19:28:21 +00:00
|
|
|
function vc2010.outputProperties(cfg)
|
2013-06-26 11:28:57 +00:00
|
|
|
if not vstudio.isMakefile(cfg) then
|
2013-04-25 20:05:08 +00:00
|
|
|
premake.callarray(vc2010, vc2010.elements.outputProperties, cfg)
|
2013-04-03 15:53:00 +00:00
|
|
|
_p(1,'</PropertyGroup>')
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
--
|
|
|
|
-- Write the NMake property group for Makefile projects, which includes the custom
|
|
|
|
-- build commands, output file location, etc.
|
|
|
|
--
|
|
|
|
|
|
|
|
function vc2010.nmakeProperties(cfg)
|
2013-06-26 11:28:57 +00:00
|
|
|
if vstudio.isMakefile(cfg) then
|
2013-04-03 15:53:00 +00:00
|
|
|
vc2010.propertyGroup(cfg)
|
|
|
|
vc2010.nmakeOutput(cfg)
|
2013-04-07 18:30:58 +00:00
|
|
|
vc2010.nmakeCommandLine(cfg, cfg.buildcommands, "Build")
|
|
|
|
vc2010.nmakeCommandLine(cfg, cfg.rebuildcommands, "ReBuild")
|
|
|
|
vc2010.nmakeCommandLine(cfg, cfg.cleancommands, "Clean")
|
2013-04-03 15:53:00 +00:00
|
|
|
_p(1,'</PropertyGroup>')
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
--
|
|
|
|
-- Write a configuration's item definition group, which contains all
|
|
|
|
-- of the per-configuration compile and link settings.
|
|
|
|
--
|
|
|
|
|
2013-04-25 20:05:08 +00:00
|
|
|
vc2010.elements.itemDefinitionGroup = {
|
|
|
|
"clCompile",
|
|
|
|
"resourceCompile",
|
|
|
|
"link",
|
2013-09-06 15:32:06 +00:00
|
|
|
"manifest",
|
2013-04-25 20:05:08 +00:00
|
|
|
"buildEvents",
|
|
|
|
"imageXex",
|
|
|
|
"deploy",
|
|
|
|
}
|
|
|
|
|
2013-04-03 15:53:00 +00:00
|
|
|
function vc2010.itemDefinitionGroup(cfg)
|
2013-06-26 11:28:57 +00:00
|
|
|
if not vstudio.isMakefile(cfg) then
|
2013-04-03 15:53:00 +00:00
|
|
|
_p(1,'<ItemDefinitionGroup %s>', vc2010.condition(cfg))
|
2013-04-25 20:05:08 +00:00
|
|
|
premake.callarray(vc2010, vc2010.elements.itemDefinitionGroup, cfg)
|
2013-04-03 15:53:00 +00:00
|
|
|
_p(1,'</ItemDefinitionGroup>')
|
|
|
|
|
|
|
|
else
|
|
|
|
if cfg == project.getfirstconfig(cfg.project) then
|
|
|
|
_p(1,'<ItemDefinitionGroup>')
|
|
|
|
_p(1,'</ItemDefinitionGroup>')
|
|
|
|
end
|
|
|
|
end
|
2012-08-01 19:28:21 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
--
|
|
|
|
-- Write the the <ClCompile> compiler settings block.
|
|
|
|
--
|
|
|
|
|
2013-04-30 16:38:11 +00:00
|
|
|
vc2010.elements.clCompile = {
|
|
|
|
"precompiledHeader",
|
|
|
|
"warningLevel",
|
|
|
|
"treatWarningAsError",
|
|
|
|
"basicRuntimeChecks",
|
|
|
|
"clCompilePreprocessorDefinitions",
|
|
|
|
"clCompileAdditionalIncludeDirectories",
|
2013-09-27 23:04:18 +00:00
|
|
|
"clCompileAdditionalUsingDirectories",
|
2013-04-30 16:38:11 +00:00
|
|
|
"forceIncludes",
|
|
|
|
"debugInformationFormat",
|
|
|
|
"programDataBaseFileName",
|
|
|
|
"optimization",
|
|
|
|
"functionLevelLinking",
|
|
|
|
"intrinsicFunctions",
|
|
|
|
"minimalRebuild",
|
|
|
|
"omitFramePointers",
|
|
|
|
"stringPooling",
|
|
|
|
"runtimeLibrary",
|
2013-10-29 07:10:01 +00:00
|
|
|
"omitDefaultLib",
|
2013-04-30 16:38:11 +00:00
|
|
|
"exceptionHandling",
|
|
|
|
"runtimeTypeInfo",
|
2013-08-15 22:22:23 +00:00
|
|
|
"bufferSecurityCheck",
|
2013-04-30 16:38:11 +00:00
|
|
|
"treatWChar_tAsBuiltInType",
|
|
|
|
"floatingPointModel",
|
|
|
|
"enableEnhancedInstructionSet",
|
|
|
|
"multiProcessorCompilation",
|
|
|
|
"additionalCompileOptions",
|
|
|
|
"compileAs",
|
|
|
|
}
|
|
|
|
|
2013-02-11 18:25:33 +00:00
|
|
|
function vc2010.clCompile(cfg)
|
2013-04-25 20:05:08 +00:00
|
|
|
_p(2,'<ClCompile>')
|
2013-04-30 16:38:11 +00:00
|
|
|
premake.callarray(vc2010, vc2010.elements.clCompile, cfg)
|
2013-04-25 20:05:08 +00:00
|
|
|
_p(2,'</ClCompile>')
|
2012-08-01 19:28:21 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
--
|
|
|
|
-- Write out the resource compiler block.
|
|
|
|
--
|
|
|
|
|
2013-04-30 16:38:11 +00:00
|
|
|
vc2010.elements.resourceCompile = {
|
|
|
|
"resourcePreprocessorDefinitions",
|
|
|
|
"resourceAdditionalIncludeDirectories",
|
2014-02-06 20:38:51 +00:00
|
|
|
"culture",
|
2013-04-30 16:38:11 +00:00
|
|
|
}
|
|
|
|
|
2012-08-01 19:28:21 +00:00
|
|
|
function vc2010.resourceCompile(cfg)
|
2013-04-25 20:05:08 +00:00
|
|
|
if cfg.system ~= premake.XBOX360 then
|
2013-03-07 17:14:03 +00:00
|
|
|
_p(2,'<ResourceCompile>')
|
2013-04-30 16:38:11 +00:00
|
|
|
premake.callarray(vc2010, vc2010.elements.resourceCompile, cfg)
|
2013-03-07 17:14:03 +00:00
|
|
|
_p(2,'</ResourceCompile>')
|
|
|
|
end
|
2012-08-01 19:28:21 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
--
|
|
|
|
-- Write out the linker tool block.
|
|
|
|
--
|
|
|
|
|
2013-12-11 22:33:44 +00:00
|
|
|
vc2010.elements.link = {
|
|
|
|
"subSystem",
|
|
|
|
"generateDebugInformation",
|
|
|
|
"optimizeReferences",
|
|
|
|
"linkDynamic",
|
|
|
|
}
|
2012-08-01 19:28:21 +00:00
|
|
|
|
2013-12-11 22:33:44 +00:00
|
|
|
vc2010.elements.linkDynamic = {
|
|
|
|
"additionalDependencies",
|
|
|
|
"additionalLibraryDirectories",
|
|
|
|
"importLibrary",
|
|
|
|
"entryPointSymbol",
|
|
|
|
"moduleDefinitionFile",
|
2013-12-24 19:01:57 +00:00
|
|
|
"treatLinkerWarningAsErrors",
|
2013-12-11 22:33:44 +00:00
|
|
|
"additionalLinkOptions",
|
|
|
|
}
|
2012-08-01 19:28:21 +00:00
|
|
|
|
2013-12-11 22:33:44 +00:00
|
|
|
vc2010.elements.linkStatic = {
|
2013-12-24 19:01:57 +00:00
|
|
|
"treatLinkerWarningAsErrors",
|
2013-12-11 22:33:44 +00:00
|
|
|
"additionalLinkOptions",
|
|
|
|
}
|
2012-08-01 19:28:21 +00:00
|
|
|
|
2013-12-11 22:33:44 +00:00
|
|
|
function vc2010.link(cfg)
|
|
|
|
_p(2,'<Link>')
|
|
|
|
local explicit = vstudio.needsExplicitLink(cfg)
|
|
|
|
premake.callarray(vc2010, vc2010.elements.link, cfg, explicit)
|
2013-04-25 20:05:08 +00:00
|
|
|
_p(2,'</Link>')
|
2012-08-01 19:28:21 +00:00
|
|
|
|
2013-04-25 20:05:08 +00:00
|
|
|
if cfg.kind == premake.STATICLIB then
|
2013-12-11 22:33:44 +00:00
|
|
|
vc2010.linkStatic(cfg, explicit)
|
2013-04-03 15:53:00 +00:00
|
|
|
end
|
2013-04-25 20:05:08 +00:00
|
|
|
|
|
|
|
vc2010.linkLibraryDependencies(cfg, explicit)
|
2012-08-01 19:28:21 +00:00
|
|
|
end
|
|
|
|
|
2013-02-11 18:25:33 +00:00
|
|
|
function vc2010.linkDynamic(cfg, explicit)
|
2013-12-11 22:33:44 +00:00
|
|
|
if cfg.kind ~= premake.STATICLIB then
|
|
|
|
premake.callarray(vc2010, vc2010.elements.linkDynamic, cfg, explicit)
|
|
|
|
end
|
2012-08-01 19:28:21 +00:00
|
|
|
end
|
|
|
|
|
2013-12-11 22:33:44 +00:00
|
|
|
function vc2010.linkStatic(cfg, explicit)
|
2014-02-08 15:44:57 +00:00
|
|
|
local contents = p.capture(function ()
|
2013-12-11 22:33:44 +00:00
|
|
|
premake.callarray(vc2010, vc2010.elements.linkStatic, cfg, explicit)
|
|
|
|
end)
|
|
|
|
if #contents > 0 then
|
2013-06-12 21:03:09 +00:00
|
|
|
_p(2,'<Lib>')
|
2014-01-31 19:29:58 +00:00
|
|
|
_p("%s", contents)
|
2013-06-12 21:03:09 +00:00
|
|
|
_p(2,'</Lib>')
|
|
|
|
end
|
2012-08-01 19:28:21 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
|
2013-09-06 15:32:06 +00:00
|
|
|
--
|
|
|
|
-- Write the manifest section.
|
|
|
|
--
|
|
|
|
|
|
|
|
function vc2010.manifest(cfg)
|
2013-09-18 08:35:02 +00:00
|
|
|
-- no additional manifests in static lib
|
2013-09-06 15:32:06 +00:00
|
|
|
if cfg.kind == premake.STATICLIB then
|
|
|
|
return
|
|
|
|
end
|
|
|
|
|
2013-09-18 08:35:02 +00:00
|
|
|
-- get the manifests files
|
2013-09-06 15:32:06 +00:00
|
|
|
local manifests = {}
|
|
|
|
for _, fname in ipairs(cfg.files) do
|
|
|
|
if path.getextension(fname) == ".manifest" then
|
|
|
|
table.insert(manifests, project.getrelative(cfg.project, fname))
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
-- when a project is not using manifest files, visual studio doesn't write the section.
|
|
|
|
if #manifests == 0 then
|
|
|
|
return
|
|
|
|
end
|
|
|
|
|
|
|
|
_p(2,'<Manifest>')
|
2013-09-18 08:35:02 +00:00
|
|
|
vc2010.element(3, "AdditionalManifestFiles", nil, "%s %%(AdditionalManifestFiles)", table.concat(manifests, " "))
|
2013-09-06 15:32:06 +00:00
|
|
|
_p(2,'</Manifest>')
|
|
|
|
end
|
|
|
|
|
|
|
|
|
2014-01-15 21:12:29 +00:00
|
|
|
|
|
|
|
---
|
2012-08-01 19:28:21 +00:00
|
|
|
-- Write out the pre- and post-build event settings.
|
2014-01-15 21:12:29 +00:00
|
|
|
---
|
2012-08-01 19:28:21 +00:00
|
|
|
|
|
|
|
function vc2010.buildEvents(cfg)
|
2014-01-15 21:12:29 +00:00
|
|
|
local write = function (event)
|
|
|
|
local name = event .. "Event"
|
|
|
|
local field = event:lower()
|
|
|
|
local steps = cfg[field .. "commands"]
|
|
|
|
local msg = cfg[field .. "message"]
|
|
|
|
|
|
|
|
if #steps > 0 then
|
|
|
|
_p(2,'<%s>', name)
|
|
|
|
_x(3,'<Command>%s</Command>', table.implode(steps, "", "", "\r\n"))
|
|
|
|
if msg then
|
|
|
|
_x(3,'<Message>%s</Message>', msg)
|
|
|
|
end
|
|
|
|
_p(2,'</%s>', name)
|
2012-08-01 19:28:21 +00:00
|
|
|
end
|
|
|
|
end
|
2014-01-15 21:12:29 +00:00
|
|
|
|
|
|
|
write("PreBuild")
|
|
|
|
write("PreLink")
|
|
|
|
write("PostBuild")
|
2012-08-01 19:28:21 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
|
2013-03-04 16:45:27 +00:00
|
|
|
--
|
|
|
|
-- Reference any managed assemblies listed in the links()
|
|
|
|
--
|
|
|
|
|
|
|
|
function vc2010.assemblyReferences(prj)
|
2013-03-05 16:00:32 +00:00
|
|
|
-- Visual Studio doesn't support per-config references; use
|
|
|
|
-- whatever is contained in the first configuration
|
2013-03-04 16:45:27 +00:00
|
|
|
local cfg = project.getfirstconfig(prj)
|
2013-03-05 16:00:32 +00:00
|
|
|
|
2013-03-04 16:45:27 +00:00
|
|
|
local refs = config.getlinks(cfg, "system", "fullpath", "managed")
|
|
|
|
if #refs > 0 then
|
|
|
|
_p(1,'<ItemGroup>')
|
|
|
|
table.foreachi(refs, function(value)
|
2013-03-05 16:00:32 +00:00
|
|
|
|
|
|
|
-- If the link contains a '/' then it is a relative path to
|
|
|
|
-- a local assembly. Otherwise treat it as a system assembly.
|
|
|
|
if value:find('/', 1, true) then
|
|
|
|
_x(2,'<Reference Include="%s">', path.getbasename(value))
|
|
|
|
_x(3,'<HintPath>%s</HintPath>', path.translate(value))
|
|
|
|
_p(2,'</Reference>')
|
|
|
|
else
|
|
|
|
_x(2,'<Reference Include="%s" />', path.getbasename(value))
|
|
|
|
end
|
|
|
|
|
2013-03-04 16:45:27 +00:00
|
|
|
end)
|
|
|
|
_p(1,'</ItemGroup>')
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
|
2012-08-01 19:28:21 +00:00
|
|
|
--
|
|
|
|
-- Write out the list of source code files, and any associated configuration.
|
|
|
|
--
|
|
|
|
|
2013-02-11 18:25:33 +00:00
|
|
|
function vc2010.files(prj)
|
|
|
|
vc2010.simplefilesgroup(prj, "ClInclude")
|
|
|
|
vc2010.compilerfilesgroup(prj)
|
|
|
|
vc2010.simplefilesgroup(prj, "None")
|
|
|
|
vc2010.simplefilesgroup(prj, "ResourceCompile")
|
2012-08-01 19:28:21 +00:00
|
|
|
vc2010.customBuildFilesGroup(prj)
|
|
|
|
end
|
|
|
|
|
2013-03-12 23:26:25 +00:00
|
|
|
|
2013-02-11 18:25:33 +00:00
|
|
|
function vc2010.simplefilesgroup(prj, group)
|
|
|
|
local files = vc2010.getfilegroup(prj, group)
|
2012-08-01 19:28:21 +00:00
|
|
|
if #files > 0 then
|
|
|
|
_p(1,'<ItemGroup>')
|
|
|
|
for _, file in ipairs(files) do
|
2014-02-11 23:04:07 +00:00
|
|
|
|
|
|
|
-- Capture the contents of the <ClCompile> element, if any, so
|
|
|
|
-- I know which form to use.
|
|
|
|
|
|
|
|
local contents = p.capture(function ()
|
|
|
|
if group == "ResourceCompile" then
|
|
|
|
for cfg in project.eachconfig(prj) do
|
|
|
|
local condition = vc2010.condition(cfg)
|
|
|
|
local filecfg = fileconfig.getconfig(file, cfg)
|
|
|
|
if cfg.system == premake.WINDOWS then
|
|
|
|
vc2010.excludedFromBuild(cfg, filecfg)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end)
|
|
|
|
|
|
|
|
if #contents > 0 then
|
|
|
|
_x(2,'<%s Include=\"%s\">', group, path.translate(file.relpath))
|
|
|
|
_p("%s", contents)
|
|
|
|
_p(2,'</%s>', group)
|
|
|
|
else
|
|
|
|
_x(2,'<%s Include=\"%s\" />', group, path.translate(file.relpath))
|
|
|
|
end
|
2012-08-01 19:28:21 +00:00
|
|
|
end
|
|
|
|
_p(1,'</ItemGroup>')
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2013-03-12 23:26:25 +00:00
|
|
|
|
2013-02-11 18:25:33 +00:00
|
|
|
function vc2010.compilerfilesgroup(prj)
|
|
|
|
local files = vc2010.getfilegroup(prj, "ClCompile")
|
2012-08-01 19:28:21 +00:00
|
|
|
if #files > 0 then
|
|
|
|
_p(1,'<ItemGroup>')
|
|
|
|
for _, file in ipairs(files) do
|
2013-01-12 16:52:59 +00:00
|
|
|
|
2013-08-11 13:52:51 +00:00
|
|
|
-- Capture the contents of the <ClCompile> element, if any, so
|
|
|
|
-- I know which form to use.
|
|
|
|
|
2014-02-08 15:44:57 +00:00
|
|
|
local contents = p.capture(function ()
|
2013-08-11 13:52:51 +00:00
|
|
|
for cfg in project.eachconfig(prj) do
|
|
|
|
local condition = vc2010.condition(cfg)
|
|
|
|
|
|
|
|
local filecfg = fileconfig.getconfig(file, cfg)
|
|
|
|
vc2010.excludedFromBuild(cfg, filecfg)
|
|
|
|
if filecfg then
|
|
|
|
vc2010.objectFileName(filecfg)
|
2014-01-28 18:41:58 +00:00
|
|
|
vc2010.clCompilePreprocessorDefinitions(filecfg, condition)
|
2013-10-16 18:29:49 +00:00
|
|
|
vc2010.optimization(filecfg, condition)
|
2013-08-11 13:52:51 +00:00
|
|
|
vc2010.forceIncludes(filecfg, condition)
|
|
|
|
vc2010.precompiledHeader(cfg, filecfg, condition)
|
|
|
|
vc2010.additionalCompileOptions(filecfg, condition)
|
|
|
|
end
|
2012-08-01 19:28:21 +00:00
|
|
|
end
|
2013-08-11 13:52:51 +00:00
|
|
|
end)
|
2013-01-12 16:52:59 +00:00
|
|
|
|
2013-08-11 13:52:51 +00:00
|
|
|
if #contents > 0 then
|
|
|
|
_x(2,'<ClCompile Include=\"%s\">', path.translate(file.relpath))
|
2014-01-31 19:29:58 +00:00
|
|
|
_p("%s", contents)
|
2013-08-11 13:52:51 +00:00
|
|
|
_p(2,'</ClCompile>')
|
|
|
|
else
|
|
|
|
_x(2,'<ClCompile Include=\"%s\" />', path.translate(file.relpath))
|
2012-08-01 19:28:21 +00:00
|
|
|
end
|
2013-08-11 13:52:51 +00:00
|
|
|
|
2012-08-01 19:28:21 +00:00
|
|
|
end
|
|
|
|
_p(1,'</ItemGroup>')
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2013-03-12 23:26:25 +00:00
|
|
|
|
2012-08-01 19:28:21 +00:00
|
|
|
function vc2010.customBuildFilesGroup(prj)
|
2013-02-11 18:25:33 +00:00
|
|
|
local files = vc2010.getfilegroup(prj, "CustomBuild")
|
2012-08-01 19:28:21 +00:00
|
|
|
if #files > 0 then
|
|
|
|
_p(1,'<ItemGroup>')
|
|
|
|
for _, file in ipairs(files) do
|
|
|
|
_x(2,'<CustomBuild Include=\"%s\">', path.translate(file.relpath))
|
|
|
|
_p(3,'<FileType>Document</FileType>')
|
2013-01-12 16:52:59 +00:00
|
|
|
|
2012-08-01 19:28:21 +00:00
|
|
|
for cfg in project.eachconfig(prj) do
|
2013-01-12 16:52:59 +00:00
|
|
|
local condition = vc2010.condition(cfg)
|
2013-07-12 15:07:26 +00:00
|
|
|
local filecfg = fileconfig.getconfig(file, cfg)
|
|
|
|
if fileconfig.hasCustomBuildRule(filecfg) then
|
2014-02-11 23:04:07 +00:00
|
|
|
vc2010.excludedFromBuild(cfg, filecfg)
|
|
|
|
|
2013-04-09 19:12:04 +00:00
|
|
|
local commands = table.concat(filecfg.buildcommands,'\r\n')
|
2012-08-01 19:28:21 +00:00
|
|
|
_p(3,'<Command %s>%s</Command>', condition, premake.esc(commands))
|
2013-01-12 16:52:59 +00:00
|
|
|
|
2013-04-17 15:54:07 +00:00
|
|
|
local outputs = project.getrelative(prj, filecfg.buildoutputs)
|
|
|
|
vc2010.element(3, "Outputs", condition, '%s', table.concat(outputs, " "))
|
2013-09-03 11:16:08 +00:00
|
|
|
|
|
|
|
if filecfg.buildmessage then
|
2013-09-18 07:49:42 +00:00
|
|
|
vc2010.element(3, "Message", condition, '%s', premake.esc(filecfg.buildmessage))
|
2013-09-03 11:16:08 +00:00
|
|
|
end
|
2012-08-01 19:28:21 +00:00
|
|
|
end
|
|
|
|
end
|
2013-01-12 16:52:59 +00:00
|
|
|
|
2012-08-01 19:28:21 +00:00
|
|
|
_p(2,'</CustomBuild>')
|
|
|
|
end
|
|
|
|
_p(1,'</ItemGroup>')
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2013-03-12 23:26:25 +00:00
|
|
|
|
2013-02-11 18:25:33 +00:00
|
|
|
function vc2010.getfilegroup(prj, group)
|
2012-08-01 19:28:21 +00:00
|
|
|
-- check for a cached copy before creating
|
|
|
|
local groups = prj.vc2010_file_groups
|
|
|
|
if not groups then
|
|
|
|
groups = {
|
|
|
|
ClCompile = {},
|
|
|
|
ClInclude = {},
|
|
|
|
None = {},
|
|
|
|
ResourceCompile = {},
|
|
|
|
CustomBuild = {},
|
|
|
|
}
|
|
|
|
prj.vc2010_file_groups = groups
|
2013-01-12 16:52:59 +00:00
|
|
|
|
2012-08-01 19:28:21 +00:00
|
|
|
local tr = project.getsourcetree(prj)
|
|
|
|
tree.traverse(tr, {
|
|
|
|
onleaf = function(node)
|
|
|
|
-- if any configuration of this file uses a custom build rule,
|
|
|
|
-- then they all must be marked as custom build
|
|
|
|
local hasbuildrule = false
|
2013-01-12 16:52:59 +00:00
|
|
|
for cfg in project.eachconfig(prj) do
|
2013-07-12 15:07:26 +00:00
|
|
|
local filecfg = fileconfig.getconfig(node, cfg)
|
|
|
|
if fileconfig.hasCustomBuildRule(filecfg) then
|
2012-08-01 19:28:21 +00:00
|
|
|
hasbuildrule = true
|
|
|
|
break
|
|
|
|
end
|
|
|
|
end
|
2013-01-12 16:52:59 +00:00
|
|
|
|
2012-08-01 19:28:21 +00:00
|
|
|
if hasbuildrule then
|
|
|
|
table.insert(groups.CustomBuild, node)
|
|
|
|
elseif path.iscppfile(node.name) then
|
|
|
|
table.insert(groups.ClCompile, node)
|
|
|
|
elseif path.iscppheader(node.name) then
|
|
|
|
table.insert(groups.ClInclude, node)
|
|
|
|
elseif path.isresourcefile(node.name) then
|
|
|
|
table.insert(groups.ResourceCompile, node)
|
|
|
|
else
|
|
|
|
table.insert(groups.None, node)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
})
|
|
|
|
end
|
|
|
|
|
|
|
|
return groups[group]
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
--
|
|
|
|
-- Generate the list of project dependencies.
|
|
|
|
--
|
|
|
|
|
2013-02-11 18:25:33 +00:00
|
|
|
function vc2010.projectReferences(prj)
|
2012-08-01 19:28:21 +00:00
|
|
|
local deps = project.getdependencies(prj)
|
|
|
|
if #deps > 0 then
|
|
|
|
_p(1,'<ItemGroup>')
|
|
|
|
for _, dep in ipairs(deps) do
|
2013-09-30 14:16:56 +00:00
|
|
|
local relpath = project.getrelative(prj, vstudio.projectfile(dep))
|
2012-08-01 19:28:21 +00:00
|
|
|
_x(2,'<ProjectReference Include=\"%s\">', path.translate(relpath))
|
|
|
|
_p(3,'<Project>{%s}</Project>', dep.uuid)
|
|
|
|
_p(2,'</ProjectReference>')
|
|
|
|
end
|
|
|
|
_p(1,'</ItemGroup>')
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
|
2013-02-11 18:25:33 +00:00
|
|
|
|
2013-03-07 17:14:03 +00:00
|
|
|
---------------------------------------------------------------------------
|
2013-02-11 18:25:33 +00:00
|
|
|
--
|
2013-03-07 17:14:03 +00:00
|
|
|
-- Handlers for individual project elements
|
2012-08-01 19:28:21 +00:00
|
|
|
--
|
2013-03-07 17:14:03 +00:00
|
|
|
---------------------------------------------------------------------------
|
2012-08-01 19:28:21 +00:00
|
|
|
|
2012-11-30 19:05:19 +00:00
|
|
|
function vc2010.additionalDependencies(cfg, explicit)
|
2012-08-01 19:28:21 +00:00
|
|
|
local links
|
2012-11-30 19:05:19 +00:00
|
|
|
|
2012-08-01 19:28:21 +00:00
|
|
|
-- check to see if this project uses an external toolset. If so, let the
|
|
|
|
-- toolset define the format of the links
|
|
|
|
local toolset = premake.vstudio.vc200x.toolset(cfg)
|
|
|
|
if toolset then
|
2012-11-30 19:05:19 +00:00
|
|
|
links = toolset.getlinks(cfg, not explicit)
|
2012-08-01 19:28:21 +00:00
|
|
|
else
|
2012-11-30 19:05:19 +00:00
|
|
|
local scope = iif(explicit, "all", "system")
|
|
|
|
links = config.getlinks(cfg, scope, "fullpath")
|
2012-08-01 19:28:21 +00:00
|
|
|
end
|
2013-01-12 16:52:59 +00:00
|
|
|
|
2012-08-01 19:28:21 +00:00
|
|
|
if #links > 0 then
|
|
|
|
links = path.translate(table.concat(links, ";"))
|
|
|
|
_x(3,'<AdditionalDependencies>%s;%%(AdditionalDependencies)</AdditionalDependencies>', links)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
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
|
|
|
|
|
|
|
|
|
|
|
|
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
|
|
|
|
|
2013-09-27 23:04:18 +00:00
|
|
|
function vc2010.additionalUsingDirectories(cfg)
|
|
|
|
if #cfg.usingdirs > 0 then
|
|
|
|
local dirs = project.getrelative(cfg.project, cfg.usingdirs)
|
|
|
|
dirs = path.translate(table.concat(dirs, ";"))
|
|
|
|
_x(3,'<AdditionalUsingDirectories>%s;%%(AdditionalUsingDirectories)</AdditionalUsingDirectories>', dirs)
|
|
|
|
end
|
2013-11-15 22:17:41 +00:00
|
|
|
end
|
2013-09-27 23:04:18 +00:00
|
|
|
|
2012-08-01 19:28:21 +00:00
|
|
|
|
2013-03-12 23:26:25 +00:00
|
|
|
function vc2010.additionalCompileOptions(cfg, condition)
|
|
|
|
if #cfg.buildoptions > 0 then
|
|
|
|
local opts = table.concat(cfg.buildoptions, " ")
|
|
|
|
vc2010.element(3, "AdditionalOptions", condition, '%s %%(AdditionalOptions)', opts)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2013-04-03 15:53:00 +00:00
|
|
|
|
2012-08-01 19:28:21 +00:00
|
|
|
function vc2010.additionalLinkOptions(cfg)
|
|
|
|
if #cfg.linkoptions > 0 then
|
|
|
|
local opts = table.concat(cfg.linkoptions, " ")
|
|
|
|
_x(3, '<AdditionalOptions>%s %%(AdditionalOptions)</AdditionalOptions>', opts)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
|
2013-02-11 18:25:33 +00:00
|
|
|
function vc2010.basicRuntimeChecks(cfg)
|
|
|
|
if cfg.flags.NoRuntimeChecks then
|
|
|
|
_p(3,'<BasicRuntimeChecks>Default</BasicRuntimeChecks>')
|
|
|
|
end
|
|
|
|
end
|
2012-08-01 19:28:21 +00:00
|
|
|
|
2013-02-11 18:25:33 +00:00
|
|
|
|
|
|
|
function vc2010.characterSet(cfg)
|
2013-06-26 11:28:57 +00:00
|
|
|
if not vstudio.isMakefile(cfg) then
|
2013-04-03 15:53:00 +00:00
|
|
|
_p(2,'<CharacterSet>%s</CharacterSet>', iif(cfg.flags.Unicode, "Unicode", "MultiByte"))
|
|
|
|
end
|
2012-08-01 19:28:21 +00:00
|
|
|
end
|
|
|
|
|
2013-08-21 09:58:08 +00:00
|
|
|
function vc2010.wholeProgramOptimization(cfg)
|
|
|
|
if cfg.flags.LinkTimeOptimization then
|
|
|
|
_p(2,'<WholeProgramOptimization>true</WholeProgramOptimization>')
|
|
|
|
end
|
|
|
|
end
|
2012-08-01 19:28:21 +00:00
|
|
|
|
2013-04-30 16:38:11 +00:00
|
|
|
function vc2010.clCompileAdditionalIncludeDirectories(cfg)
|
|
|
|
vc2010.additionalIncludeDirectories(cfg, cfg.includedirs)
|
|
|
|
end
|
|
|
|
|
2013-09-27 23:04:18 +00:00
|
|
|
function vc2010.clCompileAdditionalUsingDirectories(cfg)
|
|
|
|
vc2010.additionalUsingDirectories(cfg, cfg.usingdirs)
|
2013-11-15 22:17:41 +00:00
|
|
|
end
|
2013-09-27 23:04:18 +00:00
|
|
|
|
2013-04-30 16:38:11 +00:00
|
|
|
|
2014-01-28 18:41:58 +00:00
|
|
|
function vc2010.clCompilePreprocessorDefinitions(cfg, condition)
|
|
|
|
vc2010.preprocessorDefinitions(cfg, cfg.defines, false, condition)
|
2013-04-30 16:38:11 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
|
2013-02-11 18:25:33 +00:00
|
|
|
function vc2010.clrSupport(cfg)
|
|
|
|
if cfg.flags.Managed then
|
|
|
|
_p(2,'<CLRSupport>true</CLRSupport>')
|
|
|
|
end
|
2012-08-01 19:28:21 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
|
2013-02-11 18:25:33 +00:00
|
|
|
function vc2010.compileAs(cfg)
|
|
|
|
if cfg.project.language == "C" then
|
|
|
|
_p(3,'<CompileAs>CompileAsC</CompileAs>')
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2012-08-01 19:28:21 +00:00
|
|
|
|
2013-02-11 18:25:33 +00:00
|
|
|
function vc2010.configurationType(cfg)
|
2013-04-03 15:53:00 +00:00
|
|
|
local types = {
|
|
|
|
SharedLib = "DynamicLibrary",
|
|
|
|
StaticLib = "StaticLibrary",
|
|
|
|
ConsoleApp = "Application",
|
|
|
|
WindowedApp = "Application",
|
|
|
|
Makefile = "Makefile",
|
2013-06-25 14:15:39 +00:00
|
|
|
None = "Makefile",
|
2013-04-03 15:53:00 +00:00
|
|
|
}
|
|
|
|
_p(2,'<ConfigurationType>%s</ConfigurationType>', types[cfg.kind])
|
2013-02-11 18:25:33 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
|
2014-02-06 20:38:51 +00:00
|
|
|
function vc2010.culture(cfg)
|
|
|
|
local value = vstudio.cultureForLocale(cfg.locale)
|
|
|
|
if value then
|
|
|
|
_p(3,'<Culture>0x%04x</Culture>', value)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
|
2013-02-11 18:25:33 +00:00
|
|
|
function vc2010.debugInformationFormat(cfg)
|
2012-08-01 19:28:21 +00:00
|
|
|
local value
|
|
|
|
if cfg.flags.Symbols then
|
|
|
|
if cfg.debugformat == "c7" then
|
|
|
|
value = "OldStyle"
|
2013-01-12 16:52:59 +00:00
|
|
|
elseif cfg.architecture == "x64" or
|
|
|
|
cfg.flags.Managed or
|
2013-09-13 15:15:36 +00:00
|
|
|
config.isOptimizedBuild(cfg) or
|
2012-08-01 19:28:21 +00:00
|
|
|
cfg.flags.NoEditAndContinue
|
|
|
|
then
|
|
|
|
value = "ProgramDatabase"
|
|
|
|
else
|
|
|
|
value = "EditAndContinue"
|
|
|
|
end
|
|
|
|
end
|
|
|
|
if value then
|
|
|
|
_p(3,'<DebugInformationFormat>%s</DebugInformationFormat>', value)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
|
2013-03-07 17:14:03 +00:00
|
|
|
function vc2010.deploy(cfg)
|
|
|
|
if cfg.system == premake.XBOX360 then
|
|
|
|
_p(2,'<Deploy>')
|
|
|
|
_p(3,'<DeploymentType>CopyToHardDrive</DeploymentType>')
|
|
|
|
_p(3,'<DvdEmulationType>ZeroSeekTimes</DvdEmulationType>')
|
|
|
|
_p(3,'<DeploymentFiles>$(RemoteRoot)=$(ImagePath);</DeploymentFiles>')
|
|
|
|
_p(2,'</Deploy>')
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
|
2013-02-11 18:25:33 +00:00
|
|
|
function vc2010.enableEnhancedInstructionSet(cfg)
|
2013-09-27 18:25:10 +00:00
|
|
|
local map = {
|
|
|
|
SSE = "StreamingSIMDExtensions",
|
|
|
|
SSE2 = "StreamingSIMDExtensions2"
|
|
|
|
}
|
|
|
|
local value = map[cfg.vectorextensions]
|
|
|
|
if value then
|
|
|
|
_p(3,'<EnableEnhancedInstructionSet>%s</EnableEnhancedInstructionSet>', value)
|
2013-02-11 18:25:33 +00:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
function vc2010.entryPointSymbol(cfg)
|
2013-04-03 15:53:00 +00:00
|
|
|
if (cfg.kind == premake.CONSOLEAPP or cfg.kind == premake.WINDOWEDAPP) and
|
2013-03-07 17:14:03 +00:00
|
|
|
not cfg.flags.WinMain and
|
|
|
|
not cfg.flags.Managed and
|
|
|
|
cfg.system ~= premake.XBOX360
|
|
|
|
then
|
2013-02-11 18:25:33 +00:00
|
|
|
_p(3,'<EntryPointSymbol>mainCRTStartup</EntryPointSymbol>')
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
function vc2010.exceptionHandling(cfg)
|
|
|
|
if cfg.flags.NoExceptions then
|
|
|
|
_p(3,'<ExceptionHandling>false</ExceptionHandling>')
|
|
|
|
elseif cfg.flags.SEH then
|
|
|
|
_p(3,'<ExceptionHandling>Async</ExceptionHandling>')
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
|
2013-03-12 23:26:25 +00:00
|
|
|
function vc2010.excludedFromBuild(cfg, filecfg)
|
|
|
|
if not filecfg or filecfg.flags.ExcludeFromBuild then
|
|
|
|
_p(3,'<ExcludedFromBuild %s>true</ExcludedFromBuild>', vc2010.condition(cfg))
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
|
2013-02-11 18:25:33 +00:00
|
|
|
function vc2010.floatingPointModel(cfg)
|
2013-09-27 18:49:21 +00:00
|
|
|
if cfg.floatingpoint then
|
|
|
|
_p(3,'<FloatingPointModel>%s</FloatingPointModel>', cfg.floatingpoint)
|
2013-02-11 18:25:33 +00:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
|
2013-03-12 23:26:25 +00:00
|
|
|
function vc2010.forceIncludes(cfg, condition)
|
2013-02-11 18:25:33 +00:00
|
|
|
if #cfg.forceincludes > 0 then
|
2013-03-12 23:26:25 +00:00
|
|
|
local includes = path.translate(project.getrelative(cfg.project, cfg.forceincludes))
|
|
|
|
vc2010.element(3, "ForcedIncludeFiles", condition, table.concat(includes, ';'))
|
2013-02-11 18:25:33 +00:00
|
|
|
end
|
2013-02-20 14:57:37 +00:00
|
|
|
if #cfg.forceusings > 0 then
|
2013-03-12 23:26:25 +00:00
|
|
|
local usings = path.translate(project.getrelative(cfg.project, cfg.forceusings))
|
2013-02-20 14:57:37 +00:00
|
|
|
_x(3,'<ForcedUsingFiles>%s</ForcedUsingFiles>', table.concat(usings, ';'))
|
|
|
|
end
|
2013-02-11 18:25:33 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
function vc2010.functionLevelLinking(cfg)
|
2013-09-13 15:15:36 +00:00
|
|
|
if config.isOptimizedBuild(cfg) then
|
2013-02-11 18:25:33 +00:00
|
|
|
_p(3,'<FunctionLevelLinking>true</FunctionLevelLinking>')
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
function vc2010.generateDebugInformation(cfg)
|
|
|
|
_p(3,'<GenerateDebugInformation>%s</GenerateDebugInformation>', tostring(cfg.flags.Symbols ~= nil))
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
function vc2010.generateManifest(cfg)
|
|
|
|
if cfg.flags.NoManifest then
|
|
|
|
_p(2,'<GenerateManifest>false</GenerateManifest>')
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
function vc2010.ignoreImportLibrary(cfg)
|
|
|
|
if cfg.kind == premake.SHAREDLIB and cfg.flags.NoImportLib then
|
|
|
|
_p(2,'<IgnoreImportLibrary>true</IgnoreImportLibrary>');
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
|
2013-03-07 17:14:03 +00:00
|
|
|
function vc2010.imageXex(cfg)
|
|
|
|
if cfg.system == premake.XBOX360 then
|
|
|
|
_p(2,'<ImageXex>')
|
|
|
|
_p(3,'<ConfigurationFile>')
|
|
|
|
_p(3,'</ConfigurationFile>')
|
|
|
|
_p(3,'<AdditionalSections>')
|
|
|
|
_p(3,'</AdditionalSections>')
|
|
|
|
_p(2,'</ImageXex>')
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
function vc2010.imageXexOutput(cfg)
|
|
|
|
if cfg.system == premake.XBOX360 then
|
|
|
|
_x(2,'<ImageXexOutput>$(OutDir)$(TargetName).xex</ImageXexOutput>')
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
|
2013-02-11 18:25:33 +00:00
|
|
|
function vc2010.import(prj)
|
|
|
|
_p(1,'<Import Project="$(VCTargetsPath)\\Microsoft.Cpp.targets" />')
|
|
|
|
_p(1,'<ImportGroup Label="ExtensionTargets">')
|
|
|
|
_p(1,'</ImportGroup>')
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
function vc2010.importLibrary(cfg)
|
|
|
|
if cfg.kind == premake.SHAREDLIB then
|
|
|
|
_x(3,'<ImportLibrary>%s</ImportLibrary>', path.translate(cfg.linktarget.relpath))
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
function vc2010.intDir(cfg)
|
|
|
|
local objdir = project.getrelative(cfg.project, cfg.objdir)
|
|
|
|
_x(2,'<IntDir>%s\\</IntDir>', path.translate(objdir))
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
function vc2010.intrinsicFunctions(cfg)
|
2013-09-13 15:15:36 +00:00
|
|
|
if config.isOptimizedBuild(cfg) then
|
2013-02-11 18:25:33 +00:00
|
|
|
_p(3,'<IntrinsicFunctions>true</IntrinsicFunctions>')
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
function vc2010.linkIncremental(cfg)
|
|
|
|
if cfg.kind ~= premake.STATICLIB then
|
2013-09-13 15:15:36 +00:00
|
|
|
_p(2,'<LinkIncremental>%s</LinkIncremental>', tostring(config.canLinkIncremental(cfg)))
|
2013-02-11 18:25:33 +00:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
function vc2010.linkLibraryDependencies(cfg, explicit)
|
|
|
|
-- Left to its own devices, VS will happily link against a project dependency
|
|
|
|
-- that has been excluded from the build. As a workaround, disable dependency
|
|
|
|
-- linking and list all siblings explicitly
|
|
|
|
if explicit then
|
|
|
|
_p(2,'<ProjectReference>')
|
|
|
|
_p(3,'<LinkLibraryDependencies>false</LinkLibraryDependencies>')
|
|
|
|
_p(2,'</ProjectReference>')
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
function vc2010.minimalRebuild(cfg)
|
2013-09-13 15:15:36 +00:00
|
|
|
if config.isOptimizedBuild(cfg) or
|
2013-02-11 18:25:33 +00:00
|
|
|
cfg.flags.NoMinimalRebuild or
|
|
|
|
cfg.flags.MultiProcessorCompile or
|
|
|
|
cfg.debugformat == premake.C7
|
|
|
|
then
|
|
|
|
_p(3,'<MinimalRebuild>false</MinimalRebuild>')
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
|
2013-02-21 15:28:41 +00:00
|
|
|
function vc2010.moduleDefinitionFile(cfg)
|
|
|
|
local df = config.findfile(cfg, ".def")
|
|
|
|
if df then
|
|
|
|
_p(3,'<ModuleDefinitionFile>%s</ModuleDefinitionFile>', df)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
|
2013-02-11 18:25:33 +00:00
|
|
|
function vc2010.multiProcessorCompilation(cfg)
|
|
|
|
if cfg.flags.MultiProcessorCompile then
|
|
|
|
_p(3,'<MultiProcessorCompilation>true</MultiProcessorCompilation>')
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
|
2013-04-07 18:30:58 +00:00
|
|
|
function vc2010.nmakeCommandLine(cfg, commands, phase)
|
|
|
|
if #commands > 0 then
|
2014-02-08 15:44:57 +00:00
|
|
|
commands = table.concat(premake.esc(commands), p.eol())
|
2013-04-07 18:30:58 +00:00
|
|
|
_p(2, '<NMake%sCommandLine>%s</NMake%sCommandLine>', phase, commands, phase)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
|
2013-04-25 15:45:44 +00:00
|
|
|
function vc2010.nmakeOutDirs(cfg)
|
2013-06-26 11:28:57 +00:00
|
|
|
if vstudio.isMakefile(cfg) then
|
2013-04-25 15:45:44 +00:00
|
|
|
vc2010.outDir(cfg)
|
|
|
|
vc2010.intDir(cfg)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2013-04-03 15:53:00 +00:00
|
|
|
function vc2010.nmakeOutput(cfg)
|
|
|
|
_p(2,'<NMakeOutput>$(OutDir)%s</NMakeOutput>', cfg.buildtarget.name)
|
|
|
|
end
|
|
|
|
|
|
|
|
|
2013-03-12 23:26:25 +00:00
|
|
|
function vc2010.objectFileName(filecfg)
|
2013-07-07 20:48:17 +00:00
|
|
|
if filecfg.objname ~= filecfg.basename then
|
2013-06-21 21:32:33 +00:00
|
|
|
_p(3,'<ObjectFileName %s>$(IntDir)\\%s.obj</ObjectFileName>', vc2010.condition(filecfg.config), filecfg.objname)
|
2013-03-12 23:26:25 +00:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
|
2013-02-11 18:25:33 +00:00
|
|
|
function vc2010.omitFramePointers(cfg)
|
|
|
|
if cfg.flags.NoFramePointer then
|
|
|
|
_p(3,'<OmitFramePointers>true</OmitFramePointers>')
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
function vc2010.optimizeReferences(cfg)
|
2013-09-13 15:15:36 +00:00
|
|
|
if config.isOptimizedBuild(cfg) then
|
2013-02-11 18:25:33 +00:00
|
|
|
_p(3,'<EnableCOMDATFolding>true</EnableCOMDATFolding>')
|
|
|
|
_p(3,'<OptimizeReferences>true</OptimizeReferences>')
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2012-08-01 19:28:21 +00:00
|
|
|
|
2013-10-16 18:29:49 +00:00
|
|
|
function vc2010.optimization(cfg, condition)
|
|
|
|
local map = { Off="Disabled", On="Full", Debug="Disabled", Full="Full", Size="MinSpace", Speed="MaxSpeed" }
|
|
|
|
local value = map[cfg.optimize]
|
|
|
|
if value or not condition then
|
|
|
|
vc2010.element(3, 'Optimization', condition, value or "Disabled")
|
|
|
|
end
|
2012-08-01 19:28:21 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
|
2013-02-11 18:25:33 +00:00
|
|
|
function vc2010.outDir(cfg)
|
|
|
|
local outdir = project.getrelative(cfg.project, cfg.buildtarget.directory)
|
|
|
|
_x(2,'<OutDir>%s\\</OutDir>', path.translate(outdir))
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
function vc2010.outputFile(cfg)
|
|
|
|
if cfg.system == premake.XBOX360 then
|
2013-04-03 15:53:00 +00:00
|
|
|
_p(2,'<OutputFile>$(OutDir)%s</OutputFile>', cfg.buildtarget.name)
|
2013-02-11 18:25:33 +00:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
|
2013-03-12 23:26:25 +00:00
|
|
|
function vc2010.precompiledHeader(cfg, filecfg, condition)
|
|
|
|
if filecfg then
|
|
|
|
if cfg.pchsource == filecfg.abspath and not cfg.flags.NoPCH then
|
|
|
|
vc2010.element(3, 'PrecompiledHeader', condition, 'Create')
|
2013-10-16 20:11:39 +00:00
|
|
|
elseif filecfg.flags.NoPCH then
|
|
|
|
vc2010.element(3, 'PrecompiledHeader', condition, 'NotUsing')
|
2013-03-12 23:26:25 +00:00
|
|
|
end
|
2013-02-11 18:25:33 +00:00
|
|
|
else
|
2013-03-12 23:26:25 +00:00
|
|
|
if not cfg.flags.NoPCH and cfg.pchheader then
|
|
|
|
_p(3,'<PrecompiledHeader>Use</PrecompiledHeader>')
|
2013-08-11 18:27:17 +00:00
|
|
|
_x(3,'<PrecompiledHeaderFile>%s</PrecompiledHeaderFile>', cfg.pchheader)
|
2013-03-12 23:26:25 +00:00
|
|
|
else
|
|
|
|
_p(3,'<PrecompiledHeader>NotUsing</PrecompiledHeader>')
|
|
|
|
end
|
2013-02-11 18:25:33 +00:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2012-08-01 19:28:21 +00:00
|
|
|
|
2014-01-28 18:41:58 +00:00
|
|
|
function vc2010.preprocessorDefinitions(cfg, defines, escapeQuotes, condition)
|
2012-08-01 19:28:21 +00:00
|
|
|
if #defines > 0 then
|
|
|
|
defines = table.concat(defines, ";")
|
2013-04-30 16:25:25 +00:00
|
|
|
if escapeQuotes then
|
|
|
|
defines = defines:gsub('"', '\\"')
|
|
|
|
end
|
2014-01-28 18:41:58 +00:00
|
|
|
defines = premake.esc(defines) .. ";%%(PreprocessorDefinitions)"
|
|
|
|
vc2010.element(3, 'PreprocessorDefinitions', condition, defines)
|
2012-08-01 19:28:21 +00:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
|
2013-02-11 18:25:33 +00:00
|
|
|
function vc2010.programDataBaseFileName(cfg)
|
|
|
|
if cfg.flags.Symbols and cfg.debugformat ~= "c7" then
|
|
|
|
local filename = cfg.buildtarget.basename
|
|
|
|
_p(3,'<ProgramDataBaseFileName>$(OutDir)%s.pdb</ProgramDataBaseFileName>', filename)
|
|
|
|
end
|
|
|
|
end
|
2012-08-01 19:28:21 +00:00
|
|
|
|
2013-02-11 18:25:33 +00:00
|
|
|
|
|
|
|
function vc2010.projectGuid(prj)
|
|
|
|
_p(2,'<ProjectGuid>{%s}</ProjectGuid>', prj.uuid)
|
|
|
|
end
|
|
|
|
|
|
|
|
|
2013-05-01 16:08:41 +00:00
|
|
|
function vc2010.projectName(prj)
|
|
|
|
if prj.name ~= prj.filename then
|
|
|
|
_x(2,'<ProjectName>%s</ProjectName>', prj.name)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
|
2013-02-11 18:25:33 +00:00
|
|
|
function vc2010.propertyGroup(cfg, label)
|
|
|
|
local cond
|
|
|
|
if cfg then
|
|
|
|
cond = string.format(' %s', vc2010.condition(cfg))
|
2012-08-01 19:28:21 +00:00
|
|
|
end
|
2013-02-11 18:25:33 +00:00
|
|
|
|
|
|
|
if label then
|
|
|
|
label = string.format(' Label="%s"', label)
|
|
|
|
end
|
|
|
|
|
|
|
|
_p(1,'<PropertyGroup%s%s>', cond or "", label or "")
|
2012-12-11 16:17:43 +00:00
|
|
|
end
|
2012-08-01 19:28:21 +00:00
|
|
|
|
|
|
|
|
2013-04-30 16:38:11 +00:00
|
|
|
function vc2010.resourceAdditionalIncludeDirectories(cfg)
|
|
|
|
vc2010.additionalIncludeDirectories(cfg, table.join(cfg.includedirs, cfg.resincludedirs))
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
function vc2010.resourcePreprocessorDefinitions(cfg)
|
|
|
|
vc2010.preprocessorDefinitions(cfg, table.join(cfg.defines, cfg.resdefines), true)
|
|
|
|
end
|
|
|
|
|
|
|
|
|
2013-02-11 18:25:33 +00:00
|
|
|
function vc2010.runtimeLibrary(cfg)
|
2013-03-27 15:12:37 +00:00
|
|
|
local runtimes = {
|
|
|
|
StaticDebug = "MultiThreadedDebug",
|
|
|
|
StaticRelease = "MultiThreaded",
|
|
|
|
}
|
|
|
|
local runtime = runtimes[config.getruntime(cfg)]
|
|
|
|
if runtime then
|
|
|
|
_p(3,'<RuntimeLibrary>%s</RuntimeLibrary>', runtime)
|
2013-02-08 15:35:14 +00:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2013-10-29 07:10:01 +00:00
|
|
|
function vc2010.omitDefaultLib(cfg)
|
|
|
|
if cfg.flags.OmitDefaultLibrary then
|
|
|
|
_p(3,'<OmitDefaultLibName>true</OmitDefaultLibName>')
|
|
|
|
end
|
|
|
|
end
|
2013-02-08 15:35:14 +00:00
|
|
|
|
2013-02-11 18:25:33 +00:00
|
|
|
function vc2010.runtimeTypeInfo(cfg)
|
|
|
|
if cfg.flags.NoRTTI and not cfg.flags.Managed then
|
|
|
|
_p(3,'<RuntimeTypeInfo>false</RuntimeTypeInfo>')
|
2013-02-08 15:35:14 +00:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2013-08-15 22:22:23 +00:00
|
|
|
function vc2010.bufferSecurityCheck(cfg)
|
|
|
|
if cfg.flags.NoBufferSecurityCheck then
|
|
|
|
_p(3,'<BufferSecurityCheck>false</BufferSecurityCheck>')
|
|
|
|
end
|
|
|
|
end
|
2013-02-08 15:35:14 +00:00
|
|
|
|
2013-02-11 18:25:33 +00:00
|
|
|
function vc2010.stringPooling(cfg)
|
2013-09-13 15:15:36 +00:00
|
|
|
if config.isOptimizedBuild(cfg) then
|
2013-02-11 18:25:33 +00:00
|
|
|
_p(3,'<StringPooling>true</StringPooling>')
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
function vc2010.subSystem(cfg)
|
2013-03-07 17:14:03 +00:00
|
|
|
if cfg.system ~= premake.XBOX360 then
|
|
|
|
local subsystem = iif(cfg.kind == premake.CONSOLEAPP, "Console", "Windows")
|
|
|
|
_p(3,'<SubSystem>%s</SubSystem>', subsystem)
|
|
|
|
end
|
2013-02-11 18:25:33 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
function vc2010.targetExt(cfg)
|
2013-05-22 13:06:33 +00:00
|
|
|
local ext = cfg.buildtarget.extension
|
|
|
|
if ext ~= "" then
|
|
|
|
_x(2,'<TargetExt>%s</TargetExt>', ext)
|
|
|
|
else
|
|
|
|
_p(2,'<TargetExt>')
|
|
|
|
_p(2,'</TargetExt>')
|
|
|
|
end
|
2013-02-11 18:25:33 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
function vc2010.targetName(cfg)
|
|
|
|
_x(2,'<TargetName>%s%s</TargetName>', cfg.buildtarget.prefix, cfg.buildtarget.basename)
|
|
|
|
end
|
|
|
|
|
|
|
|
|
2013-12-24 19:01:57 +00:00
|
|
|
function vc2010.treatLinkerWarningAsErrors(cfg)
|
2014-02-14 17:23:12 +00:00
|
|
|
if cfg.flags.FatalLinkWarnings then
|
2013-12-24 19:01:57 +00:00
|
|
|
local el = iif(cfg.kind == premake.STATICLIB, "Lib", "Linker")
|
|
|
|
_p(3,'<Treat%sWarningAsErrors>true</Treat%sWarningAsErrors>', el, el)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
|
2013-02-11 18:25:33 +00:00
|
|
|
function vc2010.treatWChar_tAsBuiltInType(cfg)
|
2013-09-27 19:12:50 +00:00
|
|
|
local map = { On = "true", Off = "false" }
|
|
|
|
local value = map[cfg.nativewchar]
|
|
|
|
if value then
|
|
|
|
_p(3,'<TreatWChar_tAsBuiltInType>%s</TreatWChar_tAsBuiltInType>', value)
|
2013-02-11 18:25:33 +00:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
function vc2010.treatWarningAsError(cfg)
|
2014-02-14 17:23:12 +00:00
|
|
|
if cfg.flags.FatalLinkWarnings and cfg.warnings ~= "Off" then
|
2012-08-01 19:28:21 +00:00
|
|
|
_p(3,'<TreatWarningAsError>true</TreatWarningAsError>')
|
2013-01-12 16:52:59 +00:00
|
|
|
end
|
2012-12-11 16:17:43 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
|
2013-02-11 18:25:33 +00:00
|
|
|
function vc2010.useDebugLibraries(cfg)
|
2013-03-27 15:12:37 +00:00
|
|
|
local runtime = config.getruntime(cfg)
|
|
|
|
_p(2,'<UseDebugLibraries>%s</UseDebugLibraries>', tostring(runtime:endswith("Debug")))
|
2013-02-11 18:25:33 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
function vc2010.useOfMfc(cfg)
|
|
|
|
if cfg.flags.MFC then
|
|
|
|
_p(2,'<UseOfMfc>%s</UseOfMfc>', iif(cfg.flags.StaticRuntime, "Static", "Dynamic"))
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
function vc2010.warningLevel(cfg)
|
2013-09-29 16:39:07 +00:00
|
|
|
local map = { Off = "TurnOffAllWarnings", Extra = "Level4" }
|
|
|
|
vc2010.element(3, "WarningLevel", nil, "%s", map[cfg.warnings] or "Level3")
|
2012-08-01 19:28:21 +00:00
|
|
|
end
|
2013-03-12 23:26:25 +00:00
|
|
|
|
|
|
|
|
2014-01-07 22:08:51 +00:00
|
|
|
function vc2010.xmlDeclaration()
|
|
|
|
_p('<?xml version="1.0" encoding="utf-8"?>')
|
|
|
|
end
|
|
|
|
|
2013-03-12 23:26:25 +00:00
|
|
|
|
|
|
|
|
|
|
|
---------------------------------------------------------------------------
|
|
|
|
--
|
|
|
|
-- Support functions
|
|
|
|
--
|
|
|
|
---------------------------------------------------------------------------
|
|
|
|
|
|
|
|
--
|
|
|
|
-- Format and return a Visual Studio Condition attribute.
|
|
|
|
--
|
|
|
|
|
|
|
|
function vc2010.condition(cfg)
|
|
|
|
return string.format('Condition="\'$(Configuration)|$(Platform)\'==\'%s\'"', premake.esc(vstudio.projectConfig(cfg)))
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
--
|
|
|
|
-- Output an individual project XML element, with an optional configuration
|
|
|
|
-- condition.
|
|
|
|
--
|
|
|
|
-- @param depth
|
|
|
|
-- How much to indent the element.
|
|
|
|
-- @param name
|
|
|
|
-- The element name.
|
|
|
|
-- @param condition
|
|
|
|
-- An optional configuration condition, formatted with vc2010.condition().
|
|
|
|
-- @param value
|
|
|
|
-- The element value, which may contain printf formatting tokens.
|
|
|
|
-- @param ...
|
|
|
|
-- Optional additional arguments to satisfy any tokens in the value.
|
|
|
|
--
|
|
|
|
|
|
|
|
function vc2010.element(depth, name, condition, value, ...)
|
|
|
|
if select('#',...) == 0 then
|
|
|
|
value = premake.esc(value)
|
|
|
|
end
|
|
|
|
|
|
|
|
local format
|
|
|
|
if condition then
|
|
|
|
format = string.format('<%s %s>%s</%s>', name, condition, value, name)
|
|
|
|
else
|
|
|
|
format = string.format('<%s>%s</%s>', name, value, name)
|
|
|
|
end
|
|
|
|
|
|
|
|
_x(depth, format, ...)
|
|
|
|
end
|