The JUCE cross-platform C++ framework, with DISTRHO/KXStudio specific changes
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

2778 lines
123KB

  1. /*
  2. ==============================================================================
  3. This file is part of the JUCE library.
  4. Copyright (c) 2015 - ROLI Ltd.
  5. Permission is granted to use this software under the terms of either:
  6. a) the GPL v2 (or any later version)
  7. b) the Affero GPL v3
  8. Details of these licenses can be found at: www.gnu.org/licenses
  9. JUCE is distributed in the hope that it will be useful, but WITHOUT ANY
  10. WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
  11. A PARTICULAR PURPOSE. See the GNU General Public License for more details.
  12. ------------------------------------------------------------------------------
  13. To release a closed-source product which uses JUCE, commercial licenses are
  14. available: visit www.juce.com for more information.
  15. ==============================================================================
  16. */
  17. #include "../Application/jucer_Application.h"
  18. #include "jucer_TextWithDefaultPropertyComponent.h"
  19. namespace
  20. {
  21. const char* const osxVersionDefault = "default";
  22. const int oldestSDKVersion = 5;
  23. const int currentSDKVersion = 12;
  24. const int minimumAUv3SDKVersion = 11;
  25. const char* const osxArch_Default = "default";
  26. const char* const osxArch_Native = "Native";
  27. const char* const osxArch_32BitUniversal = "32BitUniversal";
  28. const char* const osxArch_64BitUniversal = "64BitUniversal";
  29. const char* const osxArch_64Bit = "64BitIntel";
  30. }
  31. //==============================================================================
  32. class XCodeProjectExporter : public ProjectExporter
  33. {
  34. public:
  35. //==============================================================================
  36. static const char* getNameMac() { return "Xcode (MacOSX)"; }
  37. static const char* getNameiOS() { return "Xcode (iOS)"; }
  38. static const char* getValueTreeTypeName (bool iOS) { return iOS ? "XCODE_IPHONE" : "XCODE_MAC"; }
  39. //==============================================================================
  40. XCodeProjectExporter (Project& p, const ValueTree& t, const bool isIOS)
  41. : ProjectExporter (p, t),
  42. xcodeCanUseDwarf (true),
  43. iOS (isIOS)
  44. {
  45. name = iOS ? getNameiOS() : getNameMac();
  46. if (getTargetLocationString().isEmpty())
  47. getTargetLocationValue() = getDefaultBuildsRootFolder() + (iOS ? "iOS" : "MacOSX");
  48. initialiseDependencyPathValues();
  49. if (iOS)
  50. {
  51. if (getScreenOrientationValue().toString().isEmpty())
  52. getScreenOrientationValue() = "portraitlandscape";
  53. }
  54. }
  55. static XCodeProjectExporter* createForSettings (Project& project, const ValueTree& settings)
  56. {
  57. if (settings.hasType (getValueTreeTypeName (false))) return new XCodeProjectExporter (project, settings, false);
  58. if (settings.hasType (getValueTreeTypeName (true))) return new XCodeProjectExporter (project, settings, true);
  59. return nullptr;
  60. }
  61. //==============================================================================
  62. Value getPListToMergeValue() { return getSetting ("customPList"); }
  63. String getPListToMergeString() const { return settings ["customPList"]; }
  64. Value getExtraFrameworksValue() { return getSetting (Ids::extraFrameworks); }
  65. String getExtraFrameworksString() const { return settings [Ids::extraFrameworks]; }
  66. Value getPostBuildScriptValue() { return getSetting (Ids::postbuildCommand); }
  67. String getPostBuildScript() const { return settings [Ids::postbuildCommand]; }
  68. Value getPreBuildScriptValue() { return getSetting (Ids::prebuildCommand); }
  69. String getPreBuildScript() const { return settings [Ids::prebuildCommand]; }
  70. Value getScreenOrientationValue() { return getSetting (Ids::iosScreenOrientation); }
  71. String getScreenOrientationString() const { return settings [Ids::iosScreenOrientation]; }
  72. Value getCustomResourceFoldersValue() { return getSetting (Ids::customXcodeResourceFolders); }
  73. String getCustomResourceFoldersString() const { return getSettingString (Ids::customXcodeResourceFolders).replaceCharacters ("\r\n", "::"); }
  74. Value getCustomXcassetsFolderValue() { return getSetting (Ids::customXcassetsFolder); }
  75. String getCustomXcassetsFolderString() const { return settings [Ids::customXcassetsFolder]; }
  76. Value getMicrophonePermissionValue() { return getSetting (Ids::microphonePermissionNeeded); }
  77. bool isMicrophonePermissionEnabled() const { return settings [Ids::microphonePermissionNeeded]; }
  78. Value getInAppPurchasesValue() { return getSetting (Ids::iosInAppPurchases); }
  79. bool isInAppPurchasesEnabled() const { return settings [Ids::iosInAppPurchases]; }
  80. Value getBackgroundAudioValue() { return getSetting (Ids::iosBackgroundAudio); }
  81. bool isBackgroundAudioEnabled() const { return settings [Ids::iosBackgroundAudio]; }
  82. Value getBackgroundBleValue() { return getSetting (Ids::iosBackgroundBle); }
  83. bool isBackgroundBleEnabled() const { return settings [Ids::iosBackgroundBle]; }
  84. Value getIosDevelopmentTeamIDValue() { return getSetting (Ids::iosDevelopmentTeamID); }
  85. String getIosDevelopmentTeamIDString() const { return settings [Ids::iosDevelopmentTeamID]; }
  86. bool usesMMFiles() const override { return true; }
  87. bool canCopeWithDuplicateFiles() override { return true; }
  88. bool supportsUserDefinedConfigurations() const override { return true; }
  89. bool isXcode() const override { return true; }
  90. bool isVisualStudio() const override { return false; }
  91. bool isCodeBlocks() const override { return false; }
  92. bool isMakefile() const override { return false; }
  93. bool isAndroidStudio() const override { return false; }
  94. bool isAndroidAnt() const override { return false; }
  95. bool isAndroid() const override { return false; }
  96. bool isWindows() const override { return false; }
  97. bool isLinux() const override { return false; }
  98. bool isOSX() const override { return ! iOS; }
  99. bool isiOS() const override { return iOS; }
  100. bool supportsVST() const override { return ! iOS; }
  101. bool supportsVST3() const override { return ! iOS; }
  102. bool supportsAAX() const override { return ! iOS; }
  103. bool supportsRTAS() const override { return ! iOS; }
  104. bool supportsAU() const override { return ! iOS; }
  105. bool supportsAUv3() const override { return true; }
  106. bool supportsStandalone() const override { return true; }
  107. void createExporterProperties (PropertyListBuilder& props) override
  108. {
  109. if (iOS)
  110. {
  111. props.add (new TextPropertyComponent (getCustomXcassetsFolderValue(), "Custom Xcassets folder", 128, false),
  112. "If this field is not empty, your Xcode project will use the custom xcassets folder specified here "
  113. "for the app icons and launchimages, and will ignore the Icon files specified above.");
  114. }
  115. props.add (new TextPropertyComponent (getCustomResourceFoldersValue(), "Custom Xcode Resource folders", 8192, true),
  116. "You can specify a list of custom resource folders here (separated by newlines or whitespace). "
  117. "References to these folders will then be added to the Xcode resources. "
  118. "This way you can specify them for OS X and iOS separately, and modify the content of the resource folders "
  119. "without re-saving the Projucer project.");
  120. if (iOS)
  121. {
  122. static const char* orientations[] = { "Portrait and Landscape", "Portrait", "Landscape", nullptr };
  123. static const char* orientationValues[] = { "portraitlandscape", "portrait", "landscape", nullptr };
  124. props.add (new ChoicePropertyComponent (getScreenOrientationValue(), "Screen orientation",StringArray (orientations), Array<var> (orientationValues)),
  125. "The screen orientations that this app should support");
  126. props.add (new BooleanPropertyComponent (getSetting ("UIFileSharingEnabled"), "File Sharing Enabled", "Enabled"),
  127. "Enable this to expose your app's files to iTunes.");
  128. props.add (new BooleanPropertyComponent (getSetting ("UIStatusBarHidden"), "Status Bar Hidden", "Enabled"),
  129. "Enable this to disable the status bar in your app.");
  130. props.add (new BooleanPropertyComponent (getMicrophonePermissionValue(), "Microphone access", "Enabled"),
  131. "Enable this to allow your app to use the microphone. "
  132. "The user of your app will be prompted to grant microphone access permissions.");
  133. props.add (new BooleanPropertyComponent (getInAppPurchasesValue(), "In-App purchases capability", "Enabled"),
  134. "Enable this to grant your app the capability for in-app purchases. "
  135. "This option requires that you specify a valid Development Team ID.");
  136. props.add (new BooleanPropertyComponent (getBackgroundAudioValue(), "Audio background capability", "Enabled"),
  137. "Enable this to grant your app the capability to access audio when in background mode.");
  138. props.add (new BooleanPropertyComponent (getBackgroundBleValue(), "Bluetooth MIDI background capability", "Enabled"),
  139. "Enable this to grant your app the capability to connect to Bluetooth LE devices when in background mode.");
  140. }
  141. else if (projectType.isGUIApplication())
  142. {
  143. props.add (new TextPropertyComponent (getSetting ("documentExtensions"), "Document file extensions", 128, false),
  144. "A comma-separated list of file extensions for documents that your app can open. "
  145. "Using a leading '.' is optional, and the extensions are not case-sensitive.");
  146. }
  147. props.add (new TextPropertyComponent (getPListToMergeValue(), "Custom PList", 8192, true),
  148. "You can paste the contents of an XML PList file in here, and the settings that it contains will override any "
  149. "settings that the Projucer creates. BEWARE! When doing this, be careful to remove from the XML any "
  150. "values that you DO want the Projucer to change!");
  151. props.add (new TextPropertyComponent (getExtraFrameworksValue(), "Extra Frameworks", 2048, false),
  152. "A comma-separated list of extra frameworks that should be added to the build. "
  153. "(Don't include the .framework extension in the name)");
  154. props.add (new TextPropertyComponent (getPreBuildScriptValue(), "Pre-build shell script", 32768, true),
  155. "Some shell-script that will be run before a build starts.");
  156. props.add (new TextPropertyComponent (getPostBuildScriptValue(), "Post-build shell script", 32768, true),
  157. "Some shell-script that will be run after a build completes.");
  158. props.add (new TextPropertyComponent (getIosDevelopmentTeamIDValue(), "Development Team ID", 10, false),
  159. "The Development Team ID to be used for setting up code-signing your iOS app. This is a ten-character "
  160. "string (for example, \"S7B6T5XJ2Q\") that describes the distribution certificate Apple issued to you. "
  161. "You can find this string in the OS X app Keychain Access under \"Certificates\".");
  162. props.add (new BooleanPropertyComponent (getSetting ("keepCustomXcodeSchemes"), "Keep custom Xcode schemes", "Enabled"),
  163. "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.");
  164. }
  165. bool launchProject() override
  166. {
  167. #if JUCE_MAC
  168. return getProjectBundle().startAsProcess();
  169. #else
  170. return false;
  171. #endif
  172. }
  173. bool canLaunchProject() override
  174. {
  175. #if JUCE_MAC
  176. return true;
  177. #else
  178. return false;
  179. #endif
  180. }
  181. //==============================================================================
  182. void create (const OwnedArray<LibraryModule>&) const override
  183. {
  184. for (auto& target : targets)
  185. if (target->xcodeCreatePList)
  186. target->infoPlistFile = getTargetFolder().getChildFile (target->getInfoPlistName());
  187. menuNibFile = getTargetFolder().getChildFile ("RecentFilesMenuTemplate.nib");
  188. createIconFile();
  189. File projectBundle (getProjectBundle());
  190. createDirectoryOrThrow (projectBundle);
  191. createObjects();
  192. File projectFile (projectBundle.getChildFile ("project.pbxproj"));
  193. {
  194. MemoryOutputStream mo;
  195. writeProjectFile (mo);
  196. overwriteFileIfDifferentOrThrow (projectFile, mo);
  197. }
  198. writeInfoPlistFiles();
  199. // Deleting the .rsrc files can be needed to force Xcode to update the version number.
  200. deleteRsrcFiles (getTargetFolder().getChildFile ("build"));
  201. if (! ProjucerApplication::getApp().isRunningCommandLine)
  202. {
  203. // Workaround for a bug where Xcode thinks the project is invalid if opened immedietely
  204. // after writing
  205. Thread::sleep (2000);
  206. }
  207. }
  208. //==============================================================================
  209. void addPlatformSpecificSettingsForProjectType (const ProjectType& type) override
  210. {
  211. if (type.isGUIApplication())
  212. targets.add (new Target (Target::GUIApp, *this));
  213. else if (type.isCommandLineApp())
  214. targets.add (new Target (Target::ConsoleApp, *this));
  215. else if (type.isStaticLibrary())
  216. targets.add (new Target (Target::StaticLibrary, *this));
  217. else if (type.isDynamicLibrary())
  218. targets.add (new Target (Target::DynamicLibrary, *this));
  219. else if (type.isAudioPlugin())
  220. {
  221. if (project.shouldBuildVST().getValue() && supportsVST())
  222. targets.add (new Target (Target::VSTPlugIn, *this));
  223. if (project.shouldBuildVST3().getValue() && supportsVST3())
  224. targets.add (new Target (Target::VST3PlugIn, *this));
  225. if (project.shouldBuildAU().getValue() && supportsAU())
  226. targets.add (new Target (Target::AudioUnitPlugIn, *this));
  227. if (project.shouldBuildAUv3().getValue())
  228. targets.add (new Target (Target::AudioUnitv3PlugIn, *this));
  229. if (project.shouldBuildAAX().getValue() && supportsAAX())
  230. targets.add (new Target (Target::AAXPlugIn, *this));
  231. if (project.shouldBuildStandalone().getValue())
  232. targets.add (new Target (Target::StandalonePlugIn, *this));
  233. if (project.shouldBuildRTAS().getValue() && supportsRTAS())
  234. {
  235. targets.add (new Target (Target::RTASPlugIn, *this));
  236. addRTASPluginSettings();
  237. }
  238. if (targets.size() > 0)
  239. targets.add (new Target (Target::SharedCodeTarget, *this));
  240. }
  241. if (targets.size() > 1)
  242. targets.insert (0, new Target (Target::AggregateTarget, *this));
  243. // If you hit this assert, you tried to generate a project for an exporter
  244. // that does not support any of your targets!
  245. jassert (targets.size() > 0);
  246. }
  247. void updateDeprecatedProjectSettingsInteractively() override
  248. {
  249. if (hasInvalidPostBuildScript())
  250. {
  251. String alertWindowText = iOS ? "Your Xcode (iOS) Exporter settings use an invalid post-build script. Click 'Update' to remove it."
  252. : "Your Xcode (OSX) Exporter settings use a pre-JUCE 4.2 post-build script to move the plug-in binaries to their plug-in install folders.\n\n"
  253. "Since JUCE 4.2, this is instead done using \"AU/VST/VST2/AAX/RTAS Binary Location\" in the Xcode (OS X) configuration settings.\n\n"
  254. "Click 'Update' to remove the script (otherwise your plug-in may not compile correctly).";
  255. if (AlertWindow::showOkCancelBox (AlertWindow::WarningIcon,
  256. "Project settings: " + project.getDocumentTitle(),
  257. alertWindowText, "Update", "Cancel", nullptr, nullptr))
  258. getPostBuildScriptValue() = var();
  259. }
  260. }
  261. bool hasInvalidPostBuildScript() const
  262. {
  263. // check whether the script is identical to the old one that the Introjucer used to auto-generate
  264. return (MD5 (getPostBuildScript().toUTF8()).toHexString() == "265ac212a7e734c5bbd6150e1eae18a1");
  265. }
  266. protected:
  267. //==============================================================================
  268. class XcodeBuildConfiguration : public BuildConfiguration
  269. {
  270. public:
  271. XcodeBuildConfiguration (Project& p, const ValueTree& t, const bool isIOS, const ProjectExporter& e)
  272. : BuildConfiguration (p, t, e),
  273. iOS (isIOS),
  274. osxSDKVersion (config, Ids::osxSDK, nullptr, "default"),
  275. osxDeploymentTarget (config, Ids::osxCompatibility, nullptr, "default"),
  276. iosDeploymentTarget (config, Ids::iosCompatibility, nullptr, "default"),
  277. osxArchitecture (config, Ids::osxArchitecture, nullptr, "default"),
  278. customXcodeFlags (config, Ids::customXcodeFlags, nullptr),
  279. cppLanguageStandard (config, Ids::cppLanguageStandard, nullptr),
  280. cppStandardLibrary (config, Ids::cppLibType, nullptr),
  281. codeSignIdentity (config, Ids::codeSigningIdentity, nullptr, iOS ? "iPhone Developer" : "Mac Developer"),
  282. fastMathEnabled (config, Ids::fastMath, nullptr),
  283. linkTimeOptimisationEnabled (config, Ids::linkTimeOptimisation, nullptr),
  284. stripLocalSymbolsEnabled (config, Ids::stripLocalSymbols, nullptr),
  285. vstBinaryLocation (config, Ids::xcodeVstBinaryLocation, nullptr, "$(HOME)/Library/Audio/Plug-Ins/VST/"),
  286. vst3BinaryLocation (config, Ids::xcodeVst3BinaryLocation, nullptr, "$(HOME)/Library/Audio/Plug-Ins/VST3/"),
  287. auBinaryLocation (config, Ids::xcodeAudioUnitBinaryLocation, nullptr, "$(HOME)/Library/Audio/Plug-Ins/Components/"),
  288. rtasBinaryLocation (config, Ids::xcodeRtasBinaryLocation, nullptr, "/Library/Application Support/Digidesign/Plug-Ins/"),
  289. aaxBinaryLocation (config, Ids::xcodeAaxBinaryLocation, nullptr, "/Library/Application Support/Avid/Audio/Plug-Ins/")
  290. {
  291. }
  292. //==========================================================================
  293. bool iOS;
  294. CachedValue<String> osxSDKVersion, osxDeploymentTarget, iosDeploymentTarget, osxArchitecture,
  295. customXcodeFlags, cppLanguageStandard, cppStandardLibrary, codeSignIdentity;
  296. CachedValue<bool> fastMathEnabled, linkTimeOptimisationEnabled, stripLocalSymbolsEnabled;
  297. CachedValue<String> vstBinaryLocation, vst3BinaryLocation, auBinaryLocation, rtasBinaryLocation, aaxBinaryLocation;
  298. //==========================================================================
  299. var getDefaultOptimisationLevel() const override { return var ((int) (isDebug() ? gccO0 : gccO3)); }
  300. void createConfigProperties (PropertyListBuilder& props) override
  301. {
  302. addXcodePluginInstallPathProperties (props);
  303. addGCCOptimisationProperty (props);
  304. if (iOS)
  305. {
  306. 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", 0 };
  307. 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", 0 };
  308. props.add (new ChoicePropertyComponent (iosDeploymentTarget.getPropertyAsValue(), "iOS Deployment Target",
  309. StringArray (iosVersions), Array<var> (iosVersionValues)),
  310. "The minimum version of iOS that the target binary will run on.");
  311. }
  312. else
  313. {
  314. StringArray sdkVersionNames, osxVersionNames;
  315. Array<var> versionValues;
  316. sdkVersionNames.add ("Use Default");
  317. osxVersionNames.add ("Use Default");
  318. versionValues.add (osxVersionDefault);
  319. for (int ver = oldestSDKVersion; ver <= currentSDKVersion; ++ver)
  320. {
  321. sdkVersionNames.add (getSDKName (ver));
  322. osxVersionNames.add (getOSXVersionName (ver));
  323. versionValues.add (getSDKName (ver));
  324. }
  325. props.add (new ChoicePropertyComponent (osxSDKVersion.getPropertyAsValue(), "OSX Base SDK Version", sdkVersionNames, versionValues),
  326. "The version of OSX to link against in the XCode build.");
  327. props.add (new ChoicePropertyComponent (osxDeploymentTarget.getPropertyAsValue(), "OSX Deployment Target", osxVersionNames, versionValues),
  328. "The minimum version of OSX that the target binary will be compatible with.");
  329. const char* osxArch[] = { "Use Default", "Native architecture of build machine",
  330. "Universal Binary (32-bit)", "Universal Binary (32/64-bit)", "64-bit Intel", 0 };
  331. const char* osxArchValues[] = { osxArch_Default, osxArch_Native, osxArch_32BitUniversal,
  332. osxArch_64BitUniversal, osxArch_64Bit, 0 };
  333. props.add (new ChoicePropertyComponent (osxArchitecture.getPropertyAsValue(), "OSX Architecture",
  334. StringArray (osxArch), Array<var> (osxArchValues)),
  335. "The type of OSX binary that will be produced.");
  336. }
  337. props.add (new TextPropertyComponent (customXcodeFlags.getPropertyAsValue(), "Custom Xcode flags", 8192, false),
  338. "A comma-separated list of custom Xcode setting flags which will be appended to the list of generated flags, "
  339. "e.g. MACOSX_DEPLOYMENT_TARGET_i386 = 10.5, VALID_ARCHS = \"ppc i386 x86_64\"");
  340. const char* cppLanguageStandardNames[] = { "Use Default", "C++98", "GNU++98", "C++11", "GNU++11", "C++14", "GNU++14", nullptr };
  341. Array<var> cppLanguageStandardValues;
  342. cppLanguageStandardValues.add (var());
  343. cppLanguageStandardValues.add ("c++98");
  344. cppLanguageStandardValues.add ("gnu++98");
  345. cppLanguageStandardValues.add ("c++11");
  346. cppLanguageStandardValues.add ("gnu++11");
  347. cppLanguageStandardValues.add ("c++14");
  348. cppLanguageStandardValues.add ("gnu++14");
  349. props.add (new ChoicePropertyComponent (cppLanguageStandard.getPropertyAsValue(), "C++ Language Standard",
  350. StringArray (cppLanguageStandardNames), cppLanguageStandardValues),
  351. "The standard of the C++ language that will be used for compilation.");
  352. const char* cppLibNames[] = { "Use Default", "LLVM libc++", "GNU libstdc++", nullptr };
  353. Array<var> cppLibValues;
  354. cppLibValues.add (var());
  355. cppLibValues.add ("libc++");
  356. cppLibValues.add ("libstdc++");
  357. props.add (new ChoicePropertyComponent (cppStandardLibrary.getPropertyAsValue(), "C++ Library", StringArray (cppLibNames), cppLibValues),
  358. "The type of C++ std lib that will be linked.");
  359. props.add (new TextWithDefaultPropertyComponent<String> (codeSignIdentity, "Code-signing Identity", 1024),
  360. "The name of a code-signing identity for Xcode to apply.");
  361. props.add (new BooleanPropertyComponent (fastMathEnabled.getPropertyAsValue(), "Relax IEEE compliance", "Enabled"),
  362. "Enable this to use FAST_MATH non-IEEE mode. (Warning: this can have unexpected results!)");
  363. props.add (new BooleanPropertyComponent (linkTimeOptimisationEnabled.getPropertyAsValue(), "Link-Time Optimisation", "Enabled"),
  364. "Enable this to perform link-time code generation. This is recommended for release builds.");
  365. props.add (new BooleanPropertyComponent (stripLocalSymbolsEnabled.getPropertyAsValue(), "Strip local symbols", "Enabled"),
  366. "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.");
  367. }
  368. private:
  369. //==========================================================================
  370. void addXcodePluginInstallPathProperties (PropertyListBuilder& props)
  371. {
  372. if (project.shouldBuildVST().getValue())
  373. props.add (new TextWithDefaultPropertyComponent<String> (vstBinaryLocation, "VST Binary location", 1024),
  374. "The folder in which the compiled VST binary should be placed.");
  375. if (project.shouldBuildVST3().getValue())
  376. props.add (new TextWithDefaultPropertyComponent<String> (vst3BinaryLocation, "VST3 Binary location", 1024),
  377. "The folder in which the compiled VST3 binary should be placed.");
  378. if (project.shouldBuildAU().getValue())
  379. props.add (new TextWithDefaultPropertyComponent<String> (auBinaryLocation, "AU Binary location", 1024),
  380. "The folder in which the compiled AU binary should be placed.");
  381. if (project.shouldBuildRTAS().getValue())
  382. props.add (new TextWithDefaultPropertyComponent<String> (rtasBinaryLocation, "RTAS Binary location", 1024),
  383. "The folder in which the compiled RTAS binary should be placed.");
  384. if (project.shouldBuildAAX().getValue())
  385. props.add (new TextWithDefaultPropertyComponent<String> (aaxBinaryLocation, "AAX Binary location", 1024),
  386. "The folder in which the compiled AAX binary should be placed.");
  387. }
  388. };
  389. BuildConfiguration::Ptr createBuildConfig (const ValueTree& v) const override
  390. {
  391. return new XcodeBuildConfiguration (project, v, iOS, *this);
  392. }
  393. public:
  394. //==============================================================================
  395. /* The numbers for these enum values are defined by Xcode for the different
  396. possible destinations of a "copy files" post-build step.
  397. */
  398. enum XcodeCopyFilesDestinationIDs
  399. {
  400. kWrapperFolder = 1,
  401. kExecutablesFolder = 6,
  402. kResourcesFolder = 7,
  403. kFrameworksFolder = 10,
  404. kSharedFrameworksFolder = 11,
  405. kSharedSupportFolder = 12,
  406. kPluginsFolder = 13,
  407. kJavaResourcesFolder = 15,
  408. kXPCServicesFolder = 16
  409. };
  410. //==============================================================================
  411. struct Target
  412. {
  413. enum Type
  414. {
  415. GUIApp = 0,
  416. ConsoleApp = 1,
  417. StaticLibrary = 2,
  418. DynamicLibrary = 3,
  419. VSTPlugIn = 10,
  420. VST3PlugIn = 11,
  421. AAXPlugIn = 12,
  422. RTASPlugIn = 13,
  423. AudioUnitPlugIn = 14,
  424. AudioUnitv3PlugIn = 15,
  425. StandalonePlugIn = 16,
  426. SharedCodeTarget = 20, // internal
  427. AggregateTarget = 21,
  428. unspecified = 30
  429. };
  430. //==============================================================================
  431. Target (Type targetType, const XCodeProjectExporter& exporter)
  432. : type (targetType),
  433. owner (exporter)
  434. {
  435. switch (type)
  436. {
  437. case GUIApp:
  438. xcodeIsBundle = false;
  439. xcodeIsExecutable = true;
  440. xcodeCreatePList = true;
  441. xcodePackageType = "APPL";
  442. xcodeBundleSignature = "????";
  443. xcodeFileType = "wrapper.application";
  444. xcodeBundleExtension = ".app";
  445. xcodeProductType = "com.apple.product-type.application";
  446. xcodeCopyToProductInstallPathAfterBuild = false;
  447. break;
  448. case ConsoleApp:
  449. xcodeIsBundle = false;
  450. xcodeIsExecutable = true;
  451. xcodeCreatePList = false;
  452. xcodeFileType = "compiled.mach-o.executable";
  453. xcodeBundleExtension = String();
  454. xcodeProductType = "com.apple.product-type.tool";
  455. xcodeCopyToProductInstallPathAfterBuild = false;
  456. break;
  457. case StaticLibrary:
  458. xcodeIsBundle = false;
  459. xcodeIsExecutable = false;
  460. xcodeCreatePList = false;
  461. xcodeFileType = "archive.ar";
  462. xcodeProductType = "com.apple.product-type.library.static";
  463. xcodeCopyToProductInstallPathAfterBuild = false;
  464. break;
  465. case DynamicLibrary:
  466. xcodeIsBundle = false;
  467. xcodeIsExecutable = false;
  468. xcodeCreatePList = false;
  469. xcodeFileType = "compiled.mach-o.dylib";
  470. xcodeProductType = "com.apple.product-type.library.dynamic";
  471. xcodeBundleExtension = ".dylib";
  472. xcodeCopyToProductInstallPathAfterBuild = false;
  473. break;
  474. case VSTPlugIn:
  475. xcodeIsBundle = true;
  476. xcodeIsExecutable = false;
  477. xcodeCreatePList = true;
  478. xcodePackageType = "BNDL";
  479. xcodeBundleSignature = "????";
  480. xcodeFileType = "wrapper.cfbundle";
  481. xcodeBundleExtension = ".vst";
  482. xcodeProductType = "com.apple.product-type.bundle";
  483. xcodeCopyToProductInstallPathAfterBuild = true;
  484. break;
  485. case VST3PlugIn:
  486. xcodeIsBundle = true;
  487. xcodeIsExecutable = false;
  488. xcodeCreatePList = true;
  489. xcodePackageType = "BNDL";
  490. xcodeBundleSignature = "????";
  491. xcodeFileType = "wrapper.cfbundle";
  492. xcodeBundleExtension = ".vst3";
  493. xcodeProductType = "com.apple.product-type.bundle";
  494. xcodeCopyToProductInstallPathAfterBuild = true;
  495. break;
  496. case AudioUnitPlugIn:
  497. xcodeIsBundle = true;
  498. xcodeIsExecutable = false;
  499. xcodeCreatePList = true;
  500. xcodePackageType = "BNDL";
  501. xcodeBundleSignature = "????";
  502. xcodeFileType = "wrapper.cfbundle";
  503. xcodeBundleExtension = ".component";
  504. xcodeProductType = "com.apple.product-type.bundle";
  505. xcodeCopyToProductInstallPathAfterBuild = true;
  506. addExtraAudioUnitTargetSettings();
  507. break;
  508. case StandalonePlugIn:
  509. xcodeIsBundle = false;
  510. xcodeIsExecutable = true;
  511. xcodeCreatePList = true;
  512. xcodePackageType = "APPL";
  513. xcodeBundleSignature = "????";
  514. xcodeCreatePList = true;
  515. xcodeFileType = "wrapper.application";
  516. xcodeBundleExtension = ".app";
  517. xcodeProductType = "com.apple.product-type.application";
  518. xcodeCopyToProductInstallPathAfterBuild = false;
  519. break;
  520. case AudioUnitv3PlugIn:
  521. xcodeIsBundle = false;
  522. xcodeIsExecutable = false;
  523. xcodeCreatePList = true;
  524. xcodePackageType = "XPC!";
  525. xcodeBundleSignature = "????";
  526. xcodeFileType = "wrapper.app-extension";
  527. xcodeBundleExtension = ".appex";
  528. xcodeBundleIDSubPath = "AUv3";
  529. xcodeProductType = "com.apple.product-type.app-extension";
  530. xcodeCopyToProductInstallPathAfterBuild = false;
  531. addExtraAudioUnitv3PlugInTargetSettings();
  532. break;
  533. case AAXPlugIn:
  534. xcodeIsBundle = true;
  535. xcodeIsExecutable = false;
  536. xcodeCreatePList = true;
  537. xcodePackageType = "TDMw";
  538. xcodeBundleSignature = "PTul";
  539. xcodeFileType = "wrapper.cfbundle";
  540. xcodeBundleExtension = ".aaxplugin";
  541. xcodeProductType = "com.apple.product-type.bundle";
  542. xcodeCopyToProductInstallPathAfterBuild = true;
  543. addExtraAAXTargetSettings();
  544. break;
  545. case RTASPlugIn:
  546. xcodeIsBundle = true;
  547. xcodeIsExecutable = false;
  548. xcodeCreatePList = true;
  549. xcodePackageType = "TDMw";
  550. xcodeBundleSignature = "PTul";
  551. xcodeFileType = "wrapper.cfbundle";
  552. xcodeBundleExtension = ".dpm";
  553. xcodeProductType = "com.apple.product-type.bundle";
  554. xcodeCopyToProductInstallPathAfterBuild = true;
  555. addExtraRTASTargetSettings();
  556. break;
  557. case SharedCodeTarget:
  558. xcodeIsBundle = false;
  559. xcodeIsExecutable = false;
  560. xcodeCreatePList = false;
  561. xcodeFileType = "archive.ar";
  562. xcodeProductType = "com.apple.product-type.library.static";
  563. xcodeCopyToProductInstallPathAfterBuild = false;
  564. break;
  565. case AggregateTarget:
  566. xcodeIsBundle = false;
  567. xcodeIsExecutable = false;
  568. xcodeCreatePList = false;
  569. xcodeCopyToProductInstallPathAfterBuild = false;
  570. break;
  571. default:
  572. // unknown target type!
  573. jassertfalse;
  574. break;
  575. }
  576. }
  577. const char* getName() const noexcept
  578. {
  579. switch (type)
  580. {
  581. case GUIApp: return "App";
  582. case ConsoleApp: return "ConsoleApp";
  583. case StaticLibrary: return "Static Library";
  584. case DynamicLibrary: return "Dynamic Library";
  585. case VSTPlugIn: return "VST";
  586. case VST3PlugIn: return "VST3";
  587. case AudioUnitPlugIn: return "AU";
  588. case StandalonePlugIn: return "AUv3 Standalone";
  589. case AudioUnitv3PlugIn: return "AUv3 AppExtension";
  590. case AAXPlugIn: return "AAX";
  591. case RTASPlugIn: return "RTAS";
  592. case SharedCodeTarget: return "Shared Code";
  593. case AggregateTarget: return "All";
  594. default: return "undefined";
  595. }
  596. }
  597. String getXCodeSchemeName() const
  598. {
  599. return owner.projectName + " (" + getName() + ")";
  600. }
  601. bool shouldBuildVST() const { return owner.supportsVST() && owner.project.shouldBuildVST().getValue() && (type == SharedCodeTarget || type == VSTPlugIn); }
  602. bool shouldBuildVST3() const { return owner.supportsVST3() && owner.project.shouldBuildVST3().getValue() && (type == SharedCodeTarget || type == VST3PlugIn); }
  603. bool shouldBuildAAX() const { return owner.supportsAAX() && owner.project.shouldBuildAAX().getValue() && (type == SharedCodeTarget || type == AAXPlugIn); }
  604. bool shouldBuildRTAS() const { return owner.supportsRTAS() && owner.project.shouldBuildRTAS().getValue() && (type == SharedCodeTarget || type == RTASPlugIn); }
  605. bool shouldBuildAU() const { return owner.supportsAU() && owner.project.shouldBuildAU().getValue() && (type == SharedCodeTarget || type == AudioUnitPlugIn); }
  606. bool shouldBuildAUv3() const { return owner.supportsAUv3() && owner.project.shouldBuildAUv3().getValue() && (type == SharedCodeTarget || type == AudioUnitv3PlugIn); }
  607. bool shouldBuildStandalone() const { return owner.project.shouldBuildStandalone().getValue() && (type == SharedCodeTarget || type == StandalonePlugIn); }
  608. String getID() const
  609. {
  610. return owner.createID (String ("__target") + getName());
  611. }
  612. String getInfoPlistName() const
  613. {
  614. return String ("Info-") + String (getName()).replace (" ", "_") + String (".plist");
  615. }
  616. String xcodePackageType, xcodeBundleSignature, xcodeBundleExtension;
  617. String xcodeProductType, xcodeFileType;
  618. String xcodeOtherRezFlags, xcodeExcludedFiles64Bit, xcodeBundleIDSubPath;
  619. bool xcodeIsBundle, xcodeCreatePList, xcodeIsExecutable, xcodeCopyToProductInstallPathAfterBuild;
  620. StringArray xcodeFrameworks, xcodeLibs;
  621. Type type;
  622. Array<XmlElement> xcodeExtraPListEntries;
  623. Array<RelativePath> xcodeExtraLibrariesDebug, xcodeExtraLibrariesRelease;
  624. StringArray frameworkIDs, buildPhaseIDs, configIDs, sourceIDs, rezFileIDs;
  625. String dependencyID, mainBuildProductID;
  626. File infoPlistFile;
  627. //==============================================================================
  628. void addMainBuildProduct() const
  629. {
  630. jassert (xcodeFileType.isNotEmpty());
  631. jassert (xcodeBundleExtension.isEmpty() || xcodeBundleExtension.startsWithChar ('.'));
  632. if (ProjectExporter::BuildConfiguration::Ptr config = owner.getConfiguration(0))
  633. {
  634. String productName (owner.replacePreprocessorTokens (*config, config->getTargetBinaryNameString()));
  635. if (xcodeFileType == "archive.ar")
  636. productName = getLibbedFilename (productName);
  637. else
  638. productName += xcodeBundleExtension;
  639. addBuildProduct (xcodeFileType, productName);
  640. }
  641. }
  642. //==============================================================================
  643. void addBuildProduct (const String& fileType, const String& binaryName) const
  644. {
  645. ValueTree* v = new ValueTree (owner.createID (String ("__productFileID") + getName()));
  646. v->setProperty ("isa", "PBXFileReference", nullptr);
  647. v->setProperty ("explicitFileType", fileType, nullptr);
  648. v->setProperty ("includeInIndex", (int) 0, nullptr);
  649. v->setProperty ("path", sanitisePath (binaryName), nullptr);
  650. v->setProperty ("sourceTree", "BUILT_PRODUCTS_DIR", nullptr);
  651. owner.pbxFileReferences.add (v);
  652. }
  653. //==============================================================================
  654. void addDependency()
  655. {
  656. jassert (dependencyID.isEmpty());
  657. dependencyID = owner.createID (String ("__dependency") + getName());
  658. ValueTree* const v = new ValueTree (dependencyID);
  659. v->setProperty ("isa", "PBXTargetDependency", nullptr);
  660. v->setProperty ("target", getID(), nullptr);
  661. owner.misc.add (v);
  662. }
  663. String getDependencyID() const
  664. {
  665. jassert (dependencyID.isNotEmpty());
  666. return dependencyID;
  667. }
  668. //==============================================================================
  669. void addTargetConfig (const String& configName, const StringArray& buildSettings)
  670. {
  671. String configID = owner.createID (String ("targetconfigid_") + getName() + String ("_") + configName);
  672. ValueTree* v = new ValueTree (configID);
  673. v->setProperty ("isa", "XCBuildConfiguration", nullptr);
  674. v->setProperty ("buildSettings", indentBracedList (buildSettings), nullptr);
  675. v->setProperty (Ids::name, configName, nullptr);
  676. configIDs.add (configID);
  677. owner.targetConfigs.add (v);
  678. }
  679. //==============================================================================
  680. String getTargetAttributes() const
  681. {
  682. String attributes;
  683. attributes << getID() << " = { ";
  684. String developmentTeamID = owner.getIosDevelopmentTeamIDString();
  685. if (developmentTeamID.isNotEmpty())
  686. attributes << "DevelopmentTeam = " << developmentTeamID << "; ";
  687. const int inAppPurchasesEnabled = (owner.iOS && owner.isInAppPurchasesEnabled()) ? 1 : 0;
  688. const int sandboxEnabled = (type == Target::AudioUnitv3PlugIn ? 1 : 0);
  689. attributes << "SystemCapabilities = {";
  690. attributes << "com.apple.InAppPurchase = { enabled = " << inAppPurchasesEnabled << "; }; ";
  691. attributes << "com.apple.Sandbox = { enabled = " << sandboxEnabled << "; }; ";
  692. attributes << "}; };";
  693. return attributes;
  694. }
  695. //==============================================================================
  696. ValueTree& addBuildPhase (const String& buildPhaseType, const StringArray& fileIds, const StringRef humanReadableName = StringRef())
  697. {
  698. String buildPhaseName = buildPhaseType + String ("_") + getName() + String ("_") + (humanReadableName.isNotEmpty() ? String (humanReadableName) : String ("resbuildphase"));
  699. String buildPhaseId (owner.createID (buildPhaseName));
  700. int n = 0;
  701. while (buildPhaseIDs.contains (buildPhaseId))
  702. buildPhaseId = owner.createID (buildPhaseName + String (++n));
  703. buildPhaseIDs.add (buildPhaseId);
  704. ValueTree* v = new ValueTree (buildPhaseId);
  705. v->setProperty ("isa", buildPhaseType, nullptr);
  706. v->setProperty ("buildActionMask", "2147483647", nullptr);
  707. v->setProperty ("files", indentParenthesisedList (fileIds), nullptr);
  708. v->setProperty ("runOnlyForDeploymentPostprocessing", (int) 0, nullptr);
  709. if (humanReadableName.isNotEmpty())
  710. v->setProperty ("name", String (humanReadableName), nullptr);
  711. owner.misc.add (v);
  712. return *v;
  713. }
  714. //==============================================================================
  715. StringArray getTargetSettings (const XcodeBuildConfiguration& config) const
  716. {
  717. if (type == AggregateTarget)
  718. // the aggregate target should not specify any settings at all!
  719. // it just defines dependencies on the other targets.
  720. return StringArray();
  721. StringArray s;
  722. String bundleIdentifier = owner.project.getBundleIdentifier().toString();
  723. if (xcodeBundleIDSubPath.isNotEmpty())
  724. {
  725. StringArray bundleIdSegments = StringArray::fromTokens (bundleIdentifier, ".", StringRef());
  726. jassert (bundleIdSegments.size() > 0);
  727. bundleIdentifier += String (".") + bundleIdSegments[bundleIdSegments.size() - 1] + xcodeBundleIDSubPath;
  728. }
  729. s.add ("PRODUCT_BUNDLE_IDENTIFIER = " + bundleIdentifier);
  730. const String arch ((! owner.isiOS() && type == Target::AudioUnitv3PlugIn) ? osxArch_64Bit : config.osxArchitecture.get());
  731. if (arch == osxArch_Native) s.add ("ARCHS = \"$(NATIVE_ARCH_ACTUAL)\"");
  732. else if (arch == osxArch_32BitUniversal) s.add ("ARCHS = \"$(ARCHS_STANDARD_32_BIT)\"");
  733. else if (arch == osxArch_64BitUniversal) s.add ("ARCHS = \"$(ARCHS_STANDARD_32_64_BIT)\"");
  734. else if (arch == osxArch_64Bit) s.add ("ARCHS = \"$(ARCHS_STANDARD_64_BIT)\"");
  735. s.add ("HEADER_SEARCH_PATHS = " + owner.getHeaderSearchPaths (config));
  736. s.add ("GCC_OPTIMIZATION_LEVEL = " + config.getGCCOptimisationFlag());
  737. if (xcodeCreatePList)
  738. s.add ("INFOPLIST_FILE = " + infoPlistFile.getFileName());
  739. if (config.linkTimeOptimisationEnabled.get())
  740. s.add ("LLVM_LTO = YES");
  741. if (config.fastMathEnabled.get())
  742. s.add ("GCC_FAST_MATH = YES");
  743. const String extraFlags (owner.replacePreprocessorTokens (config, owner.getExtraCompilerFlagsString()).trim());
  744. if (extraFlags.isNotEmpty())
  745. s.add ("OTHER_CPLUSPLUSFLAGS = \"" + extraFlags + "\"");
  746. String installPath = getInstallPathForConfiguration (config);
  747. if (installPath.isNotEmpty())
  748. {
  749. s.add ("INSTALL_PATH = \"" + installPath + "\"");
  750. if (xcodeCopyToProductInstallPathAfterBuild)
  751. {
  752. s.add ("DEPLOYMENT_LOCATION = YES");
  753. s.add ("DSTROOT = /");
  754. }
  755. }
  756. if (xcodeIsBundle)
  757. {
  758. s.add ("LIBRARY_STYLE = Bundle");
  759. s.add ("WRAPPER_EXTENSION = " + xcodeBundleExtension.substring (1));
  760. s.add ("GENERATE_PKGINFO_FILE = YES");
  761. }
  762. if (xcodeOtherRezFlags.isNotEmpty())
  763. s.add ("OTHER_REZFLAGS = \"" + xcodeOtherRezFlags + "\"");
  764. String configurationBuildDir = "$(PROJECT_DIR)/build/$(CONFIGURATION)";
  765. if (config.getTargetBinaryRelativePathString().isNotEmpty())
  766. {
  767. // a target's position can either be defined via installPath + xcodeCopyToProductInstallPathAfterBuild
  768. // (= for audio plug-ins) or using a custom binary path (for everything else), but not both (= conflict!)
  769. jassert (! xcodeCopyToProductInstallPathAfterBuild);
  770. RelativePath binaryPath (config.getTargetBinaryRelativePathString(), RelativePath::projectFolder);
  771. configurationBuildDir = sanitisePath (binaryPath.rebased (owner.projectFolder, owner.getTargetFolder(), RelativePath::buildTargetFolder)
  772. .toUnixStyle());
  773. }
  774. s.add ("CONFIGURATION_BUILD_DIR = " + addQuotesIfRequired (configurationBuildDir));
  775. String gccVersion ("com.apple.compilers.llvm.clang.1_0");
  776. if (owner.iOS)
  777. {
  778. s.add ("ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon");
  779. s.add ("ASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME = LaunchImage");
  780. }
  781. else
  782. {
  783. const String sdk (config.osxSDKVersion.get());
  784. const String sdkCompat (config.osxDeploymentTarget.get());
  785. // if the user doesn't set it, then use the last known version that works well with JUCE
  786. String deploymentTarget = "10.11";
  787. int oldestAllowedSDKVersion = (type == AudioUnitv3PlugIn || type == StandalonePlugIn) ? minimumAUv3SDKVersion : oldestSDKVersion;
  788. for (int ver = oldestAllowedSDKVersion; ver <= currentSDKVersion; ++ver)
  789. {
  790. if (sdk == getSDKName (ver)) s.add ("SDKROOT = macosx10." + String (ver));
  791. if (sdkCompat == getSDKName (ver)) deploymentTarget = "10." + String (ver);
  792. }
  793. s.add ("MACOSX_DEPLOYMENT_TARGET = " + deploymentTarget);
  794. s.add ("MACOSX_DEPLOYMENT_TARGET_ppc = 10.4");
  795. s.add ("SDKROOT_ppc = macosx10.5");
  796. if (xcodeExcludedFiles64Bit.isNotEmpty())
  797. {
  798. s.add ("EXCLUDED_SOURCE_FILE_NAMES = \"$(EXCLUDED_SOURCE_FILE_NAMES_$(CURRENT_ARCH))\"");
  799. s.add ("EXCLUDED_SOURCE_FILE_NAMES_x86_64 = " + xcodeExcludedFiles64Bit);
  800. }
  801. }
  802. s.add ("GCC_VERSION = " + gccVersion);
  803. s.add ("CLANG_CXX_LANGUAGE_STANDARD = \"c++0x\"");
  804. s.add ("CLANG_LINK_OBJC_RUNTIME = NO");
  805. if (! config.codeSignIdentity.isUsingDefault())
  806. s.add ("CODE_SIGN_IDENTITY = " + config.codeSignIdentity.get().quoted());
  807. if (config.cppLanguageStandard.get().isNotEmpty())
  808. s.add ("CLANG_CXX_LANGUAGE_STANDARD = " + config.cppLanguageStandard.get().quoted());
  809. if (config.cppStandardLibrary.get().isNotEmpty())
  810. s.add ("CLANG_CXX_LIBRARY = " + config.cppStandardLibrary.get().quoted());
  811. s.add ("COMBINE_HIDPI_IMAGES = YES");
  812. {
  813. StringArray linkerFlags, librarySearchPaths;
  814. getLinkerSettings (config, linkerFlags, librarySearchPaths);
  815. if (linkerFlags.size() > 0)
  816. s.add ("OTHER_LDFLAGS = \"" + linkerFlags.joinIntoString (" ") + "\"");
  817. librarySearchPaths.addArray (config.getLibrarySearchPaths());
  818. librarySearchPaths = getCleanedStringArray (librarySearchPaths);
  819. if (librarySearchPaths.size() > 0)
  820. {
  821. String libPaths ("LIBRARY_SEARCH_PATHS = (\"$(inherited)\"");
  822. for (auto& p : librarySearchPaths)
  823. libPaths += ", \"\\\"" + p + "\\\"\"";
  824. s.add (libPaths + ")");
  825. }
  826. }
  827. StringPairArray defines;
  828. if (config.isDebug())
  829. {
  830. defines.set ("_DEBUG", "1");
  831. defines.set ("DEBUG", "1");
  832. s.add ("COPY_PHASE_STRIP = NO");
  833. s.add ("GCC_DYNAMIC_NO_PIC = NO");
  834. }
  835. else
  836. {
  837. defines.set ("_NDEBUG", "1");
  838. defines.set ("NDEBUG", "1");
  839. s.add ("GCC_GENERATE_DEBUGGING_SYMBOLS = NO");
  840. s.add ("GCC_SYMBOLS_PRIVATE_EXTERN = YES");
  841. s.add ("DEAD_CODE_STRIPPING = YES");
  842. }
  843. if (type != Target::SharedCodeTarget && type != Target::StaticLibrary && type != Target::DynamicLibrary
  844. && config.stripLocalSymbolsEnabled.get())
  845. {
  846. s.add ("STRIPFLAGS = \"-x\"");
  847. s.add ("DEPLOYMENT_POSTPROCESSING = YES");
  848. s.add ("SEPARATE_STRIP = YES");
  849. }
  850. if (type == Target::SharedCodeTarget)
  851. defines.set ("JUCE_SHARED_CODE", "1");
  852. if (owner.project.getProjectType().isAudioPlugin() && type == Target::AudioUnitv3PlugIn && owner.isOSX())
  853. s.add (String ("CODE_SIGN_ENTITLEMENTS = \"") + owner.getEntitlementsFileName() + String ("\""));
  854. if (owner.project.getProjectType().isAudioPlugin())
  855. {
  856. defines.set ("JucePlugin_Build_VST", (shouldBuildVST() ? "1" : "0"));
  857. defines.set ("JucePlugin_Build_VST3", (shouldBuildVST3() ? "1" : "0"));
  858. defines.set ("JucePlugin_Build_AU", (shouldBuildAU() ? "1" : "0"));
  859. defines.set ("JucePlugin_Build_AUv3", (shouldBuildAUv3() ? "1" : "0"));
  860. defines.set ("JucePlugin_Build_RTAS", (shouldBuildRTAS() ? "1" : "0"));
  861. defines.set ("JucePlugin_Build_AAX", (shouldBuildAAX() ? "1" : "0"));
  862. defines.set ("JucePlugin_Build_Standalone", (shouldBuildStandalone() ? "1" : "0"));
  863. }
  864. defines = mergePreprocessorDefs (defines, owner.getAllPreprocessorDefs (config));
  865. StringArray defsList;
  866. for (int i = 0; i < defines.size(); ++i)
  867. {
  868. String def (defines.getAllKeys()[i]);
  869. const String value (defines.getAllValues()[i]);
  870. if (value.isNotEmpty())
  871. def << "=" << value.replace ("\"", "\\\\\\\"");
  872. defsList.add ("\"" + def + "\"");
  873. }
  874. s.add ("GCC_PREPROCESSOR_DEFINITIONS = " + indentParenthesisedList (defsList));
  875. s.addTokens (config.customXcodeFlags.get(), ",", "\"'");
  876. return getCleanedStringArray (s);
  877. }
  878. String getInstallPathForConfiguration (const XcodeBuildConfiguration& config) const
  879. {
  880. switch (type)
  881. {
  882. case GUIApp: return "$(HOME)/Applications";
  883. case ConsoleApp: return "/usr/bin";
  884. case VSTPlugIn: return config.vstBinaryLocation.get();
  885. case VST3PlugIn: return config.vst3BinaryLocation.get();
  886. case AudioUnitPlugIn: return config.auBinaryLocation.get();
  887. case RTASPlugIn: return config.rtasBinaryLocation.get();
  888. case AAXPlugIn: return config.aaxBinaryLocation.get();
  889. case SharedCodeTarget: return owner.isiOS() ? "@executable_path/Frameworks" : "@executable_path/../Frameworks";
  890. default: return String();
  891. }
  892. }
  893. //==============================================================================
  894. void getLinkerSettings (const BuildConfiguration& config, StringArray& flags, StringArray& librarySearchPaths) const
  895. {
  896. if (xcodeIsBundle)
  897. flags.add (owner.isiOS() ? "-bitcode_bundle" : "-bundle");
  898. const Array<RelativePath>& extraLibs = config.isDebug() ? xcodeExtraLibrariesDebug
  899. : xcodeExtraLibrariesRelease;
  900. for (auto& lib : extraLibs)
  901. {
  902. flags.add (getLinkerFlagForLib (lib.getFileNameWithoutExtension()));
  903. librarySearchPaths.add (owner.getSearchPathForStaticLibrary (lib));
  904. }
  905. if (owner.project.getProjectType().isAudioPlugin() && type != Target::SharedCodeTarget)
  906. {
  907. if (owner.getTargetOfType (Target::SharedCodeTarget) != nullptr)
  908. {
  909. String productName (getLibbedFilename (owner.replacePreprocessorTokens (config, config.getTargetBinaryNameString())));
  910. RelativePath sharedCodelib (productName, RelativePath::buildTargetFolder);
  911. flags.add (getLinkerFlagForLib (sharedCodelib.getFileNameWithoutExtension()));
  912. }
  913. }
  914. flags.add (owner.replacePreprocessorTokens (config, owner.getExtraLinkerFlagsString()));
  915. flags.add (owner.getExternalLibraryFlags (config));
  916. StringArray libs (owner.xcodeLibs);
  917. libs.addArray (xcodeLibs);
  918. for (auto& l : libs)
  919. flags.add (getLinkerFlagForLib (l));
  920. flags = getCleanedStringArray (flags);
  921. }
  922. //========================================================================== c
  923. void writeInfoPlistFile() const
  924. {
  925. if (! xcodeCreatePList)
  926. return;
  927. ScopedPointer<XmlElement> plist (XmlDocument::parse (owner.getPListToMergeString()));
  928. if (plist == nullptr || ! plist->hasTagName ("plist"))
  929. plist = new XmlElement ("plist");
  930. XmlElement* dict = plist->getChildByName ("dict");
  931. if (dict == nullptr)
  932. dict = plist->createNewChildElement ("dict");
  933. if (owner.iOS)
  934. {
  935. addPlistDictionaryKeyBool (dict, "LSRequiresIPhoneOS", true);
  936. if (owner.isMicrophonePermissionEnabled())
  937. addPlistDictionaryKey (dict, "NSMicrophoneUsageDescription", "This app requires microphone input.");
  938. if (type != AudioUnitv3PlugIn)
  939. addPlistDictionaryKeyBool (dict, "UIViewControllerBasedStatusBarAppearance", false);
  940. }
  941. addPlistDictionaryKey (dict, "CFBundleExecutable", "${EXECUTABLE_NAME}");
  942. if (! owner.iOS) // (NB: on iOS this causes error ITMS-90032 during publishing)
  943. addPlistDictionaryKey (dict, "CFBundleIconFile", owner.iconFile.exists() ? owner.iconFile.getFileName() : String());
  944. addPlistDictionaryKey (dict, "CFBundleIdentifier", "$(PRODUCT_BUNDLE_IDENTIFIER)");
  945. addPlistDictionaryKey (dict, "CFBundleName", owner.projectName);
  946. // needed by NSExtension on iOS
  947. addPlistDictionaryKey (dict, "CFBundleDisplayName", owner.projectName);
  948. addPlistDictionaryKey (dict, "CFBundlePackageType", xcodePackageType);
  949. addPlistDictionaryKey (dict, "CFBundleSignature", xcodeBundleSignature);
  950. addPlistDictionaryKey (dict, "CFBundleShortVersionString", owner.project.getVersionString());
  951. addPlistDictionaryKey (dict, "CFBundleVersion", owner.project.getVersionString());
  952. addPlistDictionaryKey (dict, "NSHumanReadableCopyright", owner.project.getCompanyName().toString());
  953. addPlistDictionaryKeyBool (dict, "NSHighResolutionCapable", true);
  954. StringArray documentExtensions;
  955. documentExtensions.addTokens (replacePreprocessorDefs (owner.getAllPreprocessorDefs(), owner.settings ["documentExtensions"]),
  956. ",", StringRef());
  957. documentExtensions.trim();
  958. documentExtensions.removeEmptyStrings (true);
  959. if (documentExtensions.size() > 0 && type != AudioUnitv3PlugIn)
  960. {
  961. dict->createNewChildElement ("key")->addTextElement ("CFBundleDocumentTypes");
  962. XmlElement* dict2 = dict->createNewChildElement ("array")->createNewChildElement ("dict");
  963. XmlElement* arrayTag = nullptr;
  964. for (String ex : documentExtensions)
  965. {
  966. if (ex.startsWithChar ('.'))
  967. ex = ex.substring (1);
  968. if (arrayTag == nullptr)
  969. {
  970. dict2->createNewChildElement ("key")->addTextElement ("CFBundleTypeExtensions");
  971. arrayTag = dict2->createNewChildElement ("array");
  972. addPlistDictionaryKey (dict2, "CFBundleTypeName", ex);
  973. addPlistDictionaryKey (dict2, "CFBundleTypeRole", "Editor");
  974. addPlistDictionaryKey (dict2, "CFBundleTypeIconFile", "Icon");
  975. addPlistDictionaryKey (dict2, "NSPersistentStoreTypeKey", "XML");
  976. }
  977. arrayTag->createNewChildElement ("string")->addTextElement (ex);
  978. }
  979. }
  980. if (owner.settings ["UIFileSharingEnabled"] && type != AudioUnitv3PlugIn)
  981. addPlistDictionaryKeyBool (dict, "UIFileSharingEnabled", true);
  982. if (owner.settings ["UIStatusBarHidden"] && type != AudioUnitv3PlugIn)
  983. addPlistDictionaryKeyBool (dict, "UIStatusBarHidden", true);
  984. if (owner.iOS && type != AudioUnitv3PlugIn)
  985. {
  986. // Forcing full screen disables the split screen feature and prevents error ITMS-90475
  987. addPlistDictionaryKeyBool (dict, "UIRequiresFullScreen", true);
  988. addPlistDictionaryKeyBool (dict, "UIStatusBarHidden", true);
  989. addIosScreenOrientations (dict);
  990. addIosBackgroundModes (dict);
  991. }
  992. for (auto& e : xcodeExtraPListEntries)
  993. dict->addChildElement (new XmlElement (e));
  994. MemoryOutputStream mo;
  995. plist->writeToStream (mo, "<!DOCTYPE plist PUBLIC \"-//Apple//DTD PLIST 1.0//EN\" \"http://www.apple.com/DTDs/PropertyList-1.0.dtd\">");
  996. overwriteFileIfDifferentOrThrow (infoPlistFile, mo);
  997. }
  998. //==============================================================================
  999. void addIosScreenOrientations (XmlElement* dict) const
  1000. {
  1001. String screenOrientation = owner.getScreenOrientationString();
  1002. StringArray iOSOrientations;
  1003. if (screenOrientation.contains ("portrait")) { iOSOrientations.add ("UIInterfaceOrientationPortrait"); }
  1004. if (screenOrientation.contains ("landscape")) { iOSOrientations.add ("UIInterfaceOrientationLandscapeLeft"); iOSOrientations.add ("UIInterfaceOrientationLandscapeRight"); }
  1005. addArrayToPlist (dict, "UISupportedInterfaceOrientations", iOSOrientations);
  1006. }
  1007. //==============================================================================
  1008. void addIosBackgroundModes (XmlElement* dict) const
  1009. {
  1010. StringArray iosBackgroundModes;
  1011. if (owner.isBackgroundAudioEnabled()) iosBackgroundModes.add ("audio");
  1012. if (owner.isBackgroundBleEnabled()) iosBackgroundModes.add ("bluetooth-central");
  1013. addArrayToPlist (dict, "UIBackgroundModes", iosBackgroundModes);
  1014. }
  1015. //==============================================================================
  1016. static void addArrayToPlist (XmlElement* dict, String arrayKey, const StringArray& arrayElements)
  1017. {
  1018. dict->createNewChildElement ("key")->addTextElement (arrayKey);
  1019. XmlElement* plistStringArray = dict->createNewChildElement ("array");
  1020. for (auto& e : arrayElements)
  1021. plistStringArray->createNewChildElement ("string")->addTextElement (e);
  1022. }
  1023. //==============================================================================
  1024. void addShellScriptBuildPhase (const String& phaseName, const String& script)
  1025. {
  1026. if (script.trim().isNotEmpty())
  1027. {
  1028. ValueTree& v = addBuildPhase ("PBXShellScriptBuildPhase", StringArray());
  1029. v.setProperty (Ids::name, phaseName, nullptr);
  1030. v.setProperty ("shellPath", "/bin/sh", nullptr);
  1031. v.setProperty ("shellScript", script.replace ("\\", "\\\\")
  1032. .replace ("\"", "\\\"")
  1033. .replace ("\r\n", "\\n")
  1034. .replace ("\n", "\\n"), nullptr);
  1035. }
  1036. }
  1037. void addCopyFilesPhase (const String& phaseName, const StringArray& files, XcodeCopyFilesDestinationIDs dst)
  1038. {
  1039. ValueTree& v = addBuildPhase ("PBXCopyFilesBuildPhase", files, phaseName);
  1040. v.setProperty ("dstPath", "", nullptr);
  1041. v.setProperty ("dstSubfolderSpec", (int) dst, nullptr);
  1042. }
  1043. private:
  1044. //==============================================================================
  1045. void addExtraAudioUnitTargetSettings()
  1046. {
  1047. xcodeOtherRezFlags = "-d ppc_$ppc -d i386_$i386 -d ppc64_$ppc64 -d x86_64_$x86_64"
  1048. " -I /System/Library/Frameworks/CoreServices.framework/Frameworks/CarbonCore.framework/Versions/A/Headers"
  1049. " -I \\\"$(DEVELOPER_DIR)/Extras/CoreAudio/AudioUnits/AUPublic/AUBase\\\"";
  1050. xcodeFrameworks.addTokens ("AudioUnit CoreAudioKit", false);
  1051. XmlElement plistKey ("key");
  1052. plistKey.addTextElement ("AudioComponents");
  1053. XmlElement plistEntry ("array");
  1054. XmlElement* dict = plistEntry.createNewChildElement ("dict");
  1055. const String pluginManufacturerCode = owner.project.getPluginManufacturerCode().toString().trim().substring (0, 4);
  1056. const String pluginSubType = owner.project.getPluginCode() .toString().trim().substring (0, 4);
  1057. if (pluginManufacturerCode.toLowerCase() == pluginManufacturerCode)
  1058. {
  1059. throw SaveError ("AudioUnit plugin code identifiers invalid!\n\n"
  1060. "You have used only lower case letters in your AU plugin manufacturer identifier. "
  1061. "You must have at least one uppercase letter in your AU plugin manufacturer "
  1062. "identifier code.");
  1063. }
  1064. addPlistDictionaryKey (dict, "name", owner.project.getPluginManufacturer().toString()
  1065. + ": " + owner.project.getPluginName().toString());
  1066. addPlistDictionaryKey (dict, "description", owner.project.getPluginDesc().toString());
  1067. addPlistDictionaryKey (dict, "factoryFunction", owner.project.getPluginAUExportPrefix().toString() + "Factory");
  1068. addPlistDictionaryKey (dict, "manufacturer", pluginManufacturerCode);
  1069. addPlistDictionaryKey (dict, "type", owner.project.getAUMainTypeCode());
  1070. addPlistDictionaryKey (dict, "subtype", pluginSubType);
  1071. addPlistDictionaryKeyInt (dict, "version", owner.project.getVersionAsHexInteger());
  1072. xcodeExtraPListEntries.add (plistKey);
  1073. xcodeExtraPListEntries.add (plistEntry);
  1074. }
  1075. void addExtraAudioUnitv3PlugInTargetSettings()
  1076. {
  1077. if (owner.isiOS())
  1078. xcodeFrameworks.addTokens ("CoreAudioKit AVFoundation", false);
  1079. else
  1080. xcodeFrameworks.addTokens ("AudioUnit CoreAudioKit AVFoundation", false);
  1081. XmlElement plistKey ("key");
  1082. plistKey.addTextElement ("NSExtension");
  1083. XmlElement plistEntry ("dict");
  1084. addPlistDictionaryKey (&plistEntry, "NSExtensionPrincipalClass", owner.project.getPluginAUExportPrefix().toString() + "FactoryAUv3");
  1085. addPlistDictionaryKey (&plistEntry, "NSExtensionPointIdentifier", "com.apple.AudioUnit-UI");
  1086. plistEntry.createNewChildElement ("key")->addTextElement ("NSExtensionAttributes");
  1087. XmlElement* dict = plistEntry.createNewChildElement ("dict");
  1088. dict->createNewChildElement ("key")->addTextElement ("AudioComponents");
  1089. XmlElement* componentArray = dict->createNewChildElement ("array");
  1090. XmlElement* componentDict = componentArray->createNewChildElement ("dict");
  1091. addPlistDictionaryKey (componentDict, "name", owner.project.getPluginManufacturer().toString()
  1092. + ": " + owner.project.getPluginName().toString());
  1093. addPlistDictionaryKey (componentDict, "description", owner.project.getPluginDesc().toString());
  1094. addPlistDictionaryKey (componentDict, "factoryFunction",owner.project. getPluginAUExportPrefix().toString() + "FactoryAUv3");
  1095. addPlistDictionaryKey (componentDict, "manufacturer", owner.project.getPluginManufacturerCode().toString().trim().substring (0, 4));
  1096. addPlistDictionaryKey (componentDict, "type", owner.project.getAUMainTypeCode());
  1097. addPlistDictionaryKey (componentDict, "subtype", owner.project.getPluginCode().toString().trim().substring (0, 4));
  1098. addPlistDictionaryKeyInt (componentDict, "version", owner.project.getVersionAsHexInteger());
  1099. addPlistDictionaryKeyBool (componentDict, "sandboxSafe", true);
  1100. componentDict->createNewChildElement ("key")->addTextElement ("tags");
  1101. XmlElement* tagsArray = componentDict->createNewChildElement ("array");
  1102. tagsArray->createNewChildElement ("string")
  1103. ->addTextElement (static_cast<bool> (owner.project.getPluginIsSynth().getValue()) ? "Synth" : "Effects");
  1104. xcodeExtraPListEntries.add (plistKey);
  1105. xcodeExtraPListEntries.add (plistEntry);
  1106. }
  1107. void addExtraAAXTargetSettings()
  1108. {
  1109. auto aaxLibsFolder = RelativePath (owner.getAAXPathValue().toString(), RelativePath::projectFolder).getChildFile ("Libs");
  1110. xcodeExtraLibrariesDebug.add (aaxLibsFolder.getChildFile ("Debug/libAAXLibrary.a"));
  1111. xcodeExtraLibrariesRelease.add (aaxLibsFolder.getChildFile ("Release/libAAXLibrary.a"));
  1112. }
  1113. void addExtraRTASTargetSettings()
  1114. {
  1115. RelativePath rtasFolder (owner.getRTASPathValue().toString(), RelativePath::projectFolder);
  1116. xcodeExtraLibrariesDebug.add (rtasFolder.getChildFile ("MacBag/Libs/Debug/libPluginLibrary.a"));
  1117. xcodeExtraLibrariesRelease.add (rtasFolder.getChildFile ("MacBag/Libs/Release/libPluginLibrary.a"));
  1118. }
  1119. //==============================================================================
  1120. const XCodeProjectExporter& owner;
  1121. Target& operator= (const Target&) JUCE_DELETED_FUNCTION;
  1122. };
  1123. mutable StringArray xcodeFrameworks;
  1124. StringArray xcodeLibs;
  1125. private:
  1126. //==============================================================================
  1127. bool xcodeCanUseDwarf;
  1128. OwnedArray<Target> targets;
  1129. mutable OwnedArray<ValueTree> pbxBuildFiles, pbxFileReferences, pbxGroups, misc, projectConfigs, targetConfigs;
  1130. mutable StringArray resourceIDs, sourceIDs, targetIDs;
  1131. mutable StringArray frameworkFileIDs, rezFileIDs, resourceFileRefs;
  1132. mutable File menuNibFile, iconFile;
  1133. mutable StringArray buildProducts;
  1134. const bool iOS;
  1135. static String sanitisePath (const String& path)
  1136. {
  1137. if (path.startsWithChar ('~'))
  1138. return "$(HOME)" + path.substring (1);
  1139. return path;
  1140. }
  1141. static String addQuotesIfRequired (const String& s)
  1142. {
  1143. return s.containsAnyOf (" $") ? s.quoted() : s;
  1144. }
  1145. File getProjectBundle() const { return getTargetFolder().getChildFile (project.getProjectFilenameRoot()).withFileExtension (".xcodeproj"); }
  1146. //==============================================================================
  1147. void createObjects() const
  1148. {
  1149. prepareTargets();
  1150. addFrameworks();
  1151. addCustomResourceFolders();
  1152. addPlistFileReferences();
  1153. if (iOS && ! projectType.isStaticLibrary())
  1154. addXcassets();
  1155. else
  1156. addNibFiles();
  1157. addIcons();
  1158. addBuildConfigurations();
  1159. addProjectConfigList (projectConfigs, createID ("__projList"));
  1160. {
  1161. StringArray topLevelGroupIDs;
  1162. addFilesAndGroupsToProject (topLevelGroupIDs);
  1163. addBuildPhases();
  1164. addExtraGroupsToProject (topLevelGroupIDs);
  1165. addGroup (createID ("__mainsourcegroup"), "Source", topLevelGroupIDs);
  1166. }
  1167. addProjectObject();
  1168. removeMismatchedXcuserdata();
  1169. }
  1170. void prepareTargets() const
  1171. {
  1172. for (auto* target : targets)
  1173. {
  1174. if (target->type == Target::AggregateTarget)
  1175. continue;
  1176. target->addMainBuildProduct();
  1177. String targetName = target->getName();
  1178. String fileID (createID (targetName + String ("__targetbuildref")));
  1179. String fileRefID (createID (String ("__productFileID") + targetName));
  1180. ValueTree* v = new ValueTree (fileID);
  1181. v->setProperty ("isa", "PBXBuildFile", nullptr);
  1182. v->setProperty ("fileRef", fileRefID, nullptr);
  1183. target->mainBuildProductID = fileID;
  1184. pbxBuildFiles.add (v);
  1185. target->addDependency();
  1186. }
  1187. }
  1188. void addPlistFileReferences() const
  1189. {
  1190. for (auto* target : targets)
  1191. {
  1192. if (target->type == Target::AggregateTarget)
  1193. continue;
  1194. if (target->xcodeCreatePList)
  1195. {
  1196. RelativePath plistPath (target->infoPlistFile, getTargetFolder(), RelativePath::buildTargetFolder);
  1197. addFileReference (plistPath.toUnixStyle());
  1198. resourceFileRefs.add (createFileRefID (plistPath));
  1199. }
  1200. }
  1201. }
  1202. void addNibFiles() const
  1203. {
  1204. MemoryOutputStream nib;
  1205. nib.write (BinaryData::RecentFilesMenuTemplate_nib, BinaryData::RecentFilesMenuTemplate_nibSize);
  1206. overwriteFileIfDifferentOrThrow (menuNibFile, nib);
  1207. RelativePath menuNibPath (menuNibFile, getTargetFolder(), RelativePath::buildTargetFolder);
  1208. addFileReference (menuNibPath.toUnixStyle());
  1209. resourceIDs.add (addBuildFile (menuNibPath, false, false));
  1210. resourceFileRefs.add (createFileRefID (menuNibPath));
  1211. }
  1212. void addIcons() const
  1213. {
  1214. if (iconFile.exists())
  1215. {
  1216. RelativePath iconPath (iconFile, getTargetFolder(), RelativePath::buildTargetFolder);
  1217. addFileReference (iconPath.toUnixStyle());
  1218. resourceIDs.add (addBuildFile (iconPath, false, false));
  1219. resourceFileRefs.add (createFileRefID (iconPath));
  1220. }
  1221. }
  1222. void addBuildConfigurations() const
  1223. {
  1224. // add build configurations
  1225. for (ConstConfigIterator config (*this); config.next();)
  1226. {
  1227. const XcodeBuildConfiguration& xcodeConfig = dynamic_cast<const XcodeBuildConfiguration&> (*config);
  1228. addProjectConfig (config->getName(), getProjectSettings (xcodeConfig));
  1229. }
  1230. }
  1231. void addFilesAndGroupsToProject (StringArray& topLevelGroupIDs) const
  1232. {
  1233. if (! isiOS() && project.getProjectType().isAudioPlugin())
  1234. topLevelGroupIDs.add (addEntitlementsFile());
  1235. for (auto& group : getAllGroups())
  1236. if (group.getNumChildren() > 0)
  1237. topLevelGroupIDs.add (addProjectItem (group));
  1238. }
  1239. void addExtraGroupsToProject (StringArray& topLevelGroupIDs) const
  1240. {
  1241. { // Add 'resources' group
  1242. String resourcesGroupID (createID ("__resources"));
  1243. addGroup (resourcesGroupID, "Resources", resourceFileRefs);
  1244. topLevelGroupIDs.add (resourcesGroupID);
  1245. }
  1246. { // Add 'frameworks' group
  1247. String frameworksGroupID (createID ("__frameworks"));
  1248. addGroup (frameworksGroupID, "Frameworks", frameworkFileIDs);
  1249. topLevelGroupIDs.add (frameworksGroupID);
  1250. }
  1251. { // Add 'products' group
  1252. String productsGroupID (createID ("__products"));
  1253. addGroup (productsGroupID, "Products", buildProducts);
  1254. topLevelGroupIDs.add (productsGroupID);
  1255. }
  1256. }
  1257. void addBuildPhases() const
  1258. {
  1259. // add build phases
  1260. for (auto* target : targets)
  1261. {
  1262. if (target->type != Target::AggregateTarget)
  1263. buildProducts.add (createID (String ("__productFileID") + String (target->getName())));
  1264. for (ConstConfigIterator config (*this); config.next();)
  1265. {
  1266. const XcodeBuildConfiguration& xcodeConfig = dynamic_cast<const XcodeBuildConfiguration&> (*config);
  1267. target->addTargetConfig (config->getName(), target->getTargetSettings (xcodeConfig));
  1268. }
  1269. addConfigList (*target, targetConfigs, createID (String ("__configList") + target->getName()));
  1270. target->addShellScriptBuildPhase ("Pre-build script", getPreBuildScript());
  1271. if (target->type != Target::AggregateTarget)
  1272. {
  1273. // TODO: ideally resources wouldn't be copied into the AUv3 bundle as well.
  1274. // However, fixing this requires supporting App groups -> TODO: add app groups
  1275. if (! projectType.isStaticLibrary() && target->type != Target::SharedCodeTarget)
  1276. target->addBuildPhase ("PBXResourcesBuildPhase", resourceIDs);
  1277. StringArray rezFiles (rezFileIDs);
  1278. rezFiles.addArray (target->rezFileIDs);
  1279. if (rezFiles.size() > 0)
  1280. target->addBuildPhase ("PBXRezBuildPhase", rezFiles);
  1281. StringArray sourceFiles (target->sourceIDs);
  1282. if (target->type == Target::SharedCodeTarget
  1283. || (! project.getProjectType().isAudioPlugin()))
  1284. sourceFiles.addArray (sourceIDs);
  1285. target->addBuildPhase ("PBXSourcesBuildPhase", sourceFiles);
  1286. if (! projectType.isStaticLibrary() && target->type != Target::SharedCodeTarget)
  1287. target->addBuildPhase ("PBXFrameworksBuildPhase", target->frameworkIDs);
  1288. }
  1289. target->addShellScriptBuildPhase ("Post-build script", getPostBuildScript());
  1290. if (project.getProjectType().isAudioPlugin() && project.shouldBuildAUv3().getValue()
  1291. && project.shouldBuildStandalone().getValue() && target->type == Target::StandalonePlugIn)
  1292. embedAppExtension();
  1293. addTargetObject (*target);
  1294. }
  1295. }
  1296. void embedAppExtension() const
  1297. {
  1298. if (auto* standaloneTarget = getTargetOfType (Target::StandalonePlugIn))
  1299. {
  1300. if (auto* auv3Target = getTargetOfType (Target::AudioUnitv3PlugIn))
  1301. {
  1302. StringArray files;
  1303. files.add (auv3Target->mainBuildProductID);
  1304. standaloneTarget->addCopyFilesPhase ("Embed App Extensions", files, kPluginsFolder);
  1305. }
  1306. }
  1307. }
  1308. static Image fixMacIconImageSize (Drawable& image)
  1309. {
  1310. const int validSizes[] = { 16, 32, 48, 128, 256, 512, 1024 };
  1311. const int w = image.getWidth();
  1312. const int h = image.getHeight();
  1313. int bestSize = 16;
  1314. for (int size : validSizes)
  1315. {
  1316. if (w == h && w == size)
  1317. {
  1318. bestSize = w;
  1319. break;
  1320. }
  1321. if (jmax (w, h) > size)
  1322. bestSize = size;
  1323. }
  1324. return rescaleImageForIcon (image, bestSize);
  1325. }
  1326. //==============================================================================
  1327. Target* getTargetOfType (Target::Type type) const
  1328. {
  1329. for (auto& target : targets)
  1330. if (target->type == type)
  1331. return target;
  1332. return nullptr;
  1333. }
  1334. void addTargetObject (Target& target) const
  1335. {
  1336. String targetName = target.getName();
  1337. String targetID = target.getID();
  1338. ValueTree* const v = new ValueTree (targetID);
  1339. v->setProperty ("isa", target.type == Target::AggregateTarget ? "PBXAggregateTarget" : "PBXNativeTarget", nullptr);
  1340. v->setProperty ("buildConfigurationList", createID (String ("__configList") + targetName), nullptr);
  1341. v->setProperty ("buildPhases", indentParenthesisedList (target.buildPhaseIDs), nullptr);
  1342. v->setProperty ("buildRules", "( )", nullptr);
  1343. v->setProperty ("dependencies", indentParenthesisedList (getTargetDependencies (target)), nullptr);
  1344. v->setProperty (Ids::name, target.getXCodeSchemeName(), nullptr);
  1345. v->setProperty ("productName", projectName, nullptr);
  1346. if (target.type != Target::AggregateTarget)
  1347. {
  1348. v->setProperty ("productReference", createID (String ("__productFileID") + targetName), nullptr);
  1349. jassert (target.xcodeProductType.isNotEmpty());
  1350. v->setProperty ("productType", target.xcodeProductType, nullptr);
  1351. }
  1352. targetIDs.add (targetID);
  1353. misc.add (v);
  1354. }
  1355. StringArray getTargetDependencies (const Target& target) const
  1356. {
  1357. StringArray dependencies;
  1358. if (project.getProjectType().isAudioPlugin())
  1359. {
  1360. if (target.type == Target::StandalonePlugIn) // depends on AUv3 and shared code
  1361. {
  1362. if (Target* auv3Target = getTargetOfType (Target::AudioUnitv3PlugIn))
  1363. dependencies.add (auv3Target->getDependencyID());
  1364. if (Target* sharedCodeTarget = getTargetOfType (Target::SharedCodeTarget))
  1365. dependencies.add (sharedCodeTarget->getDependencyID());
  1366. }
  1367. else if (target.type == Target::AggregateTarget) // depends on all other targets
  1368. {
  1369. for (int i = 1; i < targets.size(); ++i)
  1370. dependencies.add (targets[i]->getDependencyID());
  1371. }
  1372. else if (target.type != Target::SharedCodeTarget) // shared code doesn't depend on anything; all other targets depend only on the shared code
  1373. {
  1374. if (Target* sharedCodeTarget = getTargetOfType (Target::SharedCodeTarget))
  1375. dependencies.add (sharedCodeTarget->getDependencyID());
  1376. }
  1377. }
  1378. return dependencies;
  1379. }
  1380. static void writeOldIconFormat (MemoryOutputStream& out, const Image& image, const char* type, const char* maskType)
  1381. {
  1382. const int w = image.getWidth();
  1383. const int h = image.getHeight();
  1384. out.write (type, 4);
  1385. out.writeIntBigEndian (8 + 4 * w * h);
  1386. const Image::BitmapData bitmap (image, Image::BitmapData::readOnly);
  1387. for (int y = 0; y < h; ++y)
  1388. {
  1389. for (int x = 0; x < w; ++x)
  1390. {
  1391. const Colour pixel (bitmap.getPixelColour (x, y));
  1392. out.writeByte ((char) pixel.getAlpha());
  1393. out.writeByte ((char) pixel.getRed());
  1394. out.writeByte ((char) pixel.getGreen());
  1395. out.writeByte ((char) pixel.getBlue());
  1396. }
  1397. }
  1398. out.write (maskType, 4);
  1399. out.writeIntBigEndian (8 + w * h);
  1400. for (int y = 0; y < h; ++y)
  1401. {
  1402. for (int x = 0; x < w; ++x)
  1403. {
  1404. const Colour pixel (bitmap.getPixelColour (x, y));
  1405. out.writeByte ((char) pixel.getAlpha());
  1406. }
  1407. }
  1408. }
  1409. static void writeNewIconFormat (MemoryOutputStream& out, const Image& image, const char* type)
  1410. {
  1411. MemoryOutputStream pngData;
  1412. PNGImageFormat pngFormat;
  1413. pngFormat.writeImageToStream (image, pngData);
  1414. out.write (type, 4);
  1415. out.writeIntBigEndian (8 + (int) pngData.getDataSize());
  1416. out << pngData;
  1417. }
  1418. void writeIcnsFile (const OwnedArray<Drawable>& images, OutputStream& out) const
  1419. {
  1420. MemoryOutputStream data;
  1421. int smallest = 0x7fffffff;
  1422. Drawable* smallestImage = nullptr;
  1423. for (int i = 0; i < images.size(); ++i)
  1424. {
  1425. const Image image (fixMacIconImageSize (*images.getUnchecked(i)));
  1426. jassert (image.getWidth() == image.getHeight());
  1427. if (image.getWidth() < smallest)
  1428. {
  1429. smallest = image.getWidth();
  1430. smallestImage = images.getUnchecked(i);
  1431. }
  1432. switch (image.getWidth())
  1433. {
  1434. case 16: writeOldIconFormat (data, image, "is32", "s8mk"); break;
  1435. case 32: writeOldIconFormat (data, image, "il32", "l8mk"); break;
  1436. case 48: writeOldIconFormat (data, image, "ih32", "h8mk"); break;
  1437. case 128: writeOldIconFormat (data, image, "it32", "t8mk"); break;
  1438. case 256: writeNewIconFormat (data, image, "ic08"); break;
  1439. case 512: writeNewIconFormat (data, image, "ic09"); break;
  1440. case 1024: writeNewIconFormat (data, image, "ic10"); break;
  1441. default: break;
  1442. }
  1443. }
  1444. jassert (data.getDataSize() > 0); // no suitable sized images?
  1445. // If you only supply a 1024 image, the file doesn't work on 10.8, so we need
  1446. // to force a smaller one in there too..
  1447. if (smallest > 512 && smallestImage != nullptr)
  1448. writeNewIconFormat (data, rescaleImageForIcon (*smallestImage, 512), "ic09");
  1449. out.write ("icns", 4);
  1450. out.writeIntBigEndian ((int) data.getDataSize() + 8);
  1451. out << data;
  1452. }
  1453. void getIconImages (OwnedArray<Drawable>& images) const
  1454. {
  1455. ScopedPointer<Drawable> bigIcon (getBigIcon());
  1456. if (bigIcon != nullptr)
  1457. images.add (bigIcon.release());
  1458. ScopedPointer<Drawable> smallIcon (getSmallIcon());
  1459. if (smallIcon != nullptr)
  1460. images.add (smallIcon.release());
  1461. }
  1462. void createiOSIconFiles (File appIconSet) const
  1463. {
  1464. OwnedArray<Drawable> images;
  1465. getIconImages (images);
  1466. if (images.size() > 0)
  1467. {
  1468. for (auto& type : getiOSAppIconTypes())
  1469. {
  1470. auto image = rescaleImageForIcon (*images.getFirst(), type.size);
  1471. MemoryOutputStream pngData;
  1472. PNGImageFormat pngFormat;
  1473. pngFormat.writeImageToStream (image, pngData);
  1474. overwriteFileIfDifferentOrThrow (appIconSet.getChildFile (type.filename), pngData);
  1475. }
  1476. }
  1477. }
  1478. void createIconFile() const
  1479. {
  1480. OwnedArray<Drawable> images;
  1481. getIconImages (images);
  1482. if (images.size() > 0)
  1483. {
  1484. MemoryOutputStream mo;
  1485. writeIcnsFile (images, mo);
  1486. iconFile = getTargetFolder().getChildFile ("Icon.icns");
  1487. overwriteFileIfDifferentOrThrow (iconFile, mo);
  1488. }
  1489. }
  1490. void writeInfoPlistFiles() const
  1491. {
  1492. for (auto& target : targets)
  1493. target->writeInfoPlistFile();
  1494. }
  1495. // Delete .rsrc files in folder but don't follow sym-links
  1496. void deleteRsrcFiles (const File& folder) const
  1497. {
  1498. for (DirectoryIterator di (folder, false, "*", File::findFilesAndDirectories); di.next();)
  1499. {
  1500. const File& entry = di.getFile();
  1501. if (! entry.isSymbolicLink())
  1502. {
  1503. if (entry.existsAsFile() && entry.getFileExtension().toLowerCase() == ".rsrc")
  1504. entry.deleteFile();
  1505. else if (entry.isDirectory())
  1506. deleteRsrcFiles (entry);
  1507. }
  1508. }
  1509. }
  1510. String getHeaderSearchPaths (const BuildConfiguration& config) const
  1511. {
  1512. StringArray paths (extraSearchPaths);
  1513. paths.addArray (config.getHeaderSearchPaths());
  1514. paths.add ("$(inherited)");
  1515. paths = getCleanedStringArray (paths);
  1516. for (auto& s : paths)
  1517. {
  1518. s = replacePreprocessorTokens (config, s);
  1519. if (s.containsChar (' '))
  1520. s = "\"\\\"" + s + "\\\"\""; // crazy double quotes required when there are spaces..
  1521. else
  1522. s = "\"" + s + "\"";
  1523. }
  1524. return "(" + paths.joinIntoString (", ") + ")";
  1525. }
  1526. static String getLinkerFlagForLib (String library)
  1527. {
  1528. if (library.substring (0, 3) == "lib")
  1529. library = library.substring (3);
  1530. return "-l" + library.replace (" ", "\\\\ ").upToLastOccurrenceOf (".", false, false);
  1531. }
  1532. String getSearchPathForStaticLibrary (const RelativePath& library) const
  1533. {
  1534. String searchPath (library.toUnixStyle().upToLastOccurrenceOf ("/", false, false));
  1535. if (! library.isAbsolute())
  1536. {
  1537. String srcRoot (rebaseFromProjectFolderToBuildTarget (RelativePath (".", RelativePath::projectFolder)).toUnixStyle());
  1538. if (srcRoot.endsWith ("/.")) srcRoot = srcRoot.dropLastCharacters (2);
  1539. if (! srcRoot.endsWithChar ('/')) srcRoot << '/';
  1540. searchPath = srcRoot + searchPath;
  1541. }
  1542. return sanitisePath (searchPath);
  1543. }
  1544. StringArray getProjectSettings (const XcodeBuildConfiguration& config) const
  1545. {
  1546. StringArray s;
  1547. s.add ("ALWAYS_SEARCH_USER_PATHS = NO");
  1548. s.add ("GCC_C_LANGUAGE_STANDARD = c99");
  1549. s.add ("GCC_WARN_ABOUT_RETURN_TYPE = YES");
  1550. s.add ("GCC_WARN_CHECK_SWITCH_STATEMENTS = YES");
  1551. s.add ("GCC_WARN_UNUSED_VARIABLE = YES");
  1552. s.add ("GCC_WARN_MISSING_PARENTHESES = YES");
  1553. s.add ("GCC_WARN_NON_VIRTUAL_DESTRUCTOR = YES");
  1554. s.add ("GCC_WARN_TYPECHECK_CALLS_TO_PRINTF = YES");
  1555. s.add ("WARNING_CFLAGS = -Wreorder");
  1556. s.add ("GCC_MODEL_TUNING = G5");
  1557. if (projectType.isStaticLibrary())
  1558. {
  1559. s.add ("GCC_INLINES_ARE_PRIVATE_EXTERN = NO");
  1560. s.add ("GCC_SYMBOLS_PRIVATE_EXTERN = NO");
  1561. }
  1562. else
  1563. {
  1564. s.add ("GCC_INLINES_ARE_PRIVATE_EXTERN = YES");
  1565. }
  1566. if (config.isDebug())
  1567. {
  1568. s.add ("ENABLE_TESTABILITY = YES");
  1569. if (config.osxArchitecture.get() == osxArch_Default || config.osxArchitecture.get().isEmpty())
  1570. s.add ("ONLY_ACTIVE_ARCH = YES");
  1571. }
  1572. if (iOS)
  1573. {
  1574. s.add ("\"CODE_SIGN_IDENTITY[sdk=iphoneos*]\" = " + config.codeSignIdentity.get().quoted());
  1575. s.add ("SDKROOT = iphoneos");
  1576. s.add ("TARGETED_DEVICE_FAMILY = \"1,2\"");
  1577. const String iosVersion (config.iosDeploymentTarget.get());
  1578. if (iosVersion.isNotEmpty() && iosVersion != osxVersionDefault)
  1579. s.add ("IPHONEOS_DEPLOYMENT_TARGET = " + iosVersion);
  1580. else
  1581. s.add ("IPHONEOS_DEPLOYMENT_TARGET = 9.3");
  1582. }
  1583. else
  1584. {
  1585. if (! config.codeSignIdentity.isUsingDefault() || getIosDevelopmentTeamIDString().isNotEmpty())
  1586. s.add ("\"CODE_SIGN_IDENTITY\" = " + config.codeSignIdentity.get().quoted());
  1587. }
  1588. s.add ("ZERO_LINK = NO");
  1589. if (xcodeCanUseDwarf)
  1590. s.add ("DEBUG_INFORMATION_FORMAT = \"dwarf\"");
  1591. s.add ("PRODUCT_NAME = \"" + replacePreprocessorTokens (config, config.getTargetBinaryNameString()) + "\"");
  1592. return s;
  1593. }
  1594. void addFrameworks() const
  1595. {
  1596. if (! projectType.isStaticLibrary())
  1597. {
  1598. if (iOS && isInAppPurchasesEnabled())
  1599. xcodeFrameworks.addIfNotAlreadyThere ("StoreKit");
  1600. xcodeFrameworks.addTokens (getExtraFrameworksString(), ",;", "\"'");
  1601. xcodeFrameworks.trim();
  1602. StringArray s (xcodeFrameworks);
  1603. for (auto& target : targets)
  1604. s.addArray (target->xcodeFrameworks);
  1605. if (project.getConfigFlag ("JUCE_QUICKTIME") == Project::configFlagDisabled)
  1606. s.removeString ("QuickTime");
  1607. s.trim();
  1608. s.removeDuplicates (true);
  1609. s.sort (true);
  1610. for (auto& framework : s)
  1611. {
  1612. String frameworkID = addFramework (framework);
  1613. // find all the targets that are referring to this object
  1614. for (auto& target : targets)
  1615. if (xcodeFrameworks.contains (framework) || target->xcodeFrameworks.contains (framework))
  1616. target->frameworkIDs.add (frameworkID);
  1617. }
  1618. }
  1619. }
  1620. void addCustomResourceFolders() const
  1621. {
  1622. StringArray folders;
  1623. folders.addTokens (getCustomResourceFoldersString(), ":", "");
  1624. folders.trim();
  1625. for (auto& crf : folders)
  1626. addCustomResourceFolder (crf);
  1627. }
  1628. void addXcassets() const
  1629. {
  1630. String customXcassetsPath = getCustomXcassetsFolderString();
  1631. if (customXcassetsPath.isEmpty())
  1632. createXcassetsFolderFromIcons();
  1633. else
  1634. addCustomResourceFolder (customXcassetsPath, "folder.assetcatalog");
  1635. }
  1636. void addCustomResourceFolder (String folderPathRelativeToProjectFolder, const String fileType = "folder") const
  1637. {
  1638. String folderPath = RelativePath (folderPathRelativeToProjectFolder, RelativePath::projectFolder)
  1639. .rebased (projectFolder, getTargetFolder(), RelativePath::buildTargetFolder)
  1640. .toUnixStyle();
  1641. const String fileRefID (createFileRefID (folderPath));
  1642. addFileOrFolderReference (folderPath, "<group>", fileType);
  1643. resourceIDs.add (addBuildFile (folderPath, fileRefID, false, false));
  1644. resourceFileRefs.add (createFileRefID (folderPath));
  1645. }
  1646. //==============================================================================
  1647. void writeProjectFile (OutputStream& output) const
  1648. {
  1649. output << "// !$*UTF8*$!\n{\n"
  1650. "\tarchiveVersion = 1;\n"
  1651. "\tclasses = {\n\t};\n"
  1652. "\tobjectVersion = 46;\n"
  1653. "\tobjects = {\n\n";
  1654. Array<ValueTree*> objects;
  1655. objects.addArray (pbxBuildFiles);
  1656. objects.addArray (pbxFileReferences);
  1657. objects.addArray (pbxGroups);
  1658. objects.addArray (targetConfigs);
  1659. objects.addArray (projectConfigs);
  1660. objects.addArray (misc);
  1661. for (auto* o : objects)
  1662. {
  1663. output << "\t\t" << o->getType().toString() << " = {";
  1664. for (int j = 0; j < o->getNumProperties(); ++j)
  1665. {
  1666. const Identifier propertyName (o->getPropertyName(j));
  1667. String val (o->getProperty (propertyName).toString());
  1668. if (val.isEmpty() || (val.containsAnyOf (" \t;<>()=,&+-_@~\r\n\\#%^`*")
  1669. && ! (val.trimStart().startsWithChar ('(')
  1670. || val.trimStart().startsWithChar ('{'))))
  1671. val = "\"" + val + "\"";
  1672. output << propertyName.toString() << " = " << val << "; ";
  1673. }
  1674. output << "};\n";
  1675. }
  1676. output << "\t};\n\trootObject = " << createID ("__root") << ";\n}\n";
  1677. }
  1678. String addBuildFile (const String& path, const String& fileRefID, bool addToSourceBuildPhase, bool inhibitWarnings, Target* xcodeTarget = nullptr) const
  1679. {
  1680. String fileID (createID (path + "buildref"));
  1681. if (addToSourceBuildPhase)
  1682. {
  1683. if (xcodeTarget != nullptr) xcodeTarget->sourceIDs.add (fileID);
  1684. else sourceIDs.add (fileID);
  1685. }
  1686. ValueTree* v = new ValueTree (fileID);
  1687. v->setProperty ("isa", "PBXBuildFile", nullptr);
  1688. v->setProperty ("fileRef", fileRefID, nullptr);
  1689. if (inhibitWarnings)
  1690. v->setProperty ("settings", "{COMPILER_FLAGS = \"-w\"; }", nullptr);
  1691. pbxBuildFiles.add (v);
  1692. return fileID;
  1693. }
  1694. String addBuildFile (const RelativePath& path, bool addToSourceBuildPhase, bool inhibitWarnings, Target* xcodeTarget = nullptr) const
  1695. {
  1696. return addBuildFile (path.toUnixStyle(), createFileRefID (path), addToSourceBuildPhase, inhibitWarnings, xcodeTarget);
  1697. }
  1698. String addFileReference (String pathString) const
  1699. {
  1700. String sourceTree ("SOURCE_ROOT");
  1701. RelativePath path (pathString, RelativePath::unknown);
  1702. if (pathString.startsWith ("${"))
  1703. {
  1704. sourceTree = pathString.substring (2).upToFirstOccurrenceOf ("}", false, false);
  1705. pathString = pathString.fromFirstOccurrenceOf ("}/", false, false);
  1706. }
  1707. else if (path.isAbsolute())
  1708. {
  1709. sourceTree = "<absolute>";
  1710. }
  1711. String fileType = getFileType (path);
  1712. return addFileOrFolderReference (pathString, sourceTree, fileType);
  1713. }
  1714. String addFileOrFolderReference (String pathString, String sourceTree, String fileType) const
  1715. {
  1716. const String fileRefID (createFileRefID (pathString));
  1717. ScopedPointer<ValueTree> v (new ValueTree (fileRefID));
  1718. v->setProperty ("isa", "PBXFileReference", nullptr);
  1719. v->setProperty ("lastKnownFileType", fileType, nullptr);
  1720. v->setProperty (Ids::name, pathString.fromLastOccurrenceOf ("/", false, false), nullptr);
  1721. v->setProperty ("path", sanitisePath (pathString), nullptr);
  1722. v->setProperty ("sourceTree", sourceTree, nullptr);
  1723. const int existing = pbxFileReferences.indexOfSorted (*this, v);
  1724. if (existing >= 0)
  1725. {
  1726. // If this fails, there's either a string hash collision, or the same file is being added twice (incorrectly)
  1727. jassert (pbxFileReferences.getUnchecked (existing)->isEquivalentTo (*v));
  1728. }
  1729. else
  1730. {
  1731. pbxFileReferences.addSorted (*this, v.release());
  1732. }
  1733. return fileRefID;
  1734. }
  1735. public:
  1736. static int compareElements (const ValueTree* first, const ValueTree* second)
  1737. {
  1738. return first->getType().getCharPointer().compare (second->getType().getCharPointer());
  1739. }
  1740. private:
  1741. static String getFileType (const RelativePath& file)
  1742. {
  1743. if (file.hasFileExtension (cppFileExtensions)) return "sourcecode.cpp.cpp";
  1744. if (file.hasFileExtension (".mm")) return "sourcecode.cpp.objcpp";
  1745. if (file.hasFileExtension (".m")) return "sourcecode.c.objc";
  1746. if (file.hasFileExtension (".c")) return "sourcecode.c.c";
  1747. if (file.hasFileExtension (headerFileExtensions)) return "sourcecode.c.h";
  1748. if (file.hasFileExtension (asmFileExtensions)) return "sourcecode.c.asm";
  1749. if (file.hasFileExtension (".framework")) return "wrapper.framework";
  1750. if (file.hasFileExtension (".jpeg;.jpg")) return "image.jpeg";
  1751. if (file.hasFileExtension ("png;gif")) return "image" + file.getFileExtension();
  1752. if (file.hasFileExtension ("html;htm")) return "text.html";
  1753. if (file.hasFileExtension ("xml;zip;wav")) return "file" + file.getFileExtension();
  1754. if (file.hasFileExtension ("txt;rtf")) return "text" + file.getFileExtension();
  1755. if (file.hasFileExtension ("plist")) return "text.plist.xml";
  1756. if (file.hasFileExtension ("entitlements")) return "text.plist.xml";
  1757. if (file.hasFileExtension ("app")) return "wrapper.application";
  1758. if (file.hasFileExtension ("component;vst;plugin")) return "wrapper.cfbundle";
  1759. if (file.hasFileExtension ("xcodeproj")) return "wrapper.pb-project";
  1760. if (file.hasFileExtension ("a")) return "archive.ar";
  1761. if (file.hasFileExtension ("xcassets")) return "folder.assetcatalog";
  1762. return "file" + file.getFileExtension();
  1763. }
  1764. String addFile (const RelativePath& path, bool shouldBeCompiled, bool shouldBeAddedToBinaryResources,
  1765. bool shouldBeAddedToXcodeResources, bool inhibitWarnings, Target* xcodeTarget) const
  1766. {
  1767. const String pathAsString (path.toUnixStyle());
  1768. const String refID (addFileReference (path.toUnixStyle()));
  1769. if (shouldBeCompiled)
  1770. {
  1771. addBuildFile (pathAsString, refID, true, inhibitWarnings, xcodeTarget);
  1772. }
  1773. else if (! shouldBeAddedToBinaryResources || shouldBeAddedToXcodeResources)
  1774. {
  1775. const String fileType (getFileType (path));
  1776. if (shouldBeAddedToXcodeResources)
  1777. {
  1778. resourceIDs.add (addBuildFile (pathAsString, refID, false, false));
  1779. resourceFileRefs.add (refID);
  1780. }
  1781. }
  1782. return refID;
  1783. }
  1784. String addRezFile (const Project::Item& projectItem, const RelativePath& path) const
  1785. {
  1786. const String pathAsString (path.toUnixStyle());
  1787. const String refID (addFileReference (path.toUnixStyle()));
  1788. if (projectItem.isModuleCode())
  1789. {
  1790. if (Target* xcodeTarget = getTargetOfType (getTargetTypeFromFilePath (projectItem.getFile(), false)))
  1791. {
  1792. String rezFileID = addBuildFile (pathAsString, refID, false, false, xcodeTarget);
  1793. xcodeTarget->rezFileIDs.add (rezFileID);
  1794. return refID;
  1795. }
  1796. }
  1797. return String();
  1798. }
  1799. String getEntitlementsFileName() const
  1800. {
  1801. return project.getProjectFilenameRoot() + String (".entitlements");
  1802. }
  1803. String addEntitlementsFile() const
  1804. {
  1805. const char* sandboxEntitlement =
  1806. "<?xml version=\"1.0\" encoding=\"UTF-8\"?>"
  1807. "<!DOCTYPE plist PUBLIC \"-//Apple//DTD PLIST 1.0//EN\" \"http://www.apple.com/DTDs/PropertyList-1.0.dtd\">"
  1808. "<plist version=\"1.0\">"
  1809. "<dict>"
  1810. " <key>com.apple.security.app-sandbox</key>"
  1811. " <true/>"
  1812. "</dict>"
  1813. "</plist>";
  1814. File entitlementsFile = getTargetFolder().getChildFile (getEntitlementsFileName());
  1815. overwriteFileIfDifferentOrThrow (entitlementsFile, sandboxEntitlement);
  1816. RelativePath plistPath (entitlementsFile, getTargetFolder(), RelativePath::buildTargetFolder);
  1817. return addFile (plistPath, false, false, false, false, nullptr);
  1818. }
  1819. String addProjectItem (const Project::Item& projectItem) const
  1820. {
  1821. if (projectItem.isGroup())
  1822. {
  1823. StringArray childIDs;
  1824. for (int i = 0; i < projectItem.getNumChildren(); ++i)
  1825. {
  1826. const String childID (addProjectItem (projectItem.getChild(i)));
  1827. if (childID.isNotEmpty())
  1828. childIDs.add (childID);
  1829. }
  1830. return addGroup (projectItem, childIDs);
  1831. }
  1832. if (projectItem.shouldBeAddedToTargetProject())
  1833. {
  1834. const String itemPath (projectItem.getFilePath());
  1835. RelativePath path;
  1836. if (itemPath.startsWith ("${"))
  1837. path = RelativePath (itemPath, RelativePath::unknown);
  1838. else
  1839. path = RelativePath (projectItem.getFile(), getTargetFolder(), RelativePath::buildTargetFolder);
  1840. if (path.hasFileExtension (".r"))
  1841. return addRezFile (projectItem, path);
  1842. Target* xcodeTarget = nullptr;
  1843. if (projectItem.isModuleCode() && projectItem.shouldBeCompiled())
  1844. xcodeTarget = getTargetOfType (getTargetTypeFromFilePath (projectItem.getFile(), false));
  1845. return addFile (path, projectItem.shouldBeCompiled(),
  1846. projectItem.shouldBeAddedToBinaryResources(),
  1847. projectItem.shouldBeAddedToXcodeResources(),
  1848. projectItem.shouldInhibitWarnings(),
  1849. xcodeTarget);
  1850. }
  1851. return String();
  1852. }
  1853. String addFramework (const String& frameworkName) const
  1854. {
  1855. String path (frameworkName);
  1856. if (! File::isAbsolutePath (path))
  1857. path = "System/Library/Frameworks/" + path;
  1858. if (! path.endsWithIgnoreCase (".framework"))
  1859. path << ".framework";
  1860. const String fileRefID (createFileRefID (path));
  1861. addFileReference ((File::isAbsolutePath (frameworkName) ? "" : "${SDKROOT}/") + path);
  1862. frameworkFileIDs.add (fileRefID);
  1863. return addBuildFile (path, fileRefID, false, false);
  1864. }
  1865. void addGroup (const String& groupID, const String& groupName, const StringArray& childIDs) const
  1866. {
  1867. ValueTree* v = new ValueTree (groupID);
  1868. v->setProperty ("isa", "PBXGroup", nullptr);
  1869. v->setProperty ("children", indentParenthesisedList (childIDs), nullptr);
  1870. v->setProperty (Ids::name, groupName, nullptr);
  1871. v->setProperty ("sourceTree", "<group>", nullptr);
  1872. pbxGroups.add (v);
  1873. }
  1874. String addGroup (const Project::Item& item, StringArray& childIDs) const
  1875. {
  1876. const String groupName (item.getName());
  1877. const String groupID (getIDForGroup (item));
  1878. addGroup (groupID, groupName, childIDs);
  1879. return groupID;
  1880. }
  1881. void addProjectConfig (const String& configName, const StringArray& buildSettings) const
  1882. {
  1883. ValueTree* v = new ValueTree (createID ("projectconfigid_" + configName));
  1884. v->setProperty ("isa", "XCBuildConfiguration", nullptr);
  1885. v->setProperty ("buildSettings", indentBracedList (buildSettings), nullptr);
  1886. v->setProperty (Ids::name, configName, nullptr);
  1887. projectConfigs.add (v);
  1888. }
  1889. void addConfigList (Target& target, const OwnedArray<ValueTree>& configsToUse, const String& listID) const
  1890. {
  1891. ValueTree* v = new ValueTree (listID);
  1892. v->setProperty ("isa", "XCConfigurationList", nullptr);
  1893. v->setProperty ("buildConfigurations", indentParenthesisedList (target.configIDs), nullptr);
  1894. v->setProperty ("defaultConfigurationIsVisible", (int) 0, nullptr);
  1895. if (auto* first = configsToUse.getFirst())
  1896. v->setProperty ("defaultConfigurationName", first->getProperty (Ids::name), nullptr);
  1897. misc.add (v);
  1898. }
  1899. void addProjectConfigList (const OwnedArray<ValueTree>& configsToUse, const String& listID) const
  1900. {
  1901. StringArray configIDs;
  1902. for (auto* c : configsToUse)
  1903. configIDs.add (c->getType().toString());
  1904. ValueTree* v = new ValueTree (listID);
  1905. v->setProperty ("isa", "XCConfigurationList", nullptr);
  1906. v->setProperty ("buildConfigurations", indentParenthesisedList (configIDs), nullptr);
  1907. v->setProperty ("defaultConfigurationIsVisible", (int) 0, nullptr);
  1908. if (auto* first = configsToUse.getFirst())
  1909. v->setProperty ("defaultConfigurationName", first->getProperty (Ids::name), nullptr);
  1910. misc.add (v);
  1911. }
  1912. void addProjectObject() const
  1913. {
  1914. ValueTree* const v = new ValueTree (createID ("__root"));
  1915. v->setProperty ("isa", "PBXProject", nullptr);
  1916. v->setProperty ("buildConfigurationList", createID ("__projList"), nullptr);
  1917. v->setProperty ("attributes", getProjectObjectAttributes(), nullptr);
  1918. v->setProperty ("compatibilityVersion", "Xcode 3.2", nullptr);
  1919. v->setProperty ("hasScannedForEncodings", (int) 0, nullptr);
  1920. v->setProperty ("mainGroup", createID ("__mainsourcegroup"), nullptr);
  1921. v->setProperty ("projectDirPath", "\"\"", nullptr);
  1922. v->setProperty ("projectRoot", "\"\"", nullptr);
  1923. String targetString = "(" + targetIDs.joinIntoString (", ") + ")";
  1924. v->setProperty ("targets", targetString, nullptr);
  1925. misc.add (v);
  1926. }
  1927. static Target::Type getTargetTypeFromFilePath (const File& file, bool returnSharedTargetIfNoValidSuffic)
  1928. {
  1929. if (LibraryModule::CompileUnit::hasSuffix (file, "_AU")) return Target::AudioUnitPlugIn;
  1930. else if (LibraryModule::CompileUnit::hasSuffix (file, "_AUv3")) return Target::AudioUnitv3PlugIn;
  1931. else if (LibraryModule::CompileUnit::hasSuffix (file, "_AAX")) return Target::AAXPlugIn;
  1932. else if (LibraryModule::CompileUnit::hasSuffix (file, "_RTAS")) return Target::RTASPlugIn;
  1933. else if (LibraryModule::CompileUnit::hasSuffix (file, "_VST2")) return Target::VSTPlugIn;
  1934. else if (LibraryModule::CompileUnit::hasSuffix (file, "_VST3")) return Target::VST3PlugIn;
  1935. else if (LibraryModule::CompileUnit::hasSuffix (file, "_Standalone")) return Target::StandalonePlugIn;
  1936. return (returnSharedTargetIfNoValidSuffic ? Target::SharedCodeTarget : Target::unspecified);
  1937. }
  1938. //==============================================================================
  1939. void removeMismatchedXcuserdata() const
  1940. {
  1941. if (settings ["keepCustomXcodeSchemes"])
  1942. return;
  1943. File xcuserdata = getProjectBundle().getChildFile ("xcuserdata");
  1944. if (! xcuserdata.exists())
  1945. return;
  1946. if (! xcuserdataMatchesTargets (xcuserdata))
  1947. {
  1948. xcuserdata.deleteRecursively();
  1949. getProjectBundle().getChildFile ("project.xcworkspace").deleteRecursively();
  1950. }
  1951. }
  1952. bool xcuserdataMatchesTargets (const File& xcuserdata) const
  1953. {
  1954. Array<File> xcschemeManagementPlists;
  1955. xcuserdata.findChildFiles (xcschemeManagementPlists, File::findFiles, true, "xcschememanagement.plist");
  1956. for (auto& plist : xcschemeManagementPlists)
  1957. if (! xcschemeManagementPlistMatchesTargets (plist))
  1958. return false;
  1959. return true;
  1960. }
  1961. static StringArray parseNamesOfTargetsFromPlist (const XmlElement& dictXML)
  1962. {
  1963. forEachXmlChildElementWithTagName (dictXML, schemesKey, "key")
  1964. {
  1965. if (schemesKey->getAllSubText().trim().equalsIgnoreCase ("SchemeUserState"))
  1966. {
  1967. if (auto* dict = schemesKey->getNextElement())
  1968. {
  1969. if (dict->hasTagName ("dict"))
  1970. {
  1971. StringArray names;
  1972. forEachXmlChildElementWithTagName (*dict, key, "key")
  1973. names.add (key->getAllSubText().upToLastOccurrenceOf (".xcscheme", false, false).trim());
  1974. names.sort (false);
  1975. return names;
  1976. }
  1977. }
  1978. }
  1979. }
  1980. return StringArray();
  1981. }
  1982. StringArray getNamesOfTargets() const
  1983. {
  1984. StringArray names;
  1985. for (auto& target : targets)
  1986. names.add (target->getXCodeSchemeName());
  1987. names.sort (false);
  1988. return names;
  1989. }
  1990. bool xcschemeManagementPlistMatchesTargets (const File& plist) const
  1991. {
  1992. ScopedPointer<XmlElement> xml (XmlDocument::parse (plist));
  1993. if (xml != nullptr)
  1994. if (auto* dict = xml->getChildByName ("dict"))
  1995. return parseNamesOfTargetsFromPlist (*dict) == getNamesOfTargets();
  1996. return false;
  1997. }
  1998. //==============================================================================
  1999. struct AppIconType
  2000. {
  2001. const char* idiom;
  2002. const char* sizeString;
  2003. const char* filename;
  2004. const char* scale;
  2005. int size;
  2006. };
  2007. static Array<AppIconType> getiOSAppIconTypes()
  2008. {
  2009. AppIconType types[] =
  2010. {
  2011. { "iphone", "29x29", "Icon-29.png", "1x", 29 },
  2012. { "iphone", "29x29", "Icon-29@2x.png", "2x", 58 },
  2013. { "iphone", "29x29", "Icon-29@3x.png", "3x", 87 },
  2014. { "iphone", "40x40", "Icon-Spotlight-40@2x.png", "2x", 80 },
  2015. { "iphone", "40x40", "Icon-Spotlight-40@3x.png", "3x", 120 },
  2016. { "iphone", "57x57", "Icon.png", "1x", 57 },
  2017. { "iphone", "57x57", "Icon@2x.png", "2x", 114 },
  2018. { "iphone", "60x60", "Icon-60@2x.png", "2x", 120 },
  2019. { "iphone", "60x60", "Icon-@3x.png", "3x", 180 },
  2020. { "ipad", "29x29", "Icon-Small-1.png", "1x", 29 },
  2021. { "ipad", "29x29", "Icon-Small@2x-1.png", "2x", 58 },
  2022. { "ipad", "40x40", "Icon-Spotlight-40.png", "1x", 40 },
  2023. { "ipad", "40x40", "Icon-Spotlight-40@2x-1.png", "2x", 80 },
  2024. { "ipad", "50x50", "Icon-Small-50.png", "1x", 50 },
  2025. { "ipad", "50x50", "Icon-Small-50@2x.png", "2x", 100 },
  2026. { "ipad", "72x72", "Icon-72.png", "1x", 72 },
  2027. { "ipad", "72x72", "Icon-72@2x.png", "2x", 144 },
  2028. { "ipad", "76x76", "Icon-76.png", "1x", 76 },
  2029. { "ipad", "76x76", "Icon-76@2x.png", "2x", 152 },
  2030. { "ipad", "83.5x83.5", "Icon-83.5@2x.png", "2x", 167 }
  2031. };
  2032. return Array<AppIconType> (types, numElementsInArray (types));
  2033. }
  2034. static String getiOSAppIconContents()
  2035. {
  2036. var images;
  2037. for (auto& type : getiOSAppIconTypes())
  2038. {
  2039. DynamicObject::Ptr d = new DynamicObject();
  2040. d->setProperty ("idiom", type.idiom);
  2041. d->setProperty ("size", type.sizeString);
  2042. d->setProperty ("filename", type.filename);
  2043. d->setProperty ("scale", type.scale);
  2044. images.append (var (d.get()));
  2045. }
  2046. return getiOSAssetContents (images);
  2047. }
  2048. String getProjectObjectAttributes() const
  2049. {
  2050. String attributes;
  2051. attributes << "{ LastUpgradeCheck = 0440; ";
  2052. if (projectType.isGUIApplication() || projectType.isAudioPlugin())
  2053. {
  2054. attributes << "TargetAttributes = { ";
  2055. for (auto& target : targets)
  2056. attributes << target->getTargetAttributes();
  2057. attributes << " }; ";
  2058. }
  2059. attributes << "}";
  2060. return attributes;
  2061. }
  2062. //==============================================================================
  2063. struct ImageType
  2064. {
  2065. const char* orientation;
  2066. const char* idiom;
  2067. const char* subtype;
  2068. const char* extent;
  2069. const char* scale;
  2070. const char* filename;
  2071. int width;
  2072. int height;
  2073. };
  2074. static Array<ImageType> getiOSLaunchImageTypes()
  2075. {
  2076. ImageType types[] =
  2077. {
  2078. { "portrait", "iphone", nullptr, "full-screen", "2x", "LaunchImage-iphone-2x.png", 640, 960 },
  2079. { "portrait", "iphone", "retina4", "full-screen", "2x", "LaunchImage-iphone-retina4.png", 640, 1136 },
  2080. { "portrait", "ipad", nullptr, "full-screen", "1x", "LaunchImage-ipad-portrait-1x.png", 768, 1024 },
  2081. { "landscape","ipad", nullptr, "full-screen", "1x", "LaunchImage-ipad-landscape-1x.png", 1024, 768 },
  2082. { "portrait", "ipad", nullptr, "full-screen", "2x", "LaunchImage-ipad-portrait-2x.png", 1536, 2048 },
  2083. { "landscape","ipad", nullptr, "full-screen", "2x", "LaunchImage-ipad-landscape-2x.png", 2048, 1536 }
  2084. };
  2085. return Array<ImageType> (types, numElementsInArray (types));
  2086. }
  2087. static String getiOSLaunchImageContents()
  2088. {
  2089. var images;
  2090. for (auto& type : getiOSLaunchImageTypes())
  2091. {
  2092. DynamicObject::Ptr d = new DynamicObject();
  2093. d->setProperty ("orientation", type.orientation);
  2094. d->setProperty ("idiom", type.idiom);
  2095. d->setProperty ("extent", type.extent);
  2096. d->setProperty ("minimum-system-version", "7.0");
  2097. d->setProperty ("scale", type.scale);
  2098. d->setProperty ("filename", type.filename);
  2099. if (type.subtype != nullptr)
  2100. d->setProperty ("subtype", type.subtype);
  2101. images.append (var (d.get()));
  2102. }
  2103. return getiOSAssetContents (images);
  2104. }
  2105. static void createiOSLaunchImageFiles (const File& launchImageSet)
  2106. {
  2107. for (auto& type : getiOSLaunchImageTypes())
  2108. {
  2109. Image image (Image::ARGB, type.width, type.height, true); // (empty black image)
  2110. image.clear (image.getBounds(), Colours::black);
  2111. MemoryOutputStream pngData;
  2112. PNGImageFormat pngFormat;
  2113. pngFormat.writeImageToStream (image, pngData);
  2114. overwriteFileIfDifferentOrThrow (launchImageSet.getChildFile (type.filename), pngData);
  2115. }
  2116. }
  2117. //==============================================================================
  2118. static String getiOSAssetContents (var images)
  2119. {
  2120. DynamicObject::Ptr v (new DynamicObject());
  2121. var info (new DynamicObject());
  2122. info.getDynamicObject()->setProperty ("version", 1);
  2123. info.getDynamicObject()->setProperty ("author", "xcode");
  2124. v->setProperty ("images", images);
  2125. v->setProperty ("info", info);
  2126. return JSON::toString (var (v.get()));
  2127. }
  2128. void createXcassetsFolderFromIcons() const
  2129. {
  2130. const File assets (getTargetFolder().getChildFile (project.getProjectFilenameRoot())
  2131. .getChildFile ("Images.xcassets"));
  2132. const File iconSet (assets.getChildFile ("AppIcon.appiconset"));
  2133. const File launchImage (assets.getChildFile ("LaunchImage.launchimage"));
  2134. overwriteFileIfDifferentOrThrow (iconSet.getChildFile ("Contents.json"), getiOSAppIconContents());
  2135. createiOSIconFiles (iconSet);
  2136. overwriteFileIfDifferentOrThrow (launchImage.getChildFile ("Contents.json"), getiOSLaunchImageContents());
  2137. createiOSLaunchImageFiles (launchImage);
  2138. RelativePath assetsPath (assets, getTargetFolder(), RelativePath::buildTargetFolder);
  2139. addFileReference (assetsPath.toUnixStyle());
  2140. resourceIDs.add (addBuildFile (assetsPath, false, false));
  2141. resourceFileRefs.add (createFileRefID (assetsPath));
  2142. }
  2143. //==============================================================================
  2144. static String indentBracedList (const StringArray& list) { return "{" + indentList (list, ";", 0, true) + " }"; }
  2145. static String indentParenthesisedList (const StringArray& list) { return "(" + indentList (list, ",", 1, false) + " )"; }
  2146. static String indentList (const StringArray& list, const String& separator, int extraTabs, bool shouldSort)
  2147. {
  2148. if (list.size() == 0)
  2149. return " ";
  2150. const String tabs ("\n" + String::repeatedString ("\t", extraTabs + 4));
  2151. if (shouldSort)
  2152. {
  2153. StringArray sorted (list);
  2154. sorted.sort (true);
  2155. return tabs + sorted.joinIntoString (separator + tabs) + separator;
  2156. }
  2157. return tabs + list.joinIntoString (separator + tabs) + separator;
  2158. }
  2159. String createID (String rootString) const
  2160. {
  2161. if (rootString.startsWith ("${"))
  2162. rootString = rootString.fromFirstOccurrenceOf ("}/", false, false);
  2163. rootString += project.getProjectUID();
  2164. return MD5 (rootString.toUTF8()).toHexString().substring (0, 24).toUpperCase();
  2165. }
  2166. String createFileRefID (const RelativePath& path) const { return createFileRefID (path.toUnixStyle()); }
  2167. String createFileRefID (const String& path) const { return createID ("__fileref_" + path); }
  2168. String getIDForGroup (const Project::Item& item) const { return createID (item.getID()); }
  2169. bool shouldFileBeCompiledByDefault (const RelativePath& file) const override
  2170. {
  2171. return file.hasFileExtension (sourceFileExtensions);
  2172. }
  2173. static String getOSXVersionName (int version)
  2174. {
  2175. jassert (version >= 4);
  2176. return "10." + String (version);
  2177. }
  2178. static String getSDKName (int version)
  2179. {
  2180. return getOSXVersionName (version) + " SDK";
  2181. }
  2182. void initialiseDependencyPathValues()
  2183. {
  2184. vst3Path.referTo (Value (new DependencyPathValueSource (getSetting (Ids::vst3Folder), Ids::vst3Path, TargetOS::osx)));
  2185. aaxPath. referTo (Value (new DependencyPathValueSource (getSetting (Ids::aaxFolder), Ids::aaxPath, TargetOS::osx)));
  2186. rtasPath.referTo (Value (new DependencyPathValueSource (getSetting (Ids::rtasFolder), Ids::rtasPath, TargetOS::osx)));
  2187. }
  2188. void addRTASPluginSettings()
  2189. {
  2190. xcodeCanUseDwarf = false;
  2191. extraSearchPaths.add ("$(DEVELOPER_DIR)/Headers/FlatCarbon");
  2192. extraSearchPaths.add ("$(SDKROOT)/Developer/Headers/FlatCarbon");
  2193. static const char* p[] = { "AlturaPorts/TDMPlugIns/PlugInLibrary/Controls",
  2194. "AlturaPorts/TDMPlugIns/PlugInLibrary/CoreClasses",
  2195. "AlturaPorts/TDMPlugIns/PlugInLibrary/DSPClasses",
  2196. "AlturaPorts/TDMPlugIns/PlugInLibrary/EffectClasses",
  2197. "AlturaPorts/TDMPlugIns/PlugInLibrary/MacBuild",
  2198. "AlturaPorts/TDMPlugIns/PlugInLibrary/Meters",
  2199. "AlturaPorts/TDMPlugIns/PlugInLibrary/ProcessClasses",
  2200. "AlturaPorts/TDMPlugIns/PlugInLibrary/ProcessClasses/Interfaces",
  2201. "AlturaPorts/TDMPlugIns/PlugInLibrary/RTASP_Adapt",
  2202. "AlturaPorts/TDMPlugIns/PlugInLibrary/Utilities",
  2203. "AlturaPorts/TDMPlugIns/PlugInLibrary/ViewClasses",
  2204. "AlturaPorts/TDMPlugIns/DSPManager/**",
  2205. "AlturaPorts/TDMPlugIns/SupplementalPlugInLib/Encryption",
  2206. "AlturaPorts/TDMPlugIns/SupplementalPlugInLib/GraphicsExtensions",
  2207. "AlturaPorts/TDMPlugIns/common/**",
  2208. "AlturaPorts/TDMPlugIns/common/PI_LibInterface",
  2209. "AlturaPorts/TDMPlugIns/PACEProtection/**",
  2210. "AlturaPorts/TDMPlugIns/SignalProcessing/**",
  2211. "AlturaPorts/OMS/Headers",
  2212. "AlturaPorts/Fic/Interfaces/**",
  2213. "AlturaPorts/Fic/Source/SignalNets",
  2214. "AlturaPorts/DSIPublicInterface/PublicHeaders",
  2215. "DAEWin/Include",
  2216. "AlturaPorts/DigiPublic/Interfaces",
  2217. "AlturaPorts/DigiPublic",
  2218. "AlturaPorts/NewFileLibs/DOA",
  2219. "AlturaPorts/NewFileLibs/Cmn",
  2220. "xplat/AVX/avx2/avx2sdk/inc",
  2221. "xplat/AVX/avx2/avx2sdk/utils" };
  2222. RelativePath rtasFolder (getRTASPathValue().toString(), RelativePath::projectFolder);
  2223. for (auto* path : p)
  2224. addToExtraSearchPaths (rtasFolder.getChildFile (path));
  2225. }
  2226. JUCE_DECLARE_NON_COPYABLE (XCodeProjectExporter)
  2227. };