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.

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