diff --git a/extras/Projucer/Source/Project Saving/jucer_ProjectExport_AndroidStudio.h b/extras/Projucer/Source/Project Saving/jucer_ProjectExport_AndroidStudio.h index 37dc35fa7c..28f81a979b 100644 --- a/extras/Projucer/Source/Project Saving/jucer_ProjectExport_AndroidStudio.h +++ b/extras/Projucer/Source/Project Saving/jucer_ProjectExport_AndroidStudio.h @@ -45,63 +45,35 @@ public: } //============================================================================== - Value getGradleVersionValue() { return getSetting (Ids::gradleVersion); } - String getGradleVersionString() const { return settings [Ids::gradleVersion]; } - Value getGradleWrapperVersionValue() { return getSetting (Ids::gradleWrapperVersion); } - String getGradleWrapperVersionString() const { return settings [Ids::gradleWrapperVersion]; } - - Value getGradleToolchainValue() { return getSetting (Ids::gradleToolchain); } - String getGradleToolchainString() const { return settings [Ids::gradleToolchain]; } - Value getGradleToolchainVersionValue() { return getSetting (Ids::gradleToolchainVersion); } - String getGradleToolchainVersionString() const { return settings [Ids::gradleToolchainVersion]; } + CachedValue gradleVersion, gradleWrapperVersion, gradleToolchain; //============================================================================== AndroidStudioProjectExporter (Project& p, const ValueTree& t) : AndroidProjectExporterBase (p, t), + gradleVersion (settings, Ids::gradleVersion, nullptr, "2.10"), + gradleWrapperVersion (settings, Ids::gradleWrapperVersion, nullptr, "0.7.0-alpha4"), + gradleToolchain (settings, Ids::gradleToolchain, nullptr, "clang"), androidStudioExecutable (findAndroidStudioExecutable()) { name = getName(); - setEmptyPropertiesToDefaultValues(); - } - //============================================================================== - void setEmptyPropertiesToDefaultValues() - { if (getTargetLocationString().isEmpty()) getTargetLocationValue() = getDefaultBuildsRootFolder() + "AndroidStudio"; - - if (getGradleVersionString().isEmpty()) - getGradleVersionValue() = "2.10"; - - if (getGradleWrapperVersionString().isEmpty()) - getGradleWrapperVersionValue() = "0.7.0-alpha4"; - - if (getGradleToolchainString().isEmpty()) - getGradleToolchainValue() = "clang"; - - if (getGradleToolchainVersionString().isEmpty()) - getGradleToolchainVersionValue() = getGradleToolchainValue() == "clang" ? "3.6" : "4.9"; - - if (getBuildToolsVersionString().isEmpty()) - getBuildToolsVersionValue() = "23.0.1"; } //============================================================================== void createToolchainExporterProperties (PropertyListBuilder& props) override { - props.add (new TextPropertyComponent (getGradleVersionValue(), "gradle version", 32, false), + props.add (new TextWithDefaultPropertyComponent (gradleVersion, "gradle version", 32), "The version of gradle that Android Studio should use to build this app"); - props.add (new TextPropertyComponent (getGradleWrapperVersionValue(), "gradle-experimental wrapper version", 32, false), + props.add (new TextWithDefaultPropertyComponent (gradleWrapperVersion, "gradle-experimental wrapper version", 32), "The version of the gradle-experimental wrapper that Android Studio should use to build this app"); static const char* toolchains[] = { "clang", "gcc", nullptr }; - props.add (new ChoicePropertyComponent (getGradleToolchainValue(), "NDK Toolchain", StringArray (toolchains), Array (toolchains)), + props.add (new ChoicePropertyComponent (gradleToolchain.getPropertyAsValue(), "NDK Toolchain", StringArray (toolchains), Array (toolchains)), "The toolchain that gradle should invoke for NDK compilation (variable model.android.ndk.tooclhain in app/build.gradle)"); - - props.add (new TextPropertyComponent (getGradleToolchainVersionValue(), "NDK Toolchain version", 32, false), - "The version number of the toolchainthat gradle should invoke for NDK compilation (variable model.android.ndk.tooclhainVersion in app/build.gradle)"); } void createLibraryModuleExporterProperties (PropertyListBuilder&) override @@ -512,7 +484,7 @@ private: auto dependencies = new GradleObject ("dependencies"); dependencies->add ("classpath 'com.android.tools.build:gradle-experimental:" - + getGradleWrapperVersionString() + "'"); + + gradleWrapperVersion.get() + "'"); return dependencies; } @@ -584,16 +556,24 @@ private: GradleObject* getAndroidNdkSettings() const { - const String toolchain = getGradleToolchainString(); - const String toolchainVersion = getGradleToolchainVersionString(); + const String toolchain = gradleToolchain.get(); const bool isClang = (toolchain == "clang"); auto ndkSettings = new GradleObject ("android.ndk"); ndkSettings->add ("moduleName", "juce_jni"); ndkSettings->add ("toolchain", toolchain); - ndkSettings->add ("toolchainVersion", toolchainVersion); - ndkSettings->add ("stl", isClang ? "c++_static" : "gnustl_static"); + + if (isClang) + { + ndkSettings->add ("stl", "c++_static"); + } + else + { + ndkSettings->add ("toolchainVersion", "4.9"); + ndkSettings->add ("stl", "gnustl_static"); + } + ndkSettings->addChildObject (getNdkJuceExtraProperties()); addAllNdkCompilerSettings (ndkSettings); @@ -835,7 +815,7 @@ private: String props; props << "distributionUrl=https\\://services.gradle.org/distributions/gradle-" - << getGradleVersionString() << "-all.zip"; + << gradleVersion.get() << "-all.zip"; return props; } diff --git a/extras/Projucer/Source/Project Saving/jucer_ProjectExport_XCode.h b/extras/Projucer/Source/Project Saving/jucer_ProjectExport_XCode.h index c8ff8817e5..bb862dd9f8 100644 --- a/extras/Projucer/Source/Project Saving/jucer_ProjectExport_XCode.h +++ b/extras/Projucer/Source/Project Saving/jucer_ProjectExport_XCode.h @@ -23,7 +23,7 @@ */ #include "../Application/jucer_Application.h" - +#include "jucer_TextWithDefaultPropertyComponent.h" namespace { @@ -335,51 +335,40 @@ protected: { public: XcodeBuildConfiguration (Project& p, const ValueTree& t, const bool isIOS, const ProjectExporter& e) - : BuildConfiguration (p, t, e), iOS (isIOS) - { - if (iOS) - { - if (getiOSCompatibilityVersion().isEmpty()) - getiOSCompatibilityVersionValue() = osxVersionDefault; - } - else - { - if (getMacSDKVersion().isEmpty()) - getMacSDKVersionValue() = osxVersionDefault; - - if (getMacCompatibilityVersion().isEmpty()) - getMacCompatibilityVersionValue() = osxVersionDefault; - - if (getMacArchitecture().isEmpty()) - getMacArchitectureValue() = osxArch_Default; - } - } + : BuildConfiguration (p, t, e), + iOS (isIOS), + osxSDKVersion (config, Ids::osxSDK, nullptr, "default"), + osxDeploymentTarget (config, Ids::osxCompatibility, nullptr, "default"), + iosDeploymentTarget (config, Ids::iosCompatibility, nullptr, "default"), + osxArchitecture (config, Ids::osxArchitecture, nullptr, "default"), + customXcodeFlags (config, Ids::customXcodeFlags, nullptr), + cppLanguageStandard (config, Ids::cppLanguageStandard, nullptr), + cppStandardLibrary (config, Ids::cppLibType, nullptr), + codeSignIdentity (config, Ids::codeSigningIdentity, nullptr, iOS ? "iPhone Developer" : "Mac Developer"), + fastMathEnabled (config, Ids::fastMath, nullptr), + linkTimeOptimisationEnabled (config, Ids::linkTimeOptimisation, nullptr), + vstBinaryLocation (config, Ids::xcodeVstBinaryLocation, nullptr, "$(HOME)/Library/Audio/Plug-Ins/VST/"), + vst3BinaryLocation (config, Ids::xcodeVst3BinaryLocation, nullptr, "$(HOME)/Library/Audio/Plug-Ins/VST3/"), + auBinaryLocation (config, Ids::xcodeAudioUnitBinaryLocation, nullptr, "$(HOME)/Library/Audio/Plug-Ins/Components/"), + rtasBinaryLocation (config, Ids::xcodeRtasBinaryLocation, nullptr, "/Library/Application Support/Avid/Audio/Plug-Ins/"), + aaxBinaryLocation (config, Ids::xcodeAaxBinaryLocation, nullptr, "/Library/Application Support/Digidesign/Plug-Ins/") + { + } + + //========================================================================== + bool iOS; - Value getMacSDKVersionValue() { return getValue (Ids::osxSDK); } - String getMacSDKVersion() const { return config [Ids::osxSDK]; } - Value getMacCompatibilityVersionValue() { return getValue (Ids::osxCompatibility); } - String getMacCompatibilityVersion() const { return config [Ids::osxCompatibility]; } - Value getiOSCompatibilityVersionValue() { return getValue (Ids::iosCompatibility); } - String getiOSCompatibilityVersion() const { return config [Ids::iosCompatibility]; } - Value getMacArchitectureValue() { return getValue (Ids::osxArchitecture); } - String getMacArchitecture() const { return config [Ids::osxArchitecture]; } - Value getCustomXcodeFlagsValue() { return getValue (Ids::customXcodeFlags); } - String getCustomXcodeFlags() const { return config [Ids::customXcodeFlags]; } - Value getCppLanguageStandardValue() { return getValue (Ids::cppLanguageStandard); } - String getCppLanguageStandard() const { return config [Ids::cppLanguageStandard]; } - Value getCppLibTypeValue() { return getValue (Ids::cppLibType); } - String getCppLibType() const { return config [Ids::cppLibType]; } - Value getCodeSignIdentityValue() { return getValue (Ids::codeSigningIdentity); } - String getCodeSignIdentity() const { return config [Ids::codeSigningIdentity]; } - Value getFastMathValue() { return getValue (Ids::fastMath); } - bool isFastMathEnabled() const { return config [Ids::fastMath]; } - Value getLinkTimeOptimisationValue() { return getValue (Ids::linkTimeOptimisation); } - bool isLinkTimeOptimisationEnabled() const { return config [Ids::linkTimeOptimisation]; } + CachedValue osxSDKVersion, osxDeploymentTarget, iosDeploymentTarget, osxArchitecture, + customXcodeFlags, cppLanguageStandard, cppStandardLibrary, codeSignIdentity; + CachedValue fastMathEnabled, linkTimeOptimisationEnabled; + CachedValue vstBinaryLocation, vst3BinaryLocation, auBinaryLocation, rtasBinaryLocation, aaxBinaryLocation; + //========================================================================== var getDefaultOptimisationLevel() const override { return var ((int) (isDebug() ? gccO0 : gccO3)); } void createConfigProperties (PropertyListBuilder& props) override { + addXcodePluginInstallPathProperties (props); addGCCOptimisationProperty (props); if (iOS) @@ -387,7 +376,7 @@ protected: 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", 0 }; 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", 0 }; - props.add (new ChoicePropertyComponent (getiOSCompatibilityVersionValue(), "iOS Deployment Target", + props.add (new ChoicePropertyComponent (iosDeploymentTarget.getPropertyAsValue(), "iOS Deployment Target", StringArray (iosVersions), Array (iosVersionValues)), "The minimum version of iOS that the target binary will run on."); } @@ -407,10 +396,10 @@ protected: versionValues.add (getSDKName (ver)); } - props.add (new ChoicePropertyComponent (getMacSDKVersionValue(), "OSX Base SDK Version", sdkVersionNames, versionValues), + props.add (new ChoicePropertyComponent (osxSDKVersion.getPropertyAsValue(), "OSX Base SDK Version", sdkVersionNames, versionValues), "The version of OSX to link against in the XCode build."); - props.add (new ChoicePropertyComponent (getMacCompatibilityVersionValue(), "OSX Deployment Target", osxVersionNames, versionValues), + props.add (new ChoicePropertyComponent (osxDeploymentTarget.getPropertyAsValue(), "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", @@ -418,12 +407,12 @@ protected: const char* osxArchValues[] = { osxArch_Default, osxArch_Native, osxArch_32BitUniversal, osxArch_64BitUniversal, osxArch_64Bit, 0 }; - props.add (new ChoicePropertyComponent (getMacArchitectureValue(), "OSX Architecture", + props.add (new ChoicePropertyComponent (osxArchitecture.getPropertyAsValue(), "OSX Architecture", StringArray (osxArch), Array (osxArchValues)), "The type of OSX binary that will be produced."); } - props.add (new TextPropertyComponent (getCustomXcodeFlagsValue(), "Custom Xcode flags", 8192, false), + props.add (new TextPropertyComponent (customXcodeFlags.getPropertyAsValue(), "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\""); @@ -437,7 +426,8 @@ protected: cppLanguageStandardValues.add ("c++14"); cppLanguageStandardValues.add ("gnu++14"); - props.add (new ChoicePropertyComponent (getCppLanguageStandardValue(), "C++ Language Standard", StringArray (cppLanguageStandardNames), cppLanguageStandardValues), + props.add (new ChoicePropertyComponent (cppLanguageStandard.getPropertyAsValue(), "C++ Language Standard", + StringArray (cppLanguageStandardNames), cppLanguageStandardValues), "The standard of the C++ language that will be used for compilation."); const char* cppLibNames[] = { "Use Default", "LLVM libc++", "GNU libstdc++", nullptr }; @@ -446,20 +436,43 @@ protected: cppLibValues.add ("libc++"); cppLibValues.add ("libstdc++"); - props.add (new ChoicePropertyComponent (getCppLibTypeValue(), "C++ Library", StringArray (cppLibNames), cppLibValues), + props.add (new ChoicePropertyComponent (cppStandardLibrary.getPropertyAsValue(), "C++ Library", StringArray (cppLibNames), cppLibValues), "The type of C++ std lib that will be linked."); - props.add (new TextPropertyComponent (getCodeSignIdentityValue(), "Code-signing Identity", 8192, false), + props.add (new TextWithDefaultPropertyComponent (codeSignIdentity, "Code-signing Identity", 1024), "The name of a code-signing identity for Xcode to apply."); - props.add (new BooleanPropertyComponent (getFastMathValue(), "Relax IEEE compliance", "Enabled"), + props.add (new BooleanPropertyComponent (fastMathEnabled.getPropertyAsValue(), "Relax IEEE compliance", "Enabled"), "Enable this to use FAST_MATH non-IEEE mode. (Warning: this can have unexpected results!)"); - props.add (new BooleanPropertyComponent (getLinkTimeOptimisationValue(), "Link-Time Optimisation", "Enabled"), + props.add (new BooleanPropertyComponent (linkTimeOptimisationEnabled.getPropertyAsValue(), "Link-Time Optimisation", "Enabled"), "Enable this to perform link-time code generation. This is recommended for release builds."); } - bool iOS; + private: + //========================================================================== + void addXcodePluginInstallPathProperties (PropertyListBuilder& props) + { + if (project.shouldBuildVST().getValue()) + props.add (new TextWithDefaultPropertyComponent (vstBinaryLocation, "VST Binary location", 1024), + "The folder in which the compiled VST binary should be placed."); + + if (project.shouldBuildVST3().getValue()) + props.add (new TextWithDefaultPropertyComponent (vst3BinaryLocation, "VST3 Binary location", 1024), + "The folder in which the compiled VST3 binary should be placed."); + + if (project.shouldBuildAU().getValue()) + props.add (new TextWithDefaultPropertyComponent (auBinaryLocation, "AU Binary location", 1024), + "The folder in which the compiled AU binary should be placed."); + + if (project.shouldBuildRTAS().getValue()) + props.add (new TextWithDefaultPropertyComponent (rtasBinaryLocation, "RTAS Binary location", 1024), + "The folder in which the compiled RTAS binary should be placed."); + + if (project.shouldBuildAAX().getValue()) + props.add (new TextWithDefaultPropertyComponent (aaxBinaryLocation, "AAX Binary location", 1024), + "The folder in which the compiled AAX binary should be placed."); + } }; BuildConfiguration::Ptr createBuildConfig (const ValueTree& v) const override @@ -525,7 +538,6 @@ public: xcodeFileType = "wrapper.application"; xcodeBundleExtension = ".app"; xcodeProductType = "com.apple.product-type.application"; - xcodeProductInstallPath = "$(HOME)/Applications"; xcodeCopyToProductInstallPathAfterBuild = false; break; @@ -536,7 +548,6 @@ public: xcodeFileType = "compiled.mach-o.executable"; xcodeBundleExtension = String::empty; xcodeProductType = "com.apple.product-type.tool"; - xcodeProductInstallPath = "/usr/bin"; xcodeCopyToProductInstallPathAfterBuild = false; break; @@ -546,7 +557,6 @@ public: xcodeCreatePList = false; xcodeFileType = "archive.ar"; xcodeProductType = "com.apple.product-type.library.static"; - xcodeProductInstallPath = String::empty; xcodeCopyToProductInstallPathAfterBuild = false; break; @@ -557,7 +567,6 @@ public: xcodeFileType = "compiled.mach-o.dylib"; xcodeProductType = "com.apple.product-type.library.dynamic"; xcodeBundleExtension = ".dylib"; - xcodeProductInstallPath = String::empty; xcodeCopyToProductInstallPathAfterBuild = false; break; @@ -571,7 +580,6 @@ public: xcodeFileType = "wrapper.cfbundle"; xcodeBundleExtension = ".vst"; xcodeProductType = "com.apple.product-type.bundle"; - xcodeProductInstallPath = "$(HOME)/Library/Audio/Plug-Ins/VST/"; xcodeCopyToProductInstallPathAfterBuild = true; break; @@ -585,7 +593,6 @@ public: xcodeFileType = "wrapper.cfbundle"; xcodeBundleExtension = ".vst3"; xcodeProductType = "com.apple.product-type.bundle"; - xcodeProductInstallPath = "$(HOME)/Library/Audio/Plug-Ins/VST3/"; xcodeCopyToProductInstallPathAfterBuild = true; break; @@ -599,7 +606,6 @@ public: xcodeFileType = "wrapper.cfbundle"; xcodeBundleExtension = ".component"; xcodeProductType = "com.apple.product-type.bundle"; - xcodeProductInstallPath = "$(HOME)/Library/Audio/Plug-Ins/Components/"; xcodeCopyToProductInstallPathAfterBuild = true; addExtraAudioUnitTargetSettings(); @@ -615,7 +621,6 @@ public: xcodeFileType = "wrapper.application"; xcodeBundleExtension = ".app"; xcodeProductType = "com.apple.product-type.application"; - xcodeProductInstallPath = "$(HOME)/Applications"; xcodeCopyToProductInstallPathAfterBuild = false; break; @@ -629,7 +634,6 @@ public: xcodeBundleExtension = ".appex"; xcodeBundleIDSubPath = "AUv3"; xcodeProductType = "com.apple.product-type.app-extension"; - xcodeProductInstallPath = String::empty; xcodeCopyToProductInstallPathAfterBuild = false; addExtraAudioUnitv3PlugInTargetSettings(); @@ -644,7 +648,6 @@ public: xcodeFileType = "wrapper.cfbundle"; xcodeBundleExtension = ".aaxplugin"; xcodeProductType = "com.apple.product-type.bundle"; - xcodeProductInstallPath = "/Library/Application Support/Avid/Audio/Plug-Ins/"; xcodeCopyToProductInstallPathAfterBuild = true; addExtraAAXTargetSettings(); @@ -659,7 +662,6 @@ public: xcodeFileType = "wrapper.cfbundle"; xcodeBundleExtension = ".dpm"; xcodeProductType = "com.apple.product-type.bundle"; - xcodeProductInstallPath = "/Library/Application Support/Digidesign/Plug-Ins/"; xcodeCopyToProductInstallPathAfterBuild = true; addExtraRTASTargetSettings(); @@ -675,7 +677,6 @@ public: xcodeBundleExtension = ".framework"; xcodeProductType = "com.apple.product-type.framework"; xcodeBundleIDSubPath = "Framework"; - xcodeProductInstallPath = owner.isiOS() ? "@executable_path/Frameworks" : "@executable_path/../Frameworks"; xcodeCopyToProductInstallPathAfterBuild = false; break; @@ -739,7 +740,7 @@ public: } String xcodePackageType, xcodeBundleSignature, xcodeBundleExtension; - String xcodeProductType, xcodeProductInstallPath, xcodeFileType; + String xcodeProductType, xcodeFileType; String xcodeOtherRezFlags, xcodeExcludedFiles64Bit, xcodeBundleIDSubPath; bool xcodeIsBundle, xcodeCreatePList, xcodeIsExecutable, xcodeCopyToProductInstallPathAfterBuild; StringArray xcodeFrameworks, xcodeLibs; @@ -885,7 +886,7 @@ public: s.add ("PRODUCT_BUNDLE_IDENTIFIER = " + bundleIdentifier); - const String arch ((! owner.isiOS() && type == Target::AudioUnitv3PlugIn) ? osxArch_64Bit : config.getMacArchitecture()); + const String arch ((! owner.isiOS() && type == Target::AudioUnitv3PlugIn) ? osxArch_64Bit : config.osxArchitecture.get()); if (arch == osxArch_Native) s.add ("ARCHS = \"$(NATIVE_ARCH_ACTUAL)\""); else if (arch == osxArch_32BitUniversal) s.add ("ARCHS = \"$(ARCHS_STANDARD_32_BIT)\""); else if (arch == osxArch_64BitUniversal) s.add ("ARCHS = \"$(ARCHS_STANDARD_32_64_BIT)\""); @@ -897,19 +898,21 @@ public: if (xcodeCreatePList) s.add ("INFOPLIST_FILE = " + infoPlistFile.getFileName()); - if (config.isLinkTimeOptimisationEnabled()) + if (config.linkTimeOptimisationEnabled.get()) s.add ("LLVM_LTO = YES"); - if (config.isFastMathEnabled()) + if (config.fastMathEnabled.get()) s.add ("GCC_FAST_MATH = YES"); const String extraFlags (owner.replacePreprocessorTokens (config, owner.getExtraCompilerFlagsString()).trim()); if (extraFlags.isNotEmpty()) s.add ("OTHER_CPLUSPLUSFLAGS = \"" + extraFlags + "\""); - if (xcodeProductInstallPath.isNotEmpty()) + String installPath = getInstallPathForConfiguration (config); + + if (installPath.isNotEmpty()) { - s.add ("INSTALL_PATH = \"" + xcodeProductInstallPath + "\""); + s.add ("INSTALL_PATH = \"" + installPath + "\""); if (xcodeCopyToProductInstallPathAfterBuild) { @@ -928,19 +931,21 @@ public: if (xcodeOtherRezFlags.isNotEmpty()) s.add ("OTHER_REZFLAGS = \"" + xcodeOtherRezFlags + "\""); + String configurationBuildDir = "$(PROJECT_DIR)/build/$(CONFIGURATION)"; + if (config.getTargetBinaryRelativePathString().isNotEmpty()) { - RelativePath binaryPath (config.getTargetBinaryRelativePathString(), RelativePath::projectFolder); - binaryPath = binaryPath.rebased (owner.projectFolder, owner.getTargetFolder(), RelativePath::buildTargetFolder); + // a target's position can either be defined via installPath + xcodeCopyToProductInstallPathAfterBuild + // (= for audio plug-ins) or using a custom binary path (for everything else), but not both (= conflict!) + jassert (! xcodeCopyToProductInstallPathAfterBuild); - s.add ("DSTROOT = " + addQuotesIfContainsSpace (sanitisePath (binaryPath.toUnixStyle()))); - s.add ("SYMROOT = " + addQuotesIfContainsSpace (sanitisePath (binaryPath.toUnixStyle()))); - } - else - { - s.add ("CONFIGURATION_BUILD_DIR = \"$(PROJECT_DIR)/build/$(CONFIGURATION)\""); + RelativePath binaryPath (config.getTargetBinaryRelativePathString(), RelativePath::projectFolder); + configurationBuildDir = sanitisePath (binaryPath.rebased (owner.projectFolder, owner.getTargetFolder(), RelativePath::buildTargetFolder) + .toUnixStyle()); } + s.add ("CONFIGURATION_BUILD_DIR = " + addQuotesIfRequired (configurationBuildDir)); + String gccVersion ("com.apple.compilers.llvm.clang.1_0"); if (owner.iOS) @@ -950,8 +955,8 @@ public: } else { - const String sdk (config.getMacSDKVersion()); - const String sdkCompat (config.getMacCompatibilityVersion()); + const String sdk (config.osxSDKVersion.get()); + const String sdkCompat (config.osxDeploymentTarget.get()); for (int ver = oldestSDKVersion; ver <= currentSDKVersion; ++ver) { @@ -973,14 +978,14 @@ public: s.add ("CLANG_CXX_LANGUAGE_STANDARD = \"c++0x\""); s.add ("CLANG_LINK_OBJC_RUNTIME = NO"); - if (config.getCodeSignIdentity().isNotEmpty()) - s.add ("CODE_SIGN_IDENTITY = " + config.getCodeSignIdentity().quoted()); + if (! config.codeSignIdentity.isUsingDefault()) + s.add ("CODE_SIGN_IDENTITY = " + config.codeSignIdentity.get().quoted()); - if (config.getCppLanguageStandard().isNotEmpty()) - s.add ("CLANG_CXX_LANGUAGE_STANDARD = " + config.getCppLanguageStandard().quoted()); + if (config.cppLanguageStandard.get().isNotEmpty()) + s.add ("CLANG_CXX_LANGUAGE_STANDARD = " + config.cppLanguageStandard.get().quoted()); - if (config.getCppLibType().isNotEmpty()) - s.add ("CLANG_CXX_LIBRARY = " + config.getCppLibType().quoted()); + if (config.cppStandardLibrary.get().isNotEmpty()) + s.add ("CLANG_CXX_LIBRARY = " + config.cppStandardLibrary.get().quoted()); s.add ("COMBINE_HIDPI_IMAGES = YES"); @@ -1076,11 +1081,27 @@ public: s.add ("GCC_PREPROCESSOR_DEFINITIONS = " + indentParenthesisedList (defsList)); - s.addTokens (config.getCustomXcodeFlags(), ",", "\"'"); + s.addTokens (config.customXcodeFlags.get(), ",", "\"'"); return getCleanedStringArray (s); } + String getInstallPathForConfiguration (const XcodeBuildConfiguration& config) const + { + switch (type) + { + case GUIApp: return "$(HOME)/Applications"; + case ConsoleApp: return "/usr/bin"; + case VSTPlugIn: return config.vstBinaryLocation.get(); + case VST3PlugIn: return config.vst3BinaryLocation.get(); + case AudioUnitPlugIn: return config.auBinaryLocation.get(); + case RTASPlugIn: return config.rtasBinaryLocation.get(); + case AAXPlugIn: return config.aaxBinaryLocation.get(); + case SharedCodeTarget: return owner.isiOS() ? "@executable_path/Frameworks" : "@executable_path/../Frameworks"; + default: return String(); + } + } + //============================================================================== void getLinkerFlags (const BuildConfiguration& config, StringArray& flags, StringArray& librarySearchPaths) const { @@ -1375,9 +1396,9 @@ private: return path; } - static String addQuotesIfContainsSpace (const String& s) + static String addQuotesIfRequired (const String& s) { - return s.containsChar (' ') ? s.quoted() : s; + return s.containsAnyOf (" $") ? s.quoted() : s; } File getProjectBundle() const { return getTargetFolder().getChildFile (project.getProjectFilenameRoot()).withFileExtension (".xcodeproj"); } @@ -1663,9 +1684,6 @@ private: { v->setProperty ("productReference", createID (String ("__productFileID") + targetName), nullptr); - if (target.xcodeProductInstallPath.isNotEmpty()) - v->setProperty ("productInstallPath", target.xcodeProductInstallPath, nullptr); - jassert (target.xcodeProductType.isNotEmpty()); v->setProperty ("productType", target.xcodeProductType, nullptr); } @@ -1930,28 +1948,24 @@ private: { s.add ("ENABLE_TESTABILITY = YES"); - if (config.getMacArchitecture() == osxArch_Default || config.getMacArchitecture().isEmpty()) + if (config.osxArchitecture.get() == osxArch_Default || config.osxArchitecture.get().isEmpty()) s.add ("ONLY_ACTIVE_ARCH = YES"); } - String codeSignIdentity = config.getCodeSignIdentity().isNotEmpty() ? config.getCodeSignIdentity() - : (iOS ? "iPhone Developer" : "Mac Developer"); - if (iOS) { - s.add ("\"CODE_SIGN_IDENTITY[sdk=iphoneos*]\" = " + codeSignIdentity.quoted()); - + s.add ("\"CODE_SIGN_IDENTITY[sdk=iphoneos*]\" = " + config.codeSignIdentity.get().quoted()); s.add ("SDKROOT = iphoneos"); s.add ("TARGETED_DEVICE_FAMILY = \"1,2\""); - const String iosVersion (config.getiOSCompatibilityVersion()); + const String iosVersion (config.iosDeploymentTarget.get()); if (iosVersion.isNotEmpty() && iosVersion != osxVersionDefault) s.add ("IPHONEOS_DEPLOYMENT_TARGET = " + iosVersion); } else { - if (config.getCodeSignIdentity().isNotEmpty() || getIosDevelopmentTeamIDString().isNotEmpty()) - s.add ("\"CODE_SIGN_IDENTITY\" = " + codeSignIdentity.quoted()); + if (! config.codeSignIdentity.isUsingDefault() || getIosDevelopmentTeamIDString().isNotEmpty()) + s.add ("\"CODE_SIGN_IDENTITY\" = " + config.codeSignIdentity.get().quoted()); } s.add ("ZERO_LINK = NO"); diff --git a/extras/Projucer/Source/Project Saving/jucer_TextWithDefaultPropertyComponent.h b/extras/Projucer/Source/Project Saving/jucer_TextWithDefaultPropertyComponent.h new file mode 100644 index 0000000000..e881bdaa82 --- /dev/null +++ b/extras/Projucer/Source/Project Saving/jucer_TextWithDefaultPropertyComponent.h @@ -0,0 +1,169 @@ +/* + ============================================================================== + + This file is part of the JUCE library. + Copyright (c) 2016 - ROLI Ltd. + + Permission is granted to use this software under the terms of either: + a) the GPL v2 (or any later version) + b) the Affero GPL v3 + + Details of these licenses can be found at: www.gnu.org/licenses + + JUCE is distributed in the hope that it will be useful, but WITHOUT ANY + WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + A PARTICULAR PURPOSE. See the GNU General Public License for more details. + + ------------------------------------------------------------------------------ + + To release a closed-source product which uses JUCE, commercial licenses are + available: visit www.juce.com for more information. + + ============================================================================== +*/ + + +#ifndef JUCER_TEXTWITHDEFAULTPROPERTYCOMPONENT_H_INCLUDED +#define JUCER_TEXTWITHDEFAULTPROPERTYCOMPONENT_H_INCLUDED + +template +class TextWithDefaultPropertyComponent : public PropertyComponent, + private Label::Listener +{ + //========================================================================== + class LabelComp : public Label, + public FileDragAndDropTarget + { + public: + LabelComp (TextWithDefaultPropertyComponent& tpc, const int charLimit) + : Label (String::empty, String::empty), + 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, Colours::grey); + else + setColour (textColourId, Colours::black); + + 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::empty, dontSendNotification); + } + + void editorHidden (Label*, TextEditor&) override {} + + JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (TextWithDefaultPropertyComponent) +}; + +#endif // JUCER_TEXTWITHDEFAULTPROPERTYCOMPONENT_H_INCLUDED diff --git a/extras/Projucer/Source/Utility/jucer_PresetIDs.h b/extras/Projucer/Source/Utility/jucer_PresetIDs.h index e59a4d6556..5dca91d47a 100644 --- a/extras/Projucer/Source/Utility/jucer_PresetIDs.h +++ b/extras/Projucer/Source/Utility/jucer_PresetIDs.h @@ -90,6 +90,11 @@ namespace Ids DECLARE_ID (codeSigningIdentity); DECLARE_ID (fastMath); DECLARE_ID (linkTimeOptimisation); + DECLARE_ID (xcodeVstBinaryLocation); + DECLARE_ID (xcodeVst3BinaryLocation); + DECLARE_ID (xcodeAudioUnitBinaryLocation); + DECLARE_ID (xcodeRtasBinaryLocation); + DECLARE_ID (xcodeAaxBinaryLocation); DECLARE_ID (osxSDK); DECLARE_ID (osxCompatibility); DECLARE_ID (osxArchitecture);