From 65f147b24101e99b651c558cc85ebcaa896c9097 Mon Sep 17 00:00:00 2001 From: jules Date: Fri, 13 Jul 2012 12:28:25 +0100 Subject: [PATCH] Introjucer: Visual studio WPO and debug option fixes. --- .../Project Saving/jucer_ProjectExport_MSVC.h | 30 ++++++++++++++----- .../Source/Utility/jucer_PresetIDs.h | 1 + 2 files changed, 24 insertions(+), 7 deletions(-) diff --git a/extras/Introjucer/Source/Project Saving/jucer_ProjectExport_MSVC.h b/extras/Introjucer/Source/Project Saving/jucer_ProjectExport_MSVC.h index 404f53c651..bbe539aa1f 100644 --- a/extras/Introjucer/Source/Project Saving/jucer_ProjectExport_MSVC.h +++ b/extras/Introjucer/Source/Project Saving/jucer_ProjectExport_MSVC.h @@ -143,6 +143,9 @@ protected: Value shouldGenerateManifestValue() { return getValue (Ids::generateManifest); } bool shouldGenerateManifest() const { return config [Ids::generateManifest]; } + Value getWholeProgramOptValue() { return getValue (Ids::wholeProgramOptimisation); } + bool shouldDisableWholeProgramOpt() const { return static_cast (config [Ids::wholeProgramOptimisation]) > 0; } + String getOutputFilename (const String& suffix, bool forceSuffix) const { const String target (File::createLegalFileName (getTargetBinaryNameString().trim())); @@ -163,6 +166,13 @@ protected: props.add (new ChoicePropertyComponent (getWarningLevelValue(), "Warning Level", StringArray (warningLevelNames), Array (warningLevels))); + const char* const wpoNames[] = { "Enable link-time code generation when possible", + "Always disable link-time code generation", nullptr }; + const var wpoValues[] = { var(), var (1) }; + + props.add (new ChoicePropertyComponent (getWholeProgramOptValue(), "Whole Program Optimisation", + StringArray (wpoNames), Array (wpoValues, numElementsInArray (wpoValues)))); + props.add (new TextPropertyComponent (getPrebuildCommand(), "Pre-build Command", 2048, false)); props.add (new TextPropertyComponent (getPostbuildCommand(), "Post-build Command", 2048, false)); props.add (new BooleanPropertyComponent (shouldGenerateManifestValue(), "Manifest", "Generate Manifest")); @@ -687,7 +697,7 @@ protected: xml.setAttribute ("ATLMinimizesCRunTimeLibraryUsage", "false"); xml.setAttribute ("CharacterSet", "2"); - if (! isDebug) + if (! (isDebug || config.shouldDisableWholeProgramOpt())) xml.setAttribute ("WholeProgramOptimization", "1"); XmlElement* preBuildEvent = createToolElement (xml, "VCPreBuildEventTool"); @@ -1035,19 +1045,21 @@ protected: imports->setAttribute ("Project", "$(VCTargetsPath)\\Microsoft.Cpp.Default.props"); } - for (ConstConfigIterator config (*this); config.next();) + for (ConstConfigIterator i (*this); i.next();) { + const MSVCBuildConfiguration& config = dynamic_cast (*i); + XmlElement* e = projectXml.createNewChildElement ("PropertyGroup"); - setConditionAttribute (*e, *config); + setConditionAttribute (*e, config); e->setAttribute ("Label", "Configuration"); e->createNewChildElement ("ConfigurationType")->addTextElement (getProjectType()); e->createNewChildElement ("UseOfMfc")->addTextElement ("false"); e->createNewChildElement ("CharacterSet")->addTextElement ("MultiByte"); - if (! config->isDebug()) + if (! (config.isDebug() || config.shouldDisableWholeProgramOpt())) e->createNewChildElement ("WholeProgramOptimization")->addTextElement ("true"); - if (is64Bit (*config)) + if (is64Bit (config)) e->createNewChildElement ("PlatformToolset")->addTextElement ("Windows7.1SDK"); } @@ -1139,9 +1151,13 @@ protected: { XmlElement* cl = group->createNewChildElement ("ClCompile"); - cl->createNewChildElement ("Optimization")->addTextElement (isDebug ? "Disabled" : "MaxSpeed"); - if (isDebug) + const int optimiseLevel = config.getOptimisationLevelInt(); + cl->createNewChildElement ("Optimization")->addTextElement (optimiseLevel == 0 ? "Disabled" + : optimiseLevel == 1 ? "MinSpace" + : "MaxSpeed"); + + if (isDebug && optimiseLevel == 0) cl->createNewChildElement ("DebugInformationFormat")->addTextElement (is64Bit (config) ? "ProgramDatabase" : "EditAndContinue"); diff --git a/extras/Introjucer/Source/Utility/jucer_PresetIDs.h b/extras/Introjucer/Source/Utility/jucer_PresetIDs.h index b2d7bbe9e1..ae7425ca1d 100644 --- a/extras/Introjucer/Source/Utility/jucer_PresetIDs.h +++ b/extras/Introjucer/Source/Utility/jucer_PresetIDs.h @@ -75,6 +75,7 @@ namespace Ids DECLARE_ID (prebuildCommand); DECLARE_ID (postbuildCommand); DECLARE_ID (generateManifest); + DECLARE_ID (wholeProgramOptimisation); DECLARE_ID (juceLinkage); DECLARE_ID (buildVST); DECLARE_ID (bundleIdentifier);