Make more VC'10 project elements available for override by add-ons; clean up naming conventions of modified functions
This commit is contained in:
parent
3b84626132
commit
91272ebd37
@ -25,9 +25,9 @@
|
||||
isnextgen = true,
|
||||
|
||||
valid_kinds = { "ConsoleApp", "WindowedApp", "StaticLib", "SharedLib" },
|
||||
|
||||
|
||||
valid_languages = { "C", "C++", "C#" },
|
||||
|
||||
|
||||
valid_tools = {
|
||||
cc = { "msc" },
|
||||
dotnet = { "msnet" },
|
||||
@ -36,7 +36,7 @@
|
||||
onsolution = function(sln)
|
||||
premake.generate(sln, ".sln", vstudio.sln2005.generate_ng)
|
||||
end,
|
||||
|
||||
|
||||
onproject = function(prj)
|
||||
if premake.isdotnetproject(prj) then
|
||||
premake.generate(prj, ".csproj", vstudio.cs2005.generate_ng)
|
||||
@ -46,7 +46,7 @@
|
||||
premake.generate(prj, ".vcproj.user", vstudio.vc200x.generate_user_ng)
|
||||
end
|
||||
end,
|
||||
|
||||
|
||||
oncleansolution = vstudio.cleansolution,
|
||||
oncleanproject = vstudio.cleanproject,
|
||||
oncleantarget = vstudio.cleantarget
|
||||
@ -61,7 +61,7 @@
|
||||
|
||||
-- temporary, until I can phase out the legacy implementations
|
||||
isnextgen = true,
|
||||
|
||||
|
||||
valid_kinds = { "ConsoleApp", "WindowedApp", "StaticLib", "SharedLib" },
|
||||
|
||||
valid_languages = { "C", "C++", "C#" },
|
||||
@ -118,9 +118,9 @@
|
||||
premake.generate(prj, ".csproj", vstudio.cs2005.generate_ng)
|
||||
premake.generate(prj, ".csproj.user", vstudio.cs2005.generate_user_ng)
|
||||
else
|
||||
premake.generate(prj, ".vcxproj", vstudio.vc2010.generate_ng)
|
||||
premake.generate(prj, ".vcxproj.user", vstudio.vc2010.generate_user_ng)
|
||||
premake.generate(prj, ".vcxproj.filters", vstudio.vc2010.generate_filters_ng)
|
||||
premake.generate(prj, ".vcxproj", vstudio.vc2010.generate)
|
||||
premake.generate(prj, ".vcxproj.user", vstudio.vc2010.generateUser)
|
||||
premake.generate(prj, ".vcxproj.filters", vstudio.vc2010.generateFilters)
|
||||
end
|
||||
end,
|
||||
|
||||
@ -157,9 +157,9 @@
|
||||
premake.generate(prj, ".csproj", vstudio.cs2005.generate_ng)
|
||||
premake.generate(prj, ".csproj.user", vstudio.cs2005.generate_user_ng)
|
||||
else
|
||||
premake.generate(prj, ".vcxproj", vstudio.vc2010.generate_ng)
|
||||
premake.generate(prj, ".vcxproj.user", vstudio.vc2010.generate_user_ng)
|
||||
premake.generate(prj, ".vcxproj.filters", vstudio.vc2010.generate_filters_ng)
|
||||
premake.generate(prj, ".vcxproj", vstudio.vc2010.generate)
|
||||
premake.generate(prj, ".vcxproj.user", vstudio.vc2010.generateUser)
|
||||
premake.generate(prj, ".vcxproj.filters", vstudio.vc2010.generateFilters)
|
||||
end
|
||||
end,
|
||||
|
||||
@ -175,14 +175,14 @@
|
||||
-- add-ons.
|
||||
--
|
||||
|
||||
vstudio.vs200x_architectures =
|
||||
vstudio.vs200x_architectures =
|
||||
{
|
||||
x32 = "x86",
|
||||
x64 = "x64",
|
||||
xbox360 = "Xbox 360",
|
||||
}
|
||||
|
||||
vstudio.vs2010_architectures =
|
||||
|
||||
vstudio.vs2010_architectures =
|
||||
{
|
||||
}
|
||||
|
||||
@ -213,7 +213,7 @@
|
||||
function vstudio.archFromConfig(cfg, win32)
|
||||
local iscpp = premake.iscppproject(cfg.project)
|
||||
|
||||
local arch = architecture(cfg.system, cfg.architecture)
|
||||
local arch = architecture(cfg.system, cfg.architecture)
|
||||
if not arch then
|
||||
arch = iif(iscpp, "x86", "Any CPU")
|
||||
end
|
||||
@ -221,7 +221,7 @@
|
||||
if win32 and iscpp and arch == "x86" then
|
||||
arch = "Win32"
|
||||
end
|
||||
|
||||
|
||||
return arch
|
||||
end
|
||||
|
||||
@ -235,7 +235,7 @@
|
||||
-- @return
|
||||
-- A Visual Studio architecture identifier, or nil if no mapping
|
||||
-- could be made.
|
||||
--
|
||||
--
|
||||
|
||||
function vstudio.archFromPlatform(platform)
|
||||
local system = premake.api.checkvalue(platform, premake.fields.system)
|
||||
@ -263,7 +263,7 @@
|
||||
local cfgdeps = config.getlinks(cfg, "dependencies", "object")
|
||||
ex = #prjdeps ~= #cfgdeps
|
||||
end
|
||||
return ex
|
||||
return ex
|
||||
end
|
||||
|
||||
|
||||
@ -276,7 +276,7 @@
|
||||
-- @param arch
|
||||
-- An optional architecture identifier, to override the configuration.
|
||||
-- @return
|
||||
-- A project configuration identifier of the form
|
||||
-- A project configuration identifier of the form
|
||||
-- <project platform name>|<architecture>.
|
||||
--
|
||||
|
||||
@ -334,7 +334,7 @@
|
||||
|
||||
|
||||
--
|
||||
-- Determine the appropriate Visual Studio platform identifier for a
|
||||
-- Determine the appropriate Visual Studio platform identifier for a
|
||||
-- solution-level configuration.
|
||||
--
|
||||
-- @param cfg
|
||||
@ -351,7 +351,7 @@
|
||||
local platarch
|
||||
if platform then
|
||||
platform = vstudio.archFromPlatform(platform) or platform
|
||||
|
||||
|
||||
-- Value for 32-bit arch is different depending on whether this solution
|
||||
-- contains C++ or C# projects or both
|
||||
if platform ~= "x86" then
|
||||
@ -373,7 +373,7 @@
|
||||
-- get a VS architecture identifier for this project
|
||||
local prjcfg = project.getconfig(prj, cfg.buildcfg, cfg.platform)
|
||||
if prjcfg then
|
||||
local prjarch = vstudio.archFromConfig(prjcfg)
|
||||
local prjarch = vstudio.archFromConfig(prjcfg)
|
||||
if not slnarch then
|
||||
slnarch = prjarch
|
||||
elseif slnarch ~= prjarch then
|
||||
@ -410,20 +410,20 @@
|
||||
function vstudio.solutionarch(cfg)
|
||||
local hascpp = false
|
||||
local hasdotnet = false
|
||||
|
||||
|
||||
-- if the configuration has a platform identifier, use that as default
|
||||
local arch = cfg.platform
|
||||
|
||||
|
||||
-- if the platform identifier matches a known system or architecture,
|
||||
--
|
||||
|
||||
|
||||
for prj in solution.eachproject_ng(cfg.solution) do
|
||||
if premake.iscppproject(prj) then
|
||||
if premake.iscppproject(prj) then
|
||||
hascpp = true
|
||||
elseif premake.isdotnetproject(prj) then
|
||||
hasdotnet = true
|
||||
end
|
||||
|
||||
|
||||
if hascpp and hasdotnet then
|
||||
return "Mixed Platforms"
|
||||
end
|
||||
@ -437,7 +437,7 @@
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
-- use a default if no other architecture was specified
|
||||
arch = arch or iif(hascpp, "Win32", "Any CPU")
|
||||
return arch
|
||||
@ -458,14 +458,14 @@
|
||||
|
||||
function vstudio.solutionconfig(cfg)
|
||||
local platform = cfg.platform
|
||||
|
||||
|
||||
-- if no platform name was specified, use the architecture instead;
|
||||
-- since architectures are defined in the projects and not at the
|
||||
-- since architectures are defined in the projects and not at the
|
||||
-- solution level, need to poke around to figure this out
|
||||
if not platform then
|
||||
platform = vstudio.solutionarch(cfg)
|
||||
end
|
||||
|
||||
|
||||
return string.format("%s|%s", cfg.buildcfg, platform)
|
||||
end
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
--
|
||||
-- vs2010_vcxproj.lua
|
||||
-- Generate a Visual Studio 201x C/C++ project.
|
||||
-- Copyright (c) 2009-2012 Jason Perkins and the Premake project
|
||||
-- Copyright (c) 2009-2013 Jason Perkins and the Premake project
|
||||
--
|
||||
|
||||
premake.vstudio.vc2010 = {}
|
||||
@ -16,12 +16,12 @@
|
||||
-- Generate a Visual Studio 201x C++ project, with support for the new platforms API.
|
||||
--
|
||||
|
||||
function vc2010.generate_ng(prj)
|
||||
function vc2010.generate(prj)
|
||||
io.eol = "\r\n"
|
||||
io.indent = " "
|
||||
io.utf8()
|
||||
|
||||
vc2010.header_ng("Build")
|
||||
vc2010.project("Build")
|
||||
vc2010.projectConfigurations(prj)
|
||||
vc2010.globals(prj)
|
||||
|
||||
@ -36,7 +36,7 @@
|
||||
_p(1,'</ImportGroup>')
|
||||
|
||||
for cfg in project.eachconfig(prj) do
|
||||
vc2010.propertySheet(cfg)
|
||||
vc2010.propertySheets(cfg)
|
||||
end
|
||||
|
||||
_p(1,'<PropertyGroup Label="UserMacros" />')
|
||||
@ -47,17 +47,17 @@
|
||||
|
||||
for cfg in project.eachconfig(prj) do
|
||||
_p(1,'<ItemDefinitionGroup %s>', vc2010.condition(cfg))
|
||||
vc2010.ClCompile(cfg)
|
||||
vc2010.clCompile(cfg)
|
||||
vc2010.resourceCompile(cfg)
|
||||
vc2010.Link(cfg)
|
||||
vc2010.link(cfg)
|
||||
vc2010.buildEvents(cfg)
|
||||
_p(1,'</ItemDefinitionGroup>')
|
||||
end
|
||||
|
||||
vc2010.files_ng(prj)
|
||||
vc2010.projectReferences_ng(prj)
|
||||
vc2010.files(prj)
|
||||
vc2010.projectReferences(prj)
|
||||
|
||||
vc2010.Import(prj)
|
||||
vc2010.import(prj)
|
||||
|
||||
_p('</Project>')
|
||||
end
|
||||
@ -68,7 +68,7 @@
|
||||
-- Output the XML declaration and opening <Project> tag.
|
||||
--
|
||||
|
||||
function vc2010.header_ng(target)
|
||||
function vc2010.project(target)
|
||||
_p('<?xml version="1.0" encoding="utf-8"?>')
|
||||
|
||||
local defaultTargets = ""
|
||||
@ -118,8 +118,8 @@
|
||||
--
|
||||
|
||||
function vc2010.globals(prj)
|
||||
_p(1,'<PropertyGroup Label="Globals">')
|
||||
_p(2,'<ProjectGuid>{%s}</ProjectGuid>', prj.uuid)
|
||||
vc2010.propertyGroup(nil, "Globals")
|
||||
vc2010.projectGuid(prj)
|
||||
|
||||
-- try to determine what kind of targets we're building here
|
||||
local isWin, isManaged
|
||||
@ -152,23 +152,13 @@
|
||||
--
|
||||
|
||||
function vc2010.configurationProperties(cfg)
|
||||
_p(1,'<PropertyGroup %s Label="Configuration">', vc2010.condition(cfg))
|
||||
_p(2,'<ConfigurationType>%s</ConfigurationType>', vc2010.config_type(cfg))
|
||||
_p(2,'<UseDebugLibraries>%s</UseDebugLibraries>', tostring(premake.config.isdebugbuild(cfg)))
|
||||
|
||||
if _ACTION == "vs2012" then
|
||||
_p(2,'<PlatformToolset>v110</PlatformToolset>')
|
||||
end
|
||||
|
||||
if cfg.flags.MFC then
|
||||
_p(2,'<UseOfMfc>%s</UseOfMfc>', iif(cfg.flags.StaticRuntime, "Static", "Dynamic"))
|
||||
end
|
||||
|
||||
if cfg.flags.Managed then
|
||||
_p(2,'<CLRSupport>true</CLRSupport>')
|
||||
end
|
||||
|
||||
_p(2,'<CharacterSet>%s</CharacterSet>', iif(cfg.flags.Unicode, "Unicode", "MultiByte"))
|
||||
vc2010.propertyGroup(cfg, "Configuration")
|
||||
vc2010.configurationType(cfg)
|
||||
vc2010.useDebugLibraries(cfg)
|
||||
vc2010.platformToolset(cfg)
|
||||
vc2010.useOfMfc(cfg)
|
||||
vc2010.clrSupport(cfg)
|
||||
vc2010.characterSet(cfg)
|
||||
_p(1,'</PropertyGroup>')
|
||||
end
|
||||
|
||||
@ -177,7 +167,7 @@
|
||||
-- Write out the default property sheets for a configuration.
|
||||
--
|
||||
|
||||
function vc2010.propertySheet(cfg)
|
||||
function vc2010.propertySheets(cfg)
|
||||
_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>')
|
||||
@ -190,35 +180,15 @@
|
||||
--
|
||||
|
||||
function vc2010.outputProperties(cfg)
|
||||
local target = cfg.buildtarget
|
||||
|
||||
_p(1,'<PropertyGroup %s>', vc2010.condition(cfg))
|
||||
|
||||
if cfg.kind ~= premake.STATICLIB then
|
||||
_p(2,'<LinkIncremental>%s</LinkIncremental>', tostring(premake.config.canincrementallink(cfg)))
|
||||
end
|
||||
|
||||
if cfg.kind == premake.SHAREDLIB and cfg.flags.NoImportLib then
|
||||
_p(2,'<IgnoreImportLibrary>true</IgnoreImportLibrary>');
|
||||
end
|
||||
|
||||
local outdir = project.getrelative(cfg.project, target.directory)
|
||||
_x(2,'<OutDir>%s\\</OutDir>', path.translate(outdir))
|
||||
|
||||
if cfg.system == premake.XBOX360 then
|
||||
_x(2,'<OutputFile>$(OutDir)%s</OutputFile>', target.name)
|
||||
end
|
||||
|
||||
local objdir = project.getrelative(cfg.project, cfg.objdir)
|
||||
_x(2,'<IntDir>%s\\</IntDir>', path.translate(objdir))
|
||||
|
||||
_x(2,'<TargetName>%s%s</TargetName>', target.prefix, target.basename)
|
||||
_x(2,'<TargetExt>%s</TargetExt>', target.extension)
|
||||
|
||||
if cfg.flags.NoManifest then
|
||||
_p(2,'<GenerateManifest>false</GenerateManifest>')
|
||||
end
|
||||
|
||||
vc2010.propertyGroup(cfg)
|
||||
vc2010.linkIncremental(cfg)
|
||||
vc2010.ignoreImportLibrary(cfg)
|
||||
vc2010.outDir(cfg)
|
||||
vc2010.outputFile(cfg)
|
||||
vc2010.intDir(cfg)
|
||||
vc2010.targetName(cfg)
|
||||
vc2010.targetExt(cfg)
|
||||
vc2010.generateManifest(cfg)
|
||||
_p(1,'</PropertyGroup>')
|
||||
end
|
||||
|
||||
@ -227,95 +197,32 @@
|
||||
-- Write the the <ClCompile> compiler settings block.
|
||||
--
|
||||
|
||||
function vc2010.ClCompile(cfg)
|
||||
function vc2010.clCompile(cfg)
|
||||
_p(2,'<ClCompile>')
|
||||
|
||||
if not cfg.flags.NoPCH and cfg.pchheader then
|
||||
_p(3,'<PrecompiledHeader>Use</PrecompiledHeader>')
|
||||
_x(3,'<PrecompiledHeaderFile>%s</PrecompiledHeaderFile>', path.getname(cfg.pchheader))
|
||||
else
|
||||
_p(3,'<PrecompiledHeader>NotUsing</PrecompiledHeader>')
|
||||
end
|
||||
|
||||
vc2010.WarningLevel(cfg)
|
||||
vc2010.TreatWarningAsError(cfg)
|
||||
vc2010.BasicRuntimeChecks(cfg)
|
||||
|
||||
vc2010.precompiledHeader(cfg)
|
||||
vc2010.warningLevel(cfg)
|
||||
vc2010.treatWarningAsError(cfg)
|
||||
vc2010.basicRuntimeChecks(cfg)
|
||||
vc2010.preprocessorDefinitions(cfg.defines)
|
||||
vc2010.additionalIncludeDirectories(cfg, cfg.includedirs)
|
||||
|
||||
if #cfg.forceincludes > 0 then
|
||||
local includes = project.getrelative(cfg.project, cfg.forceincludes)
|
||||
_x(3,'<ForcedIncludeFiles>%s</ForcedIncludeFiles>', table.concat(includes, ';'))
|
||||
end
|
||||
|
||||
vc2010.debuginfo(cfg)
|
||||
|
||||
if cfg.flags.Symbols and cfg.debugformat ~= "c7" then
|
||||
local filename = cfg.buildtarget.basename
|
||||
_p(3,'<ProgramDataBaseFileName>$(OutDir)%s.pdb</ProgramDataBaseFileName>', filename)
|
||||
end
|
||||
|
||||
_p(3,'<Optimization>%s</Optimization>', vc2010.optimization(cfg))
|
||||
|
||||
if premake.config.isoptimizedbuild(cfg) then
|
||||
_p(3,'<FunctionLevelLinking>true</FunctionLevelLinking>')
|
||||
_p(3,'<IntrinsicFunctions>true</IntrinsicFunctions>')
|
||||
end
|
||||
|
||||
vc2010.MinimalRebuild(cfg)
|
||||
|
||||
if cfg.flags.NoFramePointer then
|
||||
_p(3,'<OmitFramePointers>true</OmitFramePointers>')
|
||||
end
|
||||
|
||||
if premake.config.isoptimizedbuild(cfg) then
|
||||
_p(3,'<StringPooling>true</StringPooling>')
|
||||
end
|
||||
|
||||
if cfg.flags.StaticRuntime then
|
||||
_p(3,'<RuntimeLibrary>%s</RuntimeLibrary>', iif(premake.config.isdebugbuild(cfg), "MultiThreadedDebug", "MultiThreaded"))
|
||||
end
|
||||
|
||||
if cfg.flags.NoExceptions then
|
||||
_p(3,'<ExceptionHandling>false</ExceptionHandling>')
|
||||
elseif cfg.flags.SEH then
|
||||
_p(3,'<ExceptionHandling>Async</ExceptionHandling>')
|
||||
end
|
||||
|
||||
if cfg.flags.NoRTTI and not cfg.flags.Managed then
|
||||
_p(3,'<RuntimeTypeInfo>false</RuntimeTypeInfo>')
|
||||
end
|
||||
|
||||
if cfg.flags.NativeWChar then
|
||||
_p(3,'<TreatWChar_tAsBuiltInType>true</TreatWChar_tAsBuiltInType>')
|
||||
elseif cfg.flags.NoNativeWChar then
|
||||
_p(3,'<TreatWChar_tAsBuiltInType>false</TreatWChar_tAsBuiltInType>')
|
||||
end
|
||||
|
||||
if cfg.flags.FloatFast then
|
||||
_p(3,'<FloatingPointModel>Fast</FloatingPointModel>')
|
||||
elseif cfg.flags.FloatStrict and not cfg.flags.Managed then
|
||||
_p(3,'<FloatingPointModel>Strict</FloatingPointModel>')
|
||||
end
|
||||
|
||||
if cfg.flags.EnableSSE2 then
|
||||
_p(3,'<EnableEnhancedInstructionSet>StreamingSIMDExtensions2</EnableEnhancedInstructionSet>')
|
||||
elseif cfg.flags.EnableSSE then
|
||||
_p(3,'<EnableEnhancedInstructionSet>StreamingSIMDExtensions</EnableEnhancedInstructionSet>')
|
||||
end
|
||||
|
||||
vc2010.MultiProcessorCompilation(cfg)
|
||||
|
||||
if #cfg.buildoptions > 0 then
|
||||
local options = table.concat(cfg.buildoptions, " ")
|
||||
_x(3,'<AdditionalOptions>%s %%(AdditionalOptions)</AdditionalOptions>', options)
|
||||
end
|
||||
|
||||
if cfg.project.language == "C" then
|
||||
_p(3,'<CompileAs>CompileAsC</CompileAs>')
|
||||
end
|
||||
|
||||
vc2010.forceIncludes(cfg)
|
||||
vc2010.debugInformationFormat(cfg)
|
||||
vc2010.programDataBaseFileName(cfg)
|
||||
vc2010.optimization(cfg)
|
||||
vc2010.functionLevelLinking(cfg)
|
||||
vc2010.intrinsicFunctions(cfg)
|
||||
vc2010.minimalRebuild(cfg)
|
||||
vc2010.omitFramePointers(cfg)
|
||||
vc2010.stringPooling(cfg)
|
||||
vc2010.runtimeLibrary(cfg)
|
||||
vc2010.exceptionHandling(cfg)
|
||||
vc2010.runtimeTypeInfo(cfg)
|
||||
vc2010.treatWChar_tAsBuiltInType(cfg)
|
||||
vc2010.floatingPointModel(cfg)
|
||||
vc2010.enableEnhancedInstructionSet(cfg)
|
||||
vc2010.multiProcessorCompilation(cfg)
|
||||
vc2010.clCompile_AdditionalOptions(cfg)
|
||||
vc2010.compileAs(cfg)
|
||||
_p(2,'</ClCompile>')
|
||||
end
|
||||
|
||||
@ -336,57 +243,37 @@
|
||||
-- Write out the linker tool block.
|
||||
--
|
||||
|
||||
function vc2010.Link(cfg)
|
||||
function vc2010.link(cfg)
|
||||
local explicit = vstudio.needsExplicitLink(cfg)
|
||||
|
||||
_p(2,'<Link>')
|
||||
|
||||
local subsystem = iif(cfg.kind == premake.CONSOLEAPP, "Console", "Windows")
|
||||
_p(3,'<SubSystem>%s</SubSystem>', subsystem)
|
||||
|
||||
_p(3,'<GenerateDebugInformation>%s</GenerateDebugInformation>', tostring(cfg.flags.Symbols ~= nil))
|
||||
|
||||
if premake.config.isoptimizedbuild(cfg) then
|
||||
_p(3,'<EnableCOMDATFolding>true</EnableCOMDATFolding>')
|
||||
_p(3,'<OptimizeReferences>true</OptimizeReferences>')
|
||||
end
|
||||
vc2010.subSystem(cfg)
|
||||
vc2010.generateDebugInformation(cfg)
|
||||
vc2010.optimizeReferences(cfg)
|
||||
|
||||
if cfg.kind ~= premake.STATICLIB then
|
||||
vc2010.LinkDynamic(cfg, explicit)
|
||||
vc2010.linkDynamic(cfg, explicit)
|
||||
end
|
||||
|
||||
_p(2,'</Link>')
|
||||
|
||||
if cfg.kind == premake.STATICLIB then
|
||||
vc2010.LinkStatic(cfg)
|
||||
vc2010.linkStatic(cfg)
|
||||
end
|
||||
|
||||
-- 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
|
||||
vc2010.linkLibraryDependencies(cfg, explicit)
|
||||
end
|
||||
|
||||
function vc2010.LinkDynamic(cfg, explicit)
|
||||
function vc2010.linkDynamic(cfg, explicit)
|
||||
vc2010.additionalDependencies(cfg, explicit)
|
||||
vc2010.additionalLibraryDirectories(cfg)
|
||||
|
||||
if cfg.kind == premake.SHAREDLIB then
|
||||
_x(3,'<ImportLibrary>%s</ImportLibrary>', path.translate(cfg.linktarget.relpath))
|
||||
end
|
||||
|
||||
if vc2010.config_type(cfg) == "Application" and not cfg.flags.WinMain and not cfg.flags.Managed then
|
||||
_p(3,'<EntryPointSymbol>mainCRTStartup</EntryPointSymbol>')
|
||||
end
|
||||
|
||||
vc2010.importLibrary(cfg)
|
||||
vc2010.entryPointSymbol(cfg)
|
||||
vc2010.additionalLinkOptions(cfg)
|
||||
end
|
||||
|
||||
function vc2010.LinkStatic(cfg)
|
||||
function vc2010.linkStatic(cfg)
|
||||
_p(2,'<Lib>')
|
||||
vc2010.additionalLinkOptions(cfg)
|
||||
_p(2,'</Lib>')
|
||||
@ -415,16 +302,16 @@
|
||||
-- Write out the list of source code files, and any associated configuration.
|
||||
--
|
||||
|
||||
function vc2010.files_ng(prj)
|
||||
vc2010.simplefilesgroup_ng(prj, "ClInclude")
|
||||
vc2010.compilerfilesgroup_ng(prj)
|
||||
vc2010.simplefilesgroup_ng(prj, "None")
|
||||
vc2010.simplefilesgroup_ng(prj, "ResourceCompile")
|
||||
function vc2010.files(prj)
|
||||
vc2010.simplefilesgroup(prj, "ClInclude")
|
||||
vc2010.compilerfilesgroup(prj)
|
||||
vc2010.simplefilesgroup(prj, "None")
|
||||
vc2010.simplefilesgroup(prj, "ResourceCompile")
|
||||
vc2010.customBuildFilesGroup(prj)
|
||||
end
|
||||
|
||||
function vc2010.simplefilesgroup_ng(prj, group)
|
||||
local files = vc2010.getfilegroup_ng(prj, group)
|
||||
function vc2010.simplefilesgroup(prj, group)
|
||||
local files = vc2010.getfilegroup(prj, group)
|
||||
if #files > 0 then
|
||||
_p(1,'<ItemGroup>')
|
||||
for _, file in ipairs(files) do
|
||||
@ -434,8 +321,8 @@
|
||||
end
|
||||
end
|
||||
|
||||
function vc2010.compilerfilesgroup_ng(prj)
|
||||
local files = vc2010.getfilegroup_ng(prj, "ClCompile")
|
||||
function vc2010.compilerfilesgroup(prj)
|
||||
local files = vc2010.getfilegroup(prj, "ClCompile")
|
||||
if #files > 0 then
|
||||
_p(1,'<ItemGroup>')
|
||||
for _, file in ipairs(files) do
|
||||
@ -464,7 +351,7 @@
|
||||
end
|
||||
|
||||
function vc2010.customBuildFilesGroup(prj)
|
||||
local files = vc2010.getfilegroup_ng(prj, "CustomBuild")
|
||||
local files = vc2010.getfilegroup(prj, "CustomBuild")
|
||||
if #files > 0 then
|
||||
_p(1,'<ItemGroup>')
|
||||
for _, file in ipairs(files) do
|
||||
@ -489,7 +376,7 @@
|
||||
end
|
||||
end
|
||||
|
||||
function vc2010.getfilegroup_ng(prj, group)
|
||||
function vc2010.getfilegroup(prj, group)
|
||||
-- check for a cached copy before creating
|
||||
local groups = prj.vc2010_file_groups
|
||||
if not groups then
|
||||
@ -539,7 +426,7 @@
|
||||
-- Generate the list of project dependencies.
|
||||
--
|
||||
|
||||
function vc2010.projectReferences_ng(prj)
|
||||
function vc2010.projectReferences(prj)
|
||||
local deps = project.getdependencies(prj)
|
||||
if #deps > 0 then
|
||||
local prjpath = project.getlocation(prj)
|
||||
@ -557,18 +444,31 @@
|
||||
|
||||
|
||||
--
|
||||
-- Generate the list of target imports.
|
||||
-- Format and return a Visual Studio Condition attribute.
|
||||
--
|
||||
|
||||
function vc2010.Import(prj)
|
||||
_p(1,'<Import Project="$(VCTargetsPath)\\Microsoft.Cpp.targets" />')
|
||||
_p(1,'<ImportGroup Label="ExtensionTargets">')
|
||||
_p(1,'</ImportGroup>')
|
||||
function vc2010.condition(cfg)
|
||||
return string.format('Condition="\'$(Configuration)|$(Platform)\'==\'%s\'"', premake.esc(vstudio.projectConfig(cfg)))
|
||||
end
|
||||
|
||||
|
||||
--
|
||||
-- Write out the linker's additionalDependencies element.
|
||||
-- Map Premake's project kinds to Visual Studio configuration types.
|
||||
--
|
||||
|
||||
function vc2010.configType(cfg)
|
||||
local map = {
|
||||
SharedLib = "DynamicLibrary",
|
||||
StaticLib = "StaticLibrary",
|
||||
ConsoleApp = "Application",
|
||||
WindowedApp = "Application"
|
||||
}
|
||||
return map[cfg.kind]
|
||||
end
|
||||
|
||||
|
||||
--
|
||||
-- Handlers for individual project elements.
|
||||
--
|
||||
|
||||
function vc2010.additionalDependencies(cfg, explicit)
|
||||
@ -594,11 +494,6 @@
|
||||
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)
|
||||
@ -608,10 +503,6 @@
|
||||
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)
|
||||
@ -621,10 +512,6 @@
|
||||
end
|
||||
|
||||
|
||||
--
|
||||
-- Write out the <AdditionalOptions> element for the linker blocks.
|
||||
--
|
||||
|
||||
function vc2010.additionalLinkOptions(cfg)
|
||||
if #cfg.linkoptions > 0 then
|
||||
local opts = table.concat(cfg.linkoptions, " ")
|
||||
@ -633,35 +520,46 @@
|
||||
end
|
||||
|
||||
|
||||
--
|
||||
-- Format and return a Visual Studio Condition attribute.
|
||||
--
|
||||
|
||||
function vc2010.condition(cfg)
|
||||
return string.format('Condition="\'$(Configuration)|$(Platform)\'==\'%s\'"', premake.esc(vstudio.projectConfig(cfg)))
|
||||
function vc2010.basicRuntimeChecks(cfg)
|
||||
if cfg.flags.NoRuntimeChecks then
|
||||
_p(3,'<BasicRuntimeChecks>Default</BasicRuntimeChecks>')
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
--
|
||||
-- Map Premake's project kinds to Visual Studio configuration types.
|
||||
--
|
||||
|
||||
function vc2010.config_type(cfg)
|
||||
local map = {
|
||||
SharedLib = "DynamicLibrary",
|
||||
StaticLib = "StaticLibrary",
|
||||
ConsoleApp = "Application",
|
||||
WindowedApp = "Application"
|
||||
}
|
||||
return map[cfg.kind]
|
||||
function vc2010.characterSet(cfg)
|
||||
_p(2,'<CharacterSet>%s</CharacterSet>', iif(cfg.flags.Unicode, "Unicode", "MultiByte"))
|
||||
end
|
||||
|
||||
|
||||
--
|
||||
-- Translate Premake's debugging settings to the Visual Studio equivalent.
|
||||
--
|
||||
function vc2010.clCompile_AdditionalOptions(cfg)
|
||||
if #cfg.buildoptions > 0 then
|
||||
local options = table.concat(cfg.buildoptions, " ")
|
||||
_x(3,'<AdditionalOptions>%s %%(AdditionalOptions)</AdditionalOptions>', options)
|
||||
end
|
||||
end
|
||||
|
||||
function vc2010.debuginfo(cfg)
|
||||
|
||||
function vc2010.clrSupport(cfg)
|
||||
if cfg.flags.Managed then
|
||||
_p(2,'<CLRSupport>true</CLRSupport>')
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
function vc2010.compileAs(cfg)
|
||||
if cfg.project.language == "C" then
|
||||
_p(3,'<CompileAs>CompileAsC</CompileAs>')
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
function vc2010.configurationType(cfg)
|
||||
_p(2,'<ConfigurationType>%s</ConfigurationType>', vc2010.configType(cfg))
|
||||
end
|
||||
|
||||
|
||||
function vc2010.debugInformationFormat(cfg)
|
||||
local value
|
||||
if cfg.flags.Symbols then
|
||||
if cfg.debugformat == "c7" then
|
||||
@ -682,9 +580,152 @@
|
||||
end
|
||||
|
||||
|
||||
--
|
||||
-- Translate Premake's optimization flags to the Visual Studio equivalents.
|
||||
--
|
||||
function vc2010.enableEnhancedInstructionSet(cfg)
|
||||
if cfg.flags.EnableSSE2 then
|
||||
_p(3,'<EnableEnhancedInstructionSet>StreamingSIMDExtensions2</EnableEnhancedInstructionSet>')
|
||||
elseif cfg.flags.EnableSSE then
|
||||
_p(3,'<EnableEnhancedInstructionSet>StreamingSIMDExtensions</EnableEnhancedInstructionSet>')
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
function vc2010.entryPointSymbol(cfg)
|
||||
if vc2010.configType(cfg) == "Application" and not cfg.flags.WinMain and not cfg.flags.Managed then
|
||||
_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
|
||||
|
||||
|
||||
function vc2010.floatingPointModel(cfg)
|
||||
if cfg.flags.FloatFast then
|
||||
_p(3,'<FloatingPointModel>Fast</FloatingPointModel>')
|
||||
elseif cfg.flags.FloatStrict and not cfg.flags.Managed then
|
||||
_p(3,'<FloatingPointModel>Strict</FloatingPointModel>')
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
function vc2010.forceIncludes(cfg)
|
||||
if #cfg.forceincludes > 0 then
|
||||
local includes = project.getrelative(cfg.project, cfg.forceincludes)
|
||||
_x(3,'<ForcedIncludeFiles>%s</ForcedIncludeFiles>', table.concat(includes, ';'))
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
function vc2010.functionLevelLinking(cfg)
|
||||
if premake.config.isoptimizedbuild(cfg) then
|
||||
_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
|
||||
|
||||
|
||||
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)
|
||||
if premake.config.isoptimizedbuild(cfg) then
|
||||
_p(3,'<IntrinsicFunctions>true</IntrinsicFunctions>')
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
function vc2010.linkIncremental(cfg)
|
||||
if cfg.kind ~= premake.STATICLIB then
|
||||
_p(2,'<LinkIncremental>%s</LinkIncremental>', tostring(premake.config.canincrementallink(cfg)))
|
||||
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)
|
||||
if premake.config.isoptimizedbuild(cfg) or
|
||||
cfg.flags.NoMinimalRebuild or
|
||||
cfg.flags.MultiProcessorCompile or
|
||||
cfg.debugformat == premake.C7
|
||||
then
|
||||
_p(3,'<MinimalRebuild>false</MinimalRebuild>')
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
function vc2010.multiProcessorCompilation(cfg)
|
||||
if cfg.flags.MultiProcessorCompile then
|
||||
_p(3,'<MultiProcessorCompilation>true</MultiProcessorCompilation>')
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
function vc2010.omitFramePointers(cfg)
|
||||
if cfg.flags.NoFramePointer then
|
||||
_p(3,'<OmitFramePointers>true</OmitFramePointers>')
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
function vc2010.optimizeReferences(cfg)
|
||||
if premake.config.isoptimizedbuild(cfg) then
|
||||
_p(3,'<EnableCOMDATFolding>true</EnableCOMDATFolding>')
|
||||
_p(3,'<OptimizeReferences>true</OptimizeReferences>')
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
function vc2010.optimization(cfg)
|
||||
local result = "Disabled"
|
||||
@ -697,14 +738,39 @@
|
||||
result = "MaxSpeed"
|
||||
end
|
||||
end
|
||||
return result
|
||||
_p(3,'<Optimization>%s</Optimization>', result)
|
||||
end
|
||||
|
||||
|
||||
--
|
||||
-- Write out a <PreprocessorDefinitions> element, used by both the compiler
|
||||
-- and resource compiler blocks.
|
||||
--
|
||||
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
|
||||
_x(2,'<OutputFile>$(OutDir)%s</OutputFile>', cfg.buildtarget.name)
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
function vc2010.platformToolset(cfg)
|
||||
if _ACTION == "vs2012" then
|
||||
_p(2,'<PlatformToolset>v110</PlatformToolset>')
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
function vc2010.precompiledHeader(cfg)
|
||||
if not cfg.flags.NoPCH and cfg.pchheader then
|
||||
_p(3,'<PrecompiledHeader>Use</PrecompiledHeader>')
|
||||
_x(3,'<PrecompiledHeaderFile>%s</PrecompiledHeaderFile>', path.getname(cfg.pchheader))
|
||||
else
|
||||
_p(3,'<PrecompiledHeader>NotUsing</PrecompiledHeader>')
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
function vc2010.preprocessorDefinitions(defines)
|
||||
if #defines > 0 then
|
||||
@ -714,43 +780,99 @@
|
||||
end
|
||||
|
||||
|
||||
--
|
||||
-- Handlers for individual project elements.
|
||||
--
|
||||
|
||||
function vc2010.BasicRuntimeChecks(cfg)
|
||||
if cfg.flags.NoRuntimeChecks then
|
||||
_p(3,'<BasicRuntimeChecks>Default</BasicRuntimeChecks>')
|
||||
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
|
||||
|
||||
|
||||
function vc2010.MinimalRebuild(cfg)
|
||||
if premake.config.isoptimizedbuild(cfg) or
|
||||
cfg.flags.NoMinimalRebuild or
|
||||
cfg.flags.MultiProcessorCompile or
|
||||
cfg.debugformat == premake.C7
|
||||
then
|
||||
_p(3,'<MinimalRebuild>false</MinimalRebuild>')
|
||||
function vc2010.projectGuid(prj)
|
||||
_p(2,'<ProjectGuid>{%s}</ProjectGuid>', prj.uuid)
|
||||
end
|
||||
|
||||
|
||||
function vc2010.propertyGroup(cfg, label)
|
||||
local cond
|
||||
if cfg then
|
||||
cond = string.format(' %s', vc2010.condition(cfg))
|
||||
end
|
||||
|
||||
if label then
|
||||
label = string.format(' Label="%s"', label)
|
||||
end
|
||||
|
||||
_p(1,'<PropertyGroup%s%s>', cond or "", label or "")
|
||||
end
|
||||
|
||||
|
||||
function vc2010.runtimeLibrary(cfg)
|
||||
if cfg.flags.StaticRuntime then
|
||||
_p(3,'<RuntimeLibrary>%s</RuntimeLibrary>', iif(premake.config.isdebugbuild(cfg), "MultiThreadedDebug", "MultiThreaded"))
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
function vc2010.MultiProcessorCompilation(cfg)
|
||||
if cfg.flags.MultiProcessorCompile then
|
||||
_p(3,'<MultiProcessorCompilation>true</MultiProcessorCompilation>')
|
||||
function vc2010.runtimeTypeInfo(cfg)
|
||||
if cfg.flags.NoRTTI and not cfg.flags.Managed then
|
||||
_p(3,'<RuntimeTypeInfo>false</RuntimeTypeInfo>')
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
function vc2010.TreatWarningAsError(cfg)
|
||||
function vc2010.stringPooling(cfg)
|
||||
if premake.config.isoptimizedbuild(cfg) then
|
||||
_p(3,'<StringPooling>true</StringPooling>')
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
function vc2010.subSystem(cfg)
|
||||
local subsystem = iif(cfg.kind == premake.CONSOLEAPP, "Console", "Windows")
|
||||
_p(3,'<SubSystem>%s</SubSystem>', subsystem)
|
||||
end
|
||||
|
||||
|
||||
function vc2010.targetExt(cfg)
|
||||
_x(2,'<TargetExt>%s</TargetExt>', cfg.buildtarget.extension)
|
||||
end
|
||||
|
||||
|
||||
function vc2010.targetName(cfg)
|
||||
_x(2,'<TargetName>%s%s</TargetName>', cfg.buildtarget.prefix, cfg.buildtarget.basename)
|
||||
end
|
||||
|
||||
|
||||
function vc2010.treatWChar_tAsBuiltInType(cfg)
|
||||
if cfg.flags.NativeWChar then
|
||||
_p(3,'<TreatWChar_tAsBuiltInType>true</TreatWChar_tAsBuiltInType>')
|
||||
elseif cfg.flags.NoNativeWChar then
|
||||
_p(3,'<TreatWChar_tAsBuiltInType>false</TreatWChar_tAsBuiltInType>')
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
function vc2010.treatWarningAsError(cfg)
|
||||
if cfg.flags.FatalWarnings and not cfg.flags.NoWarnings then
|
||||
_p(3,'<TreatWarningAsError>true</TreatWarningAsError>')
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
function vc2010.WarningLevel(cfg)
|
||||
function vc2010.useDebugLibraries(cfg)
|
||||
_p(2,'<UseDebugLibraries>%s</UseDebugLibraries>', tostring(premake.config.isdebugbuild(cfg)))
|
||||
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)
|
||||
local w = 3
|
||||
if cfg.flags.NoWarnings then
|
||||
w = 0
|
||||
|
@ -7,25 +7,25 @@
|
||||
local vc2010 = premake.vstudio.vc2010
|
||||
local project = premake5.project
|
||||
local tree = premake.tree
|
||||
|
||||
|
||||
|
||||
--
|
||||
-- Generate a Visual Studio 201x C++ project, with support for the new platforms API.
|
||||
--
|
||||
|
||||
function vc2010.generate_filters_ng(prj)
|
||||
function vc2010.generateFilters(prj)
|
||||
io.eol = "\r\n"
|
||||
io.indent = " "
|
||||
|
||||
vc2010.header_ng()
|
||||
|
||||
|
||||
vc2010.project()
|
||||
|
||||
vc2010.filters_uniqueidentifiers(prj)
|
||||
vc2010.filters_filegroup(prj, "None")
|
||||
vc2010.filters_filegroup(prj, "ClInclude")
|
||||
vc2010.filters_filegroup(prj, "ClCompile")
|
||||
vc2010.filters_filegroup(prj, "ResourceCompile")
|
||||
vc2010.filters_filegroup(prj, "CustomBuild")
|
||||
|
||||
|
||||
_p('</Project>')
|
||||
end
|
||||
|
||||
@ -38,7 +38,7 @@
|
||||
|
||||
function vc2010.filters_uniqueidentifiers(prj)
|
||||
local opened = false
|
||||
|
||||
|
||||
local tr = project.getsourcetree(prj)
|
||||
tree.traverse(tr, {
|
||||
onbranch = function(node, depth)
|
||||
@ -55,18 +55,18 @@
|
||||
|
||||
if opened then
|
||||
_p(1,'</ItemGroup>')
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
--
|
||||
-- The second portion of the filters file assigns filters to each source
|
||||
-- code file, as needed. Group is one of "ClCompile", "ClInclude",
|
||||
-- code file, as needed. Group is one of "ClCompile", "ClInclude",
|
||||
-- "ResourceCompile", or "None".
|
||||
--
|
||||
|
||||
function vc2010.filters_filegroup(prj, group)
|
||||
local files = vc2010.getfilegroup_ng(prj, group)
|
||||
local files = vc2010.getfilegroup(prj, group)
|
||||
if #files > 0 then
|
||||
_p(1,'<ItemGroup>')
|
||||
for _, file in ipairs(files) do
|
||||
@ -76,7 +76,7 @@
|
||||
_p(2,'</%s>', group)
|
||||
else
|
||||
_p(2,'<%s Include=\"%s\" />', group, path.translate(file.relpath))
|
||||
end
|
||||
end
|
||||
end
|
||||
_p(1,'</ItemGroup>')
|
||||
end
|
||||
|
@ -1,7 +1,7 @@
|
||||
--
|
||||
-- vs2019_vcxproj_user.lua
|
||||
-- vs2010_vcxproj_user.lua
|
||||
-- Generate a Visual Studio 201x C/C++ project .user file
|
||||
-- Copyright (c) 2011-2012 Jason Perkins and the Premake project
|
||||
-- Copyright (c) 2011-2013 Jason Perkins and the Premake project
|
||||
--
|
||||
|
||||
local vstudio = premake.vstudio
|
||||
@ -13,11 +13,11 @@
|
||||
-- Generate a Visual Studio 201x C++ user file, with support for the new platforms API.
|
||||
--
|
||||
|
||||
function vc2010.generate_user_ng(prj)
|
||||
function vc2010.generateUser(prj)
|
||||
io.eol = "\r\n"
|
||||
io.indent = " "
|
||||
|
||||
vc2010.header_ng()
|
||||
|
||||
vc2010.project()
|
||||
for cfg in project.eachconfig(prj) do
|
||||
_p(1,'<PropertyGroup %s>', vc2010.condition(cfg))
|
||||
vc2010.debugsettings(cfg)
|
||||
@ -27,40 +27,40 @@
|
||||
end
|
||||
|
||||
function vc2010.debugsettings(cfg)
|
||||
vc2010.LocalDebuggerCommand(cfg)
|
||||
vc2010.LocalDebuggerWorkingDirectory(cfg)
|
||||
vc2010.DebuggerFlavor(cfg)
|
||||
vc2010.LocalDebuggerCommandArguments(cfg)
|
||||
vc2010.LocalDebuggerEnvironment(cfg)
|
||||
vc2010.localDebuggerCommand(cfg)
|
||||
vc2010.localDebuggerWorkingDirectory(cfg)
|
||||
vc2010.debuggerFlavor(cfg)
|
||||
vc2010.localDebuggerCommandArguments(cfg)
|
||||
vc2010.localDebuggerEnvironment(cfg)
|
||||
end
|
||||
|
||||
function vc2010.DebuggerFlavor(cfg)
|
||||
function vc2010.debuggerFlavor(cfg)
|
||||
if cfg.debugdir or cfg.debugcommand then
|
||||
_p(2,'<DebuggerFlavor>WindowsLocalDebugger</DebuggerFlavor>')
|
||||
_p(2,'<DebuggerFlavor>WindowsLocalDebugger</DebuggerFlavor>')
|
||||
end
|
||||
end
|
||||
|
||||
function vc2010.LocalDebuggerCommand(cfg)
|
||||
function vc2010.localDebuggerCommand(cfg)
|
||||
if cfg.debugcommand then
|
||||
local dir = project.getrelative(cfg.project, cfg.debugcommand)
|
||||
_p(2,'<LocalDebuggerCommand>%s</LocalDebuggerCommand>', path.translate(dir))
|
||||
end
|
||||
end
|
||||
|
||||
function vc2010.LocalDebuggerCommandArguments(cfg)
|
||||
function vc2010.localDebuggerCommandArguments(cfg)
|
||||
if #cfg.debugargs > 0 then
|
||||
_x(2,'<LocalDebuggerCommandArguments>%s</LocalDebuggerCommandArguments>', table.concat(cfg.debugargs, " "))
|
||||
end
|
||||
end
|
||||
|
||||
function vc2010.LocalDebuggerWorkingDirectory(cfg)
|
||||
function vc2010.localDebuggerWorkingDirectory(cfg)
|
||||
if cfg.debugdir then
|
||||
local dir = project.getrelative(cfg.project, cfg.debugdir)
|
||||
_x(2,'<LocalDebuggerWorkingDirectory>%s</LocalDebuggerWorkingDirectory>', path.translate(dir))
|
||||
end
|
||||
end
|
||||
|
||||
function vc2010.LocalDebuggerEnvironment(cfg)
|
||||
function vc2010.localDebuggerEnvironment(cfg)
|
||||
if #cfg.debugenvs > 0 then
|
||||
local envs = table.concat(cfg.debugenvs, "\n")
|
||||
if cfg.flags.DebugEnvsInherit then
|
||||
|
@ -21,7 +21,7 @@
|
||||
|
||||
local function prepare(platform)
|
||||
cfg = project.getconfig(prj, "Debug", platform)
|
||||
vc2010.ClCompile(cfg)
|
||||
vc2010.clCompile(cfg)
|
||||
end
|
||||
|
||||
|
||||
|
@ -11,15 +11,15 @@
|
||||
|
||||
|
||||
--
|
||||
-- Setup
|
||||
-- Setup
|
||||
--
|
||||
|
||||
local sln, prj, cfg
|
||||
|
||||
|
||||
function suite.setup()
|
||||
sln, prj = test.createsolution()
|
||||
end
|
||||
|
||||
|
||||
local function prepare()
|
||||
cfg = project.getconfig(prj, "Debug")
|
||||
vc2010.configurationProperties(cfg)
|
||||
|
@ -17,19 +17,19 @@
|
||||
|
||||
function suite.setup()
|
||||
_ACTION = "vs2010"
|
||||
|
||||
|
||||
sln = solution("MySolution")
|
||||
configurations { "Debug", "Release" }
|
||||
platforms { "Zeus", "Ares" }
|
||||
language "C++"
|
||||
|
||||
|
||||
prj = project("MyProject")
|
||||
kind "ConsoleApp"
|
||||
links { "MyProject2", "MyProject3" }
|
||||
|
||||
|
||||
project("MyProject2")
|
||||
kind "StaticLib"
|
||||
|
||||
|
||||
project("MyProject3")
|
||||
kind "StaticLib"
|
||||
removeplatforms { "Ares" }
|
||||
@ -37,7 +37,7 @@
|
||||
|
||||
local function prepare(platform)
|
||||
local cfg = premake5.project.getconfig(prj, "Debug", platform)
|
||||
vc2010.Link(cfg)
|
||||
vc2010.link(cfg)
|
||||
end
|
||||
|
||||
|
||||
|
@ -20,7 +20,7 @@
|
||||
|
||||
local function prepare()
|
||||
prj = premake.solution.getproject_ng(sln, 1)
|
||||
vc2010.files_ng(prj)
|
||||
vc2010.files(prj)
|
||||
end
|
||||
|
||||
|
||||
|
@ -15,7 +15,7 @@
|
||||
--
|
||||
|
||||
function suite.project_onDefaultTarget()
|
||||
vc2010.header_ng("Build")
|
||||
vc2010.project("Build")
|
||||
test.capture [[
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
@ -27,7 +27,7 @@
|
||||
--
|
||||
|
||||
function suite.project_onNoDefaultTarget()
|
||||
vc2010.header_ng()
|
||||
vc2010.project()
|
||||
test.capture [[
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
|
@ -24,7 +24,7 @@
|
||||
|
||||
local function prepare(platform)
|
||||
cfg = project.getconfig(prj, "Debug", platform)
|
||||
vc2010.Link(cfg)
|
||||
vc2010.link(cfg)
|
||||
end
|
||||
|
||||
|
||||
@ -293,7 +293,7 @@
|
||||
]]
|
||||
end
|
||||
|
||||
|
||||
|
||||
--
|
||||
-- Enable reference optimizing if Optimize flag is specified.
|
||||
--
|
||||
|
@ -10,16 +10,16 @@
|
||||
|
||||
|
||||
--
|
||||
-- Setup
|
||||
-- Setup
|
||||
--
|
||||
|
||||
local sln, prj
|
||||
|
||||
|
||||
function suite.setup()
|
||||
_ACTION = "vs2010"
|
||||
sln = test.createsolution()
|
||||
end
|
||||
|
||||
|
||||
local function prepare()
|
||||
prj = premake.solution.getproject_ng(sln, 1)
|
||||
vc2010.projectConfigurations(prj)
|
||||
|
@ -24,7 +24,7 @@
|
||||
|
||||
local function prepare(platform)
|
||||
prj = premake.solution.getproject_ng(sln, 2)
|
||||
vc2010.projectReferences_ng(prj)
|
||||
vc2010.projectReferences(prj)
|
||||
end
|
||||
|
||||
|
||||
@ -56,7 +56,7 @@
|
||||
end
|
||||
|
||||
--
|
||||
-- Project references should always be specified relative to the
|
||||
-- Project references should always be specified relative to the
|
||||
-- project doing the referencing.
|
||||
--
|
||||
|
||||
@ -74,4 +74,4 @@
|
||||
</ItemGroup>
|
||||
]]
|
||||
end
|
||||
|
||||
|
||||
|
@ -11,18 +11,18 @@
|
||||
|
||||
|
||||
--
|
||||
-- Setup
|
||||
-- Setup
|
||||
--
|
||||
|
||||
local sln, prj, cfg
|
||||
|
||||
|
||||
function suite.setup()
|
||||
sln, prj = test.createsolution()
|
||||
end
|
||||
|
||||
|
||||
local function prepare()
|
||||
cfg = project.getconfig(prj, "Debug")
|
||||
vc2010.propertySheet(cfg)
|
||||
vc2010.propertySheets(cfg)
|
||||
end
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user