diff --git a/extras/Projucer/Builds/LinuxMakefile/Makefile b/extras/Projucer/Builds/LinuxMakefile/Makefile index 8600d0ff6f..ca3921affc 100644 --- a/extras/Projucer/Builds/LinuxMakefile/Makefile +++ b/extras/Projucer/Builds/LinuxMakefile/Makefile @@ -112,7 +112,6 @@ OBJECTS_APP := \ $(JUCE_OBJDIR)/jucer_FileHelpers_54f12f83.o \ $(JUCE_OBJDIR)/jucer_MiscUtilities_31fc8dd8.o \ $(JUCE_OBJDIR)/jucer_DependencyPathPropertyComponent_5d68c773.o \ - $(JUCE_OBJDIR)/jucer_TextWithDefaultPropertyComponentWithEnablement_537a85b0.o \ $(JUCE_OBJDIR)/jucer_Icons_d02d18f1.o \ $(JUCE_OBJDIR)/jucer_JucerTreeViewBase_9b9f2ff0.o \ $(JUCE_OBJDIR)/jucer_ProjucerLookAndFeel_3b20291d.o \ @@ -359,11 +358,6 @@ $(JUCE_OBJDIR)/jucer_DependencyPathPropertyComponent_5d68c773.o: ../../Source/Ut @echo "Compiling jucer_DependencyPathPropertyComponent.cpp" $(V_AT)$(CXX) $(JUCE_CXXFLAGS) $(JUCE_CPPFLAGS_APP) $(JUCE_CFLAGS_APP) -o "$@" -c "$<" -$(JUCE_OBJDIR)/jucer_TextWithDefaultPropertyComponentWithEnablement_537a85b0.o: ../../Source/Utility/UI/PropertyComponents/jucer_TextWithDefaultPropertyComponentWithEnablement.cpp - -$(V_AT)mkdir -p $(JUCE_OBJDIR) - @echo "Compiling jucer_TextWithDefaultPropertyComponentWithEnablement.cpp" - $(V_AT)$(CXX) $(JUCE_CXXFLAGS) $(JUCE_CPPFLAGS_APP) $(JUCE_CFLAGS_APP) -o "$@" -c "$<" - $(JUCE_OBJDIR)/jucer_Icons_d02d18f1.o: ../../Source/Utility/UI/jucer_Icons.cpp -$(V_AT)mkdir -p $(JUCE_OBJDIR) @echo "Compiling jucer_Icons.cpp" diff --git a/extras/Projucer/Builds/MacOSX/Projucer.xcodeproj/project.pbxproj b/extras/Projucer/Builds/MacOSX/Projucer.xcodeproj/project.pbxproj index 29bf926ec9..6c24c2666b 100644 --- a/extras/Projucer/Builds/MacOSX/Projucer.xcodeproj/project.pbxproj +++ b/extras/Projucer/Builds/MacOSX/Projucer.xcodeproj/project.pbxproj @@ -68,7 +68,6 @@ BF913199032B4CE970E82AA3 = {isa = PBXBuildFile; fileRef = B403AF75EAF361ED74EE476E; }; 25EF9B3FECB4C9F0F522DCAA = {isa = PBXBuildFile; fileRef = 486E8D02DAD2A0BF54A901C0; }; 2BEC1197D981951D8A897F01 = {isa = PBXBuildFile; fileRef = D859E9EA11A71BD6E85DC649; }; - 0CB5951330922218F72FC2C2 = {isa = PBXBuildFile; fileRef = B2EE6D7D91DF84E71DE91B39; }; D0E26EB54B0087C8BE3D541E = {isa = PBXBuildFile; fileRef = 846B2A670C5A19DE0039E11A; }; 468548FB21D264DC12321327 = {isa = PBXBuildFile; fileRef = 4D5F0CA8D1273144681A1D48; }; 6ECB2F11D2F593FACCCF99DB = {isa = PBXBuildFile; fileRef = 0F8C000E5FF4A2DAC1FEF8EB; }; @@ -130,7 +129,6 @@ 245C81599FB53865A74FC65B = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = "jucer_ActivityList.h"; path = "../../Source/LiveBuildEngine/jucer_ActivityList.h"; sourceTree = "SOURCE_ROOT"; }; 24EB4C2412821B8019D6F754 = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = "jucer_TestComponent.cpp"; path = "../../Source/ComponentEditor/UI/jucer_TestComponent.cpp"; sourceTree = "SOURCE_ROOT"; }; 25BE1265FE6C6EA3473A3A0A = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = "jucer_ResourceFile.h"; path = "../../Source/ProjectSaving/jucer_ResourceFile.h"; sourceTree = "SOURCE_ROOT"; }; - 25EC5A11CA56CAF4468C4D9C = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = "jucer_TextWithDefaultPropertyComponent.h"; path = "../../Source/Utility/UI/PropertyComponents/jucer_TextWithDefaultPropertyComponent.h"; sourceTree = "SOURCE_ROOT"; }; 269A454F1FF081DA67FFD578 = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = "jucer_JucerDocument.cpp"; path = "../../Source/ComponentEditor/jucer_JucerDocument.cpp"; sourceTree = "SOURCE_ROOT"; }; 28D0199327887FFABF9C3F20 = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = "jucer_UserSettingsPopup.h"; path = "../../Source/Utility/UI/jucer_UserSettingsPopup.h"; sourceTree = "SOURCE_ROOT"; }; 2BD9B4556479A8A41740BCAE = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = "jucer_ComponentTemplate.h"; path = "../../Source/BinaryData/Templates/jucer_ComponentTemplate.h"; sourceTree = "SOURCE_ROOT"; }; @@ -192,6 +190,7 @@ 58F1FF52E887887A93E84FC2 = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = "jucer_PresetIDs.h"; path = "../../Source/Utility/Helpers/jucer_PresetIDs.h"; sourceTree = "SOURCE_ROOT"; }; 59203884BC48D3B7F8DEABA8 = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = "jucer_ContentCompTemplate.h"; path = "../../Source/BinaryData/Templates/jucer_ContentCompTemplate.h"; sourceTree = "SOURCE_ROOT"; }; 59520B8137E6A2E483074399 = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = "jucer_ProjectExport_Make.h"; path = "../../Source/ProjectSaving/jucer_ProjectExport_Make.h"; sourceTree = "SOURCE_ROOT"; }; + 59F8A47C0020D62C8836A1E7 = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = "jucer_PropertyComponentsWithEnablement.h"; path = "../../Source/Utility/UI/PropertyComponents/jucer_PropertyComponentsWithEnablement.h"; sourceTree = "SOURCE_ROOT"; }; 5A75806B34E4EA6598A6024A = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AudioToolbox.framework; path = System/Library/Frameworks/AudioToolbox.framework; sourceTree = SDKROOT; }; 5B3532C5F103DAC87B4A5675 = {isa = PBXFileReference; lastKnownFileType = file.svg; name = "wizard_GUI.svg"; path = "../../Source/BinaryData/Icons/wizard_GUI.svg"; sourceTree = "SOURCE_ROOT"; }; 5E4EB84A7983AB31366A3490 = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = "jucer_ModuleTreeItems.h"; path = "../../Source/Project/UI/Sidebar/jucer_ModuleTreeItems.h"; sourceTree = "SOURCE_ROOT"; }; @@ -231,7 +230,6 @@ 7F0A5319912991615FC57945 = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = "jucer_ColourPropertyComponent.h"; path = "../../Source/ComponentEditor/Properties/jucer_ColourPropertyComponent.h"; sourceTree = "SOURCE_ROOT"; }; 807049CA2D5B6DE18EA078F2 = {isa = PBXFileReference; lastKnownFileType = file.svg; name = "export_android.svg"; path = "../../Source/BinaryData/Icons/export_android.svg"; sourceTree = "SOURCE_ROOT"; }; 80D62B907248523E6943298B = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Accelerate.framework; path = System/Library/Frameworks/Accelerate.framework; sourceTree = SDKROOT; }; - 816153F27E83EBA694EAA9F0 = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = "jucer_TextWithDefaultPropertyComponentWithEnablement.h"; path = "../../Source/Utility/UI/PropertyComponents/jucer_TextWithDefaultPropertyComponentWithEnablement.h"; sourceTree = "SOURCE_ROOT"; }; 8336A43CE1C3C26D7C7B53D8 = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = "jucer_NewComponentTemplate.cpp"; path = "../../Source/BinaryData/Templates/jucer_NewComponentTemplate.cpp"; sourceTree = "SOURCE_ROOT"; }; 842427CFE565F3FCE5B99174 = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = DiscRecording.framework; path = System/Library/Frameworks/DiscRecording.framework; sourceTree = SDKROOT; }; 846B2A670C5A19DE0039E11A = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = "jucer_Icons.cpp"; path = "../../Source/Utility/UI/jucer_Icons.cpp"; sourceTree = "SOURCE_ROOT"; }; @@ -299,7 +297,6 @@ B1C2F8ED14BF914CD1882708 = {isa = PBXFileReference; lastKnownFileType = file.svg; name = "wizard_Openfile.svg"; path = "../../Source/BinaryData/Icons/wizard_Openfile.svg"; sourceTree = "SOURCE_ROOT"; }; B24E3F34C3C4EE54A60C35CC = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = "jucer_LiveCodeBuilderDLL.h"; path = "../../Source/LiveBuildEngine/jucer_LiveCodeBuilderDLL.h"; sourceTree = "SOURCE_ROOT"; }; B2CB95B3F44C3CC5735051A3 = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = "jucer_JustificationProperty.h"; path = "../../Source/ComponentEditor/Properties/jucer_JustificationProperty.h"; sourceTree = "SOURCE_ROOT"; }; - B2EE6D7D91DF84E71DE91B39 = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = "jucer_TextWithDefaultPropertyComponentWithEnablement.cpp"; path = "../../Source/Utility/UI/PropertyComponents/jucer_TextWithDefaultPropertyComponentWithEnablement.cpp"; sourceTree = "SOURCE_ROOT"; }; B3528C08B84CBC950252EA69 = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = "jucer_ModulesInformationComponent.h"; path = "../../Source/Project/UI/jucer_ModulesInformationComponent.h"; sourceTree = "SOURCE_ROOT"; }; B403AF75EAF361ED74EE476E = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = "jucer_FileHelpers.cpp"; path = "../../Source/Utility/Helpers/jucer_FileHelpers.cpp"; sourceTree = "SOURCE_ROOT"; }; B6F2905330EA5C560D527209 = {isa = PBXFileReference; lastKnownFileType = file; name = "juce_graphics"; path = "../../../../modules/juce_graphics"; sourceTree = "SOURCE_ROOT"; }; @@ -663,9 +660,7 @@ D859E9EA11A71BD6E85DC649, F8F94093A0963D86BD27A95D, E367FC2BDAF5EBA48D767FBB, - 25EC5A11CA56CAF4468C4D9C, - B2EE6D7D91DF84E71DE91B39, - 816153F27E83EBA694EAA9F0, ); name = PropertyComponents; sourceTree = ""; }; + 59F8A47C0020D62C8836A1E7, ); name = PropertyComponents; sourceTree = ""; }; DD068F16F341D15E150CE6F1 = {isa = PBXGroup; children = ( 15F56361B9CF3E0BE705E64D, 169DD91232C070C4D6470B31, @@ -956,7 +951,6 @@ BF913199032B4CE970E82AA3, 25EF9B3FECB4C9F0F522DCAA, 2BEC1197D981951D8A897F01, - 0CB5951330922218F72FC2C2, D0E26EB54B0087C8BE3D541E, 468548FB21D264DC12321327, 6ECB2F11D2F593FACCCF99DB, diff --git a/extras/Projucer/Builds/VisualStudio2013/Projucer_App.vcxproj b/extras/Projucer/Builds/VisualStudio2013/Projucer_App.vcxproj index 5386d4f4c6..20fca052d5 100644 --- a/extras/Projucer/Builds/VisualStudio2013/Projucer_App.vcxproj +++ b/extras/Projucer/Builds/VisualStudio2013/Projucer_App.vcxproj @@ -237,7 +237,6 @@ - @@ -1572,8 +1571,7 @@ - - + @@ -1741,6 +1739,7 @@ + diff --git a/extras/Projucer/Builds/VisualStudio2013/Projucer_App.vcxproj.filters b/extras/Projucer/Builds/VisualStudio2013/Projucer_App.vcxproj.filters index 763493788e..ddbea6116b 100644 --- a/extras/Projucer/Builds/VisualStudio2013/Projucer_App.vcxproj.filters +++ b/extras/Projucer/Builds/VisualStudio2013/Projucer_App.vcxproj.filters @@ -472,9 +472,6 @@ Projucer\Utility\UI\PropertyComponents - - Projucer\Utility\UI\PropertyComponents - Projucer\Utility\UI @@ -2223,10 +2220,7 @@ Projucer\Utility\UI\PropertyComponents - - Projucer\Utility\UI\PropertyComponents - - + Projucer\Utility\UI\PropertyComponents @@ -2730,6 +2724,9 @@ JUCE Modules\juce_data_structures\values + + JUCE Modules\juce_data_structures\values + JUCE Modules\juce_data_structures diff --git a/extras/Projucer/Builds/VisualStudio2015/Projucer_App.vcxproj b/extras/Projucer/Builds/VisualStudio2015/Projucer_App.vcxproj index 99774bc6c0..7bd3231c5e 100644 --- a/extras/Projucer/Builds/VisualStudio2015/Projucer_App.vcxproj +++ b/extras/Projucer/Builds/VisualStudio2015/Projucer_App.vcxproj @@ -237,7 +237,6 @@ - @@ -1572,8 +1571,7 @@ - - + @@ -1741,6 +1739,7 @@ + diff --git a/extras/Projucer/Builds/VisualStudio2015/Projucer_App.vcxproj.filters b/extras/Projucer/Builds/VisualStudio2015/Projucer_App.vcxproj.filters index a77ea3fa5e..acdd39a36c 100644 --- a/extras/Projucer/Builds/VisualStudio2015/Projucer_App.vcxproj.filters +++ b/extras/Projucer/Builds/VisualStudio2015/Projucer_App.vcxproj.filters @@ -472,9 +472,6 @@ Projucer\Utility\UI\PropertyComponents - - Projucer\Utility\UI\PropertyComponents - Projucer\Utility\UI @@ -2223,10 +2220,7 @@ Projucer\Utility\UI\PropertyComponents - - Projucer\Utility\UI\PropertyComponents - - + Projucer\Utility\UI\PropertyComponents @@ -2730,6 +2724,9 @@ JUCE Modules\juce_data_structures\values + + JUCE Modules\juce_data_structures\values + JUCE Modules\juce_data_structures diff --git a/extras/Projucer/Builds/VisualStudio2017/Projucer_App.vcxproj b/extras/Projucer/Builds/VisualStudio2017/Projucer_App.vcxproj index 87fe37b068..8e32cad546 100644 --- a/extras/Projucer/Builds/VisualStudio2017/Projucer_App.vcxproj +++ b/extras/Projucer/Builds/VisualStudio2017/Projucer_App.vcxproj @@ -237,7 +237,6 @@ - @@ -1572,8 +1571,7 @@ - - + @@ -1741,6 +1739,7 @@ + diff --git a/extras/Projucer/Builds/VisualStudio2017/Projucer_App.vcxproj.filters b/extras/Projucer/Builds/VisualStudio2017/Projucer_App.vcxproj.filters index 16a4406e57..dfca7c4b29 100644 --- a/extras/Projucer/Builds/VisualStudio2017/Projucer_App.vcxproj.filters +++ b/extras/Projucer/Builds/VisualStudio2017/Projucer_App.vcxproj.filters @@ -472,9 +472,6 @@ Projucer\Utility\UI\PropertyComponents - - Projucer\Utility\UI\PropertyComponents - Projucer\Utility\UI @@ -2223,10 +2220,7 @@ Projucer\Utility\UI\PropertyComponents - - Projucer\Utility\UI\PropertyComponents - - + Projucer\Utility\UI\PropertyComponents @@ -2730,6 +2724,9 @@ JUCE Modules\juce_data_structures\values + + JUCE Modules\juce_data_structures\values + JUCE Modules\juce_data_structures diff --git a/extras/Projucer/Projucer.jucer b/extras/Projucer/Projucer.jucer index 8235863b9f..b669d35575 100644 --- a/extras/Projucer/Projucer.jucer +++ b/extras/Projucer/Projucer.jucer @@ -626,12 +626,8 @@ resource="0" file="Source/Utility/UI/PropertyComponents/jucer_DependencyPathPropertyComponent.h"/> - - - + diff --git a/extras/Projucer/Source/Application/jucer_CommandLine.cpp b/extras/Projucer/Source/Application/jucer_CommandLine.cpp index cf94201dfc..f77596521d 100644 --- a/extras/Projucer/Source/Application/jucer_CommandLine.cpp +++ b/extras/Projucer/Source/Application/jucer_CommandLine.cpp @@ -193,7 +193,7 @@ namespace std::cout << "Setting project version: " << version << std::endl; - proj.project->getVersionValue() = version; + proj.project->setProjectVersion (version); proj.save (false); } @@ -210,7 +210,7 @@ namespace std::cout << "Bumping project version to: " << version << std::endl; - proj.project->getVersionValue() = version; + proj.project->setProjectVersion (version); proj.save (false); } @@ -219,7 +219,7 @@ namespace checkArgumentCount (args, 2); LoadedProject proj (args[1]); - String version (proj.project->getVersionValue().toString()); + String version (proj.project->getVersionString()); if (version.trim().isEmpty()) throw CommandLineError ("Cannot read version number from project!"); @@ -254,8 +254,8 @@ namespace LoadedProject proj (args[1]); std::cout << "Project file: " << proj.project->getFile().getFullPathName() << std::endl - << "Name: " << proj.project->getTitle() << std::endl - << "UID: " << proj.project->getProjectUID() << std::endl; + << "Name: " << proj.project->getProjectNameString() << std::endl + << "UID: " << proj.project->getProjectUIDString() << std::endl; EnabledModuleList& modules = proj.project->getModules(); diff --git a/extras/Projucer/Source/Application/jucer_MainWindow.cpp b/extras/Projucer/Source/Application/jucer_MainWindow.cpp index d41b6972b4..599a8eaa5f 100644 --- a/extras/Projucer/Source/Application/jucer_MainWindow.cpp +++ b/extras/Projucer/Source/Application/jucer_MainWindow.cpp @@ -165,7 +165,7 @@ void MainWindow::setProject (Project* newProject) currentProject = newProject; if (currentProject != nullptr) - projectNameValue.referTo (currentProject->getProjectNameValue()); + projectNameValue.referTo (currentProject->getProjectValue (Ids::name)); else projectNameValue.referTo (Value()); diff --git a/extras/Projucer/Source/LiveBuildEngine/jucer_CompileEngineClient.cpp b/extras/Projucer/Source/LiveBuildEngine/jucer_CompileEngineClient.cpp index a9cf958687..542401d739 100644 --- a/extras/Projucer/Source/LiveBuildEngine/jucer_CompileEngineClient.cpp +++ b/extras/Projucer/Source/LiveBuildEngine/jucer_CompileEngineClient.cpp @@ -59,27 +59,18 @@ namespace ProjectProperties .getOrCreateChildWithName (liveSettingsSubtype, nullptr); } - static const ValueTree getLiveSettingsConst (Project& project) + static ValueWithDefault getLiveSetting (Project& p, const Identifier& i, var defaultValue = var()) { - return project.getProjectRoot().getChildWithName (liveSettingsType) - .getChildWithName (liveSettingsSubtype); + auto tree = getLiveSettings (p); + return { tree, i, p.getUndoManagerFor (tree), defaultValue }; } - static Value getLiveSetting (Project& p, const Identifier& i) { return getLiveSettings (p).getPropertyAsValue (i, p.getUndoManagerFor (getLiveSettings (p))); } - static var getLiveSettingVar (Project& p, const Identifier& i) { return getLiveSettingsConst (p) [i]; } - - static Value getUserHeaderPathValue (Project& p) { return getLiveSetting (p, Ids::headerPath); } - static String getUserHeaderPathString (Project& p) { return getLiveSettingVar (p, Ids::headerPath); } - static Value getSystemHeaderPathValue (Project& p) { return getLiveSetting (p, Ids::systemHeaderPath); } - static String getSystemHeaderPathString (Project& p) { return getLiveSettingVar (p, Ids::systemHeaderPath); } - static Value getExtraDLLsValue (Project& p) { return getLiveSetting (p, Ids::extraDLLs); } - static String getExtraDLLsString (Project& p) { return getLiveSettingVar (p, Ids::extraDLLs); } - static Value getExtraCompilerFlagsValue (Project& p) { return getLiveSetting (p, Ids::extraCompilerFlags); } - static String getExtraCompilerFlagsString (Project& p) { return getLiveSettingVar (p, Ids::extraCompilerFlags); } - static Value getExtraPreprocessorDefsValue (Project& p) { return getLiveSetting (p, Ids::defines); } - static String getExtraPreprocessorDefsString (Project& p) { return getLiveSettingVar (p, Ids::defines); } - static Value getWindowsTargetPlatformVersionValue (Project& p) { return getLiveSetting (p, Ids::liveWindowsTargetPlatformVersion); } - static String getWindowsTargetPlatformVersionString (Project& p) { return getLiveSettingVar (p, Ids::liveWindowsTargetPlatformVersion); } + static ValueWithDefault getUserHeaderPathValue (Project& p) { return getLiveSetting (p, Ids::headerPath); } + static ValueWithDefault getSystemHeaderPathValue (Project& p) { return getLiveSetting (p, Ids::systemHeaderPath); } + static ValueWithDefault getExtraDLLsValue (Project& p) { return getLiveSetting (p, Ids::extraDLLs); } + static ValueWithDefault getExtraCompilerFlagsValue (Project& p) { return getLiveSetting (p, Ids::extraCompilerFlags); } + static ValueWithDefault getExtraPreprocessorDefsValue (Project& p) { return getLiveSetting (p, Ids::defines); } + static ValueWithDefault getWindowsTargetPlatformVersionValue (Project& p) { return getLiveSetting (p, Ids::liveWindowsTargetPlatformVersion, "10.0.16299.0"); } static File getProjucerTempFolder() { @@ -92,7 +83,7 @@ namespace ProjectProperties static File getCacheLocation (Project& project) { - String cacheFolderName = project.getProjectFilenameRoot() + "_" + project.getProjectUID(); + auto cacheFolderName = project.getProjectFilenameRootString() + "_" + project.getProjectUIDString(); #if JUCE_DEBUG cacheFolderName += "_debug"; @@ -109,26 +100,22 @@ void LiveBuildProjectSettings::getLiveSettings (Project& project, PropertyListBu { using namespace ProjectProperties; - props.addSearchPathProperty (getUserHeaderPathValue (project), "User header paths", "User header search paths."); + props.addSearchPathProperty (getUserHeaderPathValue (project), "User Header Paths", "User header search paths."); props.addSearchPathProperty (getSystemHeaderPathValue (project), "System header paths", "System header search paths."); props.add (new TextPropertyComponent (getExtraPreprocessorDefsValue (project), "Preprocessor Definitions", 32768, true), "Extra preprocessor definitions. Use the form \"NAME1=value NAME2=value\", using whitespace or commas " "to separate the items - to include a space or comma in a definition, precede it with a backslash."); - props.add (new TextPropertyComponent (getExtraCompilerFlagsValue (project), "Extra compiler flags", 2048, true), + props.add (new TextPropertyComponent (getExtraCompilerFlagsValue (project), "Extra Compiler Flags", 2048, true), "Extra command-line flags to be passed to the compiler. This string can contain references to preprocessor" " definitions in the form ${NAME_OF_DEFINITION}, which will be replaced with their values."); - props.add (new TextPropertyComponent (getExtraDLLsValue (project), "Extra dynamic libraries", 2048, true), - "Extra dynamic libs that the running code may require. Use new-lines or commas to separate the items"); + props.add (new TextPropertyComponent (getExtraDLLsValue (project), "Extra Dynamic Libraries", 2048, true), + "Extra dynamic libs that the running code may require. Use new-lines or commas to separate the items."); - static const char* targetPlatformNames[] = { "(default)", "8.1", "10.0.10240.0", "10.0.10586.0", "10.0.14393.0", "10.0.16299.0", nullptr }; - const var targetPlatforms[] = { var(), "8.1", "10.0.10240.0", "10.0.10586.0", "10.0.14393.0", "10.0.16299.0" }; - - props.add (new ChoicePropertyComponent (getWindowsTargetPlatformVersionValue (project), "Windows Target Platform", - StringArray (targetPlatformNames), Array (targetPlatforms, numElementsInArray (targetPlatforms))), - "The Windows target platform to use"); + props.add (new TextPropertyComponent (getWindowsTargetPlatformVersionValue (project), "Windows Target Platform", 256, false), + "The Windows target platform to use."); } void LiveBuildProjectSettings::updateNewlyOpenedProject (Project&) { /* placeholder */ } @@ -177,7 +164,7 @@ public: const String pipeName ("ipc_" + String::toHexString (Random().nextInt64())); const String command (createCommandLineForLaunchingServer (pipeName, - owner.project.getProjectUID(), + owner.project.getProjectUIDString(), ProjectProperties::getCacheLocation (owner.project))); #if RUN_CLANG_IN_CHILD_PROCESS @@ -331,13 +318,13 @@ public: build.setUserIncludes (getUserIncludes()); build.setGlobalDefs (getGlobalDefs (project)); - build.setCompileFlags (ProjectProperties::getExtraCompilerFlagsString (project).trim()); + build.setCompileFlags (ProjectProperties::getExtraCompilerFlagsValue (project).get().toString().trim()); build.setExtraDLLs (getExtraDLLs()); build.setJuceModulesFolder (EnabledModuleList::findDefaultModulesFolder (project).getFullPathName()); build.setUtilsCppInclude (project.getAppIncludeFile().getFullPathName()); - build.setWindowsTargetPlatformVersion (ProjectProperties::getWindowsTargetPlatformVersionString (project)); + build.setWindowsTargetPlatformVersion (ProjectProperties::getWindowsTargetPlatformVersionValue (project).get().toString()); scanForProjectFiles (project, build); @@ -391,7 +378,7 @@ private: static String getGlobalDefs (Project& proj) { - String defs (ProjectProperties::getExtraPreprocessorDefsString (proj)); + String defs (ProjectProperties::getExtraPreprocessorDefsValue (proj).get().toString()); for (Project::ExporterIterator exporter (proj); exporter.next();) if (exporter->canLaunchProject()) @@ -515,14 +502,14 @@ private: { StringArray paths; paths.add (project.getGeneratedCodeFolder().getFullPathName()); - paths.addArray (getSearchPathsFromString (ProjectProperties::getUserHeaderPathString (project))); + paths.addArray (getSearchPathsFromString (ProjectProperties::getUserHeaderPathValue (project).get().toString())); return convertSearchPathsToAbsolute (paths); } StringArray getSystemIncludePaths() { StringArray paths; - paths.addArray (getSearchPathsFromString (ProjectProperties::getSystemHeaderPathString (project))); + paths.addArray (getSearchPathsFromString (ProjectProperties::getSystemHeaderPathValue (project).get().toString())); auto isVST3Host = project.getModules().isModuleEnabled ("juce_audio_processors") && project.isConfigFlagEnabled ("JUCE_PLUGINHOST_VST3"); @@ -553,7 +540,7 @@ private: StringArray getExtraDLLs() { StringArray dlls; - dlls.addTokens (ProjectProperties::getExtraDLLsString (project), "\n\r,", StringRef()); + dlls.addTokens (ProjectProperties::getExtraDLLsValue (project).get().toString(), "\n\r,", StringRef()); dlls.trim(); dlls.removeEmptyStrings(); return dlls; diff --git a/extras/Projucer/Source/Project/UI/Sidebar/jucer_ExporterTreeItems.h b/extras/Projucer/Source/Project/UI/Sidebar/jucer_ExporterTreeItems.h index 295406df04..866f208ae3 100644 --- a/extras/Projucer/Source/Project/UI/Sidebar/jucer_ExporterTreeItems.h +++ b/extras/Projucer/Source/Project/UI/Sidebar/jucer_ExporterTreeItems.h @@ -117,7 +117,7 @@ public: { if (resultCode == 1) { - exporter->addNewConfiguration (nullptr); + exporter->addNewConfiguration (false); } else if (resultCode == 2) { @@ -262,7 +262,7 @@ public: void handlePopupMenuResult (int resultCode) override { if (resultCode == 1) - exporter.addNewConfiguration (config); + exporter.addNewConfigurationFromExisting (*config); else if (resultCode == 2) deleteAllSelectedItems(); } diff --git a/extras/Projucer/Source/Project/UI/Sidebar/jucer_ModuleTreeItems.h b/extras/Projucer/Source/Project/UI/Sidebar/jucer_ModuleTreeItems.h index 7f6e2ed45b..5fbc56b512 100644 --- a/extras/Projucer/Source/Project/UI/Sidebar/jucer_ModuleTreeItems.h +++ b/extras/Projucer/Source/Project/UI/Sidebar/jucer_ModuleTreeItems.h @@ -214,29 +214,17 @@ private: "making it easy to browse/edit the module's classes. If disabled, then only the minimum number of files " "required to compile it will appear inside your project."); - StringArray possibleValues; - possibleValues.add ("(Use Default)"); - possibleValues.add ("Enabled"); - possibleValues.add ("Disabled"); - - Array mappings; - mappings.add (Project::configFlagDefault); - mappings.add (Project::configFlagEnabled); - mappings.add (Project::configFlagDisabled); - - ModuleDescription info (modules.getModuleInfo (moduleID)); + auto info = modules.getModuleInfo (moduleID); if (info.isValid()) { OwnedArray configFlags; LibraryModule (info).getConfigFlags (project, configFlags); - for (int i = 0; i < configFlags.size(); ++i) + for (auto* flag : configFlags) { - ChoicePropertyComponent* c = new ChoicePropertyComponent (configFlags[i]->value, - configFlags[i]->symbol, - possibleValues, mappings); - c->setTooltip (configFlags[i]->description); + auto* c = new ChoicePropertyComponent (flag->value, flag->symbol); + c->setTooltip (flag->description); props.add (c); } } @@ -498,7 +486,7 @@ public: { moduleListTree.addListener (this); - projectCppStandardValue.referTo (project.getCppStandardValue()); + projectCppStandardValue.referTo (project.getProjectValue (Ids::cppLanguageStandard)); defaultJuceModulePathValue.referTo (getAppSettings().getStoredPath (Ids::defaultJuceModulePath)); defaultUserModulePathValue.referTo (getAppSettings().getStoredPath (Ids::defaultUserModulePath)); diff --git a/extras/Projucer/Source/Project/UI/Sidebar/jucer_ProjectTab.h b/extras/Projucer/Source/Project/UI/Sidebar/jucer_ProjectTab.h index ff04959365..d8237d2753 100644 --- a/extras/Projucer/Source/Project/UI/Sidebar/jucer_ProjectTab.h +++ b/extras/Projucer/Source/Project/UI/Sidebar/jucer_ProjectTab.h @@ -33,7 +33,7 @@ struct ProjectSettingsComponent : public Component, { ProjectSettingsComponent (Project& p) : project (p), - group (project.getProjectFilenameRoot(), + group (project.getProjectFilenameRootString(), Icon (getIcons().settings, Colours::transparentBlack)) { addAndMakeVisible (group); @@ -60,13 +60,13 @@ struct ProjectSettingsComponent : public Component, group.setProperties (props); group.setName ("Project Settings"); - lastProjectType = project.getProjectTypeValue().getValue(); + lastProjectType = project.getProjectTypeString(); parentSizeChanged(); } void changeListenerCallback (ChangeBroadcaster*) override { - if (lastProjectType != project.getProjectTypeValue().getValue()) + if (lastProjectType != project.getProjectTypeString()) updatePropertyList(); } diff --git a/extras/Projucer/Source/Project/jucer_Module.cpp b/extras/Projucer/Source/Project/jucer_Module.cpp index bc351c0c4f..ecae18ed6f 100644 --- a/extras/Projucer/Source/Project/jucer_Module.cpp +++ b/extras/Projucer/Source/Project/jucer_Module.cpp @@ -410,7 +410,7 @@ void LibraryModule::addSettingsForModuleToExporter (ProjectExporter& exporter, P const String extraDefs (moduleInfo.getPreprocessorDefs().trim()); if (extraDefs.isNotEmpty()) - exporter.getExporterPreprocessorDefs() = exporter.getExporterPreprocessorDefsString() + "\n" + extraDefs; + exporter.getExporterPreprocessorDefsValue() = exporter.getExporterPreprocessorDefsString() + "\n" + extraDefs; } { @@ -489,7 +489,20 @@ void LibraryModule::getConfigFlags (Project& project, OwnedArraydescription = config->description.upToFirstOccurrenceOf ("*/", false, false); - config->value.referTo (project.getConfigFlag (config->symbol)); + config->value = project.getConfigFlag (config->symbol); + + i += 2; + if (lines[i].contains ("#define " + config->symbol)) + { + auto value = lines[i].fromFirstOccurrenceOf ("#define " + config->symbol, false, true).trim(); + config->value.setDefault (value == "0" ? false : true); + } + + auto currentValue = config->value.get().toString(); + + if (currentValue == "enabled") config->value = true; + else if (currentValue == "disabled") config->value = false; + flags.add (config.release()); } } @@ -852,7 +865,7 @@ StringArray EnabledModuleList::getExtraDependenciesNeeded (const String& moduleI bool EnabledModuleList::doesModuleHaveHigherCppStandardThanProject (const String& moduleID) { - auto projectCppStandard = project.getCppStandardValue().toString(); + auto projectCppStandard = project.getCppStandardString(); if (projectCppStandard == "latest") return false; diff --git a/extras/Projucer/Source/Project/jucer_Project.cpp b/extras/Projucer/Source/Project/jucer_Project.cpp index bb5fc144a7..c6c0fc95d3 100644 --- a/extras/Projucer/Source/Project/jucer_Project.cpp +++ b/extras/Projucer/Source/Project/jucer_Project.cpp @@ -51,14 +51,23 @@ Project::Project (const File& f) { Logger::writeToLog ("Loading project: " + f.getFullPathName()); setFile (f); + removeDefunctExporters(); updateOldModulePaths(); - setMissingDefaultValues(); + updateOldStyleConfigList(); + setCppVersionFromOldExporterSettings(); + moveOldPropertyFromProjectToAllExporters (Ids::bigIcon); + moveOldPropertyFromProjectToAllExporters (Ids::smallIcon); - setChangedFlag (false); + intialiseProjectValues(); + initialiseMainGroup(); + initialiseAudioPluginValues(); + + getModules().sortAlphabetically(); projectRoot.addListener (this); + setChangedFlag (false); modificationTime = getFile().getLastModificationTime(); } @@ -75,11 +84,14 @@ void Project::setTitle (const String& newTitle) { projectRoot.setProperty (Ids::name, newTitle, getUndoManagerFor (projectRoot)); getMainGroup().getNameValue() = newTitle; + + bundleIdentifierValue.setDefault (getDefaultBundleIdentifierString()); + pluginAAXIdentifierValue.setDefault (getDefaultAAXIdentifierString()); } String Project::getDocumentTitle() { - return getTitle(); + return getProjectNameString(); } void Project::updateProjectSettings() @@ -88,72 +100,6 @@ void Project::updateProjectSettings() projectRoot.setProperty (Ids::name, getDocumentTitle(), nullptr); } -void Project::setMissingDefaultValues() -{ - if (! projectRoot.hasProperty (Ids::ID)) - projectRoot.setProperty (Ids::ID, createAlphaNumericUID(), nullptr); - - // Create main file group if missing - if (! projectRoot.getChildWithName (Ids::MAINGROUP).isValid()) - { - Item mainGroup (*this, ValueTree (Ids::MAINGROUP), false); - projectRoot.addChild (mainGroup.state, 0, 0); - } - - getMainGroup().initialiseMissingProperties(); - - if (getDocumentTitle().isEmpty()) - setTitle ("JUCE Project"); - - { - auto defaultSplashScreen = ! ProjucerApplication::getApp().isPaidOrGPL(); - - if (shouldDisplaySplashScreen() == var() || defaultSplashScreen) - shouldDisplaySplashScreen() = defaultSplashScreen; - - if (ProjucerApplication::getApp().isPaidOrGPL()) - { - if (shouldReportAppUsage() == var()) - shouldReportAppUsage() = ProjucerApplication::getApp().licenseController->getState().applicationUsageDataState - == LicenseState::ApplicationUsageData::enabled; - } - else - shouldReportAppUsage() = true; - } - - if (splashScreenColour() == var()) - splashScreenColour() = "Dark"; - - if (! projectRoot.hasProperty (Ids::projectType)) - getProjectTypeValue() = ProjectType_GUIApp::getTypeName(); - - if (! projectRoot.hasProperty (Ids::version)) - getVersionValue() = "1.0.0"; - - updateOldStyleConfigList(); - moveOldPropertyFromProjectToAllExporters (Ids::bigIcon); - moveOldPropertyFromProjectToAllExporters (Ids::smallIcon); - - if (getProjectType().isAudioPlugin()) - setMissingAudioPluginDefaultValues(); - - getModules().sortAlphabetically(); - - if (getBundleIdentifier().toString().isEmpty()) - getBundleIdentifier() = getDefaultBundleIdentifier(); - - if (shouldIncludeBinaryInAppConfig() == var()) - shouldIncludeBinaryInAppConfig() = true; - - if (! projectRoot.hasProperty (Ids::cppLanguageStandard) && ! setCppVersionFromOldExporterSettings()) - getCppStandardValue() = "14"; - - if (getCompanyCopyright().toString().isEmpty()) - getCompanyCopyright() = getCompanyName().toString(); - - ProjucerApplication::getApp().updateNewlyOpenedProject (*this); -} - bool Project::setCppVersionFromOldExporterSettings() { auto highestLanguageStandard = -1; @@ -183,7 +129,7 @@ bool Project::setCppVersionFromOldExporterSettings() { if (cppLanguageStandard.toString().containsIgnoreCase ("latest")) { - getCppStandardValue() = "latest"; + cppStandardValue = "latest"; return true; } @@ -197,7 +143,7 @@ bool Project::setCppVersionFromOldExporterSettings() if (highestLanguageStandard != -1 && highestLanguageStandard >= 11) { - getCppStandardValue() = highestLanguageStandard; + cppStandardValue = highestLanguageStandard; return true; } @@ -212,35 +158,91 @@ void Project::updateDeprecatedProjectSettingsInteractively() exporter->updateDeprecatedProjectSettingsInteractively(); } -void Project::setMissingAudioPluginDefaultValues() +void Project::initialiseMainGroup() { - const String sanitisedProjectName (CodeHelpers::makeValidIdentifier (getTitle(), false, true, false)); + // Create main file group if missing + if (! projectRoot.getChildWithName (Ids::MAINGROUP).isValid()) + { + Item mainGroup (*this, ValueTree (Ids::MAINGROUP), false); + projectRoot.addChild (mainGroup.state, 0, 0); + } - setValueIfVoid (getShouldBuildVSTAsValue(), true); - setValueIfVoid (getShouldBuildVST3AsValue(), false); - setValueIfVoid (getShouldBuildAUAsValue(), true); - setValueIfVoid (getShouldBuildAUv3AsValue(), false); - setValueIfVoid (getShouldBuildRTASAsValue(), false); - setValueIfVoid (getShouldBuildAAXAsValue(), false); - setValueIfVoid (getShouldBuildStandalonePluginAsValue(), false); - setValueIfVoid (getShouldEnableIAAAsValue(), false); + getMainGroup().initialiseMissingProperties(); +} - setValueIfVoid (getPluginName(), getTitle()); - setValueIfVoid (getPluginDesc(), getTitle()); - setValueIfVoid (getPluginManufacturer(), "yourcompany"); - setValueIfVoid (getPluginManufacturerCode(), "Manu"); - setValueIfVoid (getPluginCode(), makeValid4CC (getProjectUID() + getProjectUID())); - setValueIfVoid (getPluginChannelConfigs(), String()); - setValueIfVoid (getPluginIsSynth(), false); - setValueIfVoid (getPluginWantsMidiInput(), false); - setValueIfVoid (getPluginProducesMidiOut(), false); - setValueIfVoid (getPluginIsMidiEffectPlugin(), false); - setValueIfVoid (getPluginEditorNeedsKeyFocus(), false); - setValueIfVoid (getPluginAUExportPrefix(), sanitisedProjectName + "AU"); - setValueIfVoid (getPluginRTASCategory(), String()); - setValueIfVoid (getBundleIdentifier(), getDefaultBundleIdentifier()); - setValueIfVoid (getAAXIdentifier(), getDefaultAAXIdentifier()); - setValueIfVoid (getPluginAAXCategory(), "AAX_ePlugInCategory_Dynamics"); +void Project::intialiseProjectValues() +{ + projectNameValue.referTo (projectRoot, Ids::name, getUndoManagerFor (projectRoot), "JUCE Project"); + projectUIDValue.referTo (projectRoot, Ids::ID, getUndoManagerFor (projectRoot), createAlphaNumericUID()); + projectTypeValue.referTo (projectRoot, Ids::projectType, getUndoManagerFor (projectRoot), ProjectType_GUIApp::getTypeName()); + versionValue.referTo (projectRoot, Ids::version, getUndoManagerFor (projectRoot), "1.0.0"); + bundleIdentifierValue.referTo (projectRoot, Ids::bundleIdentifier, getUndoManagerFor (projectRoot), getDefaultBundleIdentifierString()); + + companyNameValue.referTo (projectRoot, Ids::companyName, getUndoManagerFor (projectRoot)); + companyCopyrightValue.referTo (projectRoot, Ids::companyCopyright, getUndoManagerFor (projectRoot)); + companyWebsiteValue.referTo (projectRoot, Ids::companyWebsite, getUndoManagerFor (projectRoot)); + companyEmailValue.referTo (projectRoot, Ids::companyEmail, getUndoManagerFor (projectRoot)); + + displaySplashScreenValue.referTo (projectRoot, Ids::displaySplashScreen, getUndoManagerFor (projectRoot), ! ProjucerApplication::getApp().isPaidOrGPL()); + splashScreenColourValue.referTo (projectRoot, Ids::splashScreenColour, getUndoManagerFor (projectRoot), "Dark"); + reportAppUsageValue.referTo (projectRoot, Ids::reportAppUsage, getUndoManagerFor (projectRoot)); + + if (ProjucerApplication::getApp().isPaidOrGPL()) + { + reportAppUsageValue.setDefault (ProjucerApplication::getApp().licenseController->getState().applicationUsageDataState + == LicenseState::ApplicationUsageData::enabled); + } + else + { + reportAppUsageValue.setDefault (true); + } + + cppStandardValue.referTo (projectRoot, Ids::cppLanguageStandard, getUndoManagerFor (projectRoot), "14"); + + headerSearchPathsValue.referTo (projectRoot, Ids::headerPath, getUndoManagerFor (projectRoot)); + preprocessorDefsValue.referTo (projectRoot, Ids::defines, getUndoManagerFor (projectRoot)); + userNotesValue.referTo (projectRoot, Ids::userNotes, getUndoManagerFor (projectRoot)); + + maxBinaryFileSizeValue.referTo (projectRoot, Ids::maxBinaryFileSize, getUndoManagerFor (projectRoot), 10240 * 1024); + includeBinaryDataInAppConfigValue.referTo (projectRoot, Ids::includeBinaryInAppConfig, getUndoManagerFor (projectRoot), true); + binaryDataNamespaceValue.referTo (projectRoot, Ids::binaryDataNamespace, getUndoManagerFor (projectRoot), "BinaryData"); +} + +void Project::initialiseAudioPluginValues() +{ + buildVSTValue.referTo (projectRoot, Ids::buildVST, getUndoManagerFor (projectRoot), true); + buildVST3Value.referTo (projectRoot, Ids::buildVST3, getUndoManagerFor (projectRoot), false); + buildAUValue.referTo (projectRoot, Ids::buildAU, getUndoManagerFor (projectRoot), true); + buildAUv3Value.referTo (projectRoot, Ids::buildAUv3, getUndoManagerFor (projectRoot), false); + buildRTASValue.referTo (projectRoot, Ids::buildRTAS, getUndoManagerFor (projectRoot), false); + buildAAXValue.referTo (projectRoot, Ids::buildAAX, getUndoManagerFor (projectRoot), false); + buildStandaloneValue.referTo (projectRoot, Ids::buildStandalone, getUndoManagerFor (projectRoot), false); + enableIAAValue.referTo (projectRoot, Ids::enableIAA, getUndoManagerFor (projectRoot), false); + + pluginNameValue.referTo (projectRoot, Ids::pluginName, getUndoManagerFor (projectRoot), getProjectNameString()); + pluginDescriptionValue.referTo (projectRoot, Ids::pluginDesc, getUndoManagerFor (projectRoot), getProjectNameString()); + pluginManufacturerValue.referTo (projectRoot, Ids::pluginManufacturer, getUndoManagerFor (projectRoot), "yourcompany"); + pluginManufacturerCodeValue.referTo (projectRoot, Ids::pluginManufacturerCode, getUndoManagerFor (projectRoot), "Manu"); + pluginCodeValue.referTo (projectRoot, Ids::pluginCode, getUndoManagerFor (projectRoot), makeValid4CC (getProjectUIDString() + getProjectUIDString())); + pluginChannelConfigsValue.referTo (projectRoot, Ids::pluginChannelConfigs, getUndoManagerFor (projectRoot)); + + pluginIsSynthValue.referTo (projectRoot, Ids::pluginIsSynth, getUndoManagerFor (projectRoot), false); + pluginWantsMidiInputValue.referTo (projectRoot, Ids::pluginWantsMidiIn, getUndoManagerFor (projectRoot), false); + pluginProducesMidiOutValue.referTo (projectRoot, Ids::pluginProducesMidiOut, getUndoManagerFor (projectRoot), false); + pluginIsMidiEffectPluginValue.referTo (projectRoot, Ids::pluginIsMidiEffectPlugin, getUndoManagerFor (projectRoot), false); + pluginEditorNeedsKeyFocusValue.referTo (projectRoot, Ids::pluginEditorRequiresKeys, getUndoManagerFor (projectRoot), false); + + pluginVSTCategoryValue.referTo (projectRoot, Ids::pluginVSTCategory, getUndoManagerFor (projectRoot)); + pluginAUExportPrefixValue.referTo (projectRoot, Ids::pluginAUExportPrefix, getUndoManagerFor (projectRoot), + CodeHelpers::makeValidIdentifier (getProjectNameString(), false, true, false) + "AU"); + pluginAUMainTypeValue.referTo (projectRoot, Ids::pluginAUMainType, getUndoManagerFor (projectRoot)); + pluginRTASCategoryValue.referTo (projectRoot, Ids::pluginRTASCategory, getUndoManagerFor (projectRoot)); + pluginRTASBypassDisabledValue.referTo (projectRoot, Ids::pluginRTASDisableBypass, getUndoManagerFor (projectRoot)); + pluginRTASMultiMonoDisabledValue.referTo (projectRoot, Ids::pluginRTASDisableMultiMono, getUndoManagerFor (projectRoot)); + pluginAAXIdentifierValue.referTo (projectRoot, Ids::aaxIdentifier, getUndoManagerFor (projectRoot), getDefaultAAXIdentifierString()); + pluginAAXCategoryValue.referTo (projectRoot, Ids::pluginAAXCategory, getUndoManagerFor (projectRoot), "AAX_ePlugInCategory_Dynamics"); + pluginAAXBypassDisabledValue.referTo (projectRoot, Ids::pluginAAXDisableBypass, getUndoManagerFor (projectRoot)); + pluginAAXMultiMonoDisabledValue.referTo (projectRoot, Ids::pluginAAXDisableMultiMono, getUndoManagerFor (projectRoot)); } void Project::updateOldStyleConfigList() @@ -410,8 +412,11 @@ Result Project::loadDocument (const File& file) enabledModulesList.reset(); projectRoot = newTree; + intialiseProjectValues(); + initialiseMainGroup(); + initialiseAudioPluginValues(); + removeDefunctExporters(); - setMissingDefaultValues(); updateOldModulePaths(); setChangedFlag (false); @@ -432,7 +437,6 @@ Result Project::saveProject (const File& file, bool isCommandLineApp) return Result::ok(); updateProjectSettings(); - sanitiseConfigFlags(); if (! isCommandLineApp) registerRecentFile (file); @@ -450,14 +454,17 @@ Result Project::saveResourcesOnly (const File& file) } //============================================================================== -void Project::valueTreePropertyChanged (ValueTree&, const Identifier& property) +void Project::valueTreePropertyChanged (ValueTree& tree, const Identifier& property) { - if (property == Ids::projectType) - setMissingDefaultValues(); - else if (property == Ids::name) - setTitle (projectRoot [Ids::name]); + if (tree.getParent() == tree) + { + if (property == Ids::projectType) + sendChangeMessage(); + else if (property == Ids::name) + setTitle (projectRoot [Ids::name]); - changed(); + changed(); + } } void Project::valueTreeChildAdded (ValueTree&, ValueTree&) { changed(); } @@ -623,22 +630,22 @@ ProjectType::Target::TargetFileType ProjectType::Target::getTargetFileType() con //============================================================================== void Project::createPropertyEditors (PropertyListBuilder& props) { - props.add (new TextPropertyComponent (getProjectNameValue(), "Project Name", 256, false), + props.add (new TextPropertyComponent (projectNameValue, "Project Name", 256, false), "The name of the project."); - props.add (new TextPropertyComponent (getVersionValue(), "Project Version", 16, false), + props.add (new TextPropertyComponent (versionValue, "Project Version", 16, false), "The project's version number, This should be in the format major.minor.point[.point]"); - props.add (new TextPropertyComponent (getCompanyName(), "Company Name", 256, false), + props.add (new TextPropertyComponent (companyNameValue, "Company Name", 256, false), "Your company name, which will be added to the properties of the binary where possible"); - props.add (new TextPropertyComponent (getCompanyCopyright(), "Company Copyright", 256, false), + props.add (new TextPropertyComponent (companyCopyrightValue, "Company Copyright", 256, false), "Your company copyright, which will be added to the properties of the binary where possible"); - props.add (new TextPropertyComponent (getCompanyWebsite(), "Company Website", 256, false), + props.add (new TextPropertyComponent (companyWebsiteValue, "Company Website", 256, false), "Your company website, which will be added to the properties of the binary where possible"); - props.add (new TextPropertyComponent (getCompanyEmail(), "Company E-mail", 256, false), + props.add (new TextPropertyComponent (companyEmailValue, "Company E-mail", 256, false), "Your company e-mail, which will be added to the properties of the binary where possible"); { @@ -653,10 +660,10 @@ void Project::createPropertyEditors (PropertyListBuilder& props) if (ProjucerApplication::getApp().isPaidOrGPL()) { - props.add (new BooleanPropertyComponent (shouldReportAppUsage(), "Report JUCE app usage", licenseRequiredTagline), + props.add (new ChoicePropertyComponent (reportAppUsageValue, String ("Report JUCE App Usage") + " (" + licenseRequiredTagline + ")"), description["Report JUCE app usage"] + " " + licenseRequiredInfo); - props.add (new BooleanPropertyComponent (shouldDisplaySplashScreen(), "Display the JUCE splash screen", licenseRequiredTagline), + props.add (new ChoicePropertyComponent (displaySplashScreenValue, String ("Display the JUCE Splash Screen") + " (" + licenseRequiredTagline + ")"), description["Display the JUCE splash screen"] + " " + licenseRequiredInfo); } else @@ -667,45 +674,35 @@ void Project::createPropertyEditors (PropertyListBuilder& props) options.add (licenseRequiredTagline); vars.add (var()); - props.add (new ChoicePropertyComponent (Value(), "Report JUCE app usage", options, vars), + props.add (new ChoicePropertyComponent (Value(), "Report JUCE App Usage", options, vars), description["Report JUCE app usage"] + " " + licenseRequiredInfo); - props.add (new ChoicePropertyComponent (Value(), "Display the JUCE splash screen", options, vars), + props.add (new ChoicePropertyComponent (Value(), "Display the JUCE Splash Screen", options, vars), description["Display the JUCE splash screen"] + " " + licenseRequiredInfo); } } - { - StringArray splashScreenColours; - - splashScreenColours.add ("Dark"); - splashScreenColours.add ("Light"); - - Array splashScreenCodes; - - for (auto& splashScreenColour : splashScreenColours) - splashScreenCodes.add (splashScreenColour); - - props.add (new ChoicePropertyComponent (splashScreenColour(), "Splash screen colour", splashScreenColours, splashScreenCodes), - "Choose the colour of the JUCE splash screen."); - } + props.add (new ChoicePropertyComponent (splashScreenColourValue, "Splash Screen Colour", + { "Dark", "Light" }, + { "Dark", "Light" }), + "Choose the colour of the JUCE splash screen."); { StringArray projectTypeNames; Array projectTypeCodes; - const Array& types = ProjectType::getAllTypes(); + auto types = ProjectType::getAllTypes(); - for (int i = 0; i < types.size(); ++i) + for (auto i = 0; i < types.size(); ++i) { projectTypeNames.add (types.getUnchecked(i)->getDescription()); projectTypeCodes.add (types.getUnchecked(i)->getType()); } - props.add (new ChoicePropertyComponent (getProjectTypeValue(), "Project Type", projectTypeNames, projectTypeCodes)); + props.add (new ChoicePropertyComponent (projectTypeValue, "Project Type", projectTypeNames, projectTypeCodes)); } - props.add (new TextPropertyComponent (getBundleIdentifier(), "Bundle Identifier", 256, false), + props.add (new TextPropertyComponent (bundleIdentifierValue, "Bundle Identifier", 256, false), "A unique identifier for this product, mainly for use in OSX/iOS builds. It should be something like 'com.yourcompanyname.yourproductname'"); if (getProjectType().isAudioPlugin()) @@ -717,122 +714,112 @@ void Project::createPropertyEditors (PropertyListBuilder& props) StringArray maxSizeNames; Array maxSizeCodes; - maxSizeNames.add (TRANS("Default")); - maxSizeCodes.add (var()); - - maxSizeNames.add (String()); - maxSizeCodes.add (var()); - - for (int i = 0; i < numElementsInArray (maxSizes); ++i) + for (auto i = 0; i < numElementsInArray (maxSizes); ++i) { - const int sizeInBytes = maxSizes[i] * 1024; + auto sizeInBytes = maxSizes[i] * 1024; + maxSizeNames.add (File::descriptionOfSizeInBytes (sizeInBytes)); maxSizeCodes.add (sizeInBytes); } - props.add (new ChoicePropertyComponent (getMaxBinaryFileSize(), "BinaryData.cpp size limit", maxSizeNames, maxSizeCodes), + props.add (new ChoicePropertyComponent (maxBinaryFileSizeValue, "BinaryData.cpp Size Limit", maxSizeNames, maxSizeCodes), "When splitting binary data into multiple cpp files, the Projucer attempts to keep the file sizes below this threshold. " "(Note that individual resource files which are larger than this size cannot be split across multiple cpp files)."); } - props.add (new BooleanPropertyComponent (shouldIncludeBinaryInAppConfig(), "Include Binary", - "Include BinaryData.h in the AppConfig.h file")); + props.add (new ChoicePropertyComponent (includeBinaryDataInAppConfigValue, "Include BinaryData in AppConfig"), + "Include BinaryData.h in the AppConfig.h file"); - props.add (new TextPropertyComponent (binaryDataNamespace(), "BinaryData Namespace", 256, false), - "The namespace containing the binary assests. If left empty this defaults to \"BinaryData\"."); + props.add (new TextPropertyComponent (binaryDataNamespaceValue, "BinaryData Namespace", 256, false), + "The namespace containing the binary assests."); - { - static const char* cppLanguageStandardNames[] = { "C++11", "C++14", "Use Latest", nullptr }; - static const var cppLanguageStandardValues[] = { "11", "14", "latest" }; + props.add (new ChoicePropertyComponent (cppStandardValue, "C++ Language Standard", + { "C++11", "C++14", "Use Latest" }, + { "11", "14", "latest" }), + "The standard of the C++ language that will be used for compilation."); - props.add (new ChoicePropertyComponent (getCppStandardValue(), "C++ Language Standard", - StringArray (cppLanguageStandardNames), - Array (cppLanguageStandardValues, numElementsInArray (cppLanguageStandardValues))), - "The standard of the C++ language that will be used for compilation."); - } - - props.add (new TextPropertyComponent (getProjectPreprocessorDefs(), "Preprocessor definitions", 32768, true), + props.add (new TextPropertyComponent (preprocessorDefsValue, "Preprocessor Definitions", 32768, true), "Global 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.addSearchPathProperty (getProjectHeaderSearchPaths(), "Header search paths", "Global header search paths."); + props.addSearchPathProperty (headerSearchPathsValue, "Header Search Paths", "Global header search paths."); - props.add (new TextPropertyComponent (getProjectUserNotes(), "Notes", 32768, true), + props.add (new TextPropertyComponent (userNotesValue, "Notes", 32768, true), "Extra comments: This field is not used for code or project generation, it's just a space where you can express your thoughts."); } void Project::createAudioPluginPropertyEditors (PropertyListBuilder& props) { - props.add (new BooleanPropertyComponent (getShouldBuildVSTAsValue(), "Build VST", "Enabled"), + props.add (new ChoicePropertyComponent (buildVSTValue, "Build VST"), "Whether the project should produce a VST plugin."); - props.add (new BooleanPropertyComponent (getShouldBuildVST3AsValue(), "Build VST3", "Enabled"), + props.add (new ChoicePropertyComponent (buildVST3Value, "Build VST3"), "Whether the project should produce a VST3 plugin."); - props.add (new BooleanPropertyComponent (getShouldBuildAUAsValue(), "Build AudioUnit", "Enabled"), + props.add (new ChoicePropertyComponent (buildAUValue, "Build AudioUnit"), "Whether the project should produce an AudioUnit plugin."); - props.add (new BooleanPropertyComponent (getShouldBuildAUv3AsValue(), "Build AudioUnit v3", "Enabled"), + props.add (new ChoicePropertyComponent (buildAUValue, "Build AudioUnit v3"), "Whether the project should produce an AudioUnit version 3 plugin."); - props.add (new BooleanPropertyComponent (getShouldBuildRTASAsValue(), "Build RTAS", "Enabled"), + props.add (new ChoicePropertyComponent (buildRTASValue, "Build RTAS"), "Whether the project should produce an RTAS plugin."); - props.add (new BooleanPropertyComponent (getShouldBuildAAXAsValue(), "Build AAX", "Enabled"), + props.add (new ChoicePropertyComponent (buildAAXValue, "Build AAX"), "Whether the project should produce an AAX plugin."); - props.add (new BooleanPropertyComponent (getShouldBuildStandalonePluginAsValue(), "Build Standalone Plug-In", "Enabled"), + props.add (new ChoicePropertyComponent (buildStandaloneValue, "Build Standalone Plug-In"), "Whether the project should produce a standalone version of your plugin."); - props.add (new BooleanPropertyComponent (getShouldEnableIAAAsValue(), "Enable Inter-App Audio", "Enabled"), + props.add (new ChoicePropertyComponent (enableIAAValue, "Enable Inter-App Audio"), "Whether a standalone plug-in should be an Inter-App Audio app. You should also enable the audio " "background capability in the iOS exporter."); - props.add (new TextPropertyComponent (getPluginName(), "Plugin Name", 128, false), + props.add (new TextPropertyComponent (pluginNameValue, "Plugin Name", 128, false), "The name of your plugin (keep it short!)"); - props.add (new TextPropertyComponent (getPluginDesc(), "Plugin Description", 256, false), + props.add (new TextPropertyComponent (pluginDescriptionValue, "Plugin Description", 256, false), "A short description of your plugin."); - props.add (new TextPropertyComponent (getPluginManufacturer(), "Plugin Manufacturer", 256, false), + props.add (new TextPropertyComponent (pluginManufacturerValue, "Plugin Manufacturer", 256, false), "The name of your company (cannot be blank)."); - props.add (new TextPropertyComponent (getPluginManufacturerCode(), "Plugin Manufacturer Code", 4, false), + props.add (new TextPropertyComponent (pluginManufacturerCodeValue, "Plugin Manufacturer Code", 4, false), "A four-character unique ID for your company. Note that for AU compatibility, this must contain at least one upper-case letter!"); - props.add (new TextPropertyComponent (getPluginCode(), "Plugin Code", 4, false), + props.add (new TextPropertyComponent (pluginCodeValue, "Plugin Code", 4, false), "A four-character unique ID for your plugin. Note that for AU compatibility, this must contain at least one upper-case letter!"); - props.add (new TextPropertyComponent (getPluginChannelConfigs(), "Plugin Channel Configurations", 1024, false), + props.add (new TextPropertyComponent (pluginChannelConfigsValue, "Plugin Channel Configurations", 1024, false), "This list is a comma-separated set list in the form {numIns, numOuts} and each pair indicates a valid plug-in " "configuration. For example {1, 1}, {2, 2} means that the plugin can be used either with 1 input and 1 output, " "or with 2 inputs and 2 outputs. If your plug-in requires side-chains, aux output buses etc., then you must leave " "this field empty and override the isBusesLayoutSupported callback in your AudioProcessor."); - props.add (new BooleanPropertyComponent (getPluginIsSynth(), "Plugin is a Synth", "Is a Synth"), + props.add (new ChoicePropertyComponent (pluginIsSynthValue, "Plugin is a Synth"), "Enable this if you want your plugin to be treated as a synth or generator. It doesn't make much difference to the plugin itself, but some hosts treat synths differently to other plugins."); - props.add (new BooleanPropertyComponent (getPluginWantsMidiInput(), "Plugin Midi Input", "Plugin wants midi input"), + props.add (new ChoicePropertyComponent (pluginWantsMidiInputValue, "Plugin Midi Input"), "Enable this if you want your plugin to accept midi messages."); - props.add (new BooleanPropertyComponent (getPluginProducesMidiOut(), "Plugin Midi Output", "Plugin produces midi output"), + props.add (new ChoicePropertyComponent (pluginProducesMidiOutValue, "Plugin Midi Output"), "Enable this if your plugin is going to produce midi messages."); - props.add (new BooleanPropertyComponent (getPluginIsMidiEffectPlugin(), "Midi Effect Plugin", "Plugin is a midi effect plugin"), + props.add (new ChoicePropertyComponent (pluginIsMidiEffectPluginValue, "Midi Effect Plugin"), "Enable this if your plugin only processes midi and no audio."); - props.add (new BooleanPropertyComponent (getPluginEditorNeedsKeyFocus(), "Key Focus", "Plugin editor requires keyboard focus"), + props.add (new ChoicePropertyComponent (pluginEditorNeedsKeyFocusValue, "Plugin Editor Requires Keyboard Focus"), "Enable this if your plugin needs keyboard input - some hosts can be a bit funny about keyboard focus.."); - props.add (new TextPropertyComponent (getPluginAUExportPrefix(), "Plugin AU Export Prefix", 64, false), + props.add (new TextPropertyComponent (pluginAUExportPrefixValue, "Plugin AU Export Prefix", 64, false), "A prefix for the names of exported entry-point functions that the component exposes - typically this will be a version of your plugin's name that can be used as part of a C++ token."); - props.add (new TextPropertyComponent (getPluginAUMainType(), "Plugin AU Main Type", 128, false), + props.add (new TextPropertyComponent (pluginAUMainTypeValue, "Plugin AU Main Type", 128, false), "In an AU, this is the value that is set as JucePlugin_AUMainType. Leave it blank unless you want to use a custom value."); - props.add (new TextPropertyComponent (getPluginVSTCategory(), "VST Category", 64, false), + props.add (new TextPropertyComponent (pluginVSTCategoryValue, "VST Category", 64, false), "In a VST, this is the value that is set as JucePlugin_VSTCategory. Leave it blank unless you want to use a custom value."); - props.add (new TextPropertyComponent (getPluginRTASCategory(), "Plugin RTAS Category", 64, false), + props.add (new TextPropertyComponent (pluginRTASCategoryValue, "Plugin RTAS Category", 64, false), "(Leave this blank if your plugin is a synth). This is one of the RTAS categories from FicPluginEnums.h, such as: ePlugInCategory_None, ePlugInCategory_EQ, ePlugInCategory_Dynamics, " "ePlugInCategory_PitchShift, ePlugInCategory_Reverb, ePlugInCategory_Delay, " "ePlugInCategory_Modulation, ePlugInCategory_Harmonic, ePlugInCategory_NoiseReduction, " "ePlugInCategory_Dither, ePlugInCategory_SoundField"); - props.add (new TextPropertyComponent (getPluginAAXCategory(), "Plugin AAX Category", 64, false), + props.add (new TextPropertyComponent (pluginAAXCategoryValue, "Plugin AAX Category", 64, false), "This is one of the categories from the AAX_EPlugInCategory enum"); - props.add (new TextPropertyComponent (getAAXIdentifier(), "Plugin AAX Identifier", 256, false), + props.add (new TextPropertyComponent (pluginAAXIdentifierValue, "Plugin AAX Identifier", 256, false), "The value to use for the JucePlugin_AAXIdentifier setting"); } @@ -888,7 +875,7 @@ Project::Item Project::getMainGroup() PropertiesFile& Project::getStoredProperties() const { - return getAppSettings().getProjectProperties (getProjectUID()); + return getAppSettings().getProjectProperties (getProjectUIDString()); } static void findImages (const Project::Item& item, OwnedArray& found) @@ -1336,51 +1323,30 @@ ValueTree Project::getConfigNode() return projectRoot.getOrCreateChildWithName (Ids::JUCEOPTIONS, nullptr); } -const char* const Project::configFlagDefault = "default"; -const char* const Project::configFlagEnabled = "enabled"; -const char* const Project::configFlagDisabled = "disabled"; - -Value Project::getConfigFlag (const String& name) +ValueWithDefault Project::getConfigFlag (const String& name) { - ValueTree configNode (getConfigNode()); - Value v (configNode.getPropertyAsValue (name, getUndoManagerFor (configNode))); + auto configNode = getConfigNode(); - if (v.getValue().toString().isEmpty()) - v = configFlagDefault; - - return v; + return { configNode, name, getUndoManagerFor (configNode) }; } bool Project::isConfigFlagEnabled (const String& name, bool defaultIsEnabled) const { - String configValue = projectRoot.getChildWithName (Ids::JUCEOPTIONS).getProperty (name); + auto configValue = projectRoot.getChildWithName (Ids::JUCEOPTIONS).getProperty (name, "default"); - if (configValue == configFlagDefault) + if (configValue == "default") return defaultIsEnabled; - return (configValue == configFlagEnabled); -} - -void Project::sanitiseConfigFlags() -{ - ValueTree configNode (getConfigNode()); - - for (int i = configNode.getNumProperties(); --i >= 0;) - { - const var value (configNode [configNode.getPropertyName(i)]); - - if (value != configFlagEnabled && value != configFlagDisabled) - configNode.removeProperty (configNode.getPropertyName(i), getUndoManagerFor (configNode)); - } + return configValue; } //============================================================================== String Project::getPluginRTASCategoryCode() { - if (static_cast (getPluginIsSynth().getValue())) + if (static_cast (isPluginSynth())) return "ePlugInCategory_SWGenerators"; - String s (getPluginRTASCategory().toString()); + String s (getPluginRTASCategoryString()); if (s.isEmpty()) s = "ePlugInCategory_None"; @@ -1389,16 +1355,16 @@ String Project::getPluginRTASCategoryCode() String Project::getAUMainTypeString() { - String s (getPluginAUMainType().toString()); + auto s = getPluginAUMainTypeString(); if (s.isEmpty()) { // Unfortunately, Rez uses a header where kAudioUnitType_MIDIProcessor is undefined // Use aumi instead. - if (getPluginIsMidiEffectPlugin().getValue()) s = "'aumi'"; - else if (getPluginIsSynth().getValue()) s = "kAudioUnitType_MusicDevice"; - else if (getPluginWantsMidiInput().getValue()) s = "kAudioUnitType_MusicEffect"; - else s = "kAudioUnitType_Effect"; + if (isPluginMidiEffect()) s = "'aumi'"; + else if (isPluginSynth()) s = "kAudioUnitType_MusicDevice"; + else if (pluginWantsMidiInput()) s = "kAudioUnitType_MusicEffect"; + else s = "kAudioUnitType_Effect"; } return s; @@ -1406,14 +1372,14 @@ String Project::getAUMainTypeString() String Project::getAUMainTypeCode() { - String s (getPluginAUMainType().toString()); + auto s = getPluginAUMainTypeString(); if (s.isEmpty()) { - if (getPluginIsMidiEffectPlugin().getValue()) s = "aumi"; - else if (getPluginIsSynth().getValue()) s = "aumu"; - else if (getPluginWantsMidiInput().getValue()) s = "aumf"; - else s = "aufx"; + if (isPluginMidiEffect()) s = "aumi"; + else if (isPluginSynth()) s = "aumu"; + else if (pluginWantsMidiInput()) s = "aumf"; + else s = "aufx"; } return s; @@ -1422,16 +1388,16 @@ String Project::getAUMainTypeCode() String Project::getIAATypeCode() { String s; - if (getPluginWantsMidiInput().getValue()) + if (pluginWantsMidiInput()) { - if (getPluginIsSynth().getValue()) + if (isPluginSynth()) s = "auri"; else s = "aurm"; } else { - if (getPluginIsSynth().getValue()) + if (isPluginSynth()) s = "aurg"; else s = "aurx"; @@ -1441,19 +1407,18 @@ String Project::getIAATypeCode() String Project::getIAAPluginName() { - String s = getPluginManufacturer().toString(); + String s = getPluginManufacturerString(); s << ": "; - s << getPluginName().toString(); + s << getPluginNameString(); return s; } String Project::getPluginVSTCategoryString() { - String s (getPluginVSTCategory().toString().trim()); + auto s = pluginVSTCategoryValue.get().toString().trim(); if (s.isEmpty()) - s = static_cast (getPluginIsSynth().getValue()) ? "kPlugCategSynth" - : "kPlugCategEffect"; + s = isPluginSynth() ? "kPlugCategSynth" : "kPlugCategEffect"; return s; } diff --git a/extras/Projucer/Source/Project/jucer_Project.h b/extras/Projucer/Source/Project/jucer_Project.h index 063c36db55..257b9d449e 100644 --- a/extras/Projucer/Source/Project/jucer_Project.h +++ b/extras/Projucer/Source/Project/jucer_Project.h @@ -54,12 +54,19 @@ public: void setTitle (const String& newTitle); //============================================================================== - File getProjectFolder() const { return getFile().getParentDirectory(); } - ValueTree getProjectRoot() const { return projectRoot; } - String getTitle() const { return projectRoot [Ids::name]; } - Value getProjectNameValue() { return getProjectValue (Ids::name); } - String getProjectFilenameRoot() { return File::createLegalFileName (getDocumentTitle()); } - String getProjectUID() const { return projectRoot [Ids::ID]; } + File getProjectFolder() const { return getFile().getParentDirectory(); } + File getGeneratedCodeFolder() const { return getFile().getSiblingFile ("JuceLibraryCode"); } + File getSourceFilesFolder() const { return getProjectFolder().getChildFile ("Source"); } + File getLocalModulesFolder() const { return getGeneratedCodeFolder().getChildFile ("modules"); } + File getLocalModuleFolder (const String& moduleID) const { return getLocalModulesFolder().getChildFile (moduleID); } + File getAppIncludeFile() const { return getGeneratedCodeFolder().getChildFile (getJuceSourceHFilename()); } + + File getBinaryDataCppFile (int index) const; + File getBinaryDataHeaderFile() const { return getBinaryDataCppFile (0).withFileExtension (".h"); } + + String getAppConfigFilename() const { return "AppConfig.h"; } + String getJuceSourceFilenameRoot() const { return "JuceLibraryCode"; } + String getJuceSourceHFilename() const { return "JuceHeader.h"; } //============================================================================== template @@ -76,111 +83,79 @@ public: void createPropertyEditors (PropertyListBuilder&); //============================================================================== - // project types - const ProjectType& getProjectType() const; - Value getProjectTypeValue() { return getProjectValue (Ids::projectType); } - String getProjectTypeString() const { return projectRoot [Ids::projectType]; } - - Value getVersionValue() { return getProjectValue (Ids::version); } - String getVersionString() const { return projectRoot [Ids::version]; } - String getVersionAsHex() const; - int getVersionAsHexInteger() const; - - Value getBundleIdentifier() { return getProjectValue (Ids::bundleIdentifier); } - String getDefaultBundleIdentifier() { return "com.yourcompany." + CodeHelpers::makeValidIdentifier (getTitle(), false, true, false); } - - Value getAAXIdentifier() { return getProjectValue (Ids::aaxIdentifier); } - String getDefaultAAXIdentifier() { return getDefaultBundleIdentifier(); } - - Value getCompanyName() { return getProjectValue (Ids::companyName); } - String getCompanyNameString() const { return getProjectVar (Ids::companyName); } - - Value getCompanyCopyright() { return getProjectValue (Ids::companyCopyright); } - String getCompanyCopyrightString() const { return getProjectVar (Ids::companyCopyright); } - - Value getCompanyWebsite() { return getProjectValue (Ids::companyWebsite); } - String getCompanyWebsiteString() const { return getProjectVar (Ids::companyWebsite); } - - Value getCompanyEmail() { return getProjectValue (Ids::companyEmail); } - String getCompanyEmailString() const { return getProjectVar (Ids::companyEmail); } - - Value shouldDisplaySplashScreen() { return getProjectValue (Ids::displaySplashScreen); } - Value shouldReportAppUsage() { return getProjectValue (Ids::reportAppUsage); } - Value splashScreenColour() { return getProjectValue (Ids::splashScreenColour); } - - Value getCppStandardValue() { return getProjectValue (Ids::cppLanguageStandard); } - - //============================================================================== + ValueTree getProjectRoot() const { return projectRoot; } Value getProjectValue (const Identifier& name) { return projectRoot.getPropertyAsValue (name, getUndoManagerFor (projectRoot)); } var getProjectVar (const Identifier& name) const { return projectRoot.getProperty (name); } - Value getProjectHeaderSearchPaths() { return getProjectValue (Ids::headerPath); } - String getHeaderSearchPaths() const { return projectRoot [Ids::headerPath]; } + const ProjectType& getProjectType() const; + String getProjectTypeString() const { return projectTypeValue.get(); } + void setProjectType (const String& newProjectType) { projectTypeValue = newProjectType; } + + String getProjectNameString() const { return projectNameValue.get(); } + String getProjectFilenameRootString() { return File::createLegalFileName (getDocumentTitle()); } + String getProjectUIDString() const { return projectUIDValue.get(); } + + String getVersionString() const { return versionValue.get(); } + String getVersionAsHex() const; + int getVersionAsHexInteger() const; + void setProjectVersion (const String& newVersion) { versionValue = newVersion; } + + String getBundleIdentifierString() const { return bundleIdentifierValue.get(); } + String getDefaultBundleIdentifierString() { return "com.yourcompany." + CodeHelpers::makeValidIdentifier (getProjectNameString(), false, true, false); } + String getDefaultAAXIdentifierString() { return getDefaultBundleIdentifierString(); } + + String getCompanyNameString() const { return companyNameValue.get(); } + String getCompanyCopyrightString() const { return companyCopyrightValue.get(); } + String getCompanyWebsiteString() const { return companyWebsiteValue.get(); } + String getCompanyEmailString() const { return companyEmailValue.get(); } + + String getHeaderSearchPathsString() const { return headerSearchPathsValue.get(); } - Value getProjectPreprocessorDefs() { return getProjectValue (Ids::defines); } StringPairArray getPreprocessorDefs() const; - Value getProjectUserNotes() { return getProjectValue (Ids::userNotes); } + int getMaxBinaryFileSize() const { return maxBinaryFileSizeValue.get(); } + bool shouldIncludeBinaryInAppConfig() const { return includeBinaryDataInAppConfigValue.get(); } + String getBinaryDataNamespaceString() const { return binaryDataNamespaceValue.get(); } + + bool shouldDisplaySplashScreen() const { return displaySplashScreenValue.get(); } + bool shouldReportAppUsage() const { return reportAppUsageValue.get(); } + String getSplashScreenColourString() const { return splashScreenColourValue.get(); } + + String getCppStandardString() const { return cppStandardValue.get(); } //============================================================================== - File getGeneratedCodeFolder() const { return getFile().getSiblingFile ("JuceLibraryCode"); } - File getSourceFilesFolder() const { return getProjectFolder().getChildFile ("Source"); } - File getLocalModulesFolder() const { return getGeneratedCodeFolder().getChildFile ("modules"); } - File getLocalModuleFolder (const String& moduleID) const { return getLocalModulesFolder().getChildFile (moduleID); } - File getAppIncludeFile() const { return getGeneratedCodeFolder().getChildFile (getJuceSourceHFilename()); } - - File getBinaryDataCppFile (int index) const; - File getBinaryDataHeaderFile() const { return getBinaryDataCppFile (0).withFileExtension (".h"); } - Value getMaxBinaryFileSize() { return getProjectValue (Ids::maxBinaryFileSize); } - Value shouldIncludeBinaryInAppConfig() { return getProjectValue (Ids::includeBinaryInAppConfig); } - Value binaryDataNamespace() { return getProjectValue (Ids::binaryDataNamespace); } + bool shouldBuildVST() const { return buildVSTValue.get(); } + bool shouldBuildVST3() const { return buildVST3Value.get(); } + bool shouldBuildAU() const { return buildAUValue.get(); } + bool shouldBuildAUv3() const { return buildAUv3Value.get(); } + bool shouldBuildRTAS() const { return buildRTASValue.get(); } + bool shouldBuildAAX() const { return buildAAXValue.get(); } + bool shouldBuildStandalonePlugin() const { return buildStandaloneValue.get(); } + bool shouldEnableIAA() const { return enableIAAValue.get(); } //============================================================================== - String getAppConfigFilename() const { return "AppConfig.h"; } - String getJuceSourceFilenameRoot() const { return "JuceLibraryCode"; } - String getJuceSourceHFilename() const { return "JuceHeader.h"; } + String getPluginNameString() const { return pluginNameValue.get(); } + String getPluginDescriptionString() const { return pluginDescriptionValue.get();} + String getPluginManufacturerString() const { return pluginManufacturerValue.get(); } + String getPluginManufacturerCodeString() const { return pluginManufacturerCodeValue.get(); } + String getPluginCodeString() const { return pluginCodeValue.get(); } + String getPluginChannelConfigsString() const { return pluginChannelConfigsValue.get(); } + String getPluginAUExportPrefixString() const { return pluginAUExportPrefixValue.get(); } + String getPluginAUMainTypeString() const { return pluginAUMainTypeValue.get(); } + String getPluginRTASCategoryString() const { return pluginRTASCategoryValue.get(); } + String getAAXIdentifierString() const { return pluginAAXIdentifierValue.get(); } + String getPluginAAXCategoryString() const { return pluginAAXCategoryValue.get(); } - //============================================================================== - // Some helper methods for audio plugin/host projects. - Value getShouldBuildVSTAsValue() { return getProjectValue ("buildVST"); } - Value getShouldBuildVST3AsValue() { return getProjectValue ("buildVST3"); } - Value getShouldBuildAUAsValue() { return getProjectValue ("buildAU"); } - Value getShouldBuildAUv3AsValue() { return getProjectValue ("buildAUv3"); } - Value getShouldBuildRTASAsValue() { return getProjectValue ("buildRTAS"); } - Value getShouldBuildAAXAsValue() { return getProjectValue ("buildAAX"); } - Value getShouldBuildStandalonePluginAsValue() { return getProjectValue ("buildStandalone");} - Value getShouldEnableIAAAsValue() { return getProjectValue ("enableIAA"); } + bool isPluginSynth() const { return pluginIsSynthValue.get(); } + bool pluginWantsMidiInput() const { return pluginWantsMidiInputValue.get(); } + bool pluginProducesMidiOutput() const { return pluginProducesMidiOutValue.get(); } + bool isPluginMidiEffect() const { return pluginIsMidiEffectPluginValue.get(); } + bool pluginEditorNeedsKeyFocus() const { return pluginEditorNeedsKeyFocusValue.get(); } + bool isPluginRTASBypassDisabled() const { return pluginRTASBypassDisabledValue.get(); } + bool isPluginRTASMultiMonoDisabled() const { return pluginRTASMultiMonoDisabledValue.get(); } + bool isPluginAAXBypassDisabled() const { return pluginAAXBypassDisabledValue.get(); } + bool isPluginAAXMultiMonoDisabled() const { return pluginAAXMultiMonoDisabledValue.get(); } - bool shouldBuildVST() const { return getProjectVar ("buildVST"); } - bool shouldBuildVST3() const { return getProjectVar ("buildVST3"); } - bool shouldBuildAU() const { return getProjectVar ("buildAU"); } - bool shouldBuildAUv3() const { return getProjectVar ("buildAUv3"); } - bool shouldBuildRTAS() const { return getProjectVar ("buildRTAS"); } - bool shouldBuildAAX() const { return getProjectVar ("buildAAX"); } - bool shouldBuildStandalonePlugin() const { return getProjectVar ("buildStandalone"); } - bool shouldEnableIAA() const { return getProjectVar ("enableIAA"); } - - //============================================================================== - Value getPluginName() { return getProjectValue ("pluginName"); } - Value getPluginDesc() { return getProjectValue ("pluginDesc"); } - Value getPluginManufacturer() { return getProjectValue ("pluginManufacturer"); } - Value getPluginManufacturerCode() { return getProjectValue ("pluginManufacturerCode"); } - Value getPluginCode() { return getProjectValue ("pluginCode"); } - Value getPluginChannelConfigs() { return getProjectValue ("pluginChannelConfigs"); } - Value getPluginIsSynth() { return getProjectValue ("pluginIsSynth"); } - Value getPluginWantsMidiInput() { return getProjectValue ("pluginWantsMidiIn"); } - Value getPluginProducesMidiOut() { return getProjectValue ("pluginProducesMidiOut"); } - Value getPluginIsMidiEffectPlugin() { return getProjectValue ("pluginIsMidiEffectPlugin"); } - Value getPluginEditorNeedsKeyFocus() { return getProjectValue ("pluginEditorRequiresKeys"); } - Value getPluginVSTCategory() { return getProjectValue ("pluginVSTCategory"); } - Value getPluginAUExportPrefix() { return getProjectValue ("pluginAUExportPrefix"); } - Value getPluginAUMainType() { return getProjectValue ("pluginAUMainType"); } - Value getPluginRTASCategory() { return getProjectValue ("pluginRTASCategory"); } - Value getPluginRTASBypassDisabled() { return getProjectValue ("pluginRTASDisableBypass"); } - Value getPluginRTASMultiMonoDisabled() { return getProjectValue ("pluginRTASDisableMultiMono"); } - Value getPluginAAXCategory() { return getProjectValue ("pluginAAXCategory"); } - Value getPluginAAXBypassDisabled() { return getProjectValue ("pluginAAXDisableBypass"); } - Value getPluginAAXMultiMonoDisabled() { return getProjectValue ("pluginAAXDisableMultiMono"); } String getPluginRTASCategoryCode(); String getAUMainTypeString(); String getAUMainTypeCode(); @@ -192,6 +167,7 @@ public: bool isVSTPluginHost(); bool isVST3PluginHost(); + //============================================================================== bool shouldBuildTargetType (ProjectType::Target::Type targetType) const noexcept; static ProjectType::Target::Type getTargetTypeFromFilePath (const File& file, bool returnSharedTargetIfNoValidSuffix); @@ -317,15 +293,11 @@ public: //============================================================================== struct ConfigFlag { - String symbol, description, sourceModuleID, defaultValue; - Value value; // 1 = true, 2 = false, anything else = use default + String symbol, description, sourceModuleID; + ValueWithDefault value; }; - static const char* const configFlagDefault; - static const char* const configFlagEnabled; - static const char* const configFlagDisabled; - - Value getConfigFlag (const String& name); + ValueWithDefault getConfigFlag (const String& name); bool isConfigFlagEnabled (const String& name, bool defaultIsEnabled = false) const; //============================================================================== @@ -363,20 +335,36 @@ public: String specifiedExporterToSave = {}; private: - //============================================================================== - void setMissingAudioPluginDefaultValues(); - void createAudioPluginPropertyEditors (PropertyListBuilder& props); - bool setCppVersionFromOldExporterSettings(); + ValueTree projectRoot; + + ValueWithDefault projectNameValue, projectUIDValue, projectTypeValue, versionValue, bundleIdentifierValue, companyNameValue, companyCopyrightValue, + companyWebsiteValue, companyEmailValue, displaySplashScreenValue, reportAppUsageValue, splashScreenColourValue, cppStandardValue, + headerSearchPathsValue, preprocessorDefsValue, userNotesValue, maxBinaryFileSizeValue, includeBinaryDataInAppConfigValue, binaryDataNamespaceValue; + + ValueWithDefault buildVSTValue, buildVST3Value, buildAUValue, buildAUv3Value, buildRTASValue, buildAAXValue, buildStandaloneValue, + enableIAAValue, pluginNameValue, pluginDescriptionValue, pluginManufacturerValue, pluginManufacturerCodeValue, + pluginCodeValue, pluginChannelConfigsValue, pluginIsSynthValue, pluginWantsMidiInputValue, pluginProducesMidiOutValue, + pluginIsMidiEffectPluginValue, pluginEditorNeedsKeyFocusValue, pluginVSTCategoryValue, pluginAUExportPrefixValue, + pluginAUMainTypeValue, pluginRTASCategoryValue, pluginRTASBypassDisabledValue, pluginRTASMultiMonoDisabledValue, + pluginAAXIdentifierValue, pluginAAXCategoryValue, pluginAAXBypassDisabledValue, pluginAAXMultiMonoDisabledValue; //============================================================================== friend class Item; - ValueTree projectRoot; ScopedPointer enabledModulesList; bool isSaving; + Time modificationTime; + //============================================================================== + void intialiseProjectValues(); + void initialiseMainGroup(); + void initialiseAudioPluginValues(); + + bool setCppVersionFromOldExporterSettings(); + + void createAudioPluginPropertyEditors (PropertyListBuilder& props); + + //============================================================================== void updateProjectSettings(); - void sanitiseConfigFlags(); - void setMissingDefaultValues(); ValueTree getConfigurations() const; ValueTree getConfigNode(); @@ -386,7 +374,5 @@ private: void updateOldModulePaths(); void warnAboutOldProjucerVersion(); - Time modificationTime; - JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (Project) }; diff --git a/extras/Projucer/Source/ProjectSaving/jucer_ProjectExport_Android.h b/extras/Projucer/Source/ProjectSaving/jucer_ProjectExport_Android.h index 72a7a6def6..72b42e34b4 100644 --- a/extras/Projucer/Source/ProjectSaving/jucer_ProjectExport_Android.h +++ b/extras/Projucer/Source/ProjectSaving/jucer_ProjectExport_Android.h @@ -100,24 +100,13 @@ public: } //============================================================================== - CachedValue androidRepositories, androidDependencies, - androidScreenOrientation, androidActivityClass, androidActivitySubClassName, - androidManifestCustomXmlElements, androidVersionCode, androidMinimumSDK, androidTheme, - androidSharedLibraries, androidStaticLibraries, androidExtraAssetsFolder; - - CachedValue androidInternetNeeded, androidMicNeeded, androidBluetoothNeeded, - androidExternalReadPermission, androidExternalWritePermission, - androidInAppBillingPermission, androidVibratePermission; - CachedValue androidOtherPermissions; - - CachedValue androidEnableRemoteNotifications; - CachedValue androidRemoteNotificationsConfigFile; - - CachedValue androidEnableContentSharing; - - CachedValue androidKeyStore, androidKeyStorePass, androidKeyAlias, androidKeyAliasPass; - - CachedValue gradleVersion, androidPluginVersion, gradleToolchain, buildToolsVersion; + ValueWithDefault androidRepositories, androidDependencies, androidScreenOrientation, androidActivityClass, + androidActivitySubClassName, androidManifestCustomXmlElements, androidVersionCode, + androidMinimumSDK, androidTheme, androidSharedLibraries, androidStaticLibraries, androidExtraAssetsFolder, + androidInternetNeeded, androidMicNeeded, androidBluetoothNeeded, androidExternalReadPermission, + androidExternalWritePermission, androidInAppBillingPermission, androidVibratePermission,androidOtherPermissions, + androidEnableRemoteNotifications, androidRemoteNotificationsConfigFile, androidEnableContentSharing, androidKeyStore, + androidKeyStorePass, androidKeyAlias, androidKeyAliasPass, gradleVersion, gradleToolchain, androidPluginVersion, buildToolsVersion; //============================================================================== AndroidProjectExporter (Project& p, const ValueTree& t) @@ -150,41 +139,40 @@ public: androidKeyAlias (settings, Ids::androidKeyAlias, nullptr, "androiddebugkey"), androidKeyAliasPass (settings, Ids::androidKeyAliasPass, nullptr, "android"), gradleVersion (settings, Ids::gradleVersion, nullptr, "4.1"), - androidPluginVersion (settings, Ids::androidPluginVersion, nullptr, "3.0.0"), gradleToolchain (settings, Ids::gradleToolchain, nullptr, "clang"), + androidPluginVersion (settings, Ids::androidPluginVersion, nullptr, "3.0.0"), buildToolsVersion (settings, Ids::buildToolsVersion, nullptr, "27.0.0"), AndroidExecutable (findAndroidExecutable()) { name = getName(); - if (getTargetLocationString().isEmpty()) - getTargetLocationValue() = getDefaultBuildsRootFolder() + "Android"; + targetLocationValue.setDefault (getDefaultBuildsRootFolder() + "Android"); } //============================================================================== void createToolchainExporterProperties (PropertyListBuilder& props) { - props.add (new TextWithDefaultPropertyComponent (gradleVersion, "gradle version", 32), + props.add (new TextPropertyComponent (gradleVersion, "gradle version", 32, false), "The version of gradle that is used to build this app (3.3 is fine for JUCE)"); - props.add (new TextWithDefaultPropertyComponent (androidPluginVersion, "android plug-in version", 32), + props.add (new TextPropertyComponent (androidPluginVersion, "android plug-in version", 32, false), "The version of the android build plugin for gradle that is used to build this app"); - static const char* toolchains[] = { "clang", "gcc", nullptr }; - - props.add (new ChoicePropertyComponent (gradleToolchain.getPropertyAsValue(), "NDK Toolchain", StringArray (toolchains), Array (toolchains)), + props.add (new ChoicePropertyComponent (gradleToolchain, "NDK Toolchain", + { "clang", "gcc" }, + { "clang", "gcc" }), "The toolchain that gradle should invoke for NDK compilation (variable model.android.ndk.tooclhain in app/build.gradle)"); - props.add (new TextWithDefaultPropertyComponent (buildToolsVersion, "Android build tools version", 32), + props.add (new TextPropertyComponent (buildToolsVersion, "Android build tools version", 32, false), "The Android build tools version that should use to build this app"); } void createLibraryModuleExporterProperties (PropertyListBuilder& props) { - props.add (new TextPropertyComponent (androidStaticLibraries.getPropertyAsValue(), "Import static library modules", 8192, true), + props.add (new TextPropertyComponent (androidStaticLibraries, "Import static library modules", 8192, true), "Comma or whitespace delimited list of static libraries (.a) defined in NDK_MODULE_PATH."); - props.add (new TextPropertyComponent (androidSharedLibraries.getPropertyAsValue(), "Import shared library modules", 8192, true), + props.add (new TextPropertyComponent (androidSharedLibraries, "Import shared library modules", 8192, true), "Comma or whitespace delimited list of shared libraries (.so) defined in NDK_MODULE_PATH."); } @@ -319,47 +307,36 @@ protected: { public: AndroidBuildConfiguration (Project& p, const ValueTree& settings, const ProjectExporter& e) - : BuildConfiguration (p, settings, e) + : BuildConfiguration (p, settings, e), + androidArchitectures (config, Ids::androidArchitectures, nullptr, isDebug() ? "armeabi x86" : ""), + androidAdditionalXmlValueResources (config, Ids::androidAdditionalXmlValueResources, nullptr, {}), + androidAdditionalRawValueResources (config, Ids::androidAdditionalRawValueResources, nullptr, {}), + androidCustomStringXmlElements (config, Ids::androidCustomStringXmlElements, nullptr, {}) { - if (getArchitectures().isEmpty()) - { - if (isDebug()) - getArchitecturesValue() = "armeabi x86"; - else - getArchitecturesValue() = ""; - } + optimisationLevelValue.setDefault (isDebug() ? gccO0 : gccO3); } - Value getArchitecturesValue() { return getValue (Ids::androidArchitectures); } - String getArchitectures() const { return config [Ids::androidArchitectures]; } - - Value getAdditionalXmlResourcesValue() { return getValue (Ids::androidAdditionalXmlValueResources); } - String getAdditionalXmlResources() const { return config [Ids::androidAdditionalXmlValueResources]; } - - Value getAdditionalRawResourcesValue() { return getValue (Ids::androidAdditionalRawValueResources); } - String getAdditionalRawResources() const { return config [Ids::androidAdditionalRawValueResources]; } - - Value getCustomStringsXmlValue() { return getValue (Ids::androidCustomStringXmlElements); } - String getCustomStringsXml() const { return config [Ids::androidCustomStringXmlElements]; } - - var getDefaultOptimisationLevel() const override { return var ((int) (isDebug() ? gccO0 : gccO3)); } + String getArchitectures() const { return androidArchitectures.get().toString(); } + String getAdditionalXmlResources() const { return androidAdditionalXmlValueResources.get().toString(); } + String getAdditionalRawResources() const { return androidAdditionalRawValueResources.get().toString();} + String getCustomStringsXml() const { return androidCustomStringXmlElements.get().toString(); } void createConfigProperties (PropertyListBuilder& props) override { addGCCOptimisationProperty (props); - props.add (new TextPropertyComponent (getArchitecturesValue(), "Architectures", 256, false), + props.add (new TextPropertyComponent (androidArchitectures, "Architectures", 256, false), "A list of the ARM architectures to build (for a fat binary). Leave empty to build for all possible android archiftectures."); - props.add (new TextPropertyComponent (getAdditionalXmlResourcesValue(), "Extra Android XML Value Resources", 2048, true), + props.add (new TextPropertyComponent (androidAdditionalXmlValueResources, "Extra Android XML Value Resources", 2048, true), "Paths to additional \"value resource\" files in XML format that should be included in the app (one per line). " "If you have additional XML resources that should be treated as value resources, add them here."); - props.add (new TextPropertyComponent (getAdditionalRawResourcesValue(), "Extra Android Raw Resources", 2048, true), + props.add (new TextPropertyComponent (androidAdditionalRawValueResources, "Extra Android Raw Resources", 2048, true), "Paths to additional \"raw resource\" files that should be included in the app (one per line). " "Resource file names must contain only lowercase a-z, 0-9 or underscore."); - props.add (new TextPropertyComponent (getCustomStringsXmlValue(), "Custom string resources", 8192, true), + props.add (new TextPropertyComponent (androidCustomStringXmlElements, "Custom string resources", 8192, true), "Custom XML resources that will be added to string.xml as children of element. " "Example: \ntext\n" "text2\n"); @@ -379,6 +356,9 @@ protected: { return "${ANDROID_ABI}"; } + + ValueWithDefault androidArchitectures, androidAdditionalXmlValueResources, androidAdditionalRawValueResources, + androidCustomStringXmlElements; }; BuildConfiguration::Ptr createBuildConfig (const ValueTree& v) const override @@ -556,13 +536,13 @@ private: { MemoryOutputStream mo; - mo << "buildscript {" << newLine; - mo << " repositories {" << newLine; - mo << " jcenter()" << newLine; - mo << " google()" << newLine; - mo << " }" << newLine; - mo << " dependencies {" << newLine; - mo << " classpath 'com.android.tools.build:gradle:" << androidPluginVersion.get() << "'" << newLine; + mo << "buildscript {" << newLine; + mo << " repositories {" << newLine; + mo << " jcenter()" << newLine; + mo << " google()" << newLine; + mo << " }" << newLine; + mo << " dependencies {" << newLine; + mo << " classpath 'com.android.tools.build:gradle:" << androidPluginVersion.get().toString() << "'" << newLine; if (androidEnableRemoteNotifications.get()) mo << " classpath 'com.google.gms:google-services:3.1.0'" << newLine; @@ -593,26 +573,26 @@ private: MemoryOutputStream mo; mo << "apply plugin: 'com.android." << (isLibrary() ? "library" : "application") << "'" << newLine << newLine; - mo << "android {" << newLine; - mo << " compileSdkVersion " << androidMinimumSDK.get().getIntValue() << newLine; - mo << " buildToolsVersion \"" << buildToolsVersion.get() << "\"" << newLine; - mo << " externalNativeBuild {" << newLine; - mo << " cmake {" << newLine; - mo << " path \"CMakeLists.txt\"" << newLine; - mo << " }" << newLine; - mo << " }" << newLine; + mo << "android {" << newLine; + mo << " compileSdkVersion " << static_cast (androidMinimumSDK.get()) << newLine; + mo << " buildToolsVersion \"" << buildToolsVersion.get().toString() << "\"" << newLine; + mo << " externalNativeBuild {" << newLine; + mo << " cmake {" << newLine; + mo << " path \"CMakeLists.txt\"" << newLine; + mo << " }" << newLine; + mo << " }" << newLine; - mo << getAndroidSigningConfig() << newLine; - mo << getAndroidDefaultConfig() << newLine; - mo << getAndroidBuildTypes() << newLine; - mo << getAndroidProductFlavours() << newLine; - mo << getAndroidVariantFilter() << newLine; + mo << getAndroidSigningConfig() << newLine; + mo << getAndroidDefaultConfig() << newLine; + mo << getAndroidBuildTypes() << newLine; + mo << getAndroidProductFlavours() << newLine; + mo << getAndroidVariantFilter() << newLine; - mo << getAndroidRepositories() << newLine; - mo << getAndroidDependencies() << newLine; - mo << getApplyPlugins() << newLine; + mo << getAndroidRepositories() << newLine; + mo << getAndroidDependencies() << newLine; + mo << getApplyPlugins() << newLine; - mo << "}" << newLine << newLine; + mo << "}" << newLine << newLine; return mo.toString(); } @@ -664,29 +644,29 @@ private: { MemoryOutputStream mo; - String keyStoreFilePath = androidKeyStore.get().replace ("${user.home}", "${System.properties['user.home']}") - .replace ("/", "${File.separator}"); + String keyStoreFilePath = androidKeyStore.get().toString().replace ("${user.home}", "${System.properties['user.home']}") + .replace ("/", "${File.separator}"); - mo << " signingConfigs {" << newLine; - mo << " juceSigning {" << newLine; - mo << " storeFile file(\"" << keyStoreFilePath << "\")" << newLine; - mo << " storePassword \"" << androidKeyStorePass.get() << "\"" << newLine; - mo << " keyAlias \"" << androidKeyAlias.get() << "\"" << newLine; - mo << " keyPassword \"" << androidKeyAliasPass.get() << "\"" << newLine; - mo << " storeType \"jks\"" << newLine; - mo << " }" << newLine; - mo << " }" << newLine; + mo << " signingConfigs {" << newLine; + mo << " juceSigning {" << newLine; + mo << " storeFile file(\"" << keyStoreFilePath << "\")" << newLine; + mo << " storePassword \"" << androidKeyStorePass.get().toString() << "\"" << newLine; + mo << " keyAlias \"" << androidKeyAlias.get().toString() << "\"" << newLine; + mo << " keyPassword \"" << androidKeyAliasPass.get().toString() << "\"" << newLine; + mo << " storeType \"jks\"" << newLine; + mo << " }" << newLine; + mo << " }" << newLine; return mo.toString(); } String getAndroidDefaultConfig() const { - const String bundleIdentifier = project.getBundleIdentifier().toString().toLowerCase(); + const String bundleIdentifier = project.getBundleIdentifierString().toLowerCase(); const StringArray& cmakeDefs = getCmakeDefinitions(); const StringArray& cFlags = getProjectCompilerFlags(); const StringArray& cxxFlags = getProjectCxxCompilerFlags(); - const int minSdkVersion = androidMinimumSDK.get().getIntValue(); + const int minSdkVersion = static_cast (androidMinimumSDK.get()); MemoryOutputStream mo; @@ -773,7 +753,7 @@ private: MemoryOutputStream mo; juce::StringArray repositories; - repositories.addLines (androidRepositories.get()); + repositories.addLines (androidRepositories.get().toString()); mo << "repositories {" << newLine; @@ -790,7 +770,7 @@ private: MemoryOutputStream mo; juce::StringArray dependencies; - dependencies.addLines (androidDependencies.get()); + dependencies.addLines (androidDependencies.get().toString()); mo << "dependencies {" << newLine; @@ -834,7 +814,7 @@ private: String props; props << "distributionUrl=https\\://services.gradle.org/distributions/gradle-" - << gradleVersion.get() << "-all.zip"; + << gradleVersion.get().toString() << "-all.zip"; return props; } @@ -842,26 +822,25 @@ private: //============================================================================== void createBaseExporterProperties (PropertyListBuilder& props) { - static const char* orientations[] = { "Portrait and Landscape", "Portrait", "Landscape", nullptr }; - static const char* orientationValues[] = { "unspecified", "portrait", "landscape", nullptr }; - - props.add (new TextPropertyComponent (androidRepositories.getPropertyAsValue(), "Module repositories", 32768, true), + props.add (new TextPropertyComponent (androidRepositories, "Module repositories", 32768, true), "Module repositories (one per line). These will be added to module-level gradle file repositories section. "); - props.add (new TextPropertyComponent (androidDependencies.getPropertyAsValue(), "Module dependencies", 32768, true), + props.add (new TextPropertyComponent (androidDependencies, "Module dependencies", 32768, true), "Module dependencies (one per line). These will be added to module-level gradle file dependencies section. "); - props.add (new ChoicePropertyComponent (androidScreenOrientation.getPropertyAsValue(), "Screen orientation", StringArray (orientations), Array (orientationValues)), + props.add (new ChoicePropertyComponent (androidScreenOrientation, "Screen orientation", + { "Portrait and Landscape", "Portrait", "Landscape" }, + { "unspecified", "portrait", "landscape" }), "The screen orientations that this app should support"); - props.add (new TextWithDefaultPropertyComponent (androidActivityClass, "Android Activity class name", 256), + props.add (new TextPropertyComponent (androidActivityClass, "Android Activity class name", 256, false), "The full java class name to use for the app's Activity class."); - props.add (new TextPropertyComponent (androidActivitySubClassName.getPropertyAsValue(), "Android Activity sub-class name", 256, false), + props.add (new TextPropertyComponent (androidActivitySubClassName, "Android Activity sub-class name", 256, false), "If not empty, specifies the Android Activity class name stored in the app's manifest. " "Use this if you would like to use your own Android Activity sub-class."); - props.add (new TextWithDefaultPropertyComponent (androidVersionCode, "Android Version Code", 32), + props.add (new TextPropertyComponent (androidVersionCode, "Android Version Code", 32, false), "An integer value that represents the version of the application code, relative to other versions."); props.add (new DependencyPathPropertyComponent (project.getFile().getParentDirectory(), sdkPath, "Android SDK Path"), @@ -870,51 +849,51 @@ private: props.add (new DependencyPathPropertyComponent (project.getFile().getParentDirectory(), ndkPath, "Android NDK Path"), "The path to the Android NDK folder on the target build machine"); - props.add (new TextWithDefaultPropertyComponent (androidMinimumSDK, "Minimum SDK version", 32), + props.add (new TextPropertyComponent (androidMinimumSDK, "Minimum SDK version", 32, false), "The number of the minimum version of the Android SDK that the app requires"); - props.add (new TextPropertyComponent (androidExtraAssetsFolder.getPropertyAsValue(), "Extra Android Assets", 256, false), + props.add (new TextPropertyComponent (androidExtraAssetsFolder, "Extra Android Assets", 256, false), "A path to a folder (relative to the project folder) which contains extra android assets."); } //============================================================================== void createManifestExporterProperties (PropertyListBuilder& props) { - props.add (new BooleanPropertyComponent (androidInternetNeeded.getPropertyAsValue(), "Internet Access", "Specify internet access permission in the manifest"), + props.add (new ChoicePropertyComponent (androidInternetNeeded, "Internet Access"), "If enabled, this will set the android.permission.INTERNET flag in the manifest."); - props.add (new BooleanPropertyComponent (androidMicNeeded.getPropertyAsValue(), "Audio Input Required", "Specify audio record permission in the manifest"), + props.add (new ChoicePropertyComponent (androidMicNeeded, "Audio Input Required"), "If enabled, this will set the android.permission.RECORD_AUDIO flag in the manifest."); - props.add (new BooleanPropertyComponent (androidBluetoothNeeded.getPropertyAsValue(), "Bluetooth permissions Required", "Specify bluetooth permission (required for Bluetooth MIDI)"), + props.add (new ChoicePropertyComponent (androidBluetoothNeeded, "Bluetooth permissions Required"), "If enabled, this will set the android.permission.BLUETOOTH and android.permission.BLUETOOTH_ADMIN flag in the manifest. This is required for Bluetooth MIDI on Android."); - props.add (new BooleanPropertyComponent (androidExternalReadPermission.getPropertyAsValue(), "Read from external storage", "Specify permissions to read from external storage"), + props.add (new ChoicePropertyComponent (androidExternalReadPermission, "Read from external storage"), "If enabled, this will set the android.permission.READ_EXTERNAL_STORAGE flag in the manifest."); - props.add (new BooleanPropertyComponent (androidExternalWritePermission.getPropertyAsValue(), "Write to external storage", "Specify permissions to write to external storage"), + props.add (new ChoicePropertyComponent (androidExternalWritePermission, "Write to external storage"), "If enabled, this will set the android.permission.WRITE_EXTERNAL_STORAGE flag in the manifest."); - props.add (new BooleanPropertyComponent (androidInAppBillingPermission.getPropertyAsValue(), "In-App Billing", "Specify In-App Billing permission in the manifest"), + props.add (new ChoicePropertyComponent (androidInAppBillingPermission, "In-App Billing"), "If enabled, this will set the com.android.vending.BILLING flag in the manifest."); - props.add (new BooleanPropertyComponent (androidVibratePermission.getPropertyAsValue(), "Vibrate", "Specify permissions to vibrate"), + props.add (new ChoicePropertyComponent (androidVibratePermission, "Vibrate"), "If enabled, this will set the android.permission.VIBRATE flag in the manifest."); - props.add (new TextPropertyComponent (androidOtherPermissions.getPropertyAsValue(), "Custom permissions", 2048, false), + props.add (new ChoicePropertyComponent (androidEnableContentSharing, "Content Sharing"), + "If enabled, your app will be able to share content with other apps."); + + props.add (new TextPropertyComponent (androidOtherPermissions, "Custom permissions", 2048, false), "A space-separated list of other permission flags that should be added to the manifest."); - props.add (new BooleanPropertyComponent (androidEnableRemoteNotifications.getPropertyAsValue(), "Remote Notifications", "Enabled"), + props.add (new ChoicePropertyComponent (androidEnableRemoteNotifications, "Remote Notifications"), "Enable to be able to send remote notifications to devices running your app (min API level 14). Provide Remote Notifications Config File, " "configure your app in Firebase Console and ensure you have the latest Google Repository in Android Studio's SDK Manager."); - props.add (new BooleanPropertyComponent (androidEnableContentSharing.getPropertyAsValue(), "Content Sharing", "Enabled"), - "If enabled, your app will be able to share content with other apps."); - props.add (new TextPropertyComponent (androidRemoteNotificationsConfigFile.getPropertyAsValue(), "Remote Notifications Config File", 2048, false), "Path to google-services.json file. This will be the file provided by Firebase when creating a new app in Firebase console."); - props.add (new TextPropertyComponent (androidManifestCustomXmlElements.getPropertyAsValue(), "Custom manifest XML content", 8192, true), + props.add (new TextPropertyComponent (androidManifestCustomXmlElements, "Custom manifest XML content", 8192, true), "You can specify custom AndroidManifest.xml content overriding the default one generated by Projucer. " "Projucer will automatically create any missing and required XML elements and attributes " "and merge them into your custom content."); @@ -923,30 +902,30 @@ private: //============================================================================== void createCodeSigningExporterProperties (PropertyListBuilder& props) { - props.add (new TextWithDefaultPropertyComponent (androidKeyStore, "Key Signing: key.store", 2048), + props.add (new TextPropertyComponent (androidKeyStore, "Key Signing: key.store", 2048, false), "The key.store value, used when signing the release package."); - props.add (new TextWithDefaultPropertyComponent (androidKeyStorePass, "Key Signing: key.store.password", 2048), + props.add (new TextPropertyComponent (androidKeyStorePass, "Key Signing: key.store.password", 2048, false), "The key.store password, used when signing the release package."); - props.add (new TextWithDefaultPropertyComponent (androidKeyAlias, "Key Signing: key.alias", 2048), + props.add (new TextPropertyComponent (androidKeyAlias, "Key Signing: key.alias", 2048, false), "The key.alias value, used when signing the release package."); - props.add (new TextWithDefaultPropertyComponent (androidKeyAliasPass, "Key Signing: key.alias.password", 2048), + props.add (new TextPropertyComponent (androidKeyAliasPass, "Key Signing: key.alias.password", 2048, false), "The key.alias password, used when signing the release package."); } //============================================================================== void createOtherExporterProperties (PropertyListBuilder& props) { - props.add (new TextPropertyComponent (androidTheme.getPropertyAsValue(), "Android Theme", 256, false), + props.add (new TextPropertyComponent (androidTheme, "Android Theme", 256, false), "E.g. @android:style/Theme.NoTitleBar or leave blank for default"); } //============================================================================== String createDefaultClassName() const { - auto s = project.getBundleIdentifier().toString().toLowerCase(); + auto s = project.getBundleIdentifierString().toLowerCase(); if (s.length() > 5 && s.containsChar ('.') @@ -961,7 +940,7 @@ private: s = "com.yourcompany."; } - return s + CodeHelpers::makeValidIdentifier (project.getProjectFilenameRoot(), false, true, false); + return s + CodeHelpers::makeValidIdentifier (project.getProjectFilenameRootString(), false, true, false); } //============================================================================== @@ -987,13 +966,13 @@ private: void copyActivityJavaFiles (const File& javaSourceFolder, const File& targetFolder, const String& package) const { - if (androidActivityClass.get().contains ("_")) + if (androidActivityClass.get().toString().contains ("_")) throw SaveError ("Your Android activity class name or path may not contain any underscores! Try a project name without underscores."); auto className = getActivityName(); if (className.isEmpty()) - throw SaveError ("Invalid Android Activity class name: " + androidActivityClass.get()); + throw SaveError ("Invalid Android Activity class name: " + androidActivityClass.get().toString()); createDirectoryOrThrow (targetFolder); @@ -1004,7 +983,7 @@ private: juceMidiImports << newLine; - if (androidMinimumSDK.get().getIntValue() >= 23) + if (static_cast (androidMinimumSDK.get()) >= 23) { auto javaAndroidMidi = javaSourceFolder.getChildFile ("AndroidMidi.java"); auto javaRuntimePermissions = javaSourceFolder.getChildFile ("AndroidRuntimePermissions.java"); @@ -1026,26 +1005,26 @@ private: String juceWebViewImports, juceWebViewCodeNative, juceWebViewCode; - if (androidMinimumSDK.get().getIntValue() >= 23) + if (static_cast (androidMinimumSDK.get()) >= 23) juceWebViewImports << "import android.webkit.WebResourceError;" << newLine; - if (androidMinimumSDK.get().getIntValue() >= 21) + if (static_cast (androidMinimumSDK.get()) >= 21) juceWebViewImports << "import android.webkit.WebResourceRequest;" << newLine; - if (androidMinimumSDK.get().getIntValue() >= 11) + if (static_cast (androidMinimumSDK.get()) >= 11) juceWebViewImports << "import android.webkit.WebResourceResponse;" << newLine; auto javaWebViewFile = javaSourceFolder.getChildFile ("AndroidWebView.java"); auto juceWebViewCodeAll = javaWebViewFile.loadFileAsString(); - if (androidMinimumSDK.get().getIntValue() <= 10) + if (static_cast (androidMinimumSDK.get()) <= 10) { juceWebViewCode << juceWebViewCodeAll.fromFirstOccurrenceOf ("$$WebViewApi1_10", false, false) .upToFirstOccurrenceOf ("WebViewApi1_10$$", false, false); } else { - if (androidMinimumSDK.get().getIntValue() >= 23) + if (static_cast (androidMinimumSDK.get()) >= 23) { juceWebViewCodeNative << juceWebViewCodeAll.fromFirstOccurrenceOf ("$$WebViewNativeApi23", false, false) .upToFirstOccurrenceOf ("WebViewNativeApi23$$", false, false); @@ -1054,7 +1033,7 @@ private: .upToFirstOccurrenceOf ("WebViewApi23$$", false, false); } - if (androidMinimumSDK.get().getIntValue() >= 21) + if (static_cast (androidMinimumSDK.get()) >= 21) { juceWebViewCodeNative << juceWebViewCodeAll.fromFirstOccurrenceOf ("$$WebViewNativeApi21", false, false) .upToFirstOccurrenceOf ("WebViewNativeApi21$$", false, false); @@ -1161,7 +1140,7 @@ private: auto commonStart = fileContent.upToFirstOccurrenceOf ("$$ContentProviderApi11", false, false); auto commonEnd = fileContent.fromFirstOccurrenceOf ("ContentProviderApi11$$", false, false); - auto middleContent = androidMinimumSDK.get().getIntValue() >= 11 + auto middleContent = static_cast (androidMinimumSDK.get()) >= 11 ? fileContent.fromFirstOccurrenceOf ("$$ContentProviderApi11", false, false) .upToFirstOccurrenceOf ("ContentProviderApi11$$", false, false) : String(); @@ -1186,7 +1165,7 @@ private: if (androidEnableRemoteNotifications.get()) { - File file (getProject().getFile().getChildFile (androidRemoteNotificationsConfigFile.get())); + File file (getProject().getFile().getChildFile (androidRemoteNotificationsConfigFile.get().toString())); // Settings file must be present for remote notifications to work and it must be called google-services.json. jassert (file.existsAsFile() && file.getFileName() == "google-services.json"); @@ -1216,7 +1195,7 @@ private: String getActivityName() const { - return androidActivityClass.get().fromLastOccurrenceOf (".", false, false); + return androidActivityClass.get().toString().fromLastOccurrenceOf (".", false, false); } String getActivitySubClassName() const @@ -1228,12 +1207,12 @@ private: String getActivityClassPackage() const { - return androidActivityClass.get().upToLastOccurrenceOf (".", false, false); + return androidActivityClass.get().toString().upToLastOccurrenceOf (".", false, false); } String getJNIActivityClassName() const { - return androidActivityClass.get().replaceCharacter ('.', '/'); + return androidActivityClass.get().toString().replaceCharacter ('.', '/'); } static LibraryModule* getCoreModule (const OwnedArray& modules) @@ -1253,7 +1232,7 @@ private: String getAppPlatform() const { - int ndkVersion = androidMinimumSDK.get().getIntValue(); + int ndkVersion = static_cast (androidMinimumSDK.get()); if (ndkVersion == 9) ndkVersion = 10; // (doesn't seem to be a version '9') @@ -1401,7 +1380,7 @@ private: { auto cxxFlags = getAndroidCompilerFlags(); - auto cppStandard = project.getCppStandardValue().toString(); + auto cppStandard = project.getCppStandardString(); if (cppStandard == "latest") cppStandard = "1z"; @@ -1659,7 +1638,7 @@ private: if (glVersion == nullptr) glVersion = manifest.createNewChildElement ("uses-feature"); - setAttributeIfNotPresent (*glVersion, "android:glEsVersion", (androidMinimumSDK.get().getIntValue() >= 18 ? "0x00030000" : "0x00020000")); + setAttributeIfNotPresent (*glVersion, "android:glEsVersion", (static_cast (androidMinimumSDK.get()) >= 18 ? "0x00030000" : "0x00020000")); setAttributeIfNotPresent (*glVersion, "android:required", "true"); } } @@ -1669,7 +1648,7 @@ private: auto* app = getOrCreateChildWithName (manifest, "application"); setAttributeIfNotPresent (*app, "android:label", "@string/app_name"); - if (androidTheme.get().isNotEmpty()) + if (androidTheme.get().toString().isNotEmpty()) setAttributeIfNotPresent (*app, "android:theme", androidTheme.get()); if (! app->hasAttribute ("android:icon")) @@ -1680,7 +1659,7 @@ private: app->setAttribute ("android:icon", "@drawable/icon"); } - if (androidMinimumSDK.get().getIntValue() >= 11) + if (static_cast (androidMinimumSDK.get()) >= 11) { if (! app->hasAttribute ("android:hardwareAccelerated")) app->setAttribute ("android:hardwareAccelerated", "false"); // (using the 2D acceleration slows down openGL) @@ -1703,7 +1682,7 @@ private: if (! act->hasAttribute ("android:configChanges")) { String configChanges ("keyboardHidden|orientation"); - if (androidMinimumSDK.get().getIntValue() >= 13) + if (static_cast (androidMinimumSDK.get()) >= 13) configChanges += "|screenSize"; act->setAttribute ("android:configChanges", configChanges); @@ -1712,7 +1691,7 @@ private: { auto configChanges = act->getStringAttribute ("android:configChanges"); - if (androidMinimumSDK.get().getIntValue() < 13 && configChanges.contains ("screenSize")) + if (static_cast (androidMinimumSDK.get()) < 13 && configChanges.contains ("screenSize")) { configChanges = configChanges.replace ("|screenSize", "") .replace ("screenSize|", "") @@ -1724,9 +1703,9 @@ private: if (androidScreenOrientation.get() == "landscape") { - String landscapeString = androidMinimumSDK.get().getIntValue() < 9 + String landscapeString = static_cast (androidMinimumSDK.get()) < 9 ? "landscape" - : (androidMinimumSDK.get().getIntValue() < 18 ? "sensorLandscape" : "userLandscape"); + : (static_cast (androidMinimumSDK.get()) < 18 ? "sensorLandscape" : "userLandscape"); setAttributeIfNotPresent (*act, "android:screenOrientation", landscapeString); } @@ -1740,7 +1719,7 @@ private: // Using the 2D acceleration slows down OpenGL. We *do* enable it here for the activity though, and we disable it // in each ComponentPeerView instead. This way any embedded native views, which are not children of ComponentPeerView, // can still use hardware acceleration if needed (e.g. web view). - if (androidMinimumSDK.get().getIntValue() >= 11) + if (static_cast (androidMinimumSDK.get()) >= 11) { if (! act->hasAttribute ("android:hardwareAccelerated")) act->setAttribute ("android:hardwareAccelerated", "true"); // (using the 2D acceleration slows down openGL) @@ -1815,7 +1794,7 @@ private: StringArray getPermissionsRequired() const { StringArray s; - s.addTokens (androidOtherPermissions.get(), ", ", ""); + s.addTokens (androidOtherPermissions.get().toString(), ", ", ""); if (androidInternetNeeded.get()) s.add ("android.permission.INTERNET"); @@ -1864,7 +1843,7 @@ private: bool supportsGLv3() const { - return (androidMinimumSDK.get().getIntValue() >= 18); + return (static_cast (androidMinimumSDK.get()) >= 18); } //============================================================================== diff --git a/extras/Projucer/Source/ProjectSaving/jucer_ProjectExport_CLion.h b/extras/Projucer/Source/ProjectSaving/jucer_ProjectExport_CLion.h index 7e44c63c51..bb112a92d5 100644 --- a/extras/Projucer/Source/ProjectSaving/jucer_ProjectExport_CLion.h +++ b/extras/Projucer/Source/ProjectSaving/jucer_ProjectExport_CLion.h @@ -41,7 +41,6 @@ protected: } void createConfigProperties (PropertyListBuilder&) override {} - var getDefaultOptimisationLevel() const override { return {}; } String getModuleLibraryArchName() const override { return {}; } }; @@ -75,8 +74,7 @@ public: { name = getName(); - if (getTargetLocationString().isEmpty()) - getTargetLocationValue() = getDefaultBuildsRootFolder() + "CLion"; + targetLocationValue.setDefault (getDefaultBuildsRootFolder() + "CLion"); } //============================================================================== @@ -376,7 +374,7 @@ private: //============================================================================== void writeCMakeListsMakefileSection (OutputStream& out, MakefileProjectExporter& exporter) const { - out << "project (" << getProject().getTitle().quoted() << " C CXX)" << newLine + out << "project (" << getProject().getProjectNameString().quoted() << " C CXX)" << newLine << newLine; out << "find_package (PkgConfig REQUIRED)" << newLine; @@ -456,7 +454,7 @@ private: out << "set_target_properties (" << targetVarName << " PROPERTIES" << newLine << " OUTPUT_NAME " << config.getTargetBinaryNameString().quoted() << newLine; - auto cxxStandard = project.getCppStandardValue().toString(); + auto cxxStandard = project.getCppStandardString(); if (cxxStandard == "latest") cxxStandard = "1z"; @@ -540,7 +538,7 @@ private: //============================================================================== void writeCMakeListsCodeBlocksSection (OutputStream& out, CodeBlocksProjectExporter& exporter) const { - out << "project (" << getProject().getTitle().quoted() << " C CXX)" << newLine + out << "project (" << getProject().getProjectNameString().quoted() << " C CXX)" << newLine << newLine; writeCMakeTargets (out, exporter); @@ -585,7 +583,7 @@ private: out << "set_target_properties (" << targetVarName << " PROPERTIES" << newLine << " OUTPUT_NAME " << config.getTargetBinaryNameString().quoted() << newLine; - auto cxxStandard = project.getCppStandardValue().toString(); + auto cxxStandard = project.getCppStandardString(); if (cxxStandard == "latest") cxxStandard = "1z"; @@ -679,7 +677,7 @@ private: } } - out << "project (" << getProject().getTitle().quoted() << " C CXX)" << newLine << newLine; + out << "project (" << getProject().getProjectNameString().quoted() << " C CXX)" << newLine << newLine; writeCMakeTargets (out, exporter); @@ -981,7 +979,7 @@ private: out << "set_target_properties (" << targetVarName << " PROPERTIES" << newLine << " OUTPUT_NAME " << binaryName.quoted() << newLine; - auto cxxStandard = project.getCppStandardValue().toString(); + auto cxxStandard = project.getCppStandardString(); if (cxxStandard == "latest") cxxStandard = "1z"; diff --git a/extras/Projucer/Source/ProjectSaving/jucer_ProjectExport_CodeBlocks.h b/extras/Projucer/Source/ProjectSaving/jucer_ProjectExport_CodeBlocks.h index ec5237f4ac..03756c9f75 100644 --- a/extras/Projucer/Source/ProjectSaving/jucer_ProjectExport_CodeBlocks.h +++ b/extras/Projucer/Source/ProjectSaving/jucer_ProjectExport_CodeBlocks.h @@ -93,8 +93,10 @@ public: { name = getName (os); - if (getTargetLocationString().isEmpty()) - getTargetLocationValue() = getDefaultBuildsRootFolder() + getTargetFolderName (os); + targetLocationValue.setDefault (getDefaultBuildsRootFolder() + getTargetFolderName (os)); + + if (isWindows()) + targetPlatformValue.referTo (settings, Ids::codeBlocksWindowsTarget, getProject().getUndoManagerFor (settings)); } //============================================================================== @@ -141,9 +143,11 @@ public: { if (isWindows()) { - StringArray toolsetNames = { "(default)", "Windows NT 4.0", "Windows 2000", "Windows XP", "Windows Server 2003", "Windows Vista", "Windows Server 2008", "Windows 7", "Windows 8", "Windows 8.1", "Windows 10" }; - Array toolsets = { var(), "0x0400", "0x0500", "0x0501", "0x0502", "0x0600", "0x0600", "0x0601", "0x0602", "0x0603", "0x0A00" }; - props.add (new ChoicePropertyComponent (getTargetPlatformValue(), "Target platform", toolsetNames, toolsets), + props.add (new ChoicePropertyComponent (targetPlatformValue, "Target platform", + { "Windows NT 4.0", "Windows 2000", "Windows XP", "Windows Server 2003", "Windows Vista", "Windows Server 2008", + "Windows 7", "Windows 8", "Windows 8.1", "Windows 10" }, + { "0x0400", "0x0500", "0x0501", "0x0502", "0x0600", "0x0600", + "0x0601", "0x0602", "0x0603", "0x0A00" }), "This sets the preprocessor macro WINVER to an appropriate value for the corresponding platform."); } } @@ -151,8 +155,8 @@ public: //============================================================================== void create (const OwnedArray&) const override { - const File cbpFile (getTargetFolder().getChildFile (project.getProjectFilenameRoot()) - .withFileExtension (".cbp")); + auto cbpFile = getTargetFolder().getChildFile (project.getProjectFilenameRootString()) + .withFileExtension (".cbp"); XmlElement xml ("CodeBlocks_project_file"); addVersion (xml); @@ -203,52 +207,36 @@ public: } private: - Value getTargetPlatformValue() { return getSetting (Ids::codeBlocksWindowsTarget); } - String getTargetPlatform() const { return settings [Ids::codeBlocksWindowsTarget].toString(); } + ValueWithDefault targetPlatformValue; + + String getTargetPlatformString() const { return targetPlatformValue.get(); } //============================================================================== class CodeBlocksBuildConfiguration : public BuildConfiguration { public: CodeBlocksBuildConfiguration (Project& p, const ValueTree& settings, const ProjectExporter& e) - : BuildConfiguration (p, settings, e) + : BuildConfiguration (p, settings, e), + architectureTypeValue (config, exporter.isWindows() ? Ids::windowsCodeBlocksArchitecture + : Ids::linuxCodeBlocksArchitecture, getUndoManager(), "-m64") { - if (getArchitectureType().toString().isEmpty()) - getArchitectureType() = static_cast ("-m64"); + linkTimeOptimisationValue.setDefault (false); + optimisationLevelValue.setDefault (isDebug() ? gccO0 : gccO3); } - Value getArchitectureType() - { - const auto archID = exporter.isWindows() ? Ids::windowsCodeBlocksArchitecture - : Ids::linuxCodeBlocksArchitecture; - return getValue (archID); - } - - var getArchitectureTypeVar() const - { - const auto archID = exporter.isWindows() ? Ids::windowsCodeBlocksArchitecture - : Ids::linuxCodeBlocksArchitecture; - return config [archID]; - } - - var getDefaultOptimisationLevel() const override { return var ((int) (isDebug() ? gccO0 : gccO3)); } - void createConfigProperties (PropertyListBuilder& props) override { addGCCOptimisationProperty (props); - static const char* const archNames[] = { "32-bit (-m32)", "64-bit (-m64)", "ARM v6", "ARM v7" }; - const var archFlags[] = { "-m32", "-m64", "-march=armv6", "-march=armv7" }; - - props.add (new ChoicePropertyComponent (getArchitectureType(), "Architecture", - StringArray (archNames, numElementsInArray (archNames)), - Array (archFlags, numElementsInArray (archFlags)))); + props.add (new ChoicePropertyComponent (architectureTypeValue, "Architecture", + { "32-bit (-m32)", "64-bit (-m64)", "ARM v6", "ARM v7" }, + { "-m32", "-m64", "-march=armv6", "-march=armv7" })); } String getModuleLibraryArchName() const override { - const String archFlag = getArchitectureTypeVar(); - const auto prefix = String ("-march="); + auto archFlag = getArchitectureTypeString(); + String prefix ("-march="); if (archFlag.startsWith (prefix)) return archFlag.substring (prefix.length()); @@ -260,6 +248,11 @@ private: jassertfalse; return {}; } + + String getArchitectureTypeString() const { return architectureTypeValue.get(); } + + //============================================================================== + ValueWithDefault architectureTypeValue; }; BuildConfiguration::Ptr createBuildConfig (const ValueTree& tree) const override @@ -364,7 +357,7 @@ private: void addOptions (XmlElement& xml) const { - xml.createNewChildElement ("Option")->setAttribute ("title", project.getTitle()); + xml.createNewChildElement ("Option")->setAttribute ("title", project.getProjectNameString()); xml.createNewChildElement ("Option")->setAttribute ("pch_mode", 2); xml.createNewChildElement ("Option")->setAttribute ("compiler", "gcc"); } @@ -378,7 +371,7 @@ private: defines.set ("__MINGW__", "1"); defines.set ("__MINGW_EXTENSION", {}); - auto targetPlatform = getTargetPlatform(); + auto targetPlatform = getTargetPlatformString(); if (targetPlatform.isNotEmpty()) defines.set ("WINVER", targetPlatform); @@ -420,8 +413,8 @@ private: StringArray getCompilerFlags (const BuildConfiguration& config, CodeBlocksTarget& target) const { StringArray flags; - if (const auto codeBlocksConfig = dynamic_cast (&config)) - flags.add (codeBlocksConfig->getArchitectureTypeVar()); + if (auto* codeBlocksConfig = dynamic_cast (&config)) + flags.add (codeBlocksConfig->getArchitectureTypeString()); flags.add ("-O" + config.getGCCOptimisationFlag()); @@ -429,7 +422,7 @@ private: flags.add ("-flto"); { - auto cppStandard = config.project.getCppStandardValue().toString(); + auto cppStandard = config.project.getCppStandardString(); if (cppStandard == "latest") cppStandard = "1z"; @@ -475,8 +468,8 @@ private: { StringArray flags (makefileExtraLinkerFlags); - if (const auto codeBlocksConfig = dynamic_cast (&config)) - flags.add (codeBlocksConfig->getArchitectureTypeVar()); + if (auto* codeBlocksConfig = dynamic_cast (&config)) + flags.add (codeBlocksConfig->getArchitectureTypeString()); if (! config.isDebug()) flags.add ("-s"); diff --git a/extras/Projucer/Source/ProjectSaving/jucer_ProjectExport_MSVC.h b/extras/Projucer/Source/ProjectSaving/jucer_ProjectExport_MSVC.h index b07f1e408a..07d1f8efa2 100644 --- a/extras/Projucer/Source/ProjectSaving/jucer_ProjectExport_MSVC.h +++ b/extras/Projucer/Source/ProjectSaving/jucer_ProjectExport_MSVC.h @@ -32,10 +32,13 @@ class MSVCProjectExporterBase : public ProjectExporter { public: MSVCProjectExporterBase (Project& p, const ValueTree& t, const char* const folderName) - : ProjectExporter (p, t) + : ProjectExporter (p, t), + IPPLibraryValue (settings, Ids::IPPLibrary, getProject().getUndoManagerFor (settings)), + platformToolsetValue (settings, Ids::toolset, getProject().getUndoManagerFor (settings)), + targetPlatformVersion (settings, Ids::windowsTargetPlatformVersion, getProject().getUndoManagerFor (settings)), + manifestFileValue (settings, Ids::msvcManifestFile, getProject().getUndoManagerFor (settings)) { - if (getTargetLocationString().isEmpty()) - getTargetLocationValue() = getDefaultBuildsRootFolder() + folderName; + targetLocationValue.setDefault (getDefaultBuildsRootFolder() + folderName); updateOldSettings(); } @@ -48,45 +51,29 @@ public: virtual String getDefaultWindowsTargetPlatformVersion() const = 0; //============================================================================== - Value getIPPLibraryValue() { return getSetting (Ids::IPPLibrary); } - String getIPPLibrary() const { return settings [Ids::IPPLibrary]; } - - Value getPlatformToolsetValue() { return getSetting (Ids::toolset); } - String getPlatformToolset() const - { - const String s (settings [Ids::toolset].toString()); - return s.isNotEmpty() ? s : getDefaultToolset(); - } - - Value getWindowsTargetPlatformVersionValue() { return getSetting (Ids::windowsTargetPlatformVersion); } - String getWindowsTargetPlatformVersion() const - { - String targetPlatform = settings [Ids::windowsTargetPlatformVersion]; - return (targetPlatform.isNotEmpty() ? targetPlatform : getDefaultWindowsTargetPlatformVersion()); - } + String getIPPLibrary() const { return IPPLibraryValue.get(); } + String getPlatformToolset() const { return platformToolsetValue.get(); } + String getWindowsTargetPlatformVersion() const { return targetPlatformVersion.get(); } //============================================================================== void addToolsetProperty (PropertyListBuilder& props, const char** names, const var* values, int num) { - props.add (new ChoicePropertyComponent (getPlatformToolsetValue(), "Platform Toolset", - StringArray (names, num), Array (values, num))); + props.add (new ChoicePropertyComponent (platformToolsetValue, "Platform Toolset", + StringArray (names, num), { values, num })); } void addIPPLibraryProperty (PropertyListBuilder& props) { - static const char* ippOptions[] = { "No", "Yes (Default Mode)", "Multi-Threaded Static Library", "Single-Threaded Static Library", "Multi-Threaded DLL", "Single-Threaded DLL" }; - static const var ippValues[] = { var(), "true", "Parallel_Static", "Sequential", "Parallel_Dynamic", "Sequential_Dynamic" }; - - props.add (new ChoicePropertyComponent (getIPPLibraryValue(), "Use IPP Library", - StringArray (ippOptions, numElementsInArray (ippValues)), - Array (ippValues, numElementsInArray (ippValues)))); + props.add (new ChoicePropertyComponent (IPPLibraryValue, "Use IPP Library", + { "No", "Yes (Default Linking)", "Multi-Threaded Static Library", "Single-Threaded Static Library", "Multi-Threaded DLL", "Single-Threaded DLL" }, + { var(), "true", "Parallel_Static", "Sequential", "Parallel_Dynamic", "Sequential_Dynamic" })); } void addWindowsTargetPlatformProperties (PropertyListBuilder& props) { auto isWindows10SDK = getVisualStudioVersion() > 14; - props.add (new TextWithDefaultPropertyComponent (windowsTargetPlatformVersion, "Windows Target Platform", 20), + props.add (new TextPropertyComponent (targetPlatformVersion, "Windows Target Platform", 20, false), String ("Specifies the version of the Windows SDK that will be used when building this project. ") + (isWindows10SDK ? "You can see which SDKs you have installed on your machine by going to \"Program Files (x86)\\Windows Kits\\10\\Lib\". " : "") + "The default value for this exporter is " + getDefaultWindowsTargetPlatformVersion()); @@ -145,84 +132,73 @@ public: TargetOS::windows))); } - void initialiseWindowsTargetPlatformVersion() - { - windowsTargetPlatformVersion.referTo (settings, Ids::windowsTargetPlatformVersion, - nullptr, getDefaultWindowsTargetPlatformVersion()); - } - //============================================================================== class MSVCBuildConfiguration : public BuildConfiguration { public: MSVCBuildConfiguration (Project& p, const ValueTree& settings, const ProjectExporter& e) - : BuildConfiguration (p, settings, e) + : BuildConfiguration (p, settings, e), + warningLevelValue (config, Ids::winWarningLevel, getUndoManager(), 4), + warningsAreErrorsValue (config, Ids::warningsAreErrors, getUndoManager(), false), + prebuildCommandValue (config, Ids::prebuildCommand, getUndoManager()), + postbuildCommandValue (config, Ids::postbuildCommand, getUndoManager()), + generateDebugSymbolsValue (config, Ids::alwaysGenerateDebugSymbols, getUndoManager(), false), + generateManifestValue (config, Ids::generateManifest, getUndoManager(), true), + enableIncrementalLinkingValue (config, Ids::enableIncrementalLinking, getUndoManager(), false), + useRuntimeLibDLLValue (config, Ids::useRuntimeLibDLL, getUndoManager(), true), + intermediatesPathValue (config, Ids::intermediatesPath, getUndoManager()), + characterSetValue (config, Ids::characterSet, getUndoManager()), + architectureTypeValue (config, Ids::winArchitecture, getUndoManager(), get64BitArchName()), + fastMathValue (config, Ids::fastMath, getUndoManager()), + debugInformationFormatValue (config, Ids::debugInformationFormat, getUndoManager(), isDebug() ? "ProgramDatabase" : "None"), + pluginBinaryCopyStepValue (config, Ids::enablePluginBinaryCopyStep, getUndoManager(), false) { - if (getWarningLevel() == 0) - getWarningLevelValue() = 4; - - setValueIfVoid (shouldGenerateManifestValue(), true); - setValueIfVoid (getArchitectureType(), get64BitArchName()); - setValueIfVoid (getDebugInformationFormatValue(), "ProgramDatabase"); - setValueIfVoid (getPluginBinaryCopyStepEnabledValue(), false); - if (! isDebug()) - { updateOldLTOSetting(); - setValueIfVoid (getLinkTimeOptimisationEnabledValue(), true); - } - initialisePluginCachedValues(); + initialisePluginDefaultValues(); + + optimisationLevelValue.setDefault (isDebug() ? optimisationOff : optimiseFull); } - Value getWarningLevelValue() { return getValue (Ids::winWarningLevel); } - int getWarningLevel() const { return config [Ids::winWarningLevel]; } + //============================================================================== + int getWarningLevel() const { return warningLevelValue.get(); } + bool areWarningsTreatedAsErrors() const { return warningsAreErrorsValue.get(); } - Value getWarningsTreatedAsErrors() { return getValue (Ids::warningsAreErrors); } - bool areWarningsTreatedAsErrors() const { return config [Ids::warningsAreErrors]; } + String getPrebuildCommandString() const { return prebuildCommandValue.get(); } + String getPostbuildCommandString() const { return postbuildCommandValue.get(); } - Value getPrebuildCommand() { return getValue (Ids::prebuildCommand); } - String getPrebuildCommandString() const { return config [Ids::prebuildCommand]; } + bool shouldGenerateDebugSymbols() const { return generateDebugSymbolsValue.get(); } + bool shouldGenerateManifest() const { return generateManifestValue.get(); } - Value getPostbuildCommand() { return getValue (Ids::postbuildCommand); } - String getPostbuildCommandString() const { return config [Ids::postbuildCommand]; } + bool shouldLinkIncremental() const { return enableIncrementalLinkingValue.get(); } - Value shouldGenerateDebugSymbolsValue() { return getValue (Ids::alwaysGenerateDebugSymbols); } - bool shouldGenerateDebugSymbols() const { return config [Ids::alwaysGenerateDebugSymbols]; } + bool isUsingRuntimeLibDLL() const { return useRuntimeLibDLLValue.get(); } - Value shouldGenerateManifestValue() { return getValue (Ids::generateManifest); } - bool shouldGenerateManifest() const { return config [Ids::generateManifest]; } + String getIntermediatesPathString() const { return intermediatesPathValue.get(); } - Value shouldLinkIncrementalValue() { return getValue (Ids::enableIncrementalLinking); } - bool shouldLinkIncremental() const { return config [Ids::enableIncrementalLinking]; } - - Value getUsingRuntimeLibDLL() { return getValue (Ids::useRuntimeLibDLL); } - bool isUsingRuntimeLibDLL() const { return config [Ids::useRuntimeLibDLL]; } - - Value getIntermediatesPathValue() { return getValue (Ids::intermediatesPath); } - String getIntermediatesPath() const { return config [Ids::intermediatesPath].toString(); } - - Value getCharacterSetValue() { return getValue (Ids::characterSet); } - String getCharacterSet() const { return config [Ids::characterSet].toString(); } - - Value getArchitectureType() { return getValue (Ids::winArchitecture); } - bool is64Bit() const { return config [Ids::winArchitecture].toString() == get64BitArchName(); } - - Value getFastMathValue() { return getValue (Ids::fastMath); } - bool isFastMathEnabled() const { return config [Ids::fastMath]; } + String getCharacterSetString() const { return characterSetValue.get(); } String get64BitArchName() const { return "x64"; } String get32BitArchName() const { return "Win32"; } + String getArchitectureString() const { return architectureTypeValue.get(); } + bool is64Bit() const { return getArchitectureString() == get64BitArchName(); } - Value getDebugInformationFormatValue() { return getValue (Ids::debugInformationFormat); } - String getDebugInformationFormatString() const { return config [Ids::debugInformationFormat]; } + bool isFastMathEnabled() const { return fastMathValue.get(); } - Value getPluginBinaryCopyStepEnabledValue() { return getValue (Ids::enablePluginBinaryCopyStep); } - bool isPluginBinaryCopyStepEnabled() const { return config [Ids::enablePluginBinaryCopyStep]; } + String getDebugInformationFormatString() const { return debugInformationFormatValue.get(); } + bool isPluginBinaryCopyStepEnabled() const { return pluginBinaryCopyStepValue.get(); } + + String getVSTBinaryLocationString() const { return vstBinaryLocation.get(); } + String getVST3BinaryLocationString() const { return vst3BinaryLocation.get(); } + String getRTASBinaryLocationString() const { return rtasBinaryLocation.get();} + String getAAXBinaryLocationString() const { return aaxBinaryLocation.get();} + + //============================================================================== String createMSVCConfigName() const { - return getName() + "|" + (config [Ids::winArchitecture] == get64BitArchName() ? "x64" : "Win32"); + return getName() + "|" + (is64Bit() ? "x64" : "Win32"); } String getOutputFilename (const String& suffix, bool forceSuffix) const @@ -235,88 +211,65 @@ public: return target; } - var getDefaultOptimisationLevel() const override { return var ((int) (isDebug() ? optimisationOff : optimiseFull)); } - void createConfigProperties (PropertyListBuilder& props) override { addVisualStudioPluginInstallPathProperties (props); - const String archTypes[] = { get32BitArchName(), get64BitArchName() }; - props.add (new ChoicePropertyComponent (getArchitectureType(), "Architecture", - StringArray (archTypes, numElementsInArray (archTypes)), - Array (archTypes, numElementsInArray (archTypes)))); + props.add (new ChoicePropertyComponent (architectureTypeValue, "Architecture", + { get32BitArchName(), get64BitArchName() }, + { get32BitArchName(), get64BitArchName() })); - { - static const char* debugInfoOptions[] = { "None", "C7 Compatible (/Z7)", "Program Database (/Zi)", "Program Database for Edit And Continue (/ZI)", nullptr }; - static const char* debugInfoValues[] = { "None", "OldStyle", "ProgramDatabase", "EditAndContinue", nullptr }; + props.add (new ChoicePropertyComponentWithEnablement (debugInformationFormatValue, + isDebug() ? isDebugValue.getPropertyAsValue() + : generateDebugSymbolsValue.getPropertyAsValue(), + "Debug Information Format", + { "None", "C7 Compatible (/Z7)", "Program Database (/Zi)", "Program Database for Edit And Continue (/ZI)" }, + { "None", "OldStyle", "ProgramDatabase", "EditAndContinue" }), + "The type of debugging information created for your program for this configuration." + " This will always be used in a debug configuration and will be used in a release configuration" + " with forced generation of debug symbols."); - props.add (new ChoicePropertyComponentWithEnablement (getDebugInformationFormatValue(), - isDebug() ? isDebugValue() : shouldGenerateDebugSymbolsValue(), - "Debug Information Format", - StringArray (debugInfoOptions), - Array (debugInfoValues)), - "The type of debugging information created for your program for this configuration." - " This will always be used in a debug configuration and will be used in a release configuration" - " with forced generation of debug symbols."); - } - - props.add (new BooleanPropertyComponent (getFastMathValue(), "Relax IEEE compliance", "Enabled"), + props.add (new ChoicePropertyComponent (fastMathValue, "Relax IEEE Compliance"), "Enable this to use FAST_MATH non-IEEE mode. (Warning: this can have unexpected results!)"); - - static const char* optimisationLevels[] = { "Disabled (/Od)", "Minimise size (/O1)", "Maximise speed (/O2)", "Full optimisation (/Ox)", 0 }; - const int optimisationLevelValues[] = { optimisationOff, optimiseMinSize, optimiseMaxSpeed, optimiseFull, 0 }; - - props.add (new ChoicePropertyComponent (getOptimisationLevel(), "Optimisation", - StringArray (optimisationLevels), - Array (optimisationLevelValues)), + props.add (new ChoicePropertyComponent (optimisationLevelValue, "Optimisation", + { "Disabled (/Od)", "Minimise size (/O1)", "Maximise speed (/O2)", "Full optimisation (/Ox)" }, + { optimisationOff, optimiseMinSize, optimiseMaxSpeed, optimiseFull }), "The optimisation level for this configuration"); - props.add (new TextPropertyComponent (getIntermediatesPathValue(), "Intermediates path", 2048, false), + props.add (new TextPropertyComponent (intermediatesPathValue, "Intermediates Path", 2048, false), "An optional path to a folder to use for the intermediate build files. Note that Visual Studio allows " "you to use macros in this path, e.g. \"$(TEMP)\\MyAppBuildFiles\\$(Configuration)\", which is a handy way to " "send them to the user's temp folder."); - static const char* warningLevelNames[] = { "Low", "Medium", "High", nullptr }; - const int warningLevels[] = { 2, 3, 4 }; + props.add (new ChoicePropertyComponent (warningLevelValue, "Warning Level", + { "Low", "Medium", "High" }, + { 2, 3, 4 })); - props.add (new ChoicePropertyComponent (getWarningLevelValue(), "Warning Level", - StringArray (warningLevelNames), Array (warningLevels, numElementsInArray (warningLevels)))); + props.add (new ChoicePropertyComponent (warningsAreErrorsValue, "Treat Warnings as Errors")); - props.add (new BooleanPropertyComponent (getWarningsTreatedAsErrors(), "Warnings", "Treat warnings as errors")); + props.add (new ChoicePropertyComponent (useRuntimeLibDLLValue, "Runtime Library", + { "Use static runtime", "Use DLL runtime" }, + { false, true }), + "If the static runtime is selected then your app/plug-in will not be dependent upon users having Microsoft's redistributable " + "C++ runtime installed. However, if you are linking libraries from different sources you must select the same type of runtime " + "used by the libraries."); - { - static const char* runtimeNames[] = { "(Default)", "Use static runtime", "Use DLL runtime", nullptr }; - const var runtimeValues[] = { var (true), var (false), var (true) }; - - props.add (new ChoicePropertyComponent (getUsingRuntimeLibDLL(), "Runtime Library", - StringArray (runtimeNames), Array (runtimeValues, numElementsInArray (runtimeValues))), - "If the static runtime is selected then your app/plug-in will not be dependent upon users having Microsoft's redistributable " - "C++ runtime installed. However, if you are linking libraries from different sources you must select the same type of runtime " - "used by the libraries."); - } - - { - props.add (new BooleanPropertyComponent (shouldLinkIncrementalValue(), "Incremental Linking", "Enable"), - "Enable to avoid linking from scratch for every new build. " - "Disable to ensure that your final release build does not contain padding or thunks."); - } + props.add (new ChoicePropertyComponent (enableIncrementalLinkingValue, "Incremental Linking"), + "Enable to avoid linking from scratch for every new build. " + "Disable to ensure that your final release build does not contain padding or thunks."); if (! isDebug()) - props.add (new BooleanPropertyComponent (shouldGenerateDebugSymbolsValue(), "Debug Symbols", "Force generation of debug symbols")); + props.add (new ChoicePropertyComponent (generateDebugSymbolsValue, "Force Generation of Debug Symbols")); - props.add (new TextPropertyComponent (getPrebuildCommand(), "Pre-build Command", 2048, true)); - props.add (new TextPropertyComponent (getPostbuildCommand(), "Post-build Command", 2048, true)); - props.add (new BooleanPropertyComponent (shouldGenerateManifestValue(), "Manifest", "Generate Manifest")); + props.add (new TextPropertyComponent (prebuildCommandValue, "Pre-build Command", 2048, true)); + props.add (new TextPropertyComponent (postbuildCommandValue, "Post-build Command", 2048, true)); + props.add (new ChoicePropertyComponent (generateManifestValue, "Generate Manifest")); - { - static const char* characterSetNames[] = { "Default", "MultiByte", "Unicode", nullptr }; - const var charSets[] = { var(), "MultiByte", "Unicode", }; - - props.add (new ChoicePropertyComponent (getCharacterSetValue(), "Character Set", - StringArray (characterSetNames), Array (charSets, numElementsInArray (charSets)))); - } + props.add (new ChoicePropertyComponent (characterSetValue, "Character Set", + { "MultiByte", "Unicode" }, + { "MultiByte", "Unicode" })); } String getModuleLibraryArchName() const override @@ -330,15 +283,18 @@ public: return result; } - //============================================================================== - CachedValue vstBinaryLocation, vst3BinaryLocation, rtasBinaryLocation, aaxBinaryLocation; - private: + ValueWithDefault warningLevelValue, warningsAreErrorsValue, prebuildCommandValue, postbuildCommandValue, generateDebugSymbolsValue, + generateManifestValue, enableIncrementalLinkingValue, useRuntimeLibDLLValue, intermediatesPathValue, + characterSetValue, architectureTypeValue, fastMathValue, debugInformationFormatValue, pluginBinaryCopyStepValue; + + ValueWithDefault vstBinaryLocation, vst3BinaryLocation, rtasBinaryLocation, aaxBinaryLocation; + //============================================================================== void updateOldLTOSetting() { if (config.getPropertyAsValue ("wholeProgramOptimisation", nullptr) != Value()) - getLinkTimeOptimisationEnabledValue() = (static_cast (config ["wholeProgramOptimisation"]) == 0); + linkTimeOptimisationValue = (static_cast (config ["wholeProgramOptimisation"]) == 0); } void addVisualStudioPluginInstallPathProperties (PropertyListBuilder& props) @@ -347,42 +303,42 @@ public: || project.shouldBuildRTAS() || project.shouldBuildAAX()); if (isBuildingAnyPlugins) - props.add (new BooleanPropertyComponent (getPluginBinaryCopyStepEnabledValue(), "Enable Plugin Copy Step", "Enabled"), + props.add (new ChoicePropertyComponent (pluginBinaryCopyStepValue, "Enable Plugin Copy Step"), "Enable this to copy plugin binaries to a specified folder after building."); if (project.shouldBuildVST()) - props.add (new TextWithDefaultPropertyComponentWithEnablement (vstBinaryLocation, getPluginBinaryCopyStepEnabledValue(), - "VST Binary Location", 1024), + props.add (new TextPropertyComponentWithEnablement (vstBinaryLocation, pluginBinaryCopyStepValue.getPropertyAsValue(), + "VST Binary Location", 1024, false), "The folder in which the compiled VST binary should be placed."); if (project.shouldBuildVST3()) - props.add (new TextWithDefaultPropertyComponentWithEnablement (vst3BinaryLocation, getPluginBinaryCopyStepEnabledValue(), - "VST3 Binary Location", 1024), + props.add (new TextPropertyComponentWithEnablement (vst3BinaryLocation, pluginBinaryCopyStepValue.getPropertyAsValue(), + "VST3 Binary Location", 1024, false), "The folder in which the compiled VST3 binary should be placed."); if (project.shouldBuildRTAS()) - props.add (new TextWithDefaultPropertyComponentWithEnablement (rtasBinaryLocation, getPluginBinaryCopyStepEnabledValue(), - "RTAS Binary Location", 1024), + props.add (new TextPropertyComponentWithEnablement (rtasBinaryLocation, pluginBinaryCopyStepValue.getPropertyAsValue(), + "RTAS Binary Location", 1024, false), "The folder in which the compiled RTAS binary should be placed."); if (project.shouldBuildAAX()) - props.add (new TextWithDefaultPropertyComponentWithEnablement (aaxBinaryLocation, getPluginBinaryCopyStepEnabledValue(), - "AAX Binary Location", 1024), + props.add (new TextPropertyComponentWithEnablement (aaxBinaryLocation, pluginBinaryCopyStepValue.getPropertyAsValue(), + "AAX Binary Location", 1024, false), "The folder in which the compiled AAX binary should be placed."); } - void initialisePluginCachedValues() + void initialisePluginDefaultValues() { - vstBinaryLocation.referTo (config, Ids::vstBinaryLocation, nullptr, ((is64Bit() ? "%ProgramW6432%" - : "%programfiles(x86)%") + String ("\\Steinberg\\Vstplugins"))); + vstBinaryLocation.referTo (config, Ids::vstBinaryLocation, getUndoManager(), ((is64Bit() ? "%ProgramW6432%" + : "%programfiles(x86)%") + String ("\\Steinberg\\Vstplugins"))); auto prefix = is64Bit() ? "%CommonProgramW6432%" : "%CommonProgramFiles(x86)%"; - vst3BinaryLocation.referTo (config, Ids::vst3BinaryLocation, nullptr, prefix + String ("\\VST3")); - rtasBinaryLocation.referTo (config, Ids::rtasBinaryLocation, nullptr, prefix + String ("\\Digidesign\\DAE\\Plug-Ins")); - aaxBinaryLocation.referTo (config, Ids::aaxBinaryLocation, nullptr, prefix + String ("\\Avid\\Audio\\Plug-Ins")); + vst3BinaryLocation.referTo (config, Ids::vst3BinaryLocation, getUndoManager(), prefix + String ("\\VST3")); + rtasBinaryLocation.referTo (config, Ids::rtasBinaryLocation, getUndoManager(), prefix + String ("\\Digidesign\\DAE\\Plug-Ins")); + aaxBinaryLocation.referTo (config, Ids::aaxBinaryLocation, getUndoManager(), prefix + String ("\\Avid\\Audio\\Plug-Ins")); } }; @@ -393,7 +349,7 @@ public: MSVCTargetBase (ProjectType::Target::Type targetType, const MSVCProjectExporterBase& exporter) : ProjectType::Target (targetType), owner (exporter) { - projectGuid = createGUID (owner.getProject().getProjectUID() + getName()); + projectGuid = createGUID (owner.getProject().getProjectUIDString() + getName()); } virtual ~MSVCTargetBase() {} @@ -448,7 +404,7 @@ public: e->createNewChildElement ("WholeProgramOptimization")->addTextElement (config.isLinkTimeOptimisationEnabled() ? "true" : "false"); - const String charSet (config.getCharacterSet()); + auto charSet = config.getCharacterSetString(); if (charSet.isNotEmpty()) e->createNewChildElement ("CharacterSet")->addTextElement (charSet); @@ -595,7 +551,7 @@ public: if (config.areWarningsTreatedAsErrors()) cl->createNewChildElement ("TreatWarningAsError")->addTextElement ("true"); - auto cppStandard = owner.project.getCppStandardValue().toString(); + auto cppStandard = owner.project.getCppStandardString(); if (cppStandard == "11") // unfortunaly VS doesn't support the C++11 flag so we have to bump it to C++14 cppStandard = "14"; @@ -972,7 +928,9 @@ public: String getIntermediatesPath (const MSVCBuildConfiguration& config) const { - String intDir = (config.getIntermediatesPath().isNotEmpty() ? config.getIntermediatesPath() : "$(Platform)\\$(Configuration)"); + auto intDir = (config.getIntermediatesPathString().isNotEmpty() ? config.getIntermediatesPathString() + : "$(Platform)\\$(Configuration)"); + if (! intDir.endsWithChar (L'\\')) intDir += L'\\'; @@ -1097,8 +1055,8 @@ public: + createRebasedPath (bundleScript) + String (" ") + macOSDir.quoted() + String (" ") + createRebasedPath (iconFilePath); if (config.isPluginBinaryCopyStepEnabled()) - return pkgScript + "\r\n" + String ("xcopy ") + bundleDir.quoted() + " " - + String (config.aaxBinaryLocation.get() + "\\" + outputFilename + "\\").quoted() + " /E /Y /H /K"; + return pkgScript + "\r\n" + "xcopy " + bundleDir.quoted() + " " + + String (config.getAAXBinaryLocationString() + "\\" + outputFilename + "\\").quoted() + " /E /Y /H /K"; return pkgScript; } @@ -1106,9 +1064,9 @@ public: { auto copyScript = String ("copy /Y \"$(OutDir)$(TargetFileName)\"") + String (" \"$COPYDIR$\\$(TargetFileName)\""); - if (type == VSTPlugIn) return copyScript.replace ("$COPYDIR$", config.vstBinaryLocation.get()); - if (type == VST3PlugIn) return copyScript.replace ("$COPYDIR$", config.vst3BinaryLocation.get()); - if (type == RTASPlugIn) return copyScript.replace ("$COPYDIR$", config.rtasBinaryLocation.get()); + if (type == VSTPlugIn) return copyScript.replace ("$COPYDIR$", config.getVSTBinaryLocationString()); + if (type == VST3PlugIn) return copyScript.replace ("$COPYDIR$", config.getVST3BinaryLocationString()); + if (type == RTASPlugIn) return copyScript.replace ("$COPYDIR$", config.getRTASBinaryLocationString()); } return {}; @@ -1351,11 +1309,12 @@ public: } //============================================================================== - Value getManifestFile() { return getSetting (Ids::msvcManifestFile); } RelativePath getManifestPath() const { - const String& path = settings [Ids::msvcManifestFile].toString(); - return path.isEmpty() ? RelativePath() : RelativePath (settings [Ids::msvcManifestFile], RelativePath::projectFolder); + auto path = manifestFileValue.get().toString(); + + return path.isEmpty() ? RelativePath() + : RelativePath (path, RelativePath::projectFolder); } //============================================================================== @@ -1381,7 +1340,7 @@ public: void createExporterProperties (PropertyListBuilder& props) override { - props.add(new TextPropertyComponent(getManifestFile(), "Manifest file", 8192, false), + props.add (new TextPropertyComponent (manifestFileValue, "Manifest file", 8192, false), "Path to a manifest input file which should be linked into your binary (path is relative to jucer file)."); } @@ -1448,11 +1407,12 @@ protected: //============================================================================== mutable File rcFile, iconFile; OwnedArray targets; - CachedValue windowsTargetPlatformVersion; + + ValueWithDefault IPPLibraryValue, platformToolsetValue, targetPlatformVersion, manifestFileValue; File getProjectFile (const String& extension, const String& target) const { - String filename = project.getProjectFilenameRoot(); + auto filename = project.getProjectFilenameRootString(); if (target.isNotEmpty()) filename += String ("_") + target.removeCharacters (" "); @@ -1481,7 +1441,7 @@ protected: if (oldStylePrebuildCommand.isNotEmpty()) for (ConfigIterator config (*this); config.next();) - dynamic_cast (*config).getPrebuildCommand() = oldStylePrebuildCommand; + dynamic_cast (*config).getValue (Ids::prebuildCommand) = oldStylePrebuildCommand; } { @@ -1491,7 +1451,7 @@ protected: if (oldStyleLibName.isNotEmpty()) for (ConfigIterator config (*this); config.next();) if (config->isDebug()) - config->getTargetBinaryName() = oldStyleLibName; + config->getValue (Ids::targetName) = oldStyleLibName; } { @@ -1501,7 +1461,7 @@ protected: if (oldStyleLibName.isNotEmpty()) for (ConfigIterator config (*this); config.next();) if (! config->isDebug()) - config->getTargetBinaryName() = oldStyleLibName; + config->getValue (Ids::targetName) = oldStyleLibName; } } @@ -1767,11 +1727,11 @@ protected: << " BLOCK \"040904E4\"" << newLine << " BEGIN" << newLine; - writeRCValue (mo, "CompanyName", project.getCompanyName().toString()); - writeRCValue (mo, "LegalCopyright", project.getCompanyCopyright().toString()); - writeRCValue (mo, "FileDescription", project.getTitle()); + writeRCValue (mo, "CompanyName", project.getCompanyNameString()); + writeRCValue (mo, "LegalCopyright", project.getCompanyCopyrightString()); + writeRCValue (mo, "FileDescription", project.getProjectNameString()); writeRCValue (mo, "FileVersion", version); - writeRCValue (mo, "ProductName", project.getTitle()); + writeRCValue (mo, "ProductName", project.getProjectNameString()); writeRCValue (mo, "ProductVersion", version); mo << " END" << newLine @@ -1845,7 +1805,9 @@ public: : MSVCProjectExporterBase (p, t, "VisualStudio2013") { name = getName(); - initialiseWindowsTargetPlatformVersion(); + + targetPlatformVersion.setDefault (getDefaultWindowsTargetPlatformVersion()); + platformToolsetValue.setDefault (getDefaultToolset()); } static const char* getName() { return "Visual Studio 2013"; } @@ -1869,8 +1831,8 @@ public: { MSVCProjectExporterBase::createExporterProperties (props); - static const char* toolsetNames[] = { "(default)", "v120", "v120_xp", "Windows7.1SDK", "CTP_Nov2013" }; - const var toolsets[] = { var(), "v120", "v120_xp", "Windows7.1SDK", "CTP_Nov2013" }; + static const char* toolsetNames[] = { "v120", "v120_xp", "Windows7.1SDK", "CTP_Nov2013" }; + const var toolsets[] = { "v120", "v120_xp", "Windows7.1SDK", "CTP_Nov2013" }; addToolsetProperty (props, toolsetNames, toolsets, numElementsInArray (toolsets)); addIPPLibraryProperty (props); @@ -1889,7 +1851,9 @@ public: : MSVCProjectExporterBase (p, t, "VisualStudio2015") { name = getName(); - initialiseWindowsTargetPlatformVersion(); + + targetPlatformVersion.setDefault (getDefaultWindowsTargetPlatformVersion()); + platformToolsetValue.setDefault (getDefaultToolset()); } static const char* getName() { return "Visual Studio 2015"; } @@ -1912,8 +1876,8 @@ public: { MSVCProjectExporterBase::createExporterProperties (props); - static const char* toolsetNames[] = { "(default)", "v140", "v140_xp", "CTP_Nov2013" }; - const var toolsets[] = { var(), "v140", "v140_xp", "CTP_Nov2013" }; + static const char* toolsetNames[] = { "v140", "v140_xp", "CTP_Nov2013" }; + const var toolsets[] = { "v140", "v140_xp", "CTP_Nov2013" }; addToolsetProperty (props, toolsetNames, toolsets, numElementsInArray (toolsets)); addIPPLibraryProperty (props); @@ -1932,7 +1896,9 @@ public: : MSVCProjectExporterBase (p, t, "VisualStudio2017") { name = getName(); - initialiseWindowsTargetPlatformVersion(); + + targetPlatformVersion.setDefault (getDefaultWindowsTargetPlatformVersion()); + platformToolsetValue.setDefault (getDefaultToolset()); } static const char* getName() { return "Visual Studio 2017"; } @@ -1955,8 +1921,8 @@ public: { MSVCProjectExporterBase::createExporterProperties (props); - static const char* toolsetNames[] = { "(default)", "v140", "v140_xp", "v141", "v141_xp" }; - const var toolsets[] = { var(), "v140", "v140_xp", "v141", "v141_xp" }; + static const char* toolsetNames[] = { "v140", "v140_xp", "v141", "v141_xp" }; + const var toolsets[] = { "v140", "v140_xp", "v141", "v141_xp" }; addToolsetProperty (props, toolsetNames, toolsets, numElementsInArray (toolsets)); addIPPLibraryProperty (props); diff --git a/extras/Projucer/Source/ProjectSaving/jucer_ProjectExport_Make.h b/extras/Projucer/Source/ProjectSaving/jucer_ProjectExport_Make.h index 41ec2fd8e5..8affa107b4 100644 --- a/extras/Projucer/Source/ProjectSaving/jucer_ProjectExport_Make.h +++ b/extras/Projucer/Source/ProjectSaving/jucer_ProjectExport_Make.h @@ -36,30 +36,25 @@ protected: { public: MakeBuildConfiguration (Project& p, const ValueTree& settings, const ProjectExporter& e) - : BuildConfiguration (p, settings, e) + : BuildConfiguration (p, settings, e), + architectureTypeValue (config, Ids::linuxArchitecture, getUndoManager(), "-march=native") { + linkTimeOptimisationValue.setDefault (false); + optimisationLevelValue.setDefault (isDebug() ? gccO0 : gccO3); } - Value getArchitectureType() { return getValue (Ids::linuxArchitecture); } - var getArchitectureTypeVar() const { return config [Ids::linuxArchitecture]; } - - var getDefaultOptimisationLevel() const override { return var ((int) (isDebug() ? gccO0 : gccO3)); } - void createConfigProperties (PropertyListBuilder& props) override { addGCCOptimisationProperty (props); - static const char* const archNames[] = { "(Default)", "", "32-bit (-m32)", "64-bit (-m64)", "ARM v6", "ARM v7" }; - const var archFlags[] = { var(), var (String()), "-m32", "-m64", "-march=armv6", "-march=armv7" }; - - props.add (new ChoicePropertyComponent (getArchitectureType(), "Architecture", - StringArray (archNames, numElementsInArray (archNames)), - Array (archFlags, numElementsInArray (archFlags)))); + props.add (new ChoicePropertyComponent (architectureTypeValue, "Architecture", + { "", "Native", "32-bit (-m32)", "64-bit (-m64)", "ARM v6", "ARM v7" }, + { { String() } , "-march=native", "-m32", "-m64", "-march=armv6", "-march=armv7" })); } String getModuleLibraryArchName() const override { - String archFlag = getArchitectureTypeVar(); + auto archFlag = getArchitectureTypeString(); String prefix ("-march="); if (archFlag.startsWith (prefix)) @@ -73,6 +68,11 @@ protected: return "${JUCE_ARCH_LABEL}"; } + + String getArchitectureTypeString() const { return architectureTypeValue.get(); } + + //============================================================================== + ValueWithDefault architectureTypeValue; }; BuildConfiguration::Ptr createBuildConfig (const ValueTree& tree) const override @@ -308,8 +308,7 @@ public: static const char* getNameLinux() { return "Linux Makefile"; } static const char* getValueTreeTypeName() { return "LINUX_MAKE"; } - Value getExtraPkgConfig() { return getSetting (Ids::linuxExtraPkgConfig); } - String getExtraPkgConfigString() const { return getSettingString (Ids::linuxExtraPkgConfig); } + String getExtraPkgConfigString() const { return extraPkgConfigValue.get(); } static MakefileProjectExporter* createForSettings (Project& project, const ValueTree& settings) { @@ -320,12 +319,13 @@ public: } //============================================================================== - MakefileProjectExporter (Project& p, const ValueTree& t) : ProjectExporter (p, t) + MakefileProjectExporter (Project& p, const ValueTree& t) + : ProjectExporter (p, t), + extraPkgConfigValue (settings, Ids::linuxExtraPkgConfig, getProject().getUndoManagerFor (settings)) { name = getNameLinux(); - if (getTargetLocationString().isEmpty()) - getTargetLocationValue() = getDefaultBuildsRootFolder() + "LinuxMakefile"; + targetLocationValue.setDefault (getDefaultBuildsRootFolder() + "LinuxMakefile"); } //============================================================================== @@ -370,7 +370,7 @@ public: void createExporterProperties (PropertyListBuilder& properties) override { - properties.add (new TextPropertyComponent (getExtraPkgConfig(), "pkg-config libraries", 8192, false), + properties.add (new TextPropertyComponent (extraPkgConfigValue, "pkg-config libraries", 8192, false), "Extra pkg-config libraries for you application. Each package should be space separated."); } @@ -426,6 +426,9 @@ public: } private: + ValueWithDefault extraPkgConfigValue; + + //============================================================================== StringPairArray getDefines (const BuildConfiguration& config) const { StringPairArray result; @@ -526,7 +529,7 @@ private: { StringArray result; - auto cppStandard = project.getCppStandardValue().toString(); + auto cppStandard = project.getCppStandardString(); if (cppStandard == "latest") cppStandard = "1z"; @@ -865,9 +868,8 @@ private: String getArchFlags (const BuildConfiguration& config) const { - if (const MakeBuildConfiguration* makeConfig = dynamic_cast (&config)) - if (! makeConfig->getArchitectureTypeVar().isVoid()) - return makeConfig->getArchitectureTypeVar(); + if (auto* makeConfig = dynamic_cast (&config)) + return makeConfig->getArchitectureTypeString(); return "-march=native"; } diff --git a/extras/Projucer/Source/ProjectSaving/jucer_ProjectExport_Xcode.h b/extras/Projucer/Source/ProjectSaving/jucer_ProjectExport_Xcode.h index bbec7dde4e..96d9010714 100644 --- a/extras/Projucer/Source/ProjectSaving/jucer_ProjectExport_Xcode.h +++ b/extras/Projucer/Source/ProjectSaving/jucer_ProjectExport_Xcode.h @@ -30,7 +30,9 @@ //============================================================================== namespace { - const char* const osxVersionDefault = "default"; + const char* const osxVersionDefault = "10.11"; + const char* const iosVersionDefault = "9.3"; + const int oldestSDKVersion = 5; const int currentSDKVersion = 13; const int minimumAUv3SDKVersion = 11; @@ -55,24 +57,38 @@ public: XcodeProjectExporter (Project& p, const ValueTree& t, const bool isIOS) : ProjectExporter (p, t), xcodeCanUseDwarf (true), - iOS (isIOS) + iOS (isIOS), + customPListValue (settings, Ids::customPList, project.getUndoManagerFor (settings)), + pListPrefixHeaderValue (settings, Ids::pListPrefixHeader, project.getUndoManagerFor (settings)), + pListPreprocessValue (settings, Ids::pListPreprocess, project.getUndoManagerFor (settings)), + extraFrameworksValue (settings, Ids::extraFrameworks, project.getUndoManagerFor (settings)), + postbuildCommandValue (settings, Ids::postbuildCommand, project.getUndoManagerFor (settings)), + prebuildCommandValue (settings, Ids::prebuildCommand, project.getUndoManagerFor (settings)), + iosAppExtensionDuplicateResourcesFolderValue (settings, Ids::iosAppExtensionDuplicateResourcesFolder, project.getUndoManagerFor (settings)), + iosDeviceFamilyValue (settings, Ids::iosDeviceFamily, project.getUndoManagerFor (settings), "1,2"), + iPhoneScreenOrientationValue (settings, Ids::iPhoneScreenOrientation, project.getUndoManagerFor (settings), "portraitlandscape"), + iPadScreenOrientationValue (settings, Ids::iPadScreenOrientation, project.getUndoManagerFor (settings), "portraitlandscape"), + customXcodeResourceFoldersValue (settings, Ids::customXcodeResourceFolders, project.getUndoManagerFor (settings)), + customXcassetsFolderValue (settings, Ids::customXcassetsFolder, project.getUndoManagerFor (settings)), + microphonePermissionNeededValue (settings, Ids::microphonePermissionNeeded, project.getUndoManagerFor (settings)), + uiFileSharingEnabledValue (settings, Ids::uiFileSharingEnabled, project.getUndoManagerFor (settings)), + uiSupportsDocumentBrowserValue (settings, Ids::uiSupportsDocumentBrowser, project.getUndoManagerFor (settings)), + uiStatusBarHiddenValue (settings, Ids::uiStatusBarHidden, project.getUndoManagerFor (settings)), + documentExtensionsValue (settings, Ids::documentExtensions, project.getUndoManagerFor (settings)), + iosInAppPurchasesValue (settings, Ids::iosInAppPurchases, project.getUndoManagerFor (settings)), + iosBackgroundAudioValue (settings, Ids::iosBackgroundAudio, project.getUndoManagerFor (settings)), + iosBackgroundBleValue (settings, Ids::iosBackgroundBle, project.getUndoManagerFor (settings)), + iosPushNotificationsValue (settings, Ids::iosPushNotifications, project.getUndoManagerFor (settings)), + iosAppGroupsValue (settings, Ids::iosAppGroups, project.getUndoManagerFor (settings)), + iCloudPermissionsValue (settings, Ids::iCloudPermissions, project.getUndoManagerFor (settings)), + iosDevelopmentTeamIDValue (settings, Ids::iosDevelopmentTeamID, project.getUndoManagerFor (settings)), + iosAppGroupsIDValue (settings, Ids::iosAppGroupsId, project.getUndoManagerFor (settings)), + keepCustomXcodeSchemesValue (settings, Ids::keepCustomXcodeSchemes, project.getUndoManagerFor (settings)), + useHeaderMapValue (settings, Ids::useHeaderMap, project.getUndoManagerFor (settings)) { name = iOS ? getNameiOS() : getNameMac(); - if (getTargetLocationString().isEmpty()) - getTargetLocationValue() = getDefaultBuildsRootFolder() + (iOS ? "iOS" : "MacOSX"); - - if (iOS) - { - if (getiPhoneScreenOrientationValue().toString().isEmpty()) - getiPhoneScreenOrientationValue() = "portraitlandscape"; - - if (getiPadScreenOrientationValue().toString().isEmpty()) - getiPadScreenOrientationValue() = getiPhoneScreenOrientationString(); - - if (getDeviceFamilyValue().toString().isEmpty()) - getDeviceFamilyValue() = "1,2"; - } + targetLocationValue.setDefault (getDefaultBuildsRootFolder() + (iOS ? "iOS" : "MacOSX")); } static XcodeProjectExporter* createForSettings (Project& project, const ValueTree& settings) @@ -84,62 +100,37 @@ public: } //============================================================================== - Value getPListToMergeValue() { return getSetting ("customPList"); } - String getPListToMergeString() const { return settings ["customPList"]; } + String getPListToMergeString() const { return customPListValue.get(); } + String getPListPrefixHeaderString() const { return pListPrefixHeaderValue.get(); } + bool isPListPreprocessEnabled() const { return pListPreprocessValue.get(); } - Value getPListPrefixHeaderValue() { return getSetting ("PListPrefixHeader"); } - String getPListPrefixHeaderString() const { return settings ["PListPrefixHeader"]; } + String getExtraFrameworksString() const { return extraFrameworksValue.get(); } - Value getPListPreprocessValue() { return getSetting ("PListPreprocess"); } - bool isPListPreprocessEnabled() const { return settings ["PListPreprocess"]; } + String getPostBuildScript() const { return postbuildCommandValue.get(); } + String getPreBuildScript() const { return prebuildCommandValue.get(); } - Value getExtraFrameworksValue() { return getSetting (Ids::extraFrameworks); } - String getExtraFrameworksString() const { return settings [Ids::extraFrameworks]; } + bool shouldDuplicateResourcesFolderForAppExtension() const { return iosAppExtensionDuplicateResourcesFolderValue.get(); } - Value getPostBuildScriptValue() { return getSetting (Ids::postbuildCommand); } - String getPostBuildScript() const { return settings [Ids::postbuildCommand]; } + String getDeviceFamilyString() const { return iosDeviceFamilyValue.get(); } - Value getPreBuildScriptValue() { return getSetting (Ids::prebuildCommand); } - String getPreBuildScript() const { return settings [Ids::prebuildCommand]; } + String getiPhoneScreenOrientationString() const { return iPhoneScreenOrientationValue.get(); } + String getiPadScreenOrientationString() const { return iPadScreenOrientationValue.get(); } - Value getDuplicateResourcesFolderForAppExtensionValue() { return getSetting (Ids::iosAppExtensionDuplicateResourcesFolder); } - bool shouldDuplicateResourcesFolderForAppExtension() const { return settings [Ids::iosAppExtensionDuplicateResourcesFolder]; } + String getCustomResourceFoldersString() const { return customXcodeResourceFoldersValue.get().toString().replaceCharacters ("\r\n", "::"); } + String getCustomXcassetsFolderString() const { return customXcassetsFolderValue.get(); } - Value getDeviceFamilyValue() { return getSetting (Ids::iosDeviceFamily); } - String getDeviceFamilyString() const { return settings [Ids::iosDeviceFamily]; } + bool isMicrophonePermissionEnabled() const { return microphonePermissionNeededValue.get(); } + bool isInAppPurchasesEnabled() const { return iosInAppPurchasesValue.get(); } + bool isBackgroundAudioEnabled() const { return iosBackgroundAudioValue.get(); } + bool isBackgroundBleEnabled() const { return iosBackgroundBleValue.get(); } + bool isPushNotificationsEnabled() const { return iosPushNotificationsValue.get(); } + bool isAppGroupsEnabled() const { return iosAppGroupsValue.get(); } + bool isiCloudPermissionsEnabled() const { return iCloudPermissionsValue.get(); } - Value getiPhoneScreenOrientationValue() { return getSetting (Ids::iPhoneScreenOrientation); } - String getiPhoneScreenOrientationString() const { return settings [Ids::iPhoneScreenOrientation]; } - - Value getiPadScreenOrientationValue() { return getSetting (Ids::iPadScreenOrientation); } - String getiPadScreenOrientationString() const { return settings [Ids::iPadScreenOrientation]; } - - Value getCustomResourceFoldersValue() { return getSetting (Ids::customXcodeResourceFolders); } - String getCustomResourceFoldersString() const { return getSettingString (Ids::customXcodeResourceFolders).replaceCharacters ("\r\n", "::"); } - - Value getCustomXcassetsFolderValue() { return getSetting (Ids::customXcassetsFolder); } - String getCustomXcassetsFolderString() const { return settings [Ids::customXcassetsFolder]; } - - Value getMicrophonePermissionValue() { return getSetting (Ids::microphonePermissionNeeded); } - bool isMicrophonePermissionEnabled() const { return settings [Ids::microphonePermissionNeeded]; } - Value getInAppPurchasesValue() { return getSetting (Ids::iosInAppPurchases); } - bool isInAppPurchasesEnabled() const { return settings [Ids::iosInAppPurchases]; } - Value getBackgroundAudioValue() { return getSetting (Ids::iosBackgroundAudio); } - bool isBackgroundAudioEnabled() const { return settings [Ids::iosBackgroundAudio]; } - Value getBackgroundBleValue() { return getSetting (Ids::iosBackgroundBle); } - bool isBackgroundBleEnabled() const { return settings [Ids::iosBackgroundBle]; } - Value getPushNotificationsValue() { return getSetting (Ids::iosPushNotifications); } - bool isPushNotificationsEnabled() const { return settings [Ids::iosPushNotifications]; } - Value getAppGroupsEnabledValue() { return getSetting (Ids::iosAppGroups); } - bool isAppGroupsEnabled() const { return settings [Ids::iosAppGroups]; } - Value getiCloudPermissionsEnabled() { return getSetting (Ids::iCloudPermissions); } - bool isiCloudPermissionsEnabled() const { return settings [Ids::iCloudPermissions]; } - - Value getIosDevelopmentTeamIDValue() { return getSetting (Ids::iosDevelopmentTeamID); } - String getIosDevelopmentTeamIDString() const { return settings [Ids::iosDevelopmentTeamID]; } - Value getAppGroupIdValue() { return getSetting (Ids::iosAppGroupsId); } - String getAppGroupIdString() const { return settings [Ids::iosAppGroupsId]; } + String getIosDevelopmentTeamIDString() const { return iosDevelopmentTeamIDValue.get(); } + String getAppGroupIdString() const { return iosAppGroupsIDValue.get(); } + //============================================================================== bool usesMMFiles() const override { return true; } bool canCopeWithDuplicateFiles() override { return true; } bool supportsUserDefinedConfigurations() const override { return true; } @@ -187,12 +178,12 @@ public: { if (iOS) { - props.add (new TextPropertyComponent (getCustomXcassetsFolderValue(), "Custom Xcassets folder", 128, false), + props.add (new TextPropertyComponent (customXcassetsFolderValue, "Custom Xcassets Folder", 128, false), "If this field is not empty, your Xcode project will use the custom xcassets folder specified here " "for the app icons and launchimages, and will ignore the Icon files specified above."); } - props.add (new TextPropertyComponent (getCustomResourceFoldersValue(), "Custom Xcode Resource folders", 8192, true), + props.add (new TextPropertyComponent (customXcodeResourceFoldersValue, "Custom Xcode Resource Folders", 8192, true), "You can specify a list of custom resource folders here (separated by newlines or whitespace). " "References to these folders will then be added to the Xcode resources. " "This way you can specify them for OS X and iOS separately, and modify the content of the resource folders " @@ -201,105 +192,109 @@ public: if (iOS) { if (getProject().getProjectType().isAudioPlugin()) - props.add (new BooleanPropertyComponent (getDuplicateResourcesFolderForAppExtensionValue(), - "Add resources folder to app extension", "Enabled"), - "Enable this to create a resources folder for AUv3 app extensions."); + props.add (new ChoicePropertyComponent (iosAppExtensionDuplicateResourcesFolderValue, + "Don't Add Resources Folder to App Extension"), + "Enable this to prevent the Projucer from creating a resources folder for AUv3 app extensions."); - static const char* deviceFamilies[] = { "iPhone", "iPad", "Universal", nullptr}; - static const char* deviceFamilyValues[] = { "1", "2", "1,2" }; - props.add (new ChoicePropertyComponent (getDeviceFamilyValue(), "Device Family", StringArray (deviceFamilies), Array (deviceFamilyValues)), + props.add (new ChoicePropertyComponent (iosDeviceFamilyValue, "Device Family", + { "iPhone", "iPad", "Universal" }, + { "1", "2", "1,2" }), "The device family to target."); - static const char* iOSOrientations[] = { "Portrait and Landscape", "Portrait", "Landscape", nullptr }; - static const char* orientationValues[] = { "portraitlandscape", "portrait", "landscape", nullptr }; + { + StringArray orientationStrings { "Portrait and Landscape", "Portrait", "Landscape" }; + Array orientationValues { "portraitlandscape", "portrait", "landscape"}; - props.add (new ChoicePropertyComponent (getiPhoneScreenOrientationValue(), "iPhone Screen orientation", StringArray (iOSOrientations), Array (orientationValues)), - "The screen orientations that this app should support on iPhones."); + props.add (new ChoicePropertyComponent (iPhoneScreenOrientationValue, "iPhone Screen Orientation", + orientationStrings, orientationValues), + "The screen orientations that this app should support on iPhones."); - props.add (new ChoicePropertyComponent (getiPadScreenOrientationValue(), "iPad Screen orientation", StringArray (iOSOrientations), Array (orientationValues)), - "The screen orientations that this app should support on iPad."); + props.add (new ChoicePropertyComponent (iPadScreenOrientationValue, "iPad Screen Orientation", + orientationStrings, orientationValues), + "The screen orientations that this app should support on iPads."); + } - props.add (new BooleanPropertyComponent (getSetting ("UIFileSharingEnabled"), "File Sharing Enabled", "Enabled"), + props.add (new ChoicePropertyComponent (uiFileSharingEnabledValue, "File Sharing Enabled"), "Enable this to expose your app's files to iTunes."); - props.add (new BooleanPropertyComponent (getSetting ("UISupportsDocumentBrowser"), "Support Document Browser", "Enabled"), + props.add (new ChoicePropertyComponent (uiSupportsDocumentBrowserValue, "Support Document Browser"), "Enable this to allow the user to access your app documents from a native file chooser."); - props.add (new BooleanPropertyComponent (getSetting ("UIStatusBarHidden"), "Status Bar Hidden", "Enabled"), + props.add (new ChoicePropertyComponent (uiStatusBarHiddenValue, "Status Bar Hidden"), "Enable this to disable the status bar in your app."); - props.add (new BooleanPropertyComponent (getMicrophonePermissionValue(), "Microphone access", "Enabled"), + props.add (new ChoicePropertyComponent (microphonePermissionNeededValue, "Microphone Access"), "Enable this to allow your app to use the microphone. " "The user of your app will be prompted to grant microphone access permissions."); } else if (projectType.isGUIApplication()) { - props.add (new TextPropertyComponent (getSetting ("documentExtensions"), "Document file extensions", 128, false), + props.add (new TextPropertyComponent (documentExtensionsValue, "Document File Extensions", 128, false), "A comma-separated list of file extensions for documents that your app can open. " "Using a leading '.' is optional, and the extensions are not case-sensitive."); } - props.add (new BooleanPropertyComponent (getInAppPurchasesValue(), "In-App purchases capability", "Enabled"), + props.add (new ChoicePropertyComponent (iosInAppPurchasesValue, "In-App Purchases Capability"), "Enable this to grant your app the capability for in-app purchases. " "This option requires that you specify a valid Development Team ID."); if (iOS) { - props.add (new BooleanPropertyComponent (getBackgroundAudioValue(), "Audio background capability", "Enabled"), + props.add (new ChoicePropertyComponent (iosBackgroundAudioValue, "Audio Background Capability"), "Enable this to grant your app the capability to access audio when in background mode."); - props.add (new BooleanPropertyComponent (getBackgroundBleValue(), "Bluetooth MIDI background capability", "Enabled"), + props.add (new ChoicePropertyComponent (iosBackgroundBleValue, "Bluetooth MIDI Background Capability"), "Enable this to grant your app the capability to connect to Bluetooth LE devices when in background mode."); - props.add (new BooleanPropertyComponent (getAppGroupsEnabledValue(), "App groups capability", "Enabled"), + props.add (new ChoicePropertyComponent (iosAppGroupsValue, "App Groups Capability"), "Enable this to grant your app the capability to share resources between apps using the same app group ID."); - props.add (new BooleanPropertyComponent (getiCloudPermissionsEnabled(), "iCloud Permissions", "Enabled"), + props.add (new ChoicePropertyComponent (iCloudPermissionsValue, "iCloud Permissions"), "Enable this to grant your app the capability to use native file load/save browser windows on iOS."); } - props.add (new BooleanPropertyComponent (getPushNotificationsValue(), "Push Notifications capability", "Enabled"), + props.add (new ChoicePropertyComponent (iosPushNotificationsValue, "Push Notifications Capability"), "Enable this to grant your app the capability to receive push notifications."); - props.add (new TextPropertyComponent (getPListToMergeValue(), "Custom PList", 8192, true), + props.add (new TextPropertyComponent (customPListValue, "Custom PList", 8192, true), "You can paste the contents of an XML PList file in here, and the settings that it contains will override any " "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"), + props.add (new ChoicePropertyComponent (pListPreprocessValue, "PList Preprocess"), "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), + props.add (new TextPropertyComponent (pListPrefixHeaderValue, "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), + props.add (new TextPropertyComponent (extraFrameworksValue, "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)"); - props.add (new TextPropertyComponent (getPreBuildScriptValue(), "Pre-build shell script", 32768, true), + props.add (new TextPropertyComponent (prebuildCommandValue, "Pre-Build Shell Script", 32768, true), "Some shell-script that will be run before a build starts."); - props.add (new TextPropertyComponent (getPostBuildScriptValue(), "Post-build shell script", 32768, true), + props.add (new TextPropertyComponent (postbuildCommandValue, "Post-Build Shell Script", 32768, true), "Some shell-script that will be run after a build completes."); - props.add (new TextPropertyComponent (getIosDevelopmentTeamIDValue(), "Development Team ID", 10, false), + props.add (new TextPropertyComponent (iosDevelopmentTeamIDValue, "Development Team ID", 10, false), "The Development Team ID to be used for setting up code-signing your iOS app. This is a ten-character " "string (for example, \"S7B6T5XJ2Q\") that describes the distribution certificate Apple issued to you. " "You can find this string in the OS X app Keychain Access under \"Certificates\"."); if (iOS) - props.add (new TextPropertyComponentWithEnablement (getAppGroupIdValue(), getAppGroupsEnabledValue(), "App Group ID", 256, false), + props.add (new TextPropertyComponentWithEnablement (iosAppGroupsIDValue, iosAppGroupsValue.getPropertyAsValue(), "App Group ID", 256, false), "The App Group ID to be used for allowing multiple apps to access a shared resource folder. Multiple IDs can be " "added separated by a semicolon."); - props.add (new BooleanPropertyComponent (getSetting ("keepCustomXcodeSchemes"), "Keep custom Xcode schemes", "Enabled"), + props.add (new ChoicePropertyComponent (keepCustomXcodeSchemesValue, "Keep Custom Xcode Schemes"), "Enable this to keep any Xcode schemes you have created for debugging or running, e.g. to launch a plug-in in" "various hosts. If disabled, all schemes are replaced by a default set."); - props.add (new BooleanPropertyComponent (getSetting ("useHeaderMap"), "USE_HEADERMAP", "Enabled"), + props.add (new ChoicePropertyComponent (useHeaderMapValue, "USE_HEADERMAP"), "Enable this to make Xcode search all the projects folders for include files. This means you can be lazy " "and not bother using relative paths to include your headers, but it means your code won't be " "compatible with other build systems"); @@ -384,7 +379,7 @@ public: if (AlertWindow::showOkCancelBox (AlertWindow::WarningIcon, "Project settings: " + project.getDocumentTitle(), alertWindowText, "Update", "Cancel", nullptr, nullptr)) - getPostBuildScriptValue() = var(); + postbuildCommandValue.resetToDefault(); } } @@ -410,38 +405,30 @@ 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), - plistPreprocessorDefinitions (config, Ids::plistPreprocessorDefinitions, nullptr), - cppStandardLibrary (config, Ids::cppLibType, nullptr), - codeSignIdentity (config, Ids::codeSigningIdentity, nullptr, iOS ? "iPhone Developer" : "Mac Developer"), - fastMathEnabled (config, Ids::fastMath, nullptr), - stripLocalSymbolsEnabled (config, Ids::stripLocalSymbols, nullptr), - pluginBinaryCopyStepEnabled (config, Ids::enablePluginBinaryCopyStep, nullptr), - vstBinaryLocation (config, Ids::vstBinaryLocation, nullptr, "$(HOME)/Library/Audio/Plug-Ins/VST/"), - vst3BinaryLocation (config, Ids::vst3BinaryLocation, nullptr, "$(HOME)/Library/Audio/Plug-Ins/VST3/"), - auBinaryLocation (config, Ids::auBinaryLocation, nullptr, "$(HOME)/Library/Audio/Plug-Ins/Components/"), - rtasBinaryLocation (config, Ids::rtasBinaryLocation, nullptr, "/Library/Application Support/Digidesign/Plug-Ins/"), - aaxBinaryLocation (config, Ids::aaxBinaryLocation, nullptr, "/Library/Application Support/Avid/Audio/Plug-Ins/") + osxSDKVersion (config, Ids::osxSDK, getUndoManager(), String (osxVersionDefault) + " SDK"), + osxDeploymentTarget (config, Ids::osxCompatibility, getUndoManager(), String (osxVersionDefault) + " SDK"), + iosDeploymentTarget (config, Ids::iosCompatibility, getUndoManager(), iosVersionDefault), + osxArchitecture (config, Ids::osxArchitecture, getUndoManager(), osxArch_Default), + customXcodeFlags (config, Ids::customXcodeFlags, getUndoManager()), + plistPreprocessorDefinitions (config, Ids::plistPreprocessorDefinitions, getUndoManager()), + cppStandardLibrary (config, Ids::cppLibType, getUndoManager()), + codeSignIdentity (config, Ids::codeSigningIdentity, getUndoManager(), iOS ? "iPhone Developer" : "Mac Developer"), + fastMathEnabled (config, Ids::fastMath, getUndoManager()), + stripLocalSymbolsEnabled (config, Ids::stripLocalSymbols, getUndoManager()), + pluginBinaryCopyStepEnabled (config, Ids::enablePluginBinaryCopyStep, getUndoManager(), true), + vstBinaryLocation (config, Ids::vstBinaryLocation, getUndoManager(), "$(HOME)/Library/Audio/Plug-Ins/VST/"), + vst3BinaryLocation (config, Ids::vst3BinaryLocation, getUndoManager(), "$(HOME)/Library/Audio/Plug-Ins/VST3/"), + auBinaryLocation (config, Ids::auBinaryLocation, getUndoManager(), "$(HOME)/Library/Audio/Plug-Ins/Components/"), + rtasBinaryLocation (config, Ids::rtasBinaryLocation, getUndoManager(), "/Library/Application Support/Digidesign/Plug-Ins/"), + aaxBinaryLocation (config, Ids::aaxBinaryLocation, getUndoManager(), "/Library/Application Support/Avid/Audio/Plug-Ins/") { - setValueIfVoid (pluginBinaryCopyStepEnabled.getPropertyAsValue(), true); updateOldPluginBinaryLocations(); + updateOldSDKDefaults(); + + optimisationLevelValue.setDefault (isDebug() ? gccO0 : gccO3); } //========================================================================== - bool iOS; - - CachedValue osxSDKVersion, osxDeploymentTarget, iosDeploymentTarget, osxArchitecture, - customXcodeFlags, plistPreprocessorDefinitions, cppStandardLibrary, codeSignIdentity; - CachedValue fastMathEnabled, stripLocalSymbolsEnabled, pluginBinaryCopyStepEnabled; - CachedValue vstBinaryLocation, vst3BinaryLocation, auBinaryLocation, rtasBinaryLocation, aaxBinaryLocation; - - //========================================================================== - var getDefaultOptimisationLevel() const override { return var ((int) (isDebug() ? gccO0 : gccO3)); } - void createConfigProperties (PropertyListBuilder& props) override { addXcodePluginInstallPathProperties (props); @@ -449,11 +436,13 @@ protected: if (iOS) { - const char* iosVersions[] = { "Use Default", "7.0", "7.1", "8.0", "8.1", "8.2", "8.3", "8.4", "9.0", "9.1", "9.2", "9.3", "10.0", "10.1", "10.2", "10.3", "11.0", nullptr }; - const char* iosVersionValues[] = { osxVersionDefault, "7.0", "7.1", "8.0", "8.1", "8.2", "8.3", "8.4", "9.0", "9.1", "9.2", "9.3", "10.0", "10.1", "10.2", "10.3", "11.0", nullptr }; - - props.add (new ChoicePropertyComponent (iosDeploymentTarget.getPropertyAsValue(), "iOS Deployment Target", - StringArray (iosVersions), Array (iosVersionValues)), + props.add (new ChoicePropertyComponent (iosDeploymentTarget, "iOS Deployment Target", + { "7.0", "7.1", "8.0", "8.1", "8.2", "8.3", "8.4", + "9.0", "9.1", "9.2", "9.3", "10.0", "10.1", "10.2", "10.3", + "11.0" }, + { "7.0", "7.1", "8.0", "8.1", "8.2", "8.3", "8.4", + "9.0", "9.1", "9.2", "9.3", "10.0", "10.1", "10.2", "10.3", + "11.0" }), "The minimum version of iOS that the target binary will run on."); } else @@ -461,10 +450,6 @@ protected: StringArray sdkVersionNames, osxVersionNames; Array versionValues; - sdkVersionNames.add ("Use Default"); - osxVersionNames.add ("Use Default"); - versionValues.add (osxVersionDefault); - for (int ver = oldestSDKVersion; ver <= currentSDKVersion; ++ver) { sdkVersionNames.add (getSDKName (ver)); @@ -472,46 +457,37 @@ protected: versionValues.add (getSDKName (ver)); } - props.add (new ChoicePropertyComponent (osxSDKVersion.getPropertyAsValue(), "OSX Base SDK Version", sdkVersionNames, versionValues), + props.add (new ChoicePropertyComponent (osxSDKVersion, "OSX Base SDK Version", sdkVersionNames, versionValues), "The version of OSX to link against in the Xcode build."); - props.add (new ChoicePropertyComponent (osxDeploymentTarget.getPropertyAsValue(), "OSX Deployment Target", osxVersionNames, versionValues), + props.add (new ChoicePropertyComponent (osxDeploymentTarget, "OSX Deployment Target", osxVersionNames, versionValues), "The minimum version of OSX that the target binary will be compatible with."); - const char* osxArch[] = { "Use Default", "Native architecture of build machine", - "Universal Binary (32-bit)", "Universal Binary (32/64-bit)", "64-bit Intel", 0 }; - const char* osxArchValues[] = { osxArch_Default, osxArch_Native, osxArch_32BitUniversal, - osxArch_64BitUniversal, osxArch_64Bit, 0 }; - - props.add (new ChoicePropertyComponent (osxArchitecture.getPropertyAsValue(), "OSX Architecture", - StringArray (osxArch), Array (osxArchValues)), + props.add (new ChoicePropertyComponent (osxArchitecture, "OSX Architecture", + { "Native architecture of build machine", "Universal Binary (32-bit)", "Universal Binary (32/64-bit)", "64-bit Intel" }, + { osxArch_Native, osxArch_32BitUniversal, osxArch_64BitUniversal, osxArch_64Bit }), "The type of OSX binary that will be produced."); } - props.add (new TextPropertyComponent (customXcodeFlags.getPropertyAsValue(), "Custom Xcode flags", 8192, false), + props.add (new TextPropertyComponent (customXcodeFlags, "Custom Xcode Flags", 8192, false), "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), + props.add (new TextPropertyComponent (plistPreprocessorDefinitions, "PList Preprocessor Definitions", 2048, true), "Preprocessor definitions used during PList preprocessing (see PList Preprocess)."); - { - static const char* cppLibNames[] = { "Use Default", "LLVM libc++", "GNU libstdc++", nullptr }; - static const var cppLibValues[] = { var(), "libc++", "libstdc++" }; + props.add (new ChoicePropertyComponent (cppStandardLibrary, "C++ Library", + { "LLVM libc++", "GNU libstdc++" }, + { "libc++", "libstdc++" }), + "The type of C++ std lib that will be linked."); - props.add (new ChoicePropertyComponent (cppStandardLibrary.getPropertyAsValue(), "C++ Library", - StringArray (cppLibNames), - Array (cppLibValues, numElementsInArray (cppLibValues))), - "The type of C++ std lib that will be linked."); - } - - props.add (new TextWithDefaultPropertyComponent (codeSignIdentity, "Code-signing Identity", 1024), + props.add (new TextPropertyComponent (codeSignIdentity, "Code-Signing Identity", 1024, false), "The name of a code-signing identity for Xcode to apply."); - props.add (new BooleanPropertyComponent (fastMathEnabled.getPropertyAsValue(), "Relax IEEE compliance", "Enabled"), + props.add (new ChoicePropertyComponent (fastMathEnabled, "Relax IEEE Compliance"), "Enable this to use FAST_MATH non-IEEE mode. (Warning: this can have unexpected results!)"); - props.add (new BooleanPropertyComponent (stripLocalSymbolsEnabled.getPropertyAsValue(), "Strip local symbols", "Enabled"), + props.add (new ChoicePropertyComponent (stripLocalSymbolsEnabled, "Strip Local Symbols"), "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."); } @@ -521,7 +497,42 @@ protected: return "${CURRENT_ARCH}"; } + //========================================================================== + String getOSXArchitectureString() const { return osxArchitecture.get(); } + String getPListPreprocessorDefinitionsString() const { return plistPreprocessorDefinitions.get(); } + + bool isFastMathEnabled() const { return fastMathEnabled.get(); } + + String getCPPStandardLibraryString() const { return cppStandardLibrary.get(); } + + bool isStripLocalSymbolsEnabled() const { return stripLocalSymbolsEnabled.get(); } + + String getCustomXcodeFlagsString() const { return customXcodeFlags.get(); } + + String getOSXSDKVersionString() const { return osxSDKVersion.get(); } + String getOSXDeploymentTargetString() const { return osxDeploymentTarget.get(); } + + String getCodeSignIdentityString() const { return codeSignIdentity.get(); } + bool isUsingDefaultCodeSignIdentity() const { return codeSignIdentity.isUsingDefault(); } + + String getiOSDeploymentTargetString() const { return iosDeploymentTarget.get(); } + + bool isPluginBinaryCopyStepEnabled() const { return pluginBinaryCopyStepEnabled.get(); } + String getVSTBinaryLocationString() const { return vstBinaryLocation.get(); } + String getVST3BinaryLocationString() const { return vst3BinaryLocation.get(); } + String getAUBinaryLocationString() const { return auBinaryLocation.get(); } + String getRTASBinaryLocationString() const { return rtasBinaryLocation.get();} + String getAAXBinaryLocationString() const { return aaxBinaryLocation.get();} + private: + //========================================================================== + bool iOS; + + ValueWithDefault osxSDKVersion, osxDeploymentTarget, iosDeploymentTarget, osxArchitecture, + customXcodeFlags, plistPreprocessorDefinitions, cppStandardLibrary, codeSignIdentity, + fastMathEnabled, stripLocalSymbolsEnabled, pluginBinaryCopyStepEnabled, + vstBinaryLocation, vst3BinaryLocation, auBinaryLocation, rtasBinaryLocation, aaxBinaryLocation; + //========================================================================== void addXcodePluginInstallPathProperties (PropertyListBuilder& props) { @@ -529,33 +540,32 @@ protected: || project.shouldBuildRTAS() || project.shouldBuildAAX()); if (isBuildingAnyPlugins) - props.add (new BooleanPropertyComponent (pluginBinaryCopyStepEnabled.getPropertyAsValue(), - "Enable Plugin Copy Step", "Enabled"), + props.add (new ChoicePropertyComponent (pluginBinaryCopyStepEnabled, "Enable Plugin Copy Step"), "Enable this to copy plugin binaries to the specified folder after building."); if (project.shouldBuildVST()) - props.add (new TextWithDefaultPropertyComponentWithEnablement (vstBinaryLocation, pluginBinaryCopyStepEnabled.getPropertyAsValue(), - "VST Binary Location", 1024), + props.add (new TextPropertyComponentWithEnablement (vstBinaryLocation, pluginBinaryCopyStepEnabled.getPropertyAsValue(), + "VST Binary Location", 1024, false), "The folder in which the compiled VST binary should be placed."); if (project.shouldBuildVST3()) - props.add (new TextWithDefaultPropertyComponentWithEnablement (vst3BinaryLocation, pluginBinaryCopyStepEnabled.getPropertyAsValue(), - "VST3 Binary Location", 1024), + props.add (new TextPropertyComponentWithEnablement (vst3BinaryLocation, pluginBinaryCopyStepEnabled.getPropertyAsValue(), + "VST3 Binary Location", 1024, false), "The folder in which the compiled VST3 binary should be placed."); if (project.shouldBuildAU()) - props.add (new TextWithDefaultPropertyComponentWithEnablement (auBinaryLocation, pluginBinaryCopyStepEnabled.getPropertyAsValue(), - "AU Binary Location", 1024), + props.add (new TextPropertyComponentWithEnablement (auBinaryLocation, pluginBinaryCopyStepEnabled.getPropertyAsValue(), + "AU Binary Location", 1024, false), "The folder in which the compiled AU binary should be placed."); if (project.shouldBuildRTAS()) - props.add (new TextWithDefaultPropertyComponentWithEnablement (rtasBinaryLocation, pluginBinaryCopyStepEnabled.getPropertyAsValue(), - "RTAS Binary Location", 1024), + props.add (new TextPropertyComponentWithEnablement (rtasBinaryLocation, pluginBinaryCopyStepEnabled.getPropertyAsValue(), + "RTAS Binary Location", 1024, false), "The folder in which the compiled RTAS binary should be placed."); if (project.shouldBuildAAX()) - props.add (new TextWithDefaultPropertyComponentWithEnablement (aaxBinaryLocation, pluginBinaryCopyStepEnabled.getPropertyAsValue(), - "AAX Binary Location", 1024), + props.add (new TextPropertyComponentWithEnablement (aaxBinaryLocation, pluginBinaryCopyStepEnabled.getPropertyAsValue(), + "AAX Binary Location", 1024, false), "The folder in which the compiled AAX binary should be placed."); } @@ -567,6 +577,14 @@ protected: if (! config ["xcodeRtasBinaryLocation"].isVoid()) rtasBinaryLocation = config ["xcodeRtasBinaryLocation"]; if (! config ["xcodeAaxBinaryLocation"].isVoid()) aaxBinaryLocation = config ["xcodeAaxBinaryLocation"]; } + + void updateOldSDKDefaults() + { + if (iosDeploymentTarget.get() == "default") iosDeploymentTarget.resetToDefault(); + if (osxArchitecture.get() == "default") osxArchitecture.resetToDefault(); + if (osxSDKVersion.get() == "default") osxSDKVersion.resetToDefault(); + if (osxDeploymentTarget.get() == "default") osxDeploymentTarget.resetToDefault(); + } }; BuildConfiguration::Ptr createBuildConfig (const ValueTree& v) const override @@ -929,7 +947,7 @@ public: String getBundleIdentifier() const { - String bundleIdentifier = owner.project.getBundleIdentifier().toString(); + auto bundleIdentifier = owner.project.getBundleIdentifierString(); if (xcodeBundleIDSubPath.isNotEmpty()) { @@ -963,8 +981,10 @@ public: s.set ("PRODUCT_BUNDLE_IDENTIFIER", getBundleIdentifier()); - const String arch ((! owner.isiOS() && type == Target::AudioUnitv3PlugIn) ? osxArch_64Bit : config.osxArchitecture.get()); - if (arch == osxArch_Native) s.set ("ARCHS", "\"$(NATIVE_ARCH_ACTUAL)\""); + auto arch = (! owner.isiOS() && type == Target::AudioUnitv3PlugIn) ? osxArch_64Bit + : config.getOSXArchitectureString(); + + if (arch == osxArch_Native) s.set ("ARCHS", "\"$(NATIVE_ARCH_ACTUAL)\""); else if (arch == osxArch_32BitUniversal) s.set ("ARCHS", "\"$(ARCHS_STANDARD_32_BIT)\""); else if (arch == osxArch_64BitUniversal) s.set ("ARCHS", "\"$(ARCHS_STANDARD_32_64_BIT)\""); else if (arch == osxArch_64Bit) s.set ("ARCHS", "\"$(ARCHS_STANDARD_64_BIT)\""); @@ -983,7 +1003,7 @@ public: s.set ("INFOPLIST_PREPROCESS", (owner.isPListPreprocessEnabled() ? String ("YES") : String ("NO"))); - auto plistDefs = parsePreprocessorDefs (config.plistPreprocessorDefinitions.get()); + auto plistDefs = parsePreprocessorDefs (config.getPListPreprocessorDefinitionsString()); StringArray defsList; for (int i = 0; i < plistDefs.size(); ++i) @@ -1004,7 +1024,7 @@ public: if (config.isLinkTimeOptimisationEnabled()) s.set ("LLVM_LTO", "YES"); - if (config.fastMathEnabled.get()) + if (config.isFastMathEnabled()) s.set ("GCC_FAST_MATH", "YES"); const String extraFlags (owner.replacePreprocessorTokens (config, owner.getExtraCompilerFlagsString()).trim()); @@ -1075,7 +1095,7 @@ public: if (isUsingCodeSigning (config)) { s.set (owner.iOS ? "\"CODE_SIGN_IDENTITY[sdk=iphoneos*]\"" : "CODE_SIGN_IDENTITY", - getCodeSignIdentity (config).quoted()); + config.getCodeSignIdentityString().quoted()); s.set ("PROVISIONING_PROFILE_SPECIFIER", "\"\""); } @@ -1086,7 +1106,7 @@ public: s.set ("CODE_SIGN_ENTITLEMENTS", owner.getEntitlementsFileName().quoted()); { - auto cppStandard = owner.project.getCppStandardValue().toString(); + auto cppStandard = owner.project.getCppStandardString(); if (cppStandard == "latest") cppStandard = "1z"; @@ -1095,8 +1115,8 @@ public: : "c++") + cppStandard).quoted()); } - if (config.cppStandardLibrary.get().isNotEmpty()) - s.set ("CLANG_CXX_LIBRARY", config.cppStandardLibrary.get().quoted()); + if (config.getCPPStandardLibraryString().isNotEmpty()) + s.set ("CLANG_CXX_LIBRARY", config.getCPPStandardLibraryString().quoted()); s.set ("COMBINE_HIDPI_IMAGES", "YES"); @@ -1140,7 +1160,7 @@ public: } if (type != Target::SharedCodeTarget && type != Target::StaticLibrary && type != Target::DynamicLibrary - && config.stripLocalSymbolsEnabled.get()) + && config.isStripLocalSymbolsEnabled()) { s.set ("STRIPFLAGS", "\"-x\""); s.set ("DEPLOYMENT_POSTPROCESSING", "YES"); @@ -1170,7 +1190,7 @@ public: s.set ("GCC_PREPROCESSOR_DEFINITIONS", indentParenthesisedList (defsList)); StringArray customFlags; - customFlags.addTokens (config.customXcodeFlags.get(), ",", "\"'"); + customFlags.addTokens (config.getCustomXcodeFlagsString(), ",", "\"'"); customFlags.removeEmptyStrings(); for (auto flag : customFlags) @@ -1188,11 +1208,11 @@ public: { case GUIApp: return "$(HOME)/Applications"; case ConsoleApp: return "/usr/bin"; - case VSTPlugIn: return config.pluginBinaryCopyStepEnabled.get() ? config.vstBinaryLocation.get() : String(); - case VST3PlugIn: return config.pluginBinaryCopyStepEnabled.get() ? config.vst3BinaryLocation.get() : String(); - case AudioUnitPlugIn: return config.pluginBinaryCopyStepEnabled.get() ? config.auBinaryLocation.get() : String(); - case RTASPlugIn: return config.pluginBinaryCopyStepEnabled.get() ? config.rtasBinaryLocation.get() : String(); - case AAXPlugIn: return config.pluginBinaryCopyStepEnabled.get() ? config.aaxBinaryLocation.get() : String(); + case VSTPlugIn: return config.isPluginBinaryCopyStepEnabled() ? config.getVSTBinaryLocationString() : String(); + case VST3PlugIn: return config.isPluginBinaryCopyStepEnabled() ? config.getVST3BinaryLocationString() : String(); + case AudioUnitPlugIn: return config.isPluginBinaryCopyStepEnabled() ? config.getAUBinaryLocationString() : String(); + case RTASPlugIn: return config.isPluginBinaryCopyStepEnabled() ? config.getRTASBinaryLocationString() : String(); + case AAXPlugIn: return config.isPluginBinaryCopyStepEnabled() ? config.getAAXBinaryLocationString() : String(); case SharedCodeTarget: return owner.isiOS() ? "@executable_path/Frameworks" : "@executable_path/../Frameworks"; default: return {}; } @@ -1277,7 +1297,7 @@ public: addPlistDictionaryKey (dict, "CFBundleSignature", xcodeBundleSignature); addPlistDictionaryKey (dict, "CFBundleShortVersionString", owner.project.getVersionString()); addPlistDictionaryKey (dict, "CFBundleVersion", owner.project.getVersionString()); - addPlistDictionaryKey (dict, "NSHumanReadableCopyright", owner.project.getCompanyCopyright().toString()); + addPlistDictionaryKey (dict, "NSHumanReadableCopyright", owner.project.getCompanyCopyrightString()); addPlistDictionaryKeyBool (dict, "NSHighResolutionCapable", true); StringArray documentExtensions; @@ -1312,13 +1332,13 @@ public: } } - if (owner.settings ["UIFileSharingEnabled"] && type != AudioUnitv3PlugIn) + if (owner.settings [Ids::uiFileSharingEnabled] && type != AudioUnitv3PlugIn) addPlistDictionaryKeyBool (dict, "UIFileSharingEnabled", true); - if (owner.settings ["UISupportsDocumentBrowser"]) + if (owner.settings [Ids::uiSupportsDocumentBrowser]) addPlistDictionaryKeyBool (dict, "UISupportsDocumentBrowser", true); - if (owner.settings ["UIStatusBarHidden"] && type != AudioUnitv3PlugIn) + if (owner.settings [Ids::uiStatusBarHidden] && type != AudioUnitv3PlugIn) addPlistDictionaryKeyBool (dict, "UIStatusBarHidden", true); if (owner.iOS) @@ -1344,9 +1364,9 @@ public: XmlElement* audioComponentsDict = audioComponentsPlistEntry.createNewChildElement ("dict"); addPlistDictionaryKey (audioComponentsDict, "name", owner.project.getIAAPluginName()); - addPlistDictionaryKey (audioComponentsDict, "manufacturer", owner.project.getPluginManufacturerCode().toString().trim().substring (0, 4)); + addPlistDictionaryKey (audioComponentsDict, "manufacturer", owner.project.getPluginManufacturerCodeString().trim().substring (0, 4)); addPlistDictionaryKey (audioComponentsDict, "type", owner.project.getIAATypeCode()); - addPlistDictionaryKey (audioComponentsDict, "subtype", owner.project.getPluginCode().toString().trim().substring (0, 4)); + addPlistDictionaryKey (audioComponentsDict, "subtype", owner.project.getPluginCodeString().trim().substring (0, 4)); addPlistDictionaryKeyInt (audioComponentsDict, "version", owner.project.getVersionAsHexInteger()); dict->addChildElement (new XmlElement (audioComponentsPlistEntry)); @@ -1470,8 +1490,8 @@ public: XmlElement plistEntry ("array"); XmlElement* dict = plistEntry.createNewChildElement ("dict"); - const String pluginManufacturerCode = owner.project.getPluginManufacturerCode().toString().trim().substring (0, 4); - const String pluginSubType = owner.project.getPluginCode() .toString().trim().substring (0, 4); + auto pluginManufacturerCode = owner.project.getPluginManufacturerCodeString().trim().substring (0, 4); + auto pluginSubType = owner.project.getPluginCodeString().trim().substring (0, 4); if (pluginManufacturerCode.toLowerCase() == pluginManufacturerCode) { @@ -1481,10 +1501,10 @@ public: "identifier code."); } - addPlistDictionaryKey (dict, "name", owner.project.getPluginManufacturer().toString() - + ": " + owner.project.getPluginName().toString()); - addPlistDictionaryKey (dict, "description", owner.project.getPluginDesc().toString()); - addPlistDictionaryKey (dict, "factoryFunction", owner.project.getPluginAUExportPrefix().toString() + "Factory"); + addPlistDictionaryKey (dict, "name", owner.project.getPluginManufacturerString() + + ": " + owner.project.getPluginNameString()); + addPlistDictionaryKey (dict, "description", owner.project.getPluginDescriptionString()); + addPlistDictionaryKey (dict, "factoryFunction", owner.project.getPluginAUExportPrefixString() + "Factory"); addPlistDictionaryKey (dict, "manufacturer", pluginManufacturerCode); addPlistDictionaryKey (dict, "type", owner.project.getAUMainTypeCode()); addPlistDictionaryKey (dict, "subtype", pluginSubType); @@ -1506,7 +1526,7 @@ public: XmlElement plistEntry ("dict"); - addPlistDictionaryKey (&plistEntry, "NSExtensionPrincipalClass", owner.project.getPluginAUExportPrefix().toString() + "FactoryAUv3"); + addPlistDictionaryKey (&plistEntry, "NSExtensionPrincipalClass", owner.project.getPluginAUExportPrefixString() + "FactoryAUv3"); addPlistDictionaryKey (&plistEntry, "NSExtensionPointIdentifier", "com.apple.AudioUnit-UI"); plistEntry.createNewChildElement ("key")->addTextElement ("NSExtensionAttributes"); @@ -1516,13 +1536,13 @@ public: XmlElement* componentDict = componentArray->createNewChildElement ("dict"); - addPlistDictionaryKey (componentDict, "name", owner.project.getPluginManufacturer().toString() - + ": " + owner.project.getPluginName().toString()); - addPlistDictionaryKey (componentDict, "description", owner.project.getPluginDesc().toString()); - addPlistDictionaryKey (componentDict, "factoryFunction",owner.project. getPluginAUExportPrefix().toString() + "FactoryAUv3"); - addPlistDictionaryKey (componentDict, "manufacturer", owner.project.getPluginManufacturerCode().toString().trim().substring (0, 4)); + addPlistDictionaryKey (componentDict, "name", owner.project.getPluginManufacturerString() + + ": " + owner.project.getPluginNameString()); + addPlistDictionaryKey (componentDict, "description", owner.project.getPluginDescriptionString()); + addPlistDictionaryKey (componentDict, "factoryFunction",owner.project. getPluginAUExportPrefixString() + "FactoryAUv3"); + addPlistDictionaryKey (componentDict, "manufacturer", owner.project.getPluginManufacturerCodeString().trim().substring (0, 4)); addPlistDictionaryKey (componentDict, "type", owner.project.getAUMainTypeCode()); - addPlistDictionaryKey (componentDict, "subtype", owner.project.getPluginCode().toString().trim().substring (0, 4)); + addPlistDictionaryKey (componentDict, "subtype", owner.project.getPluginCodeString().trim().substring (0, 4)); addPlistDictionaryKeyInt (componentDict, "version", owner.project.getVersionAsHexInteger()); addPlistDictionaryKeyBool (componentDict, "sandboxSafe", true); @@ -1530,7 +1550,7 @@ public: XmlElement* tagsArray = componentDict->createNewChildElement ("array"); tagsArray->createNewChildElement ("string") - ->addTextElement (static_cast (owner.project.getPluginIsSynth().getValue()) ? "Synth" : "Effects"); + ->addTextElement (static_cast (owner.project.isPluginSynth()) ? "Synth" : "Effects"); xcodeExtraPListEntries.add (plistKey); xcodeExtraPListEntries.add (plistEntry); @@ -1610,7 +1630,7 @@ public: { if (auto xcodeConfig = dynamic_cast (&config)) { - const auto& configValue = xcodeConfig->cppStandardLibrary.get(); + auto configValue = xcodeConfig->getCPPStandardLibraryString(); if (configValue.isNotEmpty()) return (configValue == "libc++"); @@ -1627,15 +1647,15 @@ public: String getOSXDeploymentTarget (const XcodeBuildConfiguration& config, String* sdkRoot = nullptr) const { - const String sdk (config.osxSDKVersion.get()); - const String sdkCompat (config.osxDeploymentTarget.get()); + auto sdk = config.getOSXSDKVersionString() + " SDK"; + auto sdkCompat = config.getOSXDeploymentTargetString(); // The AUv3 target always needs to be at least 10.11 int oldestAllowedDeploymentTarget = (type == Target::AudioUnitv3PlugIn ? minimumAUv3SDKVersion : oldestSDKVersion); // if the user doesn't set it, then use the last known version that works well with JUCE - String deploymentTarget = "10.11"; + String deploymentTarget (osxVersionDefault); for (int ver = oldestAllowedDeploymentTarget; ver <= currentSDKVersion; ++ver) { @@ -1646,17 +1666,9 @@ public: return deploymentTarget; } - String getCodeSignIdentity (const XcodeBuildConfiguration& config) const - { - if (config.codeSignIdentity.isUsingDefault()) - return owner.iOS ? "iPhone Developer" : "Mac Developer"; - - return config.codeSignIdentity.get(); - } - bool isUsingCodeSigning (const XcodeBuildConfiguration& config) const { - return (! config.codeSignIdentity.isUsingDefault()) + return (! config.isUsingDefaultCodeSignIdentity()) || owner.getIosDevelopmentTeamIDString().isNotEmpty(); } @@ -1684,6 +1696,13 @@ private: const bool iOS; + ValueWithDefault customPListValue, pListPrefixHeaderValue, pListPreprocessValue, extraFrameworksValue, postbuildCommandValue, + prebuildCommandValue, iosAppExtensionDuplicateResourcesFolderValue, iosDeviceFamilyValue, iPhoneScreenOrientationValue, + iPadScreenOrientationValue, customXcodeResourceFoldersValue, customXcassetsFolderValue, microphonePermissionNeededValue, + uiFileSharingEnabledValue, uiSupportsDocumentBrowserValue, uiStatusBarHiddenValue, documentExtensionsValue, iosInAppPurchasesValue, + iosBackgroundAudioValue, iosBackgroundBleValue, iosPushNotificationsValue, iosAppGroupsValue, iCloudPermissionsValue, + iosDevelopmentTeamIDValue, iosAppGroupsIDValue, keepCustomXcodeSchemesValue, useHeaderMapValue; + static String sanitisePath (const String& path) { if (path.startsWithChar ('~')) @@ -1697,7 +1716,7 @@ private: return s.containsAnyOf (" $") ? s.quoted() : s; } - File getProjectBundle() const { return getTargetFolder().getChildFile (project.getProjectFilenameRoot()).withFileExtension (".xcodeproj"); } + File getProjectBundle() const { return getTargetFolder().getChildFile (project.getProjectFilenameRootString()).withFileExtension (".xcodeproj"); } //============================================================================== void createObjects() const @@ -2251,26 +2270,21 @@ private: { s.set ("ENABLE_TESTABILITY", "YES"); - if (config.osxArchitecture.get() == osxArch_Default || config.osxArchitecture.get().isEmpty()) + if (config.getOSXArchitectureString() == osxArch_Default) s.set ("ONLY_ACTIVE_ARCH", "YES"); } if (iOS) { - s.set ("\"CODE_SIGN_IDENTITY[sdk=iphoneos*]\"", config.codeSignIdentity.get().quoted()); + s.set ("\"CODE_SIGN_IDENTITY[sdk=iphoneos*]\"", config.getCodeSignIdentityString().quoted()); s.set ("SDKROOT", "iphoneos"); s.set ("TARGETED_DEVICE_FAMILY", getDeviceFamilyString().quoted()); - - const String iosVersion (config.iosDeploymentTarget.get()); - if (iosVersion.isNotEmpty() && iosVersion != osxVersionDefault) - s.set ("IPHONEOS_DEPLOYMENT_TARGET", iosVersion); - else - s.set ("IPHONEOS_DEPLOYMENT_TARGET", "9.3"); + s.set ("IPHONEOS_DEPLOYMENT_TARGET", config.getiOSDeploymentTargetString()); } else { - if (! config.codeSignIdentity.isUsingDefault() || getIosDevelopmentTeamIDString().isNotEmpty()) - s.set ("CODE_SIGN_IDENTITY", config.codeSignIdentity.get().quoted()); + if (! config.isUsingDefaultCodeSignIdentity() || getIosDevelopmentTeamIDString().isNotEmpty()) + s.set ("CODE_SIGN_IDENTITY", config.getCodeSignIdentityString().quoted()); } s.set ("ZERO_LINK", "NO"); @@ -2301,7 +2315,7 @@ private: for (auto& target : targets) s.addArray (target->xcodeFrameworks); - if (project.getConfigFlag ("JUCE_QUICKTIME") == Project::configFlagDisabled) + if (! project.getConfigFlag ("JUCE_QUICKTIME").get()) s.removeString ("QuickTime"); s.trim(); @@ -2551,7 +2565,7 @@ private: String getEntitlementsFileName() const { - return project.getProjectFilenameRoot() + String (".entitlements"); + return project.getProjectFilenameRootString() + String (".entitlements"); } StringPairArray getEntitlements() const @@ -3017,10 +3031,10 @@ private: void createXcassetsFolderFromIcons() const { - const File assets (getTargetFolder().getChildFile (project.getProjectFilenameRoot()) - .getChildFile ("Images.xcassets")); - const File iconSet (assets.getChildFile ("AppIcon.appiconset")); - const File launchImage (assets.getChildFile ("LaunchImage.launchimage")); + auto assets = getTargetFolder().getChildFile (project.getProjectFilenameRootString()) + .getChildFile ("Images.xcassets"); + auto iconSet = assets.getChildFile ("AppIcon.appiconset"); + auto launchImage = assets.getChildFile ("LaunchImage.launchimage"); overwriteFileIfDifferentOrThrow (iconSet.getChildFile ("Contents.json"), getiOSAppIconContents()); createiOSIconFiles (iconSet); @@ -3061,7 +3075,7 @@ private: if (rootString.startsWith ("${")) rootString = rootString.fromFirstOccurrenceOf ("}/", false, false); - rootString += project.getProjectUID(); + rootString += project.getProjectUIDString(); return MD5 (rootString.toUTF8()).toHexString().substring (0, 24).toUpperCase(); } diff --git a/extras/Projucer/Source/ProjectSaving/jucer_ProjectExporter.cpp b/extras/Projucer/Source/ProjectSaving/jucer_ProjectExporter.cpp index da61ecf447..51bd1200b1 100644 --- a/extras/Projucer/Source/ProjectSaving/jucer_ProjectExporter.cpp +++ b/extras/Projucer/Source/ProjectSaving/jucer_ProjectExporter.cpp @@ -217,8 +217,17 @@ ProjectExporter::ProjectExporter (Project& p, const ValueTree& state) : settings (state), project (p), projectType (p.getProjectType()), - projectName (p.getTitle()), - projectFolder (p.getProjectFolder()) + projectName (p.getProjectNameString()), + projectFolder (p.getProjectFolder()), + targetLocationValue (settings, Ids::targetFolder, project.getUndoManagerFor (settings)), + extraCompilerFlagsValue (settings, Ids::extraCompilerFlags, project.getUndoManagerFor (settings)), + extraLinkerFlagsValue (settings, Ids::extraLinkerFlags, project.getUndoManagerFor (settings)), + externalLibrariesValue (settings, Ids::externalLibraries, project.getUndoManagerFor (settings)), + userNotesValue (settings, Ids::userNotes, project.getUndoManagerFor (settings)), + gnuExtensionsValue (settings, Ids::enableGNUExtensions, project.getUndoManagerFor (settings)), + bigIconValue (settings, Ids::bigIcon, project.getUndoManagerFor (settings)), + smallIconValue (settings, Ids::smallIcon, project.getUndoManagerFor (settings)), + extraPPDefsValue (settings, Ids::extraDefs, project.getUndoManagerFor (settings)) { } @@ -257,30 +266,30 @@ void ProjectExporter::createPropertyEditors (PropertyListBuilder& props) { if (! isCLion()) { - props.add (new TextPropertyComponent (getTargetLocationValue(), "Target Project Folder", 2048, false), + props.add (new TextPropertyComponent (targetLocationValue, "Target Project Folder", 2048, false), "The location of the folder in which the " + name + " project will be created. " "This path can be absolute, but it's much more sensible to make it relative to the jucer project directory."); createDependencyPathProperties (props); - props.add (new TextPropertyComponent (getExporterPreprocessorDefs(), "Extra Preprocessor Definitions", 32768, true), + props.add (new TextPropertyComponent (extraPPDefsValue, "Extra Preprocessor Definitions", 32768, true), "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 TextPropertyComponent (getExtraCompilerFlags(), "Extra compiler flags", 8192, true), + props.add (new TextPropertyComponent (extraCompilerFlagsValue, "Extra Compiler Flags", 8192, true), "Extra command-line flags to be passed to the compiler. This string can contain references to preprocessor definitions in the " "form ${NAME_OF_DEFINITION}, which will be replaced with their values."); - props.add (new TextPropertyComponent (getExtraLinkerFlags(), "Extra linker flags", 8192, true), + props.add (new TextPropertyComponent (extraLinkerFlagsValue, "Extra Linker Flags", 8192, true), "Extra command-line flags to be passed to the linker. You might want to use this for adding additional libraries. " "This string can contain references to preprocessor definitions in the form ${NAME_OF_VALUE}, which will be replaced with their values."); - props.add (new TextPropertyComponent (getExternalLibraries(), "External libraries to link", 8192, true), + props.add (new TextPropertyComponent (externalLibrariesValue, "External Libraries to Link", 8192, true), "Additional libraries to link (one per line). You should not add any platform specific decoration to these names. " "This string can contain references to preprocessor definitions in the form ${NAME_OF_VALUE}, which will be replaced with their values."); if (! isVisualStudio()) - props.add (new BooleanPropertyComponent (getShouldUseGNUExtensionsValue(), "GNU Compiler Extensions", "Enabled"), + props.add (new ChoicePropertyComponent (gnuExtensionsValue, "GNU Compiler Extensions"), "Enabling this will use the GNU C++ language standard variant for compilation."); createIconProperties (props); @@ -288,7 +297,7 @@ void ProjectExporter::createPropertyEditors (PropertyListBuilder& props) createExporterProperties (props); - props.add (new TextPropertyComponent (getUserNotes(), "Notes", 32768, true), + props.add (new TextPropertyComponent (userNotesValue, "Notes", 32768, true), "Extra comments: This field is not used for code or project generation, it's just a space where you can express your thoughts."); } @@ -326,8 +335,6 @@ void ProjectExporter::createIconProperties (PropertyListBuilder& props) choices.add (""); ids.add (var()); - choices.add (String()); - ids.add (var()); for (int i = 0; i < images.size(); ++i) { @@ -335,10 +342,10 @@ void ProjectExporter::createIconProperties (PropertyListBuilder& props) ids.add (images.getUnchecked(i)->getID()); } - props.add (new ChoicePropertyComponent (getSmallIconImageItemID(), "Icon (small)", choices, ids), + props.add (new ChoicePropertyComponent (smallIconValue, "Icon (Small)", choices, ids), "Sets an icon to use for the executable."); - props.add (new ChoicePropertyComponent (getBigIconImageItemID(), "Icon (large)", choices, ids), + props.add (new ChoicePropertyComponent (bigIconValue, "Icon (Large)", choices, ids), "Sets an icon to use for the executable."); } @@ -684,12 +691,9 @@ String ProjectExporter::getUniqueConfigName (String nm) const return nm; } -void ProjectExporter::addNewConfiguration (const BuildConfiguration* configToCopy) +void ProjectExporter::addNewConfigurationFromExisting (const BuildConfiguration& configToCopy) { - const String configName (getUniqueConfigName (configToCopy != nullptr ? configToCopy->config [Ids::name].toString() - : "New Build Configuration")); - - ValueTree configs (getConfigurations()); + auto configs = getConfigurations(); if (! configs.isValid()) { @@ -698,14 +702,29 @@ void ProjectExporter::addNewConfiguration (const BuildConfiguration* configToCop } ValueTree newConfig (Ids::CONFIGURATION); - if (configToCopy != nullptr) - newConfig = configToCopy->config.createCopy(); + newConfig = configToCopy.config.createCopy(); - newConfig.setProperty (Ids::name, configName, 0); + newConfig.setProperty (Ids::name, configToCopy.getName(), 0); configs.appendChild (newConfig, project.getUndoManagerFor (configs)); } +void ProjectExporter::addNewConfiguration (bool isDebugConfig) +{ + auto configs = getConfigurations(); + + if (! configs.isValid()) + { + settings.addChild (ValueTree (Ids::CONFIGURATIONS), 0, project.getUndoManagerFor (settings)); + configs = getConfigurations(); + } + + ValueTree newConfig (Ids::CONFIGURATION); + newConfig.setProperty (Ids::isDebug, isDebugConfig, project.getUndoManagerFor (settings)); + + configs.appendChild (newConfig, project.getUndoManagerFor (settings)); +} + void ProjectExporter::BuildConfiguration::removeFromExporter() { ValueTree configs (config.getParent()); @@ -718,16 +737,11 @@ void ProjectExporter::createDefaultConfigs() for (int i = 0; i < 2; ++i) { - addNewConfiguration (nullptr); + auto isDebug = i == 0; + + addNewConfiguration (isDebug); BuildConfiguration::Ptr config (getConfiguration (i)); - - const bool debugConfig = i == 0; - - config->getNameValue() = debugConfig ? "Debug" : "Release"; - config->isDebugValue() = debugConfig; - config->getOptimisationLevel() = config->getDefaultOptimisationLevel(); - config->getLinkTimeOptimisationEnabledValue() = ! debugConfig; - config->getTargetBinaryName() = project.getProjectFilenameRoot(); + config->getValue (Ids::name) = (isDebug ? "Debug" : "Release"); } } @@ -830,7 +844,17 @@ bool ProjectExporter::ConstConfigIterator::next() //============================================================================== ProjectExporter::BuildConfiguration::BuildConfiguration (Project& p, const ValueTree& configNode, const ProjectExporter& e) - : config (configNode), project (p), exporter (e) + : config (configNode), project (p), exporter (e), + isDebugValue (config, Ids::isDebug, getUndoManager(), getValue (Ids::isDebug)), + configNameValue (config, Ids::name, getUndoManager(), "Build Configuration"), + targetNameValue (config, Ids::targetName, getUndoManager(), project.getProjectFilenameRootString()), + targetBinaryPathValue (config, Ids::binaryPath, getUndoManager()), + optimisationLevelValue (config, Ids::optimisation, getUndoManager()), + linkTimeOptimisationValue (config, Ids::linkTimeOptimisation, getUndoManager(), ! isDebug()), + ppDefinesValue (config, Ids::defines, getUndoManager()), + headerSearchPathValue (config, Ids::headerPath, getUndoManager()), + librarySearchPathValue (config, Ids::libraryPath, getUndoManager()), + userNotesValue (config, Ids::userNotes, getUndoManager()) { } @@ -856,58 +880,43 @@ String ProjectExporter::BuildConfiguration::getGCCOptimisationFlag() const void ProjectExporter::BuildConfiguration::addGCCOptimisationProperty (PropertyListBuilder& props) { - static const char* optimisationLevels[] = { "-O0 (no optimisation)", - "-Os (minimise code size)", - "-O1 (fast)", - "-O2 (faster)", - "-O3 (fastest with safe optimisations)", - "-Ofast (uses aggressive optimisations)", - nullptr }; - - static const int optimisationLevelValues[] = { gccO0, - gccOs, - gccO1, - gccO2, - gccO3, - gccOfast, - 0 }; - - props.add (new ChoicePropertyComponent (getOptimisationLevel(), "Optimisation", - StringArray (optimisationLevels), - Array (optimisationLevelValues)), + props.add (new ChoicePropertyComponent (optimisationLevelValue, "Optimisation", + { "-O0 (no optimisation)", "-Os (minimise code size)", "-O1 (fast)", "-O2 (faster)", + "-O3 (fastest with safe optimisations)", "-Ofast (uses aggressive optimisations)" }, + { gccO0, gccOs, gccO1, gccO2, gccO3, gccOfast }), "The optimisation level for this configuration"); } void ProjectExporter::BuildConfiguration::createPropertyEditors (PropertyListBuilder& props) { if (exporter.supportsUserDefinedConfigurations()) - props.add (new TextPropertyComponent (getNameValue(), "Name", 96, false), + props.add (new TextPropertyComponent (configNameValue, "Name", 96, false), "The name of this configuration."); - props.add (new BooleanPropertyComponent (isDebugValue(), "Debug mode", "Debugging enabled"), + props.add (new ChoicePropertyComponent (isDebugValue, "Debug mode"), "If enabled, this means that the configuration should be built with debug symbols."); - props.add (new TextPropertyComponent (getTargetBinaryName(), "Binary name", 256, false), + props.add (new TextPropertyComponent (targetNameValue, "Binary name", 256, false), "The filename to use for the destination binary executable file. If you don't add a suffix to this name, " "a suitable platform-specific suffix will be added automatically."); - props.add (new TextPropertyComponent (getTargetBinaryRelativePath(), "Binary location", 1024, false), + props.add (new TextPropertyComponent (targetBinaryPathValue, "Binary location", 1024, false), "The folder in which the finished binary should be placed. Leave this blank to cause the binary to be placed " "in its default location in the build folder."); - props.addSearchPathProperty (getHeaderSearchPathValue(), "Header search paths", "Extra header search paths."); - props.addSearchPathProperty (getLibrarySearchPathValue(), "Extra library search paths", "Extra library search paths."); + props.addSearchPathProperty (headerSearchPathValue, "Header search paths", "Extra header search paths."); + props.addSearchPathProperty (librarySearchPathValue, "Extra library search paths", "Extra library search paths."); - props.add (new TextPropertyComponent (getBuildConfigPreprocessorDefs(), "Preprocessor definitions", 32768, true), + props.add (new TextPropertyComponent (ppDefinesValue, "Preprocessor definitions", 32768, true), "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"), + props.add (new ChoicePropertyComponent (linkTimeOptimisationValue, "Link-Time Optimisation"), "Enable this to perform link-time code optimisation. This is recommended for release builds."); createConfigProperties (props); - props.add (new TextPropertyComponent (getUserNotes(), "Notes", 32768, true), + props.add (new TextPropertyComponent (userNotesValue, "Notes", 32768, true), "Extra comments: This field is not used for code or project generation, it's just a space where you can express your thoughts."); } @@ -941,7 +950,7 @@ StringPairArray ProjectExporter::BuildConfiguration::getUniquePreprocessorDefs() StringArray ProjectExporter::BuildConfiguration::getHeaderSearchPaths() const { - return getSearchPathsFromString (getHeaderSearchPathString() + ';' + project.getHeaderSearchPaths()); + return getSearchPathsFromString (getHeaderSearchPathString() + ';' + project.getHeaderSearchPathsString()); } StringArray ProjectExporter::BuildConfiguration::getLibrarySearchPaths() const diff --git a/extras/Projucer/Source/ProjectSaving/jucer_ProjectExporter.h b/extras/Projucer/Source/ProjectSaving/jucer_ProjectExporter.h index b3a07746df..e1a023051a 100644 --- a/extras/Projucer/Source/ProjectSaving/jucer_ProjectExporter.h +++ b/extras/Projucer/Source/ProjectSaving/jucer_ProjectExporter.h @@ -28,8 +28,7 @@ #include "../Project/jucer_Project.h" #include "../Utility/UI/PropertyComponents/jucer_DependencyPathPropertyComponent.h" -#include "../Utility/UI/PropertyComponents/jucer_TextWithDefaultPropertyComponent.h" -#include "../Utility/UI/PropertyComponents/jucer_TextWithDefaultPropertyComponentWithEnablement.h" +#include "../Utility/UI/PropertyComponents/jucer_PropertyComponentsWithEnablement.h" class ProjectSaver; @@ -138,30 +137,23 @@ public: Project& getProject() noexcept { return project; } const Project& getProject() const noexcept { return project; } - Value getSetting (const Identifier& nm) { return settings.getPropertyAsValue (nm, project.getUndoManagerFor (settings)); } + Value getSetting (const Identifier& nm) { return settings.getPropertyAsValue (nm, project.getUndoManagerFor (settings)); } String getSettingString (const Identifier& nm) const { return settings [nm]; } - Value getTargetLocationValue() { return getSetting (Ids::targetFolder); } - String getTargetLocationString() const { return getSettingString (Ids::targetFolder); } + Value getTargetLocationValue() { return targetLocationValue.getPropertyAsValue(); } + String getTargetLocationString() const { return targetLocationValue.get(); } - Value getExtraCompilerFlags() { return getSetting (Ids::extraCompilerFlags); } - String getExtraCompilerFlagsString() const { return getSettingString (Ids::extraCompilerFlags).replaceCharacters ("\r\n", " "); } + String getExtraCompilerFlagsString() const { return extraCompilerFlagsValue.get().toString().replaceCharacters ("\r\n", " "); } + String getExtraLinkerFlagsString() const { return extraLinkerFlagsValue.get().toString().replaceCharacters ("\r\n", " "); } - Value getExtraLinkerFlags() { return getSetting (Ids::extraLinkerFlags); } - String getExtraLinkerFlagsString() const { return getSettingString (Ids::extraLinkerFlags).replaceCharacters ("\r\n", " "); } + String getExternalLibrariesString() const { return getSearchPathsFromString (externalLibrariesValue.get().toString()).joinIntoString (";"); } - Value getExternalLibraries() { return getSetting (Ids::externalLibraries); } - String getExternalLibrariesString() const { return getSearchPathsFromString (getSettingString (Ids::externalLibraries)).joinIntoString (";"); } - - Value getUserNotes() { return getSetting (Ids::userNotes); } + bool shouldUseGNUExtensions() const { return gnuExtensionsValue.get();} Value getVST3PathValue() const { return vst3Path; } Value getRTASPathValue() const { return rtasPath; } Value getAAXPathValue() const { return aaxPath; } - Value getShouldUseGNUExtensionsValue() { return getSetting (Ids::enableGNUExtensions); } - bool shouldUseGNUExtensions() const { return (getSettingString (Ids::enableGNUExtensions) == "1");} - // NB: this is the path to the parent "modules" folder that contains the named module, not the // module folder itself. Value getPathForModuleValue (const String& moduleID); @@ -183,8 +175,6 @@ public: void addProjectPathToBuildPathList (StringArray&, const RelativePath&, int index = -1) const; - Value getBigIconImageItemID() { return getSetting (Ids::bigIcon); } - Value getSmallIconImageItemID() { return getSetting (Ids::smallIcon); } Drawable* getBigIcon() const; Drawable* getSmallIcon() const; Image getBestIconForSize (int size, bool returnNullIfNothingBigEnough) const; @@ -192,7 +182,7 @@ public: String getExporterIdentifierMacro() const { return "JUCER_" + settings.getType().toString() + "_" - + String::toHexString (getSettingString (Ids::targetFolder).hashCode()).toUpperCase(); + + String::toHexString (getTargetLocationString().hashCode()).toUpperCase(); } // An exception that can be thrown by the create() method. @@ -244,49 +234,35 @@ public: //============================================================================== virtual void createConfigProperties (PropertyListBuilder&) = 0; - virtual var getDefaultOptimisationLevel() const = 0; virtual String getModuleLibraryArchName() const = 0; //============================================================================== - Value getNameValue() { return getValue (Ids::name); } - String getName() const { return config [Ids::name]; } + String getName() const { return configNameValue.get(); } + bool isDebug() const { return isDebugValue.get(); } - Value isDebugValue() { return getValue (Ids::isDebug); } - bool isDebug() const { return config [Ids::isDebug]; } + String getTargetBinaryNameString() const { return targetNameValue.get(); } + String getTargetBinaryRelativePathString() const { return targetBinaryPathValue.get(); } - Value getTargetBinaryName() { return getValue (Ids::targetName); } - String getTargetBinaryNameString() const { return config [Ids::targetName]; } - - // the path relative to the build folder in which the binary should go - Value getTargetBinaryRelativePath() { return getValue (Ids::binaryPath); } - String getTargetBinaryRelativePathString() const { return config [Ids::binaryPath]; } - - Value getOptimisationLevel() { return getValue (Ids::optimisation); } - int getOptimisationLevelInt() const { return config [Ids::optimisation]; } + int getOptimisationLevelInt() const { return optimisationLevelValue.get(); } String getGCCOptimisationFlag() const; + bool isLinkTimeOptimisationEnabled() const { return linkTimeOptimisationValue.get(); } - Value getLinkTimeOptimisationEnabledValue() { return getValue (Ids::linkTimeOptimisation); } - bool isLinkTimeOptimisationEnabled() const { return config [Ids::linkTimeOptimisation]; } + String getBuildConfigPreprocessorDefsString() const { return ppDefinesValue.get(); } + StringPairArray getAllPreprocessorDefs() const; // includes inherited definitions + StringPairArray getUniquePreprocessorDefs() const; // returns pre-processor definitions that are not already in the project pre-processor defs - Value getBuildConfigPreprocessorDefs() { return getValue (Ids::defines); } - String getBuildConfigPreprocessorDefsString() const { return config [Ids::defines]; } - StringPairArray getAllPreprocessorDefs() const; // includes inherited definitions - StringPairArray getUniquePreprocessorDefs() const; // returns pre-processor definitions that are not already in the project pre-processor defs - - Value getHeaderSearchPathValue() { return getValue (Ids::headerPath); } - String getHeaderSearchPathString() const { return config [Ids::headerPath]; } + String getHeaderSearchPathString() const { return headerSearchPathValue.get(); } StringArray getHeaderSearchPaths() const; - Value getLibrarySearchPathValue() { return getValue (Ids::libraryPath); } - String getLibrarySearchPathString() const { return config [Ids::libraryPath]; } + String getLibrarySearchPathString() const { return librarySearchPathValue.get(); } StringArray getLibrarySearchPaths() const; String getGCCLibraryPathFlags() const; - Value getUserNotes() { return getValue (Ids::userNotes); } - - Value getValue (const Identifier& nm) { return config.getPropertyAsValue (nm, getUndoManager()); } - UndoManager* getUndoManager() const { return project.getUndoManagerFor (config); } + //============================================================================== + Value getValue (const Identifier& nm) { return config.getPropertyAsValue (nm, getUndoManager()); } + UndoManager* getUndoManager() const { return project.getUndoManagerFor (config); } + //============================================================================== void createPropertyEditors (PropertyListBuilder&); void addGCCOptimisationProperty (PropertyListBuilder&); void removeFromExporter(); @@ -296,11 +272,16 @@ public: Project& project; const ProjectExporter& exporter; + protected: + ValueWithDefault isDebugValue, configNameValue, targetNameValue, targetBinaryPathValue, optimisationLevelValue, + linkTimeOptimisationValue, ppDefinesValue, headerSearchPathValue, librarySearchPathValue, userNotesValue; + private: JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (BuildConfiguration) }; - void addNewConfiguration (const BuildConfiguration* configToCopy); + void addNewConfigurationFromExisting (const BuildConfiguration& configToCopy); + void addNewConfiguration (bool isDebugConfig); bool hasConfigurationNamed (const String& name) const; String getUniqueConfigName (String name) const; @@ -349,8 +330,8 @@ public: void createDefaultModulePaths(); //============================================================================== - Value getExporterPreprocessorDefs() { return getSetting (Ids::extraDefs); } - String getExporterPreprocessorDefsString() const { return getSettingString (Ids::extraDefs); } + Value getExporterPreprocessorDefsValue() { return extraPPDefsValue.getPropertyAsValue(); } + String getExporterPreprocessorDefsString() const { return extraPPDefsValue.get(); } // includes exporter, project + config defs StringPairArray getAllPreprocessorDefs (const BuildConfiguration& config, const ProjectType::Target::Type targetType) const; @@ -382,6 +363,9 @@ protected: const File projectFolder; Value vst3Path, rtasPath, aaxPath; // these must be initialised in the specific exporter c'tors! + ValueWithDefault targetLocationValue, extraCompilerFlagsValue, extraLinkerFlagsValue, externalLibrariesValue, + userNotesValue, gnuExtensionsValue, bigIconValue, smallIconValue, extraPPDefsValue; + mutable Array itemGroups; void initItemGroups() const; Project::Item* modulesGroup = nullptr; diff --git a/extras/Projucer/Source/ProjectSaving/jucer_ProjectSaver.cpp b/extras/Projucer/Source/ProjectSaving/jucer_ProjectSaver.cpp index cd91adccff..84bbc532da 100644 --- a/extras/Projucer/Source/ProjectSaving/jucer_ProjectSaver.cpp +++ b/extras/Projucer/Source/ProjectSaving/jucer_ProjectSaver.cpp @@ -48,19 +48,19 @@ namespace return maxVal; } - inline String valueToBool (const Value& v) + inline String boolToString (bool b) { - return static_cast (v.getValue()) ? "1" : "0"; + return b ? "1" : "0"; } - inline String valueToStringLiteral (const var& v) + inline String toStringLiteral (const String& v) { - return CppTokeniserFunctions::addEscapeChars (v.toString()).quoted(); + return CppTokeniserFunctions::addEscapeChars (v).quoted(); } - inline String valueToCharLiteral (const var& v) + inline String toCharLiteral (const String& v) { - auto fourCharCode = v.toString().trim().substring (0, 4); + auto fourCharCode = v.trim().substring (0, 4); uint32 hexRepresentation = 0; for (int i = 0; i < 4; ++i) @@ -77,54 +77,54 @@ namespace void ProjectSaver::writePluginCharacteristicsFile() { StringPairArray flags; - flags.set ("JucePlugin_Build_VST", valueToBool (project.getShouldBuildVSTAsValue())); - flags.set ("JucePlugin_Build_VST3", valueToBool (project.getShouldBuildVST3AsValue())); - flags.set ("JucePlugin_Build_AU", valueToBool (project.getShouldBuildAUAsValue())); - flags.set ("JucePlugin_Build_AUv3", valueToBool (project.getShouldBuildAUv3AsValue())); - flags.set ("JucePlugin_Build_RTAS", valueToBool (project.getShouldBuildRTASAsValue())); - flags.set ("JucePlugin_Build_AAX", valueToBool (project.getShouldBuildAAXAsValue())); - flags.set ("JucePlugin_Build_Standalone", valueToBool (project.getShouldBuildStandalonePluginAsValue())); - flags.set ("JucePlugin_Enable_IAA", valueToBool (project.getShouldEnableIAAAsValue())); - flags.set ("JucePlugin_Name", valueToStringLiteral (project.getPluginName())); - flags.set ("JucePlugin_Desc", valueToStringLiteral (project.getPluginDesc())); - flags.set ("JucePlugin_Manufacturer", valueToStringLiteral (project.getPluginManufacturer())); - flags.set ("JucePlugin_ManufacturerWebsite", valueToStringLiteral (project.getCompanyWebsite())); - flags.set ("JucePlugin_ManufacturerEmail", valueToStringLiteral (project.getCompanyEmail())); - flags.set ("JucePlugin_ManufacturerCode", valueToCharLiteral (project.getPluginManufacturerCode())); - flags.set ("JucePlugin_PluginCode", valueToCharLiteral (project.getPluginCode())); - flags.set ("JucePlugin_IsSynth", valueToBool (project.getPluginIsSynth())); - flags.set ("JucePlugin_WantsMidiInput", valueToBool (project.getPluginWantsMidiInput())); - flags.set ("JucePlugin_ProducesMidiOutput", valueToBool (project.getPluginProducesMidiOut())); - flags.set ("JucePlugin_IsMidiEffect", valueToBool (project.getPluginIsMidiEffectPlugin())); - flags.set ("JucePlugin_EditorRequiresKeyboardFocus", valueToBool (project.getPluginEditorNeedsKeyFocus())); + flags.set ("JucePlugin_Build_VST", boolToString (project.shouldBuildVST())); + flags.set ("JucePlugin_Build_VST3", boolToString (project.shouldBuildVST3())); + flags.set ("JucePlugin_Build_AU", boolToString (project.shouldBuildAU())); + flags.set ("JucePlugin_Build_AUv3", boolToString (project.shouldBuildAUv3())); + flags.set ("JucePlugin_Build_RTAS", boolToString (project.shouldBuildRTAS())); + flags.set ("JucePlugin_Build_AAX", boolToString (project.shouldBuildAAX())); + flags.set ("JucePlugin_Build_Standalone", boolToString (project.shouldBuildStandalonePlugin())); + flags.set ("JucePlugin_Enable_IAA", boolToString (project.shouldEnableIAA())); + flags.set ("JucePlugin_Name", toStringLiteral (project.getPluginNameString())); + flags.set ("JucePlugin_Desc", toStringLiteral (project.getPluginDescriptionString())); + flags.set ("JucePlugin_Manufacturer", toStringLiteral (project.getPluginManufacturerString())); + flags.set ("JucePlugin_ManufacturerWebsite", toStringLiteral (project.getCompanyWebsiteString())); + flags.set ("JucePlugin_ManufacturerEmail", toStringLiteral (project.getCompanyEmailString())); + flags.set ("JucePlugin_ManufacturerCode", toCharLiteral (project.getPluginManufacturerCodeString())); + flags.set ("JucePlugin_PluginCode", toCharLiteral (project.getPluginCodeString())); + flags.set ("JucePlugin_IsSynth", boolToString (project.isPluginSynth())); + flags.set ("JucePlugin_WantsMidiInput", boolToString (project.pluginWantsMidiInput())); + flags.set ("JucePlugin_ProducesMidiOutput", boolToString (project.pluginProducesMidiOutput())); + flags.set ("JucePlugin_IsMidiEffect", boolToString (project.isPluginMidiEffect())); + flags.set ("JucePlugin_EditorRequiresKeyboardFocus", boolToString (project.pluginEditorNeedsKeyFocus())); flags.set ("JucePlugin_Version", project.getVersionString()); flags.set ("JucePlugin_VersionCode", project.getVersionAsHex()); - flags.set ("JucePlugin_VersionString", valueToStringLiteral (project.getVersionString())); + flags.set ("JucePlugin_VersionString", toStringLiteral (project.getVersionString())); flags.set ("JucePlugin_VSTUniqueID", "JucePlugin_PluginCode"); flags.set ("JucePlugin_VSTCategory", project.getPluginVSTCategoryString()); flags.set ("JucePlugin_AUMainType", project.getAUMainTypeString()); flags.set ("JucePlugin_AUSubType", "JucePlugin_PluginCode"); - flags.set ("JucePlugin_AUExportPrefix", project.getPluginAUExportPrefix().toString()); - flags.set ("JucePlugin_AUExportPrefixQuoted", valueToStringLiteral (project.getPluginAUExportPrefix())); + flags.set ("JucePlugin_AUExportPrefix", project.getPluginAUExportPrefixString()); + flags.set ("JucePlugin_AUExportPrefixQuoted", toStringLiteral (project.getPluginAUExportPrefixString())); flags.set ("JucePlugin_AUManufacturerCode", "JucePlugin_ManufacturerCode"); - flags.set ("JucePlugin_CFBundleIdentifier", project.getBundleIdentifier().toString()); + flags.set ("JucePlugin_CFBundleIdentifier", project.getBundleIdentifierString()); flags.set ("JucePlugin_RTASCategory", project.getPluginRTASCategoryCode()); flags.set ("JucePlugin_RTASManufacturerCode", "JucePlugin_ManufacturerCode"); flags.set ("JucePlugin_RTASProductId", "JucePlugin_PluginCode"); - flags.set ("JucePlugin_RTASDisableBypass", valueToBool (project.getPluginRTASBypassDisabled())); - flags.set ("JucePlugin_RTASDisableMultiMono", valueToBool (project.getPluginRTASMultiMonoDisabled())); - flags.set ("JucePlugin_AAXIdentifier", project.getAAXIdentifier().toString()); + flags.set ("JucePlugin_RTASDisableBypass", boolToString (project.isPluginRTASBypassDisabled())); + flags.set ("JucePlugin_RTASDisableMultiMono", boolToString (project.isPluginRTASMultiMonoDisabled())); + flags.set ("JucePlugin_AAXIdentifier", project.getAAXIdentifierString()); flags.set ("JucePlugin_AAXManufacturerCode", "JucePlugin_ManufacturerCode"); flags.set ("JucePlugin_AAXProductId", "JucePlugin_PluginCode"); - flags.set ("JucePlugin_AAXCategory", project.getPluginAAXCategory().toString()); - flags.set ("JucePlugin_AAXDisableBypass", valueToBool (project.getPluginAAXBypassDisabled())); - flags.set ("JucePlugin_AAXDisableMultiMono", valueToBool (project.getPluginAAXMultiMonoDisabled())); - flags.set ("JucePlugin_IAAType", valueToCharLiteral (project.getIAATypeCode())); + flags.set ("JucePlugin_AAXCategory", project.getPluginAAXCategoryString()); + flags.set ("JucePlugin_AAXDisableBypass", boolToString (project.isPluginAAXBypassDisabled())); + flags.set ("JucePlugin_AAXDisableMultiMono", boolToString (project.isPluginAAXMultiMonoDisabled())); + flags.set ("JucePlugin_IAAType", toCharLiteral (project.getIAATypeCode())); flags.set ("JucePlugin_IAASubType", "JucePlugin_PluginCode"); flags.set ("JucePlugin_IAAName", project.getIAAPluginName().quoted()); { - String plugInChannelConfig = project.getPluginChannelConfigs().toString(); + String plugInChannelConfig = project.getPluginChannelConfigsString(); if (plugInChannelConfig.isNotEmpty()) { diff --git a/extras/Projucer/Source/ProjectSaving/jucer_ProjectSaver.h b/extras/Projucer/Source/ProjectSaving/jucer_ProjectSaver.h index 9be17c8b23..a9239b83ee 100644 --- a/extras/Projucer/Source/ProjectSaving/jucer_ProjectSaver.h +++ b/extras/Projucer/Source/ProjectSaving/jucer_ProjectSaver.h @@ -414,16 +414,16 @@ private: << "// BEGIN SECTION A" << newLine << newLine << "#ifndef JUCE_DISPLAY_SPLASH_SCREEN" << newLine - << " #define JUCE_DISPLAY_SPLASH_SCREEN " << (project.shouldDisplaySplashScreen().getValue() ? "1" : "0") << newLine + << " #define JUCE_DISPLAY_SPLASH_SCREEN " << (project.shouldDisplaySplashScreen() ? "1" : "0") << newLine << "#endif" << newLine << newLine << "#ifndef JUCE_REPORT_APP_USAGE" << newLine - << " #define JUCE_REPORT_APP_USAGE " << (project.shouldReportAppUsage().getValue() ? "1" : "0") << newLine + << " #define JUCE_REPORT_APP_USAGE " << (project.shouldReportAppUsage() ? "1" : "0") << newLine << "#endif" << newLine << newLine << "// END SECTION A" << newLine << newLine - << "#define JUCE_USE_DARK_SPLASH_SCREEN " << (project.splashScreenColour().toString() == "Dark" ? "1" : "0") << newLine; + << "#define JUCE_USE_DARK_SPLASH_SCREEN " << (project.getSplashScreenColourString() == "Dark" ? "1" : "0") << newLine; out << newLine << "//==============================================================================" << newLine; @@ -451,28 +451,15 @@ private: << "//==============================================================================" << newLine << "// " << m->getID() << " flags:" << newLine; - for (int i = 0; i < flags.size(); ++i) + for (auto* flag : flags) { - flags.getUnchecked(i)->value.referTo (project.getConfigFlag (flags.getUnchecked(i)->symbol)); - - const Project::ConfigFlag* const f = flags[i]; - const String value (project.getConfigFlag (f->symbol).toString()); - out << newLine - << "#ifndef " << f->symbol << newLine; - - if (value == Project::configFlagEnabled) - out << " #define " << f->symbol << " 1"; - else if (value == Project::configFlagDisabled) - out << " #define " << f->symbol << " 0"; - else if (f->defaultValue.isEmpty()) - out << " //#define " << f->symbol << " 1"; - else - out << " #define " << f->symbol << " " << f->defaultValue; - - - out << newLine - << "#endif" << newLine; + << "#ifndef " << flag->symbol + << newLine + << (flag->value.isUsingDefault() ? " //#define " : " #define ") << flag->symbol << " " << (flag->value.get() ? "1" : "0") + << newLine + << "#endif" + << newLine; } } } @@ -533,7 +520,7 @@ private: out << newLine; } - if (hasBinaryData && project.shouldIncludeBinaryInAppConfig().getValue()) + if (hasBinaryData && project.shouldIncludeBinaryInAppConfig()) out << CodeHelpers::createIncludeStatement (project.getBinaryDataHeaderFile(), appConfigFile) << newLine; out << newLine @@ -546,7 +533,7 @@ private: << "#if ! JUCE_DONT_DECLARE_PROJECTINFO" << newLine << "namespace ProjectInfo" << newLine << "{" << newLine - << " const char* const projectName = " << CppTokeniserFunctions::addEscapeChars (project.getTitle()).quoted() << ";" << newLine + << " const char* const projectName = " << CppTokeniserFunctions::addEscapeChars (project.getProjectNameString()).quoted() << ";" << newLine << " const char* const versionString = " << CppTokeniserFunctions::addEscapeChars (project.getVersionString()).quoted() << ";" << newLine << " const int versionNumber = " << project.getVersionAsHex() << ";" << newLine << "}" << newLine @@ -593,7 +580,7 @@ private: if (resourceFile.getNumFiles() > 0) { - auto dataNamespace = project.binaryDataNamespace().toString().trim(); + auto dataNamespace = project.getBinaryDataNamespaceString().trim(); if (dataNamespace.isEmpty()) dataNamespace = "BinaryData"; @@ -601,7 +588,7 @@ private: Array binaryDataFiles; - int maxSize = project.getMaxBinaryFileSize().getValue(); + int maxSize = project.getMaxBinaryFileSize(); if (maxSize <= 0) maxSize = 10 * 1024 * 1024; diff --git a/extras/Projucer/Source/Utility/Helpers/jucer_MiscUtilities.h b/extras/Projucer/Source/Utility/Helpers/jucer_MiscUtilities.h index ade65da465..947c52c92b 100644 --- a/extras/Projucer/Source/Utility/Helpers/jucer_MiscUtilities.h +++ b/extras/Projucer/Source/Utility/Helpers/jucer_MiscUtilities.h @@ -78,6 +78,12 @@ struct PropertyListBuilder mainHelpText + " Use semi-colons or new-lines to separate multiple paths."); } + void addSearchPathProperty (const ValueWithDefault& value, const String& name, const String& mainHelpText) + { + add (new TextPropertyComponent (value, name, 16384, true), + mainHelpText + " Use semi-colons or new-lines to separate multiple paths."); + } + void setPreferredHeight (int height) { for (int j = components.size(); --j >= 0;) diff --git a/extras/Projucer/Source/Utility/Helpers/jucer_PresetIDs.h b/extras/Projucer/Source/Utility/Helpers/jucer_PresetIDs.h index abf74df466..82b0fb032c 100644 --- a/extras/Projucer/Source/Utility/Helpers/jucer_PresetIDs.h +++ b/extras/Projucer/Source/Utility/Helpers/jucer_PresetIDs.h @@ -97,6 +97,15 @@ namespace Ids DECLARE_ID (customXcassetsFolder); DECLARE_ID (customXcodeResourceFolders); DECLARE_ID (plistPreprocessorDefinitions); + DECLARE_ID (customPList); + DECLARE_ID (pListPrefixHeader); + DECLARE_ID (pListPreprocess); + DECLARE_ID (uiFileSharingEnabled); + DECLARE_ID (uiSupportsDocumentBrowser); + DECLARE_ID (uiStatusBarHidden); + DECLARE_ID (documentExtensions); + DECLARE_ID (keepCustomXcodeSchemes); + DECLARE_ID (useHeaderMap); DECLARE_ID (cppLanguageStandard); DECLARE_ID (enableGNUExtensions); DECLARE_ID (cppLibType); @@ -137,7 +146,6 @@ namespace Ids DECLARE_ID (generateManifest); DECLARE_ID (useRuntimeLibDLL); DECLARE_ID (enableIncrementalLinking); - DECLARE_ID (buildVST); DECLARE_ID (bundleIdentifier); DECLARE_ID (aaxIdentifier); DECLARE_ID (aaxCategory); @@ -274,6 +282,34 @@ namespace Ids DECLARE_ID (classDecl); DECLARE_ID (initialisers); DECLARE_ID (destructors); + DECLARE_ID (buildVST); + DECLARE_ID (buildVST3); + DECLARE_ID (buildAU); + DECLARE_ID (buildAUv3); + DECLARE_ID (buildRTAS); + DECLARE_ID (buildAAX); + DECLARE_ID (buildStandalone); + DECLARE_ID (enableIAA); + DECLARE_ID (pluginName); + DECLARE_ID (pluginDesc); + DECLARE_ID (pluginManufacturer); + DECLARE_ID (pluginManufacturerCode); + DECLARE_ID (pluginCode); + DECLARE_ID (pluginChannelConfigs); + DECLARE_ID (pluginIsSynth); + DECLARE_ID (pluginWantsMidiIn); + DECLARE_ID (pluginProducesMidiOut); + DECLARE_ID (pluginIsMidiEffectPlugin); + DECLARE_ID (pluginEditorRequiresKeys); + DECLARE_ID (pluginVSTCategory); + DECLARE_ID (pluginAUExportPrefix); + DECLARE_ID (pluginAUMainType); + DECLARE_ID (pluginRTASCategory); + DECLARE_ID (pluginRTASDisableBypass); + DECLARE_ID (pluginRTASDisableMultiMono); + DECLARE_ID (pluginAAXCategory); + DECLARE_ID (pluginAAXDisableBypass); + DECLARE_ID (pluginAAXDisableMultiMono); const Identifier ID ("id"); const Identifier ID_uppercase ("ID"); diff --git a/extras/Projucer/Source/Utility/UI/PropertyComponents/jucer_DependencyPathPropertyComponent.cpp b/extras/Projucer/Source/Utility/UI/PropertyComponents/jucer_DependencyPathPropertyComponent.cpp index 2f286ab242..6cb34f22ec 100644 --- a/extras/Projucer/Source/Utility/UI/PropertyComponents/jucer_DependencyPathPropertyComponent.cpp +++ b/extras/Projucer/Source/Utility/UI/PropertyComponents/jucer_DependencyPathPropertyComponent.cpp @@ -284,47 +284,3 @@ Colour DependencyFilePathPropertyComponent::getTextColourToDisplay() const return isValidPath ? findColour (widgetTextColourId).withMultipliedAlpha (alpha) : Colours::red.withMultipliedAlpha (alpha); } - -//============================================================================== -TextPropertyComponentWithEnablement::TextPropertyComponentWithEnablement (const Value& valueToControl, const Value& valueToListenTo, - const String& propertyName, int maxNumChars, bool isMultiLine) - : TextPropertyComponent (valueToControl, propertyName, maxNumChars, isMultiLine), - value (valueToListenTo) -{ - value.addListener (this); - setEnabled (value.getValue()); -} - -TextPropertyComponentWithEnablement::~TextPropertyComponentWithEnablement() -{ - value.removeListener (this); -} - -void TextPropertyComponentWithEnablement::valueChanged (Value& v) -{ - setEnabled (v.getValue()); -} - -//============================================================================== -ChoicePropertyComponentWithEnablement::ChoicePropertyComponentWithEnablement (const Value& valueToControl, - const Value& valueToListenTo, - const String& propertyName, - const StringArray& choices, - const Array& correspondingValues) - : ChoicePropertyComponent (valueToControl, propertyName, - choices, correspondingValues), - value (valueToListenTo) -{ - value.addListener (this); - setEnabled (value.getValue()); -} - -ChoicePropertyComponentWithEnablement::~ChoicePropertyComponentWithEnablement() -{ - value.removeListener (this); -} - -void ChoicePropertyComponentWithEnablement::valueChanged (Value& v) -{ - setEnabled (v.getValue()); -} diff --git a/extras/Projucer/Source/Utility/UI/PropertyComponents/jucer_DependencyPathPropertyComponent.h b/extras/Projucer/Source/Utility/UI/PropertyComponents/jucer_DependencyPathPropertyComponent.h index e7458ea539..8d935bd573 100644 --- a/extras/Projucer/Source/Utility/UI/PropertyComponents/jucer_DependencyPathPropertyComponent.h +++ b/extras/Projucer/Source/Utility/UI/PropertyComponents/jucer_DependencyPathPropertyComponent.h @@ -245,34 +245,3 @@ private: JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (DependencyFilePathPropertyComponent) }; - -//============================================================================== -class TextPropertyComponentWithEnablement : public TextPropertyComponent, - private Value::Listener -{ -public: - TextPropertyComponentWithEnablement (const Value&, const Value&, const String&, int, bool); - - ~TextPropertyComponentWithEnablement(); - -private: - Value value; - - void valueChanged (Value& v) override; -}; - -//============================================================================== -class ChoicePropertyComponentWithEnablement : public ChoicePropertyComponent, - private Value::Listener -{ -public: - ChoicePropertyComponentWithEnablement (const Value&, const Value&, const String&, - const StringArray&, const Array&); - - ~ChoicePropertyComponentWithEnablement(); - -private: - Value value; - - void valueChanged (Value& v) override; -}; diff --git a/extras/Projucer/Source/Utility/UI/PropertyComponents/jucer_PropertyComponentsWithEnablement.h b/extras/Projucer/Source/Utility/UI/PropertyComponents/jucer_PropertyComponentsWithEnablement.h new file mode 100644 index 0000000000..ac0a35e22a --- /dev/null +++ b/extras/Projucer/Source/Utility/UI/PropertyComponents/jucer_PropertyComponentsWithEnablement.h @@ -0,0 +1,78 @@ +/* + ============================================================================== + + This file is part of the JUCE library. + Copyright (c) 2017 - ROLI Ltd. + + JUCE is an open source library subject to commercial or open-source + licensing. + + By using JUCE, you agree to the terms of both the JUCE 5 End-User License + Agreement and JUCE 5 Privacy Policy (both updated and effective as of the + 27th April 2017). + + End User License Agreement: www.juce.com/juce-5-licence + Privacy Policy: www.juce.com/juce-5-privacy-policy + + Or: You may also use this code under the terms of the GPL v3 (see + www.gnu.org/licenses). + + JUCE IS PROVIDED "AS IS" WITHOUT ANY WARRANTY, AND ALL WARRANTIES, WHETHER + EXPRESSED OR IMPLIED, INCLUDING MERCHANTABILITY AND FITNESS FOR PURPOSE, ARE + DISCLAIMED. + + ============================================================================== +*/ + +#pragma once + + +//============================================================================== +class TextPropertyComponentWithEnablement : public TextPropertyComponent, + private Value::Listener +{ +public: + TextPropertyComponentWithEnablement (const ValueWithDefault& valueToControl, + const Value& valueToListenTo, + const String& propertyName, + int maxNumChars, + bool isMultiLine) + : TextPropertyComponent (valueToControl, propertyName, maxNumChars, isMultiLine), + value (valueToListenTo) + { + value.addListener (this); + setEnabled (value.getValue()); + } + + ~TextPropertyComponentWithEnablement() { value.removeListener (this); } + +private: + Value value; + + void valueChanged (Value& v) override { setEnabled (v.getValue()); } +}; + +//============================================================================== +class ChoicePropertyComponentWithEnablement : public ChoicePropertyComponent, + private Value::Listener +{ +public: + ChoicePropertyComponentWithEnablement (const ValueWithDefault& valueToControl, + const Value& valueToListenTo, + const String& propertyName, + const StringArray& choices, + const Array& correspondingValues) + : ChoicePropertyComponent (valueToControl, propertyName, choices, correspondingValues), + value (valueToListenTo) + { + value.addListener (this); + setEnabled (value.getValue()); + } + + ~ChoicePropertyComponentWithEnablement() { value.removeListener (this); } + +private: + Value value; + + void valueChanged (Value& v) override { setEnabled (v.getValue()); } +}; diff --git a/extras/Projucer/Source/Utility/UI/PropertyComponents/jucer_TextWithDefaultPropertyComponent.h b/extras/Projucer/Source/Utility/UI/PropertyComponents/jucer_TextWithDefaultPropertyComponent.h deleted file mode 100644 index a606f7940d..0000000000 --- a/extras/Projucer/Source/Utility/UI/PropertyComponents/jucer_TextWithDefaultPropertyComponent.h +++ /dev/null @@ -1,171 +0,0 @@ -/* - ============================================================================== - - This file is part of the JUCE library. - Copyright (c) 2017 - ROLI Ltd. - - JUCE is an open source library subject to commercial or open-source - licensing. - - By using JUCE, you agree to the terms of both the JUCE 5 End-User License - Agreement and JUCE 5 Privacy Policy (both updated and effective as of the - 27th April 2017). - - End User License Agreement: www.juce.com/juce-5-licence - Privacy Policy: www.juce.com/juce-5-privacy-policy - - Or: You may also use this code under the terms of the GPL v3 (see - www.gnu.org/licenses). - - JUCE IS PROVIDED "AS IS" WITHOUT ANY WARRANTY, AND ALL WARRANTIES, WHETHER - EXPRESSED OR IMPLIED, INCLUDING MERCHANTABILITY AND FITNESS FOR PURPOSE, ARE - DISCLAIMED. - - ============================================================================== -*/ - -#pragma once - - -//============================================================================== -template -class TextWithDefaultPropertyComponent : public PropertyComponent, - private Label::Listener -{ - //========================================================================== - class LabelComp : public Label, - public FileDragAndDropTarget - { - public: - LabelComp (TextWithDefaultPropertyComponent& tpc, const int charLimit) - : Label (String(), String()), - owner (tpc), - maxChars (charLimit) - { - setEditable (true, true, false); - addListener (&tpc); - - updateColours(); - } - - bool isInterestedInFileDrag (const StringArray&) override - { - return true; - } - - void filesDropped (const StringArray& files, int, int) override - { - setText (getText() + files.joinIntoString (", "), sendNotificationSync); - showEditor(); - } - - TextEditor* createEditorComponent() override - { - TextEditor* const ed = Label::createEditorComponent(); - ed->setInputRestrictions (maxChars); - return ed; - } - - void textWasEdited() override - { - owner.textWasEdited(); - } - - void updateColours() - { - setColour (backgroundColourId, owner.findColour (TextWithDefaultPropertyComponent::backgroundColourId)); - setColour (outlineColourId, owner.findColour (TextWithDefaultPropertyComponent::outlineColourId)); - setColour (textColourId, owner.findColour (TextWithDefaultPropertyComponent::textColourId)); - repaint(); - } - - private: - TextWithDefaultPropertyComponent& owner; - int maxChars; - }; - -protected: - //========================================================================== - TextWithDefaultPropertyComponent (const String& propertyName, int maxNumChars) - : PropertyComponent (propertyName) - { - createEditor (maxNumChars); - } - -public: - //========================================================================== - TextWithDefaultPropertyComponent (CachedValue& valueToControl, const String& propertyName, int maxNumChars) - : PropertyComponent (propertyName), - cachedValue (valueToControl) - { - createEditor (maxNumChars); - refresh(); - } - - virtual String getText() const - { - return cachedValue.get(); - } - - enum ColourIds - { - backgroundColourId = 0x100e401, /**< The colour to fill the background of the text area. */ - textColourId = 0x100e402, /**< The colour to use for the editable text. */ - outlineColourId = 0x100e403, /**< The colour to use to draw an outline around the text area. */ - }; - - void colourChanged() override - { - PropertyComponent::colourChanged(); - textEditor->updateColours(); - } - - //============================================================================== - void refresh() override - { - if (cachedValue.isUsingDefault()) - setColour (textColourId, findColour (widgetTextColourId).withMultipliedAlpha (0.5f)); - else - setColour (textColourId, findColour (widgetTextColourId)); - - textEditor->setText (getText(), dontSendNotification); - } - - virtual void textWasEdited() - { - String textDisplayed = textEditor->getText(); - - if (textDisplayed.isEmpty()) - cachedValue.resetToDefault(); - else - cachedValue = textDisplayed; - - refresh(); - } - -private: - //============================================================================== - friend class LabelComp; - CachedValue& cachedValue; - - ScopedPointer textEditor; - - void createEditor (int maxNumChars) - { - addAndMakeVisible (textEditor = new LabelComp (*this, maxNumChars)); - } - - void labelTextChanged (Label*) override {} - - void editorShown (Label*, TextEditor& editor) override - { - if (cachedValue.isUsingDefault()) - editor.setText (String(), dontSendNotification); - } - - void editorHidden (Label*, TextEditor&) override {} - - void lookAndFeelChanged() override { refresh(); } - - JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (TextWithDefaultPropertyComponent) -}; diff --git a/extras/Projucer/Source/Utility/UI/PropertyComponents/jucer_TextWithDefaultPropertyComponentWithEnablement.cpp b/extras/Projucer/Source/Utility/UI/PropertyComponents/jucer_TextWithDefaultPropertyComponentWithEnablement.cpp deleted file mode 100644 index 24ca52843d..0000000000 --- a/extras/Projucer/Source/Utility/UI/PropertyComponents/jucer_TextWithDefaultPropertyComponentWithEnablement.cpp +++ /dev/null @@ -1,50 +0,0 @@ -/* - ============================================================================== - - This file is part of the JUCE library. - Copyright (c) 2017 - ROLI Ltd. - - JUCE is an open source library subject to commercial or open-source - licensing. - - By using JUCE, you agree to the terms of both the JUCE 5 End-User License - Agreement and JUCE 5 Privacy Policy (both updated and effective as of the - 27th April 2017). - - End User License Agreement: www.juce.com/juce-5-licence - Privacy Policy: www.juce.com/juce-5-privacy-policy - - Or: You may also use this code under the terms of the GPL v3 (see - www.gnu.org/licenses). - - JUCE IS PROVIDED "AS IS" WITHOUT ANY WARRANTY, AND ALL WARRANTIES, WHETHER - EXPRESSED OR IMPLIED, INCLUDING MERCHANTABILITY AND FITNESS FOR PURPOSE, ARE - DISCLAIMED. - - ============================================================================== -*/ - -#include "../../../Application/jucer_Headers.h" -#include "jucer_TextWithDefaultPropertyComponentWithEnablement.h" - - -TextWithDefaultPropertyComponentWithEnablement::TextWithDefaultPropertyComponentWithEnablement (CachedValue& valueToControl, - const Value& valueToListenTo, - const String& propertyName, - int maxNumChars) - : TextWithDefaultPropertyComponent (valueToControl, propertyName, maxNumChars), - value (valueToListenTo) -{ - value.addListener (this); - setEnabled (value.getValue()); -} - -TextWithDefaultPropertyComponentWithEnablement::~TextWithDefaultPropertyComponentWithEnablement() -{ - value.removeListener (this); -} - -void TextWithDefaultPropertyComponentWithEnablement::valueChanged (Value& v) -{ - setEnabled (v.getValue()); -} diff --git a/extras/Projucer/Source/Utility/UI/PropertyComponents/jucer_TextWithDefaultPropertyComponentWithEnablement.h b/extras/Projucer/Source/Utility/UI/PropertyComponents/jucer_TextWithDefaultPropertyComponentWithEnablement.h deleted file mode 100644 index 4b628a8530..0000000000 --- a/extras/Projucer/Source/Utility/UI/PropertyComponents/jucer_TextWithDefaultPropertyComponentWithEnablement.h +++ /dev/null @@ -1,44 +0,0 @@ -/* - ============================================================================== - - This file is part of the JUCE library. - Copyright (c) 2017 - ROLI Ltd. - - JUCE is an open source library subject to commercial or open-source - licensing. - - By using JUCE, you agree to the terms of both the JUCE 5 End-User License - Agreement and JUCE 5 Privacy Policy (both updated and effective as of the - 27th April 2017). - - End User License Agreement: www.juce.com/juce-5-licence - Privacy Policy: www.juce.com/juce-5-privacy-policy - - Or: You may also use this code under the terms of the GPL v3 (see - www.gnu.org/licenses). - - JUCE IS PROVIDED "AS IS" WITHOUT ANY WARRANTY, AND ALL WARRANTIES, WHETHER - EXPRESSED OR IMPLIED, INCLUDING MERCHANTABILITY AND FITNESS FOR PURPOSE, ARE - DISCLAIMED. - - ============================================================================== -*/ - -#pragma once - -#include "jucer_TextWithDefaultPropertyComponent.h" - -class TextWithDefaultPropertyComponentWithEnablement : public TextWithDefaultPropertyComponent, - private Value::Listener -{ -public: - TextWithDefaultPropertyComponentWithEnablement (CachedValue&, const Value&, - const String&, int); - - ~TextWithDefaultPropertyComponentWithEnablement(); - -private: - Value value; - - void valueChanged (Value&) override; -}; diff --git a/extras/Projucer/Source/Wizards/jucer_NewProjectWizard.h b/extras/Projucer/Source/Wizards/jucer_NewProjectWizard.h index 85cbe7cf70..c6cb9c21b9 100644 --- a/extras/Projucer/Source/Wizards/jucer_NewProjectWizard.h +++ b/extras/Projucer/Source/Wizards/jucer_NewProjectWizard.h @@ -32,7 +32,7 @@ static void setExecutableNameForAllTargets (Project& project, const String& exeN { for (Project::ExporterIterator exporter (project); exporter.next();) for (ProjectExporter::ConfigIterator config (*exporter); config.next();) - config->getTargetBinaryName() = exeName; + config->getValue (Ids::targetName) = exeName; } static Project::Item createSourceGroup (Project& project) @@ -135,7 +135,6 @@ struct NewProjectWizard { project->setFile (projectFile); project->setTitle (appTitle); - project->getBundleIdentifier() = project->getDefaultBundleIdentifier(); if (! initialiseProject (*project)) return nullptr; diff --git a/extras/Projucer/Source/Wizards/jucer_ProjectWizard_Animated.h b/extras/Projucer/Source/Wizards/jucer_ProjectWizard_Animated.h index d1e1faa218..c26c02a362 100644 --- a/extras/Projucer/Source/Wizards/jucer_ProjectWizard_Animated.h +++ b/extras/Projucer/Source/Wizards/jucer_ProjectWizard_Animated.h @@ -45,7 +45,7 @@ struct AnimatedAppWizard : public NewProjectWizard File contentCompH = contentCompCpp.withFileExtension (".h"); String contentCompName = "MainContentComponent"; - project.getProjectTypeValue() = ProjectType_GUIApp::getTypeName(); + project.setProjectType (ProjectType_GUIApp::getTypeName()); Project::Item sourceGroup (createSourceGroup (project)); diff --git a/extras/Projucer/Source/Wizards/jucer_ProjectWizard_AudioApp.h b/extras/Projucer/Source/Wizards/jucer_ProjectWizard_AudioApp.h index 06b1e1d653..c0e01eeb70 100644 --- a/extras/Projucer/Source/Wizards/jucer_ProjectWizard_AudioApp.h +++ b/extras/Projucer/Source/Wizards/jucer_ProjectWizard_AudioApp.h @@ -45,7 +45,7 @@ struct AudioAppWizard : public NewProjectWizard File contentCompH = contentCompCpp.withFileExtension (".h"); String contentCompName = "MainContentComponent"; - project.getProjectTypeValue() = ProjectType_GUIApp::getTypeName(); + project.setProjectType (ProjectType_GUIApp::getTypeName()); Project::Item sourceGroup (createSourceGroup (project)); diff --git a/extras/Projucer/Source/Wizards/jucer_ProjectWizard_AudioPlugin.h b/extras/Projucer/Source/Wizards/jucer_ProjectWizard_AudioPlugin.h index 22cdba4f08..19afc6f19d 100644 --- a/extras/Projucer/Source/Wizards/jucer_ProjectWizard_AudioPlugin.h +++ b/extras/Projucer/Source/Wizards/jucer_ProjectWizard_AudioPlugin.h @@ -58,11 +58,11 @@ struct AudioPluginAppWizard : public NewProjectWizard File editorCppFile = getSourceFilesFolder().getChildFile ("PluginEditor.cpp"); File editorHFile = editorCppFile.withFileExtension (".h"); - project.getProjectTypeValue() = ProjectType_AudioPlugin::getTypeName(); - project.getShouldBuildStandalonePluginAsValue().setValue (true); + project.setProjectType (ProjectType_AudioPlugin::getTypeName()); + project.getProjectValue (Ids::buildStandalone) = true; Project::Item sourceGroup (createSourceGroup (project)); - project.getConfigFlag ("JUCE_QUICKTIME") = Project::configFlagDisabled; // disabled because it interferes with RTAS build on PC + project.getConfigFlag ("JUCE_QUICKTIME") = false; // disabled because it interferes with RTAS build on PC setExecutableNameForAllTargets (project, File::createLegalFileName (appTitle)); diff --git a/extras/Projucer/Source/Wizards/jucer_ProjectWizard_Blank.h b/extras/Projucer/Source/Wizards/jucer_ProjectWizard_Blank.h index 9f23f45e28..0cdfb9e9c9 100644 --- a/extras/Projucer/Source/Wizards/jucer_ProjectWizard_Blank.h +++ b/extras/Projucer/Source/Wizards/jucer_ProjectWizard_Blank.h @@ -39,7 +39,7 @@ struct BlankAppWizard : public NewProjectWizard bool initialiseProject (Project& project) override { createSourceFolder(); - project.getProjectTypeValue() = ProjectType_GUIApp::getTypeName(); + project.setProjectType (ProjectType_GUIApp::getTypeName()); Project::Item sourceGroup (createSourceGroup (project)); setExecutableNameForAllTargets (project, File::createLegalFileName (appTitle)); diff --git a/extras/Projucer/Source/Wizards/jucer_ProjectWizard_Console.h b/extras/Projucer/Source/Wizards/jucer_ProjectWizard_Console.h index c481bad6b0..853f7fbd55 100644 --- a/extras/Projucer/Source/Wizards/jucer_ProjectWizard_Console.h +++ b/extras/Projucer/Source/Wizards/jucer_ProjectWizard_Console.h @@ -60,7 +60,7 @@ struct ConsoleAppWizard : public NewProjectWizard { createSourceFolder(); - project.getProjectTypeValue() = ProjectType_ConsoleApp::getTypeName(); + project.setProjectType (ProjectType_ConsoleApp::getTypeName()); Project::Item sourceGroup (createSourceGroup (project)); diff --git a/extras/Projucer/Source/Wizards/jucer_ProjectWizard_DLL.h b/extras/Projucer/Source/Wizards/jucer_ProjectWizard_DLL.h index 05aa24404f..53878cbd3d 100644 --- a/extras/Projucer/Source/Wizards/jucer_ProjectWizard_DLL.h +++ b/extras/Projucer/Source/Wizards/jucer_ProjectWizard_DLL.h @@ -39,7 +39,7 @@ struct DynamicLibraryWizard : public NewProjectWizard bool initialiseProject (Project& project) override { createSourceFolder(); - project.getProjectTypeValue() = ProjectType_DLL::getTypeName(); + project.setProjectType (ProjectType_DLL::getTypeName()); createSourceGroup (project); setExecutableNameForAllTargets (project, File::createLegalFileName (appTitle)); diff --git a/extras/Projucer/Source/Wizards/jucer_ProjectWizard_GUIApp.h b/extras/Projucer/Source/Wizards/jucer_ProjectWizard_GUIApp.h index 2e5ac4e371..de28f297c0 100644 --- a/extras/Projucer/Source/Wizards/jucer_ProjectWizard_GUIApp.h +++ b/extras/Projucer/Source/Wizards/jucer_ProjectWizard_GUIApp.h @@ -67,7 +67,7 @@ struct GUIAppWizard : public NewProjectWizard File contentCompH = contentCompCpp.withFileExtension (".h"); String contentCompName = "MainContentComponent"; - project.getProjectTypeValue() = ProjectType_GUIApp::getTypeName(); + project.setProjectType (ProjectType_GUIApp::getTypeName()); Project::Item sourceGroup (createSourceGroup (project)); diff --git a/extras/Projucer/Source/Wizards/jucer_ProjectWizard_StaticLibrary.h b/extras/Projucer/Source/Wizards/jucer_ProjectWizard_StaticLibrary.h index a966272ff6..8d5cceb677 100644 --- a/extras/Projucer/Source/Wizards/jucer_ProjectWizard_StaticLibrary.h +++ b/extras/Projucer/Source/Wizards/jucer_ProjectWizard_StaticLibrary.h @@ -39,7 +39,7 @@ struct StaticLibraryWizard : public NewProjectWizard bool initialiseProject (Project& project) override { createSourceFolder(); - project.getProjectTypeValue() = ProjectType_StaticLibrary::getTypeName(); + project.setProjectType (ProjectType_StaticLibrary::getTypeName()); createSourceGroup (project); setExecutableNameForAllTargets (project, File::createLegalFileName (appTitle)); diff --git a/extras/Projucer/Source/Wizards/jucer_ProjectWizard_openGL.h b/extras/Projucer/Source/Wizards/jucer_ProjectWizard_openGL.h index 04a90ca108..61b774175d 100644 --- a/extras/Projucer/Source/Wizards/jucer_ProjectWizard_openGL.h +++ b/extras/Projucer/Source/Wizards/jucer_ProjectWizard_openGL.h @@ -45,7 +45,7 @@ struct OpenGLAppWizard : public NewProjectWizard File contentCompH = contentCompCpp.withFileExtension (".h"); String contentCompName = "MainContentComponent"; - project.getProjectTypeValue() = ProjectType_GUIApp::getTypeName(); + project.setProjectType (ProjectType_GUIApp::getTypeName()); Project::Item sourceGroup (createSourceGroup (project));