@@ -304,24 +304,31 @@ private: | |||||
String getGlobalDefs() | String getGlobalDefs() | ||||
{ | { | ||||
StringArray defs; | |||||
defs.add (project.getCompileEngineSettings().getExtraPreprocessorDefsString()); | |||||
auto mergeDefs = [] (const StringPairArray& inDefs) -> String | |||||
{ | { | ||||
auto projectDefines = project.getPreprocessorDefs(); | |||||
StringArray outDefs; | |||||
for (int i = 0; i < projectDefines.size(); ++i) | |||||
for (int i = 0; i < inDefs.size(); ++i) | |||||
{ | { | ||||
auto def = projectDefines.getAllKeys()[i]; | |||||
auto value = projectDefines.getAllValues()[i]; | |||||
auto def = inDefs.getAllKeys()[i]; | |||||
auto value = inDefs.getAllValues()[i]; | |||||
if (value.isNotEmpty()) | if (value.isNotEmpty()) | ||||
def << "=" << value; | def << "=" << value; | ||||
defs.add (def); | |||||
outDefs.add (def); | |||||
} | } | ||||
} | |||||
return outDefs.joinIntoString (" "); | |||||
}; | |||||
StringArray defs; | |||||
if (! project.shouldUseAppConfig()) | |||||
defs.add (mergeDefs (project.getAppConfigDefs())); | |||||
defs.add (project.getCompileEngineSettings().getExtraPreprocessorDefsString()); | |||||
defs.add (mergeDefs (project.getPreprocessorDefs())); | |||||
for (Project::ExporterIterator exporter (project); exporter.next();) | for (Project::ExporterIterator exporter (project); exporter.next();) | ||||
if (exporter->canLaunchProject()) | if (exporter->canLaunchProject()) | ||||
@@ -2425,6 +2425,49 @@ String Project::getFileTemplate (const String& templateName) | |||||
} | } | ||||
StringPairArray Project::getAppConfigDefs() | |||||
{ | |||||
StringPairArray result; | |||||
result.set ("JUCE_DISPLAY_SPLASH_SCREEN", shouldDisplaySplashScreen() ? "1" : "0"); | |||||
result.set ("JUCE_USE_DARK_SPLASH_SCREEN", getSplashScreenColourString() == "Dark" ? "1" : "0"); | |||||
result.set ("JUCE_PROJUCER_VERSION", "0x" + String::toHexString (ProjectInfo::versionNumber)); | |||||
OwnedArray<LibraryModule> modules; | |||||
getEnabledModules().createRequiredModules (modules); | |||||
for (auto& m : modules) | |||||
result.set ("JUCE_MODULE_AVAILABLE_" + m->getID(), "1"); | |||||
result.set ("JUCE_GLOBAL_MODULE_SETTINGS_INCLUDED", "1"); | |||||
for (auto& m : modules) | |||||
{ | |||||
OwnedArray<Project::ConfigFlag> flags; | |||||
m->getConfigFlags (*this, flags); | |||||
for (auto* flag : flags) | |||||
if (! flag->value.isUsingDefault()) | |||||
result.set (flag->symbol, flag->value.get() ? "1" : "0"); | |||||
} | |||||
result.addArray (getAudioPluginFlags()); | |||||
const auto& type = getProjectType(); | |||||
const auto isStandaloneApplication = (! type.isAudioPlugin() && ! type.isDynamicLibrary()); | |||||
const auto standaloneValue = [&] | |||||
{ | |||||
if (result.containsKey ("JucePlugin_Name") && result.containsKey ("JucePlugin_Build_Standalone")) | |||||
return "JucePlugin_Build_Standalone"; | |||||
return isStandaloneApplication ? "1" : "0"; | |||||
}(); | |||||
result.set ("JUCE_STANDALONE_APPLICATION", standaloneValue); | |||||
return result; | |||||
} | |||||
StringPairArray Project::getAudioPluginFlags() const | StringPairArray Project::getAudioPluginFlags() const | ||||
{ | { | ||||
if (! isAudioPluginProject()) | if (! isAudioPluginProject()) | ||||
@@ -310,6 +310,7 @@ public: | |||||
//============================================================================== | //============================================================================== | ||||
void updateDeprecatedProjectSettingsInteractively(); | void updateDeprecatedProjectSettingsInteractively(); | ||||
StringPairArray getAppConfigDefs(); | |||||
StringPairArray getAudioPluginFlags() const; | StringPairArray getAudioPluginFlags() const; | ||||
//============================================================================== | //============================================================================== | ||||
@@ -448,54 +448,11 @@ StringPairArray ProjectExporter::getAllPreprocessorDefs (const BuildConfiguratio | |||||
addTargetSpecificPreprocessorDefs (defs, targetType); | addTargetSpecificPreprocessorDefs (defs, targetType); | ||||
if (! project.shouldUseAppConfig()) | if (! project.shouldUseAppConfig()) | ||||
defs = mergePreprocessorDefs (defs, getAppConfigDefs()); | |||||
defs = mergePreprocessorDefs (defs, project.getAppConfigDefs()); | |||||
return defs; | return defs; | ||||
} | } | ||||
StringPairArray ProjectExporter::getAppConfigDefs() const | |||||
{ | |||||
StringPairArray result; | |||||
result.set ("JUCE_DISPLAY_SPLASH_SCREEN", project.shouldDisplaySplashScreen() ? "1" : "0"); | |||||
result.set ("JUCE_USE_DARK_SPLASH_SCREEN", project.getSplashScreenColourString() == "Dark" ? "1" : "0"); | |||||
result.set ("JUCE_PROJUCER_VERSION", "0x" + String::toHexString (ProjectInfo::versionNumber)); | |||||
OwnedArray<LibraryModule> modules; | |||||
project.getEnabledModules().createRequiredModules (modules); | |||||
for (auto& m : modules) | |||||
result.set ("JUCE_MODULE_AVAILABLE_" + m->getID(), "1"); | |||||
result.set ("JUCE_GLOBAL_MODULE_SETTINGS_INCLUDED", "1"); | |||||
for (auto& m : modules) | |||||
{ | |||||
OwnedArray<Project::ConfigFlag> flags; | |||||
m->getConfigFlags (project, flags); | |||||
for (auto* flag : flags) | |||||
if (! flag->value.isUsingDefault()) | |||||
result.set (flag->symbol, flag->value.get() ? "1" : "0"); | |||||
} | |||||
result.addArray (project.getAudioPluginFlags()); | |||||
const auto& type = project.getProjectType(); | |||||
const auto isStandaloneApplication = (! type.isAudioPlugin() && ! type.isDynamicLibrary()); | |||||
const auto standaloneValue = [&] | |||||
{ | |||||
if (result.containsKey ("JucePlugin_Name") && result.containsKey ("JucePlugin_Build_Standalone")) | |||||
return "JucePlugin_Build_Standalone"; | |||||
return isStandaloneApplication ? "1" : "0"; | |||||
}(); | |||||
result.set ("JUCE_STANDALONE_APPLICATION", standaloneValue); | |||||
return result; | |||||
} | |||||
StringPairArray ProjectExporter::getAllPreprocessorDefs() const | StringPairArray ProjectExporter::getAllPreprocessorDefs() const | ||||
{ | { | ||||
auto defs = mergePreprocessorDefs (project.getPreprocessorDefs(), | auto defs = mergePreprocessorDefs (project.getPreprocessorDefs(), | ||||
@@ -329,8 +329,6 @@ public: | |||||
StringPairArray getAllPreprocessorDefs (const BuildConfiguration& config, const build_tools::ProjectType::Target::Type targetType) const; | StringPairArray getAllPreprocessorDefs (const BuildConfiguration& config, const build_tools::ProjectType::Target::Type targetType) const; | ||||
// includes exporter + project defs | // includes exporter + project defs | ||||
StringPairArray getAllPreprocessorDefs() const; | StringPairArray getAllPreprocessorDefs() const; | ||||
// just appconfig defs | |||||
StringPairArray getAppConfigDefs() const; | |||||
void addTargetSpecificPreprocessorDefs (StringPairArray& defs, const build_tools::ProjectType::Target::Type targetType) const; | void addTargetSpecificPreprocessorDefs (StringPairArray& defs, const build_tools::ProjectType::Target::Type targetType) const; | ||||