1
0
Fork 0
mirror of https://github.com/juce-framework/JUCE.git synced 2026-02-03 03:30:06 +00:00

Projucer: added support for Xcode's INFOPLIST_PREFIX_HEADER, INFOPLIST_PREPROCESS, INFOPLIST_PREPROCESSOR_DEFINITIONS to allow pre-processing of info plists

This commit is contained in:
jules 2017-06-09 11:29:52 +01:00
parent 851b3e6db1
commit 9b02982f4e
2 changed files with 68 additions and 19 deletions

View file

@ -79,8 +79,14 @@ public:
}
//==============================================================================
Value getPListToMergeValue() { return getSetting ("customPList"); }
String getPListToMergeString() const { return settings ["customPList"]; }
Value getPListToMergeValue() { return getSetting ("customPList"); }
String getPListToMergeString() const { return settings ["customPList"]; }
Value getPListPrefixHeaderValue() { return getSetting ("PListPrefixHeader"); }
String getPListPrefixHeaderString() const { return settings ["PListPrefixHeader"]; }
Value getPListPreprocessValue() { return getSetting ("PListPreprocess"); }
bool isPListPreprocessEnabled() const { return settings ["PListPreprocess"]; }
Value getExtraFrameworksValue() { return getSetting (Ids::extraFrameworks); }
String getExtraFrameworksString() const { return settings [Ids::extraFrameworks]; }
@ -209,6 +215,14 @@ public:
"settings that the Projucer creates. BEWARE! When doing this, be careful to remove from the XML any "
"values that you DO want the Projucer to change!");
props.add (new BooleanPropertyComponent (getPListPreprocessValue(), "PList Preprocess", "Enabled"),
"Enable this to preprocess PList file. This will allow you to set values to preprocessor defines,"
" for instance if you define: #define MY_FLAG 1 in a prefix header file (see PList prefix header), you can have"
" a key with MY_FLAG value and it will be replaced with 1.");
props.add (new TextPropertyComponent (getPListPrefixHeaderValue(), "PList Prefix Header", 512, false),
"Header file containing definitions used in plist file (see PList Preprocess).");
props.add (new TextPropertyComponent (getExtraFrameworksValue(), "Extra Frameworks", 2048, false),
"A comma-separated list of extra frameworks that should be added to the build. "
"(Don't include the .framework extension in the name)");
@ -331,22 +345,23 @@ protected:
XcodeBuildConfiguration (Project& p, const ValueTree& t, const bool isIOS, const ProjectExporter& e)
: BuildConfiguration (p, t, e),
iOS (isIOS),
osxSDKVersion (config, Ids::osxSDK, nullptr, "default"),
osxDeploymentTarget (config, Ids::osxCompatibility, nullptr, "default"),
iosDeploymentTarget (config, Ids::iosCompatibility, nullptr, "default"),
osxArchitecture (config, Ids::osxArchitecture, nullptr, "default"),
customXcodeFlags (config, Ids::customXcodeFlags, nullptr),
cppLanguageStandard (config, Ids::cppLanguageStandard, nullptr),
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/"),
auBinaryLocation (config, Ids::xcodeAudioUnitBinaryLocation, nullptr, "$(HOME)/Library/Audio/Plug-Ins/Components/"),
rtasBinaryLocation (config, Ids::xcodeRtasBinaryLocation, nullptr, "/Library/Application Support/Digidesign/Plug-Ins/"),
aaxBinaryLocation (config, Ids::xcodeAaxBinaryLocation, nullptr, "/Library/Application Support/Avid/Audio/Plug-Ins/")
osxSDKVersion (config, Ids::osxSDK, nullptr, "default"),
osxDeploymentTarget (config, Ids::osxCompatibility, nullptr, "default"),
iosDeploymentTarget (config, Ids::iosCompatibility, nullptr, "default"),
osxArchitecture (config, Ids::osxArchitecture, nullptr, "default"),
customXcodeFlags (config, Ids::customXcodeFlags, nullptr),
plistPreprocessorDefinitions (config, Ids::plistPreprocessorDefinitions, nullptr),
cppLanguageStandard (config, Ids::cppLanguageStandard, nullptr),
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/"),
auBinaryLocation (config, Ids::xcodeAudioUnitBinaryLocation, nullptr, "$(HOME)/Library/Audio/Plug-Ins/Components/"),
rtasBinaryLocation (config, Ids::xcodeRtasBinaryLocation, nullptr, "/Library/Application Support/Digidesign/Plug-Ins/"),
aaxBinaryLocation (config, Ids::xcodeAaxBinaryLocation, nullptr, "/Library/Application Support/Avid/Audio/Plug-Ins/")
{
}
@ -354,7 +369,8 @@ protected:
bool iOS;
CachedValue<String> osxSDKVersion, osxDeploymentTarget, iosDeploymentTarget, osxArchitecture,
customXcodeFlags, cppLanguageStandard, cppStandardLibrary, codeSignIdentity;
customXcodeFlags, plistPreprocessorDefinitions,
cppLanguageStandard, cppStandardLibrary, codeSignIdentity;
CachedValue<bool> fastMathEnabled, linkTimeOptimisationEnabled, stripLocalSymbolsEnabled;
CachedValue<String> vstBinaryLocation, vst3BinaryLocation, auBinaryLocation, rtasBinaryLocation, aaxBinaryLocation;
@ -411,6 +427,9 @@ protected:
"A comma-separated list of custom Xcode setting flags which will be appended to the list of generated flags, "
"e.g. MACOSX_DEPLOYMENT_TARGET_i386 = 10.5, VALID_ARCHS = \"ppc i386 x86_64\"");
props.add (new TextPropertyComponent (plistPreprocessorDefinitions.getPropertyAsValue(), "PList Preprocessor Definitions", 2048, true),
"Preprocessor definitions used during PList preprocessing (see PList Preprocess).");
const char* cppLanguageStandardNames[] = { "Use Default", "C++11", "GNU++11", "C++14", "GNU++14", nullptr };
Array<var> cppLanguageStandardValues;
cppLanguageStandardValues.add (var());
@ -807,8 +826,32 @@ public:
s.add ("GCC_OPTIMIZATION_LEVEL = " + config.getGCCOptimisationFlag());
if (shouldCreatePList())
{
s.add ("INFOPLIST_FILE = " + infoPlistFile.getFileName());
if (owner.getPListPrefixHeaderString().isNotEmpty())
s.add ("INFOPLIST_PREFIX_HEADER = " + owner.getPListPrefixHeaderString());
s.add ("INFOPLIST_PREPROCESS = " + (owner.isPListPreprocessEnabled() ? String ("YES") : String ("NO")));
auto plistDefs = parsePreprocessorDefs (config.plistPreprocessorDefinitions.get());
StringArray defsList;
for (int i = 0; i < plistDefs.size(); ++i)
{
String def (plistDefs.getAllKeys()[i]);
const String value (plistDefs.getAllValues()[i]);
if (value.isNotEmpty())
def << "=" << value.replace ("\"", "\\\\\\\"");
defsList.add ("\"" + def + "\"");
}
if (defsList.size() > 0)
s.add ("INFOPLIST_PREPROCESSOR_DEFINITIONS = " + indentParenthesisedList (defsList));
}
if (config.linkTimeOptimisationEnabled.get())
s.add ("LLVM_LTO = YES");

View file

@ -93,6 +93,7 @@ namespace Ids
DECLARE_ID (customXcodeFlags);
DECLARE_ID (customXcassetsFolder);
DECLARE_ID (customXcodeResourceFolders);
DECLARE_ID (plistPreprocessorDefinitions);
DECLARE_ID (cppLanguageStandard);
DECLARE_ID (cppLibType);
DECLARE_ID (codeSigningIdentity);
@ -162,6 +163,9 @@ namespace Ids
DECLARE_ID (useLocalCopy);
DECLARE_ID (overwriteOnSave);
DECLARE_ID (microphonePermissionNeeded);
DECLARE_ID (androidRepositories);
DECLARE_ID (androidDependencies);
DECLARE_ID (androidAdditionalXmlValueResources);
DECLARE_ID (androidActivityClass);
DECLARE_ID (androidActivitySubClassName);
DECLARE_ID (androidVersionCode);
@ -169,6 +173,8 @@ namespace Ids
DECLARE_ID (androidNDKPath);
DECLARE_ID (androidInternetNeeded);
DECLARE_ID (androidArchitectures);
DECLARE_ID (androidManifestCustomXmlElements);
DECLARE_ID (androidCustomStringXmlElements);
DECLARE_ID (androidBluetoothNeeded);
DECLARE_ID (androidExternalReadNeeded);
DECLARE_ID (androidExternalWriteNeeded);