From 6812f6493b51e9819cb919056a0d6779ca07ebeb Mon Sep 17 00:00:00 2001 From: Jason Perkins Date: Tue, 8 Apr 2014 14:33:01 -0400 Subject: [PATCH] Bit more cleanup of VC 200x exporter; calling it done (for now) --- src/actions/vstudio/vs200x_vcproj.lua | 76 ++++++++++++--------------- 1 file changed, 33 insertions(+), 43 deletions(-) diff --git a/src/actions/vstudio/vs200x_vcproj.lua b/src/actions/vstudio/vs200x_vcproj.lua index 8027d839..5d82ec23 100644 --- a/src/actions/vstudio/vs200x_vcproj.lua +++ b/src/actions/vstudio/vs200x_vcproj.lua @@ -473,7 +473,9 @@ m.treatWChar_tAsBuiltInType, m.usePrecompiledHeader, m.programDataBaseFileName, - m.warnings, + m.warningLevel, + m.warnAsError, + m.detect64BitPortabilityProblems, m.debugInformationFormat, m.compileAs, m.forcedIncludeFiles, @@ -730,41 +732,12 @@ ---------------------------------------------------------------------------- --- --- EVERYTHING BELOW THIS NEEDS REWORK, which I'm in the process of --- doing right now. Hold on tight. --- ---------------------------------------------------------------------------- - - --------------------------------------------------------------------------- -- -- Support functions -- --------------------------------------------------------------------------- --- --- Build a list architectures which are used by a project. --- --- @param prj --- The project under consideration. --- @return --- An array of Visual Studio architectures. --- - - function m.architectures(prj) - architectures = {} - for cfg in project.eachconfig(prj) do - local arch = vstudio.archFromConfig(cfg, true) - if not table.contains(architectures, arch) then - table.insert(architectures, arch) - end - end - return architectures - end - - -- -- Return the debugging symbol level for a configuration. -- @@ -779,8 +752,7 @@ if cfg.flags.NoEditAndContinue or config.isOptimizedBuild(cfg) or cfg.flags.Managed or - cfg.system == "x64" or - cfg.platform == "x64" -- TODO: remove this when the _ng stuff goes live + cfg.system == "x64" then return 3 else @@ -1081,6 +1053,15 @@ + function m.detect64BitPortabilityProblems(cfg) + local prjcfg, filecfg = config.normalize(cfg) + if _ACTION < "vs2008" and not cfg.flags.Managed and cfg.warnings ~= "Off" and not filecfg then + p.w('Detect64BitPortabilityProblems="%s"', tostring(not cfg.flags.No64BitChecks)) + end + end + + + function m.enableCOMDATFolding(cfg, toolset) if config.isOptimizedBuild(cfg) and not toolset then p.w('EnableCOMDATFolding="2"') @@ -1377,8 +1358,16 @@ function m.platforms(prj) + architectures = {} + for cfg in project.eachconfig(prj) do + local arch = vstudio.archFromConfig(cfg, true) + if not table.contains(architectures, arch) then + table.insert(architectures, arch) + end + end + p.push('') - table.foreachi(m.architectures(prj), function(arch) + table.foreachi(architectures, function(arch) p.push('') @@ -1426,7 +1415,6 @@ function m.projectReferences(prj) local deps = project.getdependencies(prj) if #deps > 0 then - -- This is a little odd: Visual Studio wants the "relative path to project" -- to be relative to the *solution*, rather than the project doing the -- referencing. Which, in theory, would break if the project is included @@ -1610,7 +1598,16 @@ end - function m.warnings(cfg) + + function m.warnAsError(cfg) + if cfg.flags.FatalCompileWarnings and cfg.warnings ~= "Off" then + p.w('WarnAsError="true"') + end + end + + + + function m.warningLevel(cfg) local prjcfg, filecfg = config.normalize(cfg) local level @@ -1625,17 +1622,10 @@ if level then p.w('WarningLevel="%s"', level) end - - if cfg.flags.FatalCompileWarnings and cfg.warnings ~= "Off" then - p.w('WarnAsError="true"') - end - - if _ACTION < "vs2008" and not cfg.flags.Managed and cfg.warnings ~= "Off" and not filecfg then - p.w('Detect64BitPortabilityProblems="%s"', tostring(not cfg.flags.No64BitChecks)) - end end + function m.wholeProgramOptimization(cfg) if cfg.flags.LinkTimeOptimization then p.x('WholeProgramOptimization="true"')