diff options
Diffstat (limited to 'src/actions/vstudio/vs200x_vcproj.lua')
-rw-r--r-- | src/actions/vstudio/vs200x_vcproj.lua | 162 |
1 files changed, 81 insertions, 81 deletions
diff --git a/src/actions/vstudio/vs200x_vcproj.lua b/src/actions/vstudio/vs200x_vcproj.lua index 3ef4e8b..90b7a1e 100644 --- a/src/actions/vstudio/vs200x_vcproj.lua +++ b/src/actions/vstudio/vs200x_vcproj.lua @@ -91,7 +91,7 @@ if (cfg.flags.MFC) then _p(3, 'UseOfMFC="%d"', iif(cfg.flags.StaticRuntime, 1, 2)) - end + end if (cfg.flags.ATL or cfg.flags.StaticATL) then _p(3, 'UseOfATL="%d"', iif(cfg.flags.StaticATL, 1, 2)) end @@ -101,7 +101,7 @@ end _p(3,'>') end - + -- -- Write out the <Files> element. @@ -109,7 +109,7 @@ function vc200x.Files(prj) local tr = premake.project.buildsourcetree(prj) - + tree.traverse(tr, { -- folders are handled at the internal nodes onbranchenter = function(node, depth) @@ -126,7 +126,7 @@ -- source files are handled at the leaves onleaf = function(node, depth) local fname = node.cfg.name - + _p(depth, '<File') _p(depth, '\tRelativePath="%s"', path.translate(fname, "\\")) _p(depth, '\t>') @@ -137,30 +137,30 @@ for _, cfginfo in ipairs(prj.solution.vstudio_configs) do if cfginfo.isreal then local cfg = premake.getconfig(prj, cfginfo.src_buildcfg, cfginfo.src_platform) - + local usePCH = (not prj.flags.NoPCH and prj.pchsource == node.cfg.name) local isSourceCode = path.iscppfile(fname) local needsCompileAs = (path.iscfile(fname) ~= premake.project.iscproject(prj)) - + if usePCH or (isSourceCode and needsCompileAs) then _p(depth, '<FileConfiguration') _p(depth, '\tName="%s"', cfginfo.name) _p(depth, '\t>') _p(depth, '\t<Tool') - _p(depth, '\t\tName="%s"', iif(cfg.system == "Xbox360", - "VCCLX360CompilerTool", + _p(depth, '\t\tName="%s"', iif(cfg.system == "Xbox360", + "VCCLX360CompilerTool", "VCCLCompilerTool")) if needsCompileAs then _p(depth, '\t\tCompileAs="%s"', iif(path.iscfile(fname), 1, 2)) end - + if usePCH then if cfg.system == "PS3" then - local options = table.join(premake.snc.getcflags(cfg), - premake.snc.getcxxflags(cfg), + local options = table.join(premake.snc.getcflags(cfg), + premake.snc.getcxxflags(cfg), cfg.buildoptions) options = table.concat(options, " "); - options = options .. ' --create_pch="$(IntDir)/$(TargetName).pch"' + options = options .. ' --create_pch="$(IntDir)/$(TargetName).pch"' _p(depth, '\t\tAdditionalOptions="%s"', premake.esc(options)) else _p(depth, '\t\tUsePrecompiledHeader="1"') @@ -181,7 +181,7 @@ end - + -- -- Write out the <Platforms> element; ensures that each target platform -- is listed only once. Skips over .NET's pseudo-platforms (like "Any CPU"). @@ -211,9 +211,9 @@ return 0 else -- Edit-and-continue does't work for some configurations - if cfg.flags.NoEditAndContinue or - vc200x.optimization(cfg) ~= 0 or - cfg.flags.Managed or + if cfg.flags.NoEditAndContinue or + vc200x.optimization(cfg) ~= 0 or + cfg.flags.Managed or cfg.platform == "x64" then return 3 else @@ -230,42 +230,42 @@ function vc200x.VCCLCompilerTool(cfg) _p(3,'<Tool') _p(4,'Name="%s"', iif(cfg.platform ~= "Xbox360", "VCCLCompilerTool", "VCCLX360CompilerTool")) - + if #cfg.buildoptions > 0 then _p(4,'AdditionalOptions="%s"', table.concat(premake.esc(cfg.buildoptions), " ")) end - + _p(4,'Optimization="%s"', vc200x.optimization(cfg)) - + if cfg.flags.NoFramePointer then _p(4,'OmitFramePointers="%s"', bool(true)) end - + if #cfg.includedirs > 0 then _p(4,'AdditionalIncludeDirectories="%s"', premake.esc(path.translate(table.concat(cfg.includedirs, ";"), '\\'))) end - + if #cfg.defines > 0 then _p(4,'PreprocessorDefinitions="%s"', premake.esc(table.concat(cfg.defines, ";"))) end - + if premake.config.isdebugbuild(cfg) and not cfg.flags.NoMinimalRebuild and not cfg.flags.Managed then _p(4,'MinimalRebuild="%s"', bool(true)) end - + if cfg.flags.NoExceptions then _p(4,'ExceptionHandling="%s"', iif(_ACTION < "vs2005", "FALSE", 0)) elseif cfg.flags.SEH and _ACTION > "vs2003" then _p(4,'ExceptionHandling="2"') end - + if vc200x.optimization(cfg) == 0 and not cfg.flags.Managed then _p(4,'BasicRuntimeChecks="3"') end if vc200x.optimization(cfg) ~= 0 then _p(4,'StringPooling="%s"', bool(true)) end - + local runtime if premake.config.isdebugbuild(cfg) then runtime = iif(cfg.flags.StaticRuntime, 1, 3) @@ -283,7 +283,7 @@ _p(4,'EnableEnhancedInstructionSet="2"') end end - + if _ACTION < "vs2005" then if cfg.flags.FloatFast then _p(4,'ImproveFloatingPointConsistency="%s"', bool(false)) @@ -297,36 +297,36 @@ _p(4,'FloatingPointModel="1"') end end - + if _ACTION < "vs2005" and not cfg.flags.NoRTTI then _p(4,'RuntimeTypeInfo="%s"', bool(true)) elseif _ACTION > "vs2003" and cfg.flags.NoRTTI and not cfg.flags.Managed then _p(4,'RuntimeTypeInfo="%s"', bool(false)) end - + if cfg.flags.NativeWChar then _p(4,'TreatWChar_tAsBuiltInType="%s"', bool(true)) elseif cfg.flags.NoNativeWChar then _p(4,'TreatWChar_tAsBuiltInType="%s"', bool(false)) end - + if not cfg.flags.NoPCH and cfg.pchheader then _p(4,'UsePrecompiledHeader="%s"', iif(_ACTION < "vs2005", 3, 2)) _p(4,'PrecompiledHeaderThrough="%s"', cfg.pchheader) else _p(4,'UsePrecompiledHeader="%s"', iif(_ACTION > "vs2003" or cfg.flags.NoPCH, 0, 2)) end - + _p(4,'WarningLevel="%s"', iif(cfg.flags.ExtraWarnings, 4, 3)) - + if cfg.flags.FatalWarnings then _p(4,'WarnAsError="%s"', bool(true)) end - + if _ACTION < "vs2008" and not cfg.flags.Managed then _p(4,'Detect64BitPortabilityProblems="%s"', bool(not cfg.flags.No64BitChecks)) end - + _p(4,'ProgramDataBaseFileName="$(OutDir)\\%s.pdb"', path.getbasename(cfg.buildtarget.name)) _p(4,'DebugInformationFormat="%s"', vc200x.Symbols(cfg)) if cfg.language == "C" then @@ -334,8 +334,8 @@ end _p(3,'/>') end - - + + -- -- Linker block for Windows and Xbox 360 platforms. @@ -345,66 +345,66 @@ _p(3,'<Tool') if cfg.kind ~= "StaticLib" then _p(4,'Name="%s"', iif(cfg.platform ~= "Xbox360", "VCLinkerTool", "VCX360LinkerTool")) - + if cfg.flags.NoImportLib then _p(4,'IgnoreImportLibrary="%s"', bool(true)) end - + if #cfg.linkoptions > 0 then _p(4,'AdditionalOptions="%s"', table.concat(premake.esc(cfg.linkoptions), " ")) end - + if #cfg.links > 0 then _p(4,'AdditionalDependencies="%s"', table.concat(premake.getlinks(cfg, "all", "fullpath"), " ")) end - + _p(4,'OutputFile="$(OutDir)\\%s"', cfg.buildtarget.name) - _p(4,'LinkIncremental="%s"', + _p(4,'LinkIncremental="%s"', iif(premake.config.isincrementallink(cfg) , 2, 1)) - + _p(4,'AdditionalLibraryDirectories="%s"', table.concat(premake.esc(path.translate(cfg.libdirs, '\\')) , ";")) - + local deffile = premake.findfile(cfg, ".def") if deffile then _p(4,'ModuleDefinitionFile="%s"', deffile) end - + if cfg.flags.NoManifest then _p(4,'GenerateManifest="%s"', bool(false)) end - + _p(4,'GenerateDebugInformation="%s"', bool(vc200x.Symbols(cfg) ~= 0)) - + if vc200x.Symbols(cfg) ~= 0 then _p(4,'ProgramDataBaseFileName="$(OutDir)\\%s.pdb"', path.getbasename(cfg.buildtarget.name)) end - + _p(4,'SubSystem="%s"', iif(cfg.kind == "ConsoleApp", 1, 2)) - + if vc200x.optimization(cfg) ~= 0 then _p(4,'OptimizeReferences="2"') _p(4,'EnableCOMDATFolding="2"') end - + if (cfg.kind == "ConsoleApp" or cfg.kind == "WindowedApp") and not cfg.flags.WinMain then _p(4,'EntryPointSymbol="mainCRTStartup"') end - + if cfg.kind == "SharedLib" then local implibname = cfg.linktarget.fullpath _p(4,'ImportLibrary="%s"', iif(cfg.flags.NoImportLib, cfg.objectsdir .. "\\" .. path.getname(implibname), implibname)) end - + _p(4,'TargetMachine="%d"', iif(cfg.platform == "x64", 17, 1)) - + else _p(4,'Name="VCLibrarianTool"') - + if #cfg.links > 0 then _p(4,'AdditionalDependencies="%s"', table.concat(premake.getlinks(cfg, "all", "fullpath"), " ")) end - + _p(4,'OutputFile="$(OutDir)\\%s"', cfg.buildtarget.name) if #cfg.libdirs > 0 then @@ -422,11 +422,11 @@ _p(4,'AdditionalOptions="%s"', table.concat(premake.esc(addlOptions), " ")) end end - + _p(3,'/>') end - - + + -- -- Compiler and linker blocks for the PS3 platform, which uses Sony's SNC. -- @@ -464,23 +464,23 @@ _p(3,'<Tool') if cfg.kind ~= "StaticLib" then _p(4,'Name="VCLinkerTool"') - + local buildoptions = table.join(premake.snc.getldflags(cfg), cfg.linkoptions) if #buildoptions > 0 then _p(4,'AdditionalOptions="%s"', premake.esc(table.concat(buildoptions, " "))) end - + if #cfg.links > 0 then _p(4,'AdditionalDependencies="%s"', table.concat(premake.getlinks(cfg, "all", "fullpath"), " ")) end - + _p(4,'OutputFile="$(OutDir)\\%s"', cfg.buildtarget.name) _p(4,'LinkIncremental="0"') _p(4,'AdditionalLibraryDirectories="%s"', table.concat(premake.esc(path.translate(cfg.libdirs, '\\')) , ";")) _p(4,'GenerateManifest="%s"', bool(false)) _p(4,'ProgramDatabaseFile=""') _p(4,'RandomizedBaseAddress="1"') - _p(4,'DataExecutionPrevention="0"') + _p(4,'DataExecutionPrevention="0"') else _p(4,'Name="VCLibrarianTool"') @@ -488,21 +488,21 @@ if #buildoptions > 0 then _p(4,'AdditionalOptions="%s"', premake.esc(table.concat(buildoptions, " "))) end - + if #cfg.links > 0 then _p(4,'AdditionalDependencies="%s"', table.concat(premake.getlinks(cfg, "all", "fullpath"), " ")) end - + _p(4,'OutputFile="$(OutDir)\\%s"', cfg.buildtarget.name) if #cfg.libdirs > 0 then _p(4,'AdditionalLibraryDirectories="%s"', premake.esc(path.translate(table.concat(cfg.libdirs , ";")))) end end - + _p(3,'/>') end - + -- @@ -528,8 +528,8 @@ _p(3,'/>') end - - + + -- -- Manifest block. @@ -543,7 +543,7 @@ table.insert(manifests, fname) end end - + _p(3,'<Tool') _p(4,'Name="VCManifestTool"') if #manifests > 0 then @@ -567,7 +567,7 @@ _p(3,'/>') end - + -- -- Write out a custom build steps block. @@ -589,7 +589,7 @@ -- an empty <Tool> element. -- - vc200x.toolmap = + vc200x.toolmap = { VCCLCompilerTool = vc200x.VCCLCompilerTool, VCCLCompilerTool_PS3 = vc200x.VCCLCompilerTool_PS3, @@ -680,9 +680,9 @@ "VCAppVerifierTool", "VCWebDeploymentTool", "VCPostBuildEventTool" - } + } else - return { + return { "VCPreBuildEventTool", "VCCustomBuildTool", "VCXMLDataGeneratorTool", @@ -701,7 +701,7 @@ "VCAppVerifierTool", "VCWebDeploymentTool", "VCPostBuildEventTool" - } + } end end @@ -713,7 +713,7 @@ function vc200x.generate(prj) vc200x.header('VisualStudioProject') - + _p(1,'Name="%s"', premake.esc(prj.name)) _p(1,'ProjectGUID="{%s}"', prj.uuid) if _ACTION > "vs2003" then @@ -734,11 +734,11 @@ for _, cfginfo in ipairs(prj.solution.vstudio_configs) do if cfginfo.isreal then local cfg = premake.getconfig(prj, cfginfo.src_buildcfg, cfginfo.src_platform) - + -- Start a configuration vc200x.Configuration(cfginfo.name, cfg) for _, block in ipairs(getsections(_ACTION, cfginfo.src_platform)) do - + if vc200x.toolmap[block] then vc200x.toolmap[block](cfg) @@ -762,19 +762,19 @@ _p(4,'OutputFileName="%s"', premake.esc(path.translate(cfg.imagepath))) end _p(3,'/>') - + elseif block == "DebuggerTool" then _p(3,'<DebuggerTool') _p(3,'/>') - + -- End Xbox 360 custom sections -- - + else _p(3,'<Tool') _p(4,'Name="%s"', block) _p(3,'/>') end - + end _p(2,'</Configuration>') @@ -784,11 +784,11 @@ _p(1,'<References>') _p(1,'</References>') - + _p(1,'<Files>') vc200x.Files(prj) _p(1,'</Files>') - + _p(1,'<Globals>') _p(1,'</Globals>') _p('</VisualStudioProject>') |