| @@ -360,6 +360,11 @@ protected: | |||
| { | |||
| return "${ANDROID_ABI}"; | |||
| } | |||
| String getLinkerFlagsString() const | |||
| { | |||
| return String ("\"-DCMAKE_EXE_LINKER_FLAGS_") + (isDebug() ? "DEBUG" : "RELEASE") + "=-flto\""; | |||
| } | |||
| }; | |||
| BuildConfiguration::Ptr createBuildConfig (const ValueTree& v) const override | |||
| @@ -595,7 +600,9 @@ private: | |||
| << ", \"-DCMAKE_CXX_FLAGS_" << (cfg.isDebug() ? "DEBUG" : "RELEASE") | |||
| << "=-O" << cfg.getGCCOptimisationFlag() << "\"" | |||
| << ", \"-DCMAKE_C_FLAGS_" << (cfg.isDebug() ? "DEBUG" : "RELEASE") | |||
| << "=-O" << cfg.getGCCOptimisationFlag() << "\"" << newLine; | |||
| << "=-O" << cfg.getGCCOptimisationFlag() << "\"" | |||
| << (cfg.isLinkTimeOptimisationEnabled() ? ", " + cfg.getLinkerFlagsString() : "") | |||
| << newLine; | |||
| mo << " }" << newLine; | |||
| mo << " }" << newLine; | |||
| mo << " }" << newLine; | |||
| @@ -380,6 +380,9 @@ private: | |||
| flags.add ("-O" + config.getGCCOptimisationFlag()); | |||
| if (config.isLinkTimeOptimisationEnabled()) | |||
| flags.add ("-flto"); | |||
| { | |||
| auto cppStandard = config.project.getCppStandardValue().toString(); | |||
| @@ -160,6 +160,9 @@ public: | |||
| setValueIfVoid (shouldGenerateManifestValue(), true); | |||
| setValueIfVoid (getArchitectureType(), get64BitArchName()); | |||
| if (! isDebug()) | |||
| updateOldLTOSetting(); | |||
| } | |||
| Value getWarningLevelValue() { return getValue (Ids::winWarningLevel); } | |||
| @@ -182,9 +185,6 @@ public: | |||
| Value shouldLinkIncrementalValue() { return getValue (Ids::enableIncrementalLinking); } | |||
| bool shouldLinkIncremental() const { return config [Ids::enableIncrementalLinking]; } | |||
| Value getWholeProgramOptValue() { return getValue (Ids::wholeProgramOptimisation); } | |||
| bool shouldDisableWholeProgramOpt() const { return static_cast<int> (config [Ids::wholeProgramOptimisation]) > 0; } | |||
| Value getUsingRuntimeLibDLL() { return getValue (Ids::useRuntimeLibDLL); } | |||
| bool isUsingRuntimeLibDLL() const { return config [Ids::useRuntimeLibDLL]; } | |||
| @@ -263,15 +263,6 @@ public: | |||
| "used by the libraries."); | |||
| } | |||
| { | |||
| static const char* 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<var> (wpoValues, numElementsInArray (wpoValues)))); | |||
| } | |||
| { | |||
| props.add (new BooleanPropertyComponent (shouldLinkIncrementalValue(), "Incremental Linking", "Enable"), | |||
| "Enable to avoid linking from scratch for every new build. " | |||
| @@ -304,6 +295,11 @@ public: | |||
| return result; | |||
| } | |||
| void updateOldLTOSetting() | |||
| { | |||
| getLinkTimeOptimisationEnabledValue() = (static_cast<int> (config ["wholeProgramOptimisation"]) == 0); | |||
| } | |||
| }; | |||
| //============================================================================== | |||
| @@ -371,7 +367,7 @@ public: | |||
| if (charSet.isNotEmpty()) | |||
| e->createNewChildElement ("CharacterSet")->addTextElement (charSet); | |||
| if (! (config.isDebug() || config.shouldDisableWholeProgramOpt())) | |||
| if (config.isLinkTimeOptimisationEnabled()) | |||
| e->createNewChildElement ("WholeProgramOptimization")->addTextElement ("true"); | |||
| if (config.shouldLinkIncremental()) | |||
| @@ -601,6 +601,7 @@ private: | |||
| out << " -g -ggdb"; | |||
| out << " -O" << config.getGCCOptimisationFlag() | |||
| << (config.isLinkTimeOptimisationEnabled() ? " -flto" : "") | |||
| << (" " + replacePreprocessorTokens (config, getExtraCompilerFlagsString())).trimEnd() | |||
| << " $(CFLAGS)" << newLine; | |||
| @@ -399,7 +399,6 @@ protected: | |||
| cppStandardLibrary (config, Ids::cppLibType, nullptr), | |||
| codeSignIdentity (config, Ids::codeSigningIdentity, nullptr, iOS ? "iPhone Developer" : "Mac Developer"), | |||
| fastMathEnabled (config, Ids::fastMath, nullptr), | |||
| linkTimeOptimisationEnabled (config, Ids::linkTimeOptimisation, nullptr), | |||
| stripLocalSymbolsEnabled (config, Ids::stripLocalSymbols, nullptr), | |||
| vstBinaryLocation (config, Ids::xcodeVstBinaryLocation, nullptr, "$(HOME)/Library/Audio/Plug-Ins/VST/"), | |||
| vst3BinaryLocation (config, Ids::xcodeVst3BinaryLocation, nullptr, "$(HOME)/Library/Audio/Plug-Ins/VST3/"), | |||
| @@ -414,7 +413,7 @@ protected: | |||
| CachedValue<String> osxSDKVersion, osxDeploymentTarget, iosDeploymentTarget, osxArchitecture, | |||
| customXcodeFlags, plistPreprocessorDefinitions, cppStandardLibrary, codeSignIdentity; | |||
| CachedValue<bool> fastMathEnabled, linkTimeOptimisationEnabled, stripLocalSymbolsEnabled; | |||
| CachedValue<bool> fastMathEnabled, stripLocalSymbolsEnabled; | |||
| CachedValue<String> vstBinaryLocation, vst3BinaryLocation, auBinaryLocation, rtasBinaryLocation, aaxBinaryLocation; | |||
| //========================================================================== | |||
| @@ -489,9 +488,6 @@ protected: | |||
| props.add (new BooleanPropertyComponent (fastMathEnabled.getPropertyAsValue(), "Relax IEEE compliance", "Enabled"), | |||
| "Enable this to use FAST_MATH non-IEEE mode. (Warning: this can have unexpected results!)"); | |||
| props.add (new BooleanPropertyComponent (linkTimeOptimisationEnabled.getPropertyAsValue(), "Link-Time Optimisation", "Enabled"), | |||
| "Enable this to perform link-time code generation. This is recommended for release builds."); | |||
| props.add (new BooleanPropertyComponent (stripLocalSymbolsEnabled.getPropertyAsValue(), "Strip local symbols", "Enabled"), | |||
| "Enable this to strip any locally defined symbols resulting in a smaller binary size. Enabling this " | |||
| "will also remove any function names from crash logs. Must be disabled for static library projects."); | |||
| @@ -910,7 +906,7 @@ public: | |||
| s.add ("INFOPLIST_PREPROCESSOR_DEFINITIONS = " + indentParenthesisedList (defsList)); | |||
| } | |||
| if (config.linkTimeOptimisationEnabled.get()) | |||
| if (config.isLinkTimeOptimisationEnabled()) | |||
| s.add ("LLVM_LTO = YES"); | |||
| if (config.fastMathEnabled.get()) | |||
| @@ -715,6 +715,7 @@ void ProjectExporter::createDefaultConfigs() | |||
| config->getNameValue() = debugConfig ? "Debug" : "Release"; | |||
| config->isDebugValue() = debugConfig; | |||
| config->getOptimisationLevel() = config->getDefaultOptimisationLevel(); | |||
| config->getLinkTimeOptimisationEnabledValue() = ! debugConfig; | |||
| config->getTargetBinaryName() = project.getProjectFilenameRoot(); | |||
| } | |||
| } | |||
| @@ -890,6 +891,9 @@ void ProjectExporter::BuildConfiguration::createPropertyEditors (PropertyListBui | |||
| "Extra preprocessor definitions. Use the form \"NAME1=value NAME2=value\", using whitespace, commas, or " | |||
| "new-lines to separate the items - to include a space or comma in a definition, precede it with a backslash."); | |||
| props.add (new BooleanPropertyComponent (getLinkTimeOptimisationEnabledValue(), "Link-Time Optimisation", "Enabled"), | |||
| "Enable this to perform link-time code optimisation. This is recommended for release builds."); | |||
| createConfigProperties (props); | |||
| props.add (new TextPropertyComponent (getUserNotes(), "Notes", 32768, true), | |||
| @@ -261,6 +261,9 @@ public: | |||
| int getOptimisationLevelInt() const { return config [Ids::optimisation]; } | |||
| String getGCCOptimisationFlag() const; | |||
| Value getLinkTimeOptimisationEnabledValue() { return getValue (Ids::linkTimeOptimisation); } | |||
| bool isLinkTimeOptimisationEnabled() const { return config [Ids::linkTimeOptimisation]; } | |||
| Value getBuildConfigPreprocessorDefs() { return getValue (Ids::defines); } | |||
| String getBuildConfigPreprocessorDefsString() const { return config [Ids::defines]; } | |||
| StringPairArray getAllPreprocessorDefs() const; // includes inherited definitions | |||
| @@ -133,7 +133,6 @@ namespace Ids | |||
| DECLARE_ID (postbuildCommand); | |||
| DECLARE_ID (generateManifest); | |||
| DECLARE_ID (useRuntimeLibDLL); | |||
| DECLARE_ID (wholeProgramOptimisation); | |||
| DECLARE_ID (enableIncrementalLinking); | |||
| DECLARE_ID (buildVST); | |||
| DECLARE_ID (bundleIdentifier); | |||