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.

2774 lines
122KB

  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();
  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. addPlistDictionaryKey (dict, "name", owner.project.getPluginManufacturer().toString()
  1053. + ": " + owner.project.getPluginName().toString());
  1054. addPlistDictionaryKey (dict, "description", owner.project.getPluginDesc().toString());
  1055. addPlistDictionaryKey (dict, "factoryFunction", owner.project.getPluginAUExportPrefix().toString() + "Factory");
  1056. addPlistDictionaryKey (dict, "manufacturer", owner.project.getPluginManufacturerCode().toString().trim().substring (0, 4));
  1057. addPlistDictionaryKey (dict, "type", owner.project.getAUMainTypeCode());
  1058. addPlistDictionaryKey (dict, "subtype", owner.project.getPluginCode().toString().trim().substring (0, 4));
  1059. addPlistDictionaryKeyInt (dict, "version", owner.project.getVersionAsHexInteger());
  1060. xcodeExtraPListEntries.add (plistKey);
  1061. xcodeExtraPListEntries.add (plistEntry);
  1062. }
  1063. void addExtraAudioUnitv3PlugInTargetSettings()
  1064. {
  1065. if (owner.isiOS())
  1066. xcodeFrameworks.addTokens ("CoreAudioKit AVFoundation", false);
  1067. else
  1068. xcodeFrameworks.addTokens ("AudioUnit CoreAudioKit AVFoundation", false);
  1069. XmlElement plistKey ("key");
  1070. plistKey.addTextElement ("NSExtension");
  1071. XmlElement plistEntry ("dict");
  1072. addPlistDictionaryKey (&plistEntry, "NSExtensionPrincipalClass", owner.project.getPluginAUExportPrefix().toString() + "FactoryAUv3");
  1073. addPlistDictionaryKey (&plistEntry, "NSExtensionPointIdentifier", "com.apple.AudioUnit-UI");
  1074. plistEntry.createNewChildElement ("key")->addTextElement ("NSExtensionAttributes");
  1075. XmlElement* dict = plistEntry.createNewChildElement ("dict");
  1076. dict->createNewChildElement ("key")->addTextElement ("AudioComponents");
  1077. XmlElement* componentArray = dict->createNewChildElement ("array");
  1078. XmlElement* componentDict = componentArray->createNewChildElement ("dict");
  1079. addPlistDictionaryKey (componentDict, "name", owner.project.getPluginManufacturer().toString()
  1080. + ": " + owner.project.getPluginName().toString());
  1081. addPlistDictionaryKey (componentDict, "description", owner.project.getPluginDesc().toString());
  1082. addPlistDictionaryKey (componentDict, "factoryFunction",owner.project. getPluginAUExportPrefix().toString() + "FactoryAUv3");
  1083. addPlistDictionaryKey (componentDict, "manufacturer", owner.project.getPluginManufacturerCode().toString().trim().substring (0, 4));
  1084. addPlistDictionaryKey (componentDict, "type", owner.project.getAUMainTypeCode());
  1085. addPlistDictionaryKey (componentDict, "subtype", owner.project.getPluginCode().toString().trim().substring (0, 4));
  1086. addPlistDictionaryKeyInt (componentDict, "version", owner.project.getVersionAsHexInteger());
  1087. addPlistDictionaryKeyBool (componentDict, "sandboxSafe", true);
  1088. componentDict->createNewChildElement ("key")->addTextElement ("tags");
  1089. XmlElement* tagsArray = componentDict->createNewChildElement ("array");
  1090. tagsArray->createNewChildElement ("string")->addTextElement (static_cast<bool> (owner.project.getPluginIsSynth().getValue()) ? "Synth" : "Effects");
  1091. xcodeExtraPListEntries.add (plistKey);
  1092. xcodeExtraPListEntries.add (plistEntry);
  1093. }
  1094. void addExtraAAXTargetSettings()
  1095. {
  1096. const RelativePath aaxLibsFolder = RelativePath (owner.getAAXPathValue().toString(), RelativePath::projectFolder).getChildFile ("Libs");
  1097. xcodeExtraLibrariesDebug.add (aaxLibsFolder.getChildFile ("Debug/libAAXLibrary.a"));
  1098. xcodeExtraLibrariesRelease.add (aaxLibsFolder.getChildFile ("Release/libAAXLibrary.a"));
  1099. }
  1100. void addExtraRTASTargetSettings()
  1101. {
  1102. RelativePath rtasFolder (owner.getRTASPathValue().toString(), RelativePath::projectFolder);
  1103. xcodeExtraLibrariesDebug.add (rtasFolder.getChildFile ("MacBag/Libs/Debug/libPluginLibrary.a"));
  1104. xcodeExtraLibrariesRelease.add (rtasFolder.getChildFile ("MacBag/Libs/Release/libPluginLibrary.a"));
  1105. }
  1106. //==============================================================================
  1107. const XCodeProjectExporter& owner;
  1108. Target& operator= (const Target&) JUCE_DELETED_FUNCTION;
  1109. };
  1110. mutable StringArray xcodeFrameworks;
  1111. StringArray xcodeLibs;
  1112. private:
  1113. //==============================================================================
  1114. bool xcodeCanUseDwarf;
  1115. OwnedArray<Target> targets;
  1116. mutable OwnedArray<ValueTree> pbxBuildFiles, pbxFileReferences, pbxGroups, misc, projectConfigs, targetConfigs;
  1117. mutable StringArray resourceIDs, sourceIDs, targetIDs;
  1118. mutable StringArray frameworkFileIDs, rezFileIDs, resourceFileRefs;
  1119. mutable File menuNibFile, iconFile;
  1120. mutable StringArray buildProducts;
  1121. const bool iOS;
  1122. static String sanitisePath (const String& path)
  1123. {
  1124. if (path.startsWithChar ('~'))
  1125. return "$(HOME)" + path.substring (1);
  1126. return path;
  1127. }
  1128. static String addQuotesIfRequired (const String& s)
  1129. {
  1130. return s.containsAnyOf (" $") ? s.quoted() : s;
  1131. }
  1132. File getProjectBundle() const { return getTargetFolder().getChildFile (project.getProjectFilenameRoot()).withFileExtension (".xcodeproj"); }
  1133. //==============================================================================
  1134. void createObjects() const
  1135. {
  1136. prepareTargets();
  1137. addFrameworks();
  1138. addCustomResourceFolders();
  1139. addPlistFileReferences();
  1140. if (iOS && ! projectType.isStaticLibrary())
  1141. addXcassets();
  1142. else
  1143. addNibFiles();
  1144. addIcons();
  1145. addBuildConfigurations();
  1146. addProjectConfigList (projectConfigs, createID ("__projList"));
  1147. {
  1148. StringArray topLevelGroupIDs;
  1149. addFilesAndGroupsToProject (topLevelGroupIDs);
  1150. addBuildPhases();
  1151. addExtraGroupsToProject (topLevelGroupIDs);
  1152. addGroup (createID ("__mainsourcegroup"), "Source", topLevelGroupIDs);
  1153. }
  1154. addProjectObject();
  1155. removeMismatchedXcuserdata();
  1156. }
  1157. void prepareTargets() const
  1158. {
  1159. for (int targetIdx = 0; targetIdx < targets.size(); ++targetIdx)
  1160. {
  1161. Target& target = *targets[targetIdx];
  1162. if (target.type == Target::AggregateTarget)
  1163. continue;
  1164. target.addMainBuildProduct();
  1165. String targetName = target.getName();
  1166. String fileID (createID (targetName + String ("__targetbuildref")));
  1167. String fileRefID (createID (String ("__productFileID") + targetName));
  1168. ValueTree* v = new ValueTree (fileID);
  1169. v->setProperty ("isa", "PBXBuildFile", nullptr);
  1170. v->setProperty ("fileRef", fileRefID, nullptr);
  1171. target.mainBuildProductID = fileID;
  1172. pbxBuildFiles.add (v);
  1173. target.addDependency();
  1174. }
  1175. }
  1176. void addPlistFileReferences() const
  1177. {
  1178. for (int targetIdx = 0; targetIdx < targets.size(); ++targetIdx)
  1179. {
  1180. Target& target = *targets[targetIdx];
  1181. if (target.type == Target::AggregateTarget)
  1182. continue;
  1183. if (target.xcodeCreatePList)
  1184. {
  1185. RelativePath plistPath (target.infoPlistFile, getTargetFolder(), RelativePath::buildTargetFolder);
  1186. addFileReference (plistPath.toUnixStyle());
  1187. resourceFileRefs.add (createFileRefID (plistPath));
  1188. }
  1189. }
  1190. }
  1191. void addNibFiles() const
  1192. {
  1193. MemoryOutputStream nib;
  1194. nib.write (BinaryData::RecentFilesMenuTemplate_nib, BinaryData::RecentFilesMenuTemplate_nibSize);
  1195. overwriteFileIfDifferentOrThrow (menuNibFile, nib);
  1196. RelativePath menuNibPath (menuNibFile, getTargetFolder(), RelativePath::buildTargetFolder);
  1197. addFileReference (menuNibPath.toUnixStyle());
  1198. resourceIDs.add (addBuildFile (menuNibPath, false, false));
  1199. resourceFileRefs.add (createFileRefID (menuNibPath));
  1200. }
  1201. void addIcons() const
  1202. {
  1203. if (iconFile.exists())
  1204. {
  1205. RelativePath iconPath (iconFile, getTargetFolder(), RelativePath::buildTargetFolder);
  1206. addFileReference (iconPath.toUnixStyle());
  1207. resourceIDs.add (addBuildFile (iconPath, false, false));
  1208. resourceFileRefs.add (createFileRefID (iconPath));
  1209. }
  1210. }
  1211. void addBuildConfigurations() const
  1212. {
  1213. // add build configurations
  1214. for (ConstConfigIterator config (*this); config.next();)
  1215. {
  1216. const XcodeBuildConfiguration& xcodeConfig = dynamic_cast<const XcodeBuildConfiguration&> (*config);
  1217. addProjectConfig (config->getName(), getProjectSettings (xcodeConfig));
  1218. }
  1219. }
  1220. void addFilesAndGroupsToProject (StringArray& topLevelGroupIDs) const
  1221. {
  1222. if (! isiOS() && project.getProjectType().isAudioPlugin())
  1223. topLevelGroupIDs.add (addEntitlementsFile());
  1224. for (int i = 0; i < getAllGroups().size(); ++i)
  1225. {
  1226. const Project::Item& group = getAllGroups().getReference(i);
  1227. if (group.getNumChildren() > 0)
  1228. topLevelGroupIDs.add (addProjectItem (group));
  1229. }
  1230. }
  1231. void addExtraGroupsToProject (StringArray& topLevelGroupIDs) const
  1232. {
  1233. { // Add 'resources' group
  1234. String resourcesGroupID (createID ("__resources"));
  1235. addGroup (resourcesGroupID, "Resources", resourceFileRefs);
  1236. topLevelGroupIDs.add (resourcesGroupID);
  1237. }
  1238. { // Add 'frameworks' group
  1239. String frameworksGroupID (createID ("__frameworks"));
  1240. addGroup (frameworksGroupID, "Frameworks", frameworkFileIDs);
  1241. topLevelGroupIDs.add (frameworksGroupID);
  1242. }
  1243. { // Add 'products' group
  1244. String productsGroupID (createID ("__products"));
  1245. addGroup (productsGroupID, "Products", buildProducts);
  1246. topLevelGroupIDs.add (productsGroupID);
  1247. }
  1248. }
  1249. void addBuildPhases() const
  1250. {
  1251. // add build phases
  1252. for (int i = 0; i < targets.size(); ++i)
  1253. {
  1254. Target& target = *targets[i];
  1255. if (target.type != Target::AggregateTarget)
  1256. buildProducts.add (createID (String ("__productFileID") + String (target.getName())));
  1257. for (ConstConfigIterator config (*this); config.next();)
  1258. {
  1259. const XcodeBuildConfiguration& xcodeConfig = dynamic_cast<const XcodeBuildConfiguration&> (*config);
  1260. target.addTargetConfig (config->getName(), target.getTargetSettings (xcodeConfig));
  1261. }
  1262. addConfigList (target, targetConfigs, createID (String ("__configList") + target.getName()));
  1263. target.addShellScriptBuildPhase ("Pre-build script", getPreBuildScript());
  1264. if (target.type != Target::AggregateTarget)
  1265. {
  1266. // TODO: ideally resources wouldn't be copied into the AUv3 bundle as well.
  1267. // However, fixing this requires supporting App groups -> TODO: add app groups
  1268. if (! projectType.isStaticLibrary() && target.type != Target::SharedCodeTarget)
  1269. target.addBuildPhase ("PBXResourcesBuildPhase", resourceIDs);
  1270. StringArray rezFiles (rezFileIDs);
  1271. rezFiles.addArray (target.rezFileIDs);
  1272. if (rezFiles.size() > 0)
  1273. target.addBuildPhase ("PBXRezBuildPhase", rezFiles);
  1274. StringArray sourceFiles (target.sourceIDs);
  1275. if (target.type == Target::SharedCodeTarget
  1276. || (! project.getProjectType().isAudioPlugin()))
  1277. sourceFiles.addArray (sourceIDs);
  1278. target.addBuildPhase ("PBXSourcesBuildPhase", sourceFiles);
  1279. if (! projectType.isStaticLibrary() && target.type != Target::SharedCodeTarget)
  1280. target.addBuildPhase ("PBXFrameworksBuildPhase", target.frameworkIDs);
  1281. }
  1282. target.addShellScriptBuildPhase ("Post-build script", getPostBuildScript());
  1283. if (project.getProjectType().isAudioPlugin() && project.shouldBuildAUv3().getValue()
  1284. && project.shouldBuildStandalone().getValue() && target.type == Target::StandalonePlugIn)
  1285. embedAppExtension();
  1286. addTargetObject (target);
  1287. }
  1288. }
  1289. void embedAppExtension() const
  1290. {
  1291. if (Target* standaloneTarget = getTargetOfType (Target::StandalonePlugIn))
  1292. {
  1293. if (Target* auv3Target = getTargetOfType (Target::AudioUnitv3PlugIn))
  1294. {
  1295. StringArray files;
  1296. files.add (auv3Target->mainBuildProductID);
  1297. standaloneTarget->addCopyFilesPhase ("Embed App Extensions", files, kPluginsFolder);
  1298. }
  1299. }
  1300. }
  1301. static Image fixMacIconImageSize (Drawable& image)
  1302. {
  1303. const int validSizes[] = { 16, 32, 48, 128, 256, 512, 1024 };
  1304. const int w = image.getWidth();
  1305. const int h = image.getHeight();
  1306. int bestSize = 16;
  1307. for (int i = 0; i < numElementsInArray (validSizes); ++i)
  1308. {
  1309. if (w == h && w == validSizes[i])
  1310. {
  1311. bestSize = w;
  1312. break;
  1313. }
  1314. if (jmax (w, h) > validSizes[i])
  1315. bestSize = validSizes[i];
  1316. }
  1317. return rescaleImageForIcon (image, bestSize);
  1318. }
  1319. //==============================================================================
  1320. Target* getTargetOfType (Target::Type type) const
  1321. {
  1322. for (auto& target : targets)
  1323. if (target->type == type)
  1324. return target;
  1325. return nullptr;
  1326. }
  1327. void addTargetObject (Target& target) const
  1328. {
  1329. String targetName = target.getName();
  1330. String targetID = target.getID();
  1331. ValueTree* const v = new ValueTree (targetID);
  1332. v->setProperty ("isa", target.type == Target::AggregateTarget ? "PBXAggregateTarget" : "PBXNativeTarget", nullptr);
  1333. v->setProperty ("buildConfigurationList", createID (String ("__configList") + targetName), nullptr);
  1334. v->setProperty ("buildPhases", indentParenthesisedList (target.buildPhaseIDs), nullptr);
  1335. v->setProperty ("buildRules", "( )", nullptr);
  1336. v->setProperty ("dependencies", indentParenthesisedList (getTargetDependencies (target)), nullptr);
  1337. v->setProperty (Ids::name, target.getXCodeSchemeName(), nullptr);
  1338. v->setProperty ("productName", projectName, nullptr);
  1339. if (target.type != Target::AggregateTarget)
  1340. {
  1341. v->setProperty ("productReference", createID (String ("__productFileID") + targetName), nullptr);
  1342. jassert (target.xcodeProductType.isNotEmpty());
  1343. v->setProperty ("productType", target.xcodeProductType, nullptr);
  1344. }
  1345. targetIDs.add (targetID);
  1346. misc.add (v);
  1347. }
  1348. StringArray getTargetDependencies (const Target& target) const
  1349. {
  1350. StringArray dependencies;
  1351. if (project.getProjectType().isAudioPlugin())
  1352. {
  1353. if (target.type == Target::StandalonePlugIn) // depends on AUv3 and shared code
  1354. {
  1355. if (Target* auv3Target = getTargetOfType (Target::AudioUnitv3PlugIn))
  1356. dependencies.add (auv3Target->getDependencyID());
  1357. if (Target* sharedCodeTarget = getTargetOfType (Target::SharedCodeTarget))
  1358. dependencies.add (sharedCodeTarget->getDependencyID());
  1359. }
  1360. else if (target.type == Target::AggregateTarget) // depends on all other targets
  1361. {
  1362. for (int i = 1; i < targets.size(); ++i)
  1363. dependencies.add (targets[i]->getDependencyID());
  1364. }
  1365. else if (target.type != Target::SharedCodeTarget) // shared code doesn't depend on anything; all other targets depend only on the shared code
  1366. {
  1367. if (Target* sharedCodeTarget = getTargetOfType (Target::SharedCodeTarget))
  1368. dependencies.add (sharedCodeTarget->getDependencyID());
  1369. }
  1370. }
  1371. return dependencies;
  1372. }
  1373. static void writeOldIconFormat (MemoryOutputStream& out, const Image& image, const char* type, const char* maskType)
  1374. {
  1375. const int w = image.getWidth();
  1376. const int h = image.getHeight();
  1377. out.write (type, 4);
  1378. out.writeIntBigEndian (8 + 4 * w * h);
  1379. const Image::BitmapData bitmap (image, Image::BitmapData::readOnly);
  1380. for (int y = 0; y < h; ++y)
  1381. {
  1382. for (int x = 0; x < w; ++x)
  1383. {
  1384. const Colour pixel (bitmap.getPixelColour (x, y));
  1385. out.writeByte ((char) pixel.getAlpha());
  1386. out.writeByte ((char) pixel.getRed());
  1387. out.writeByte ((char) pixel.getGreen());
  1388. out.writeByte ((char) pixel.getBlue());
  1389. }
  1390. }
  1391. out.write (maskType, 4);
  1392. out.writeIntBigEndian (8 + w * h);
  1393. for (int y = 0; y < h; ++y)
  1394. {
  1395. for (int x = 0; x < w; ++x)
  1396. {
  1397. const Colour pixel (bitmap.getPixelColour (x, y));
  1398. out.writeByte ((char) pixel.getAlpha());
  1399. }
  1400. }
  1401. }
  1402. static void writeNewIconFormat (MemoryOutputStream& out, const Image& image, const char* type)
  1403. {
  1404. MemoryOutputStream pngData;
  1405. PNGImageFormat pngFormat;
  1406. pngFormat.writeImageToStream (image, pngData);
  1407. out.write (type, 4);
  1408. out.writeIntBigEndian (8 + (int) pngData.getDataSize());
  1409. out << pngData;
  1410. }
  1411. void writeIcnsFile (const OwnedArray<Drawable>& images, OutputStream& out) const
  1412. {
  1413. MemoryOutputStream data;
  1414. int smallest = 0x7fffffff;
  1415. Drawable* smallestImage = nullptr;
  1416. for (int i = 0; i < images.size(); ++i)
  1417. {
  1418. const Image image (fixMacIconImageSize (*images.getUnchecked(i)));
  1419. jassert (image.getWidth() == image.getHeight());
  1420. if (image.getWidth() < smallest)
  1421. {
  1422. smallest = image.getWidth();
  1423. smallestImage = images.getUnchecked(i);
  1424. }
  1425. switch (image.getWidth())
  1426. {
  1427. case 16: writeOldIconFormat (data, image, "is32", "s8mk"); break;
  1428. case 32: writeOldIconFormat (data, image, "il32", "l8mk"); break;
  1429. case 48: writeOldIconFormat (data, image, "ih32", "h8mk"); break;
  1430. case 128: writeOldIconFormat (data, image, "it32", "t8mk"); break;
  1431. case 256: writeNewIconFormat (data, image, "ic08"); break;
  1432. case 512: writeNewIconFormat (data, image, "ic09"); break;
  1433. case 1024: writeNewIconFormat (data, image, "ic10"); break;
  1434. default: break;
  1435. }
  1436. }
  1437. jassert (data.getDataSize() > 0); // no suitable sized images?
  1438. // If you only supply a 1024 image, the file doesn't work on 10.8, so we need
  1439. // to force a smaller one in there too..
  1440. if (smallest > 512 && smallestImage != nullptr)
  1441. writeNewIconFormat (data, rescaleImageForIcon (*smallestImage, 512), "ic09");
  1442. out.write ("icns", 4);
  1443. out.writeIntBigEndian ((int) data.getDataSize() + 8);
  1444. out << data;
  1445. }
  1446. void getIconImages (OwnedArray<Drawable>& images) const
  1447. {
  1448. ScopedPointer<Drawable> bigIcon (getBigIcon());
  1449. if (bigIcon != nullptr)
  1450. images.add (bigIcon.release());
  1451. ScopedPointer<Drawable> smallIcon (getSmallIcon());
  1452. if (smallIcon != nullptr)
  1453. images.add (smallIcon.release());
  1454. }
  1455. void createiOSIconFiles (File appIconSet) const
  1456. {
  1457. const Array<AppIconType> types (getiOSAppIconTypes());
  1458. OwnedArray<Drawable> images;
  1459. getIconImages (images);
  1460. if (images.size() > 0)
  1461. {
  1462. for (int i = 0; i < types.size(); ++i)
  1463. {
  1464. const AppIconType type = types.getUnchecked(i);
  1465. const Image image (rescaleImageForIcon (*images.getFirst(), type.size));
  1466. MemoryOutputStream pngData;
  1467. PNGImageFormat pngFormat;
  1468. pngFormat.writeImageToStream (image, pngData);
  1469. overwriteFileIfDifferentOrThrow (appIconSet.getChildFile (type.filename), pngData);
  1470. }
  1471. }
  1472. }
  1473. void createIconFile() const
  1474. {
  1475. OwnedArray<Drawable> images;
  1476. getIconImages (images);
  1477. if (images.size() > 0)
  1478. {
  1479. MemoryOutputStream mo;
  1480. writeIcnsFile (images, mo);
  1481. iconFile = getTargetFolder().getChildFile ("Icon.icns");
  1482. overwriteFileIfDifferentOrThrow (iconFile, mo);
  1483. }
  1484. }
  1485. void writeInfoPlistFiles() const
  1486. {
  1487. for (auto& target : targets)
  1488. target->writeInfoPlistFile();
  1489. }
  1490. void deleteRsrcFiles() const
  1491. {
  1492. for (DirectoryIterator di (getTargetFolder().getChildFile ("build"), true, "*.rsrc", File::findFiles); di.next();)
  1493. di.getFile().deleteFile();
  1494. }
  1495. String getHeaderSearchPaths (const BuildConfiguration& config) const
  1496. {
  1497. StringArray paths (extraSearchPaths);
  1498. paths.addArray (config.getHeaderSearchPaths());
  1499. paths.add ("$(inherited)");
  1500. paths = getCleanedStringArray (paths);
  1501. for (int i = 0; i < paths.size(); ++i)
  1502. {
  1503. String& s = paths.getReference(i);
  1504. s = replacePreprocessorTokens (config, s);
  1505. if (s.containsChar (' '))
  1506. s = "\"\\\"" + s + "\\\"\""; // crazy double quotes required when there are spaces..
  1507. else
  1508. s = "\"" + s + "\"";
  1509. }
  1510. return "(" + paths.joinIntoString (", ") + ")";
  1511. }
  1512. static String getLinkerFlagForLib (String library)
  1513. {
  1514. if (library.substring (0, 3) == "lib")
  1515. library = library.substring (3);
  1516. return "-l" + library.replace (" ", "\\\\ ").upToLastOccurrenceOf (".", false, false);
  1517. }
  1518. String getSearchPathForStaticLibrary (const RelativePath& library) const
  1519. {
  1520. String searchPath (library.toUnixStyle().upToLastOccurrenceOf ("/", false, false));
  1521. if (! library.isAbsolute())
  1522. {
  1523. String srcRoot (rebaseFromProjectFolderToBuildTarget (RelativePath (".", RelativePath::projectFolder)).toUnixStyle());
  1524. if (srcRoot.endsWith ("/.")) srcRoot = srcRoot.dropLastCharacters (2);
  1525. if (! srcRoot.endsWithChar ('/')) srcRoot << '/';
  1526. searchPath = srcRoot + searchPath;
  1527. }
  1528. return sanitisePath (searchPath);
  1529. }
  1530. StringArray getProjectSettings (const XcodeBuildConfiguration& config) const
  1531. {
  1532. StringArray s;
  1533. s.add ("ALWAYS_SEARCH_USER_PATHS = NO");
  1534. s.add ("GCC_C_LANGUAGE_STANDARD = c99");
  1535. s.add ("GCC_WARN_ABOUT_RETURN_TYPE = YES");
  1536. s.add ("GCC_WARN_CHECK_SWITCH_STATEMENTS = YES");
  1537. s.add ("GCC_WARN_UNUSED_VARIABLE = YES");
  1538. s.add ("GCC_WARN_MISSING_PARENTHESES = YES");
  1539. s.add ("GCC_WARN_NON_VIRTUAL_DESTRUCTOR = YES");
  1540. s.add ("GCC_WARN_TYPECHECK_CALLS_TO_PRINTF = YES");
  1541. s.add ("WARNING_CFLAGS = -Wreorder");
  1542. s.add ("GCC_MODEL_TUNING = G5");
  1543. if (projectType.isStaticLibrary())
  1544. {
  1545. s.add ("GCC_INLINES_ARE_PRIVATE_EXTERN = NO");
  1546. s.add ("GCC_SYMBOLS_PRIVATE_EXTERN = NO");
  1547. }
  1548. else
  1549. {
  1550. s.add ("GCC_INLINES_ARE_PRIVATE_EXTERN = YES");
  1551. }
  1552. if (config.isDebug())
  1553. {
  1554. s.add ("ENABLE_TESTABILITY = YES");
  1555. if (config.osxArchitecture.get() == osxArch_Default || config.osxArchitecture.get().isEmpty())
  1556. s.add ("ONLY_ACTIVE_ARCH = YES");
  1557. }
  1558. if (iOS)
  1559. {
  1560. s.add ("\"CODE_SIGN_IDENTITY[sdk=iphoneos*]\" = " + config.codeSignIdentity.get().quoted());
  1561. s.add ("SDKROOT = iphoneos");
  1562. s.add ("TARGETED_DEVICE_FAMILY = \"1,2\"");
  1563. const String iosVersion (config.iosDeploymentTarget.get());
  1564. if (iosVersion.isNotEmpty() && iosVersion != osxVersionDefault)
  1565. s.add ("IPHONEOS_DEPLOYMENT_TARGET = " + iosVersion);
  1566. else
  1567. s.add ("IPHONEOS_DEPLOYMENT_TARGET = 9.3");
  1568. }
  1569. else
  1570. {
  1571. if (! config.codeSignIdentity.isUsingDefault() || getIosDevelopmentTeamIDString().isNotEmpty())
  1572. s.add ("\"CODE_SIGN_IDENTITY\" = " + config.codeSignIdentity.get().quoted());
  1573. }
  1574. s.add ("ZERO_LINK = NO");
  1575. if (xcodeCanUseDwarf)
  1576. s.add ("DEBUG_INFORMATION_FORMAT = \"dwarf\"");
  1577. s.add ("PRODUCT_NAME = \"" + replacePreprocessorTokens (config, config.getTargetBinaryNameString()) + "\"");
  1578. return s;
  1579. }
  1580. void addFrameworks() const
  1581. {
  1582. if (! projectType.isStaticLibrary())
  1583. {
  1584. if (iOS && isInAppPurchasesEnabled())
  1585. xcodeFrameworks.addIfNotAlreadyThere ("StoreKit");
  1586. xcodeFrameworks.addTokens (getExtraFrameworksString(), ",;", "\"'");
  1587. xcodeFrameworks.trim();
  1588. StringArray s (xcodeFrameworks);
  1589. for (auto& target : targets)
  1590. s.addArray (target->xcodeFrameworks);
  1591. if (project.getConfigFlag ("JUCE_QUICKTIME") == Project::configFlagDisabled)
  1592. s.removeString ("QuickTime");
  1593. s.trim();
  1594. s.removeDuplicates (true);
  1595. s.sort (true);
  1596. for (int i = 0; i < s.size(); ++i)
  1597. {
  1598. String frameworkID = addFramework (s[i]);
  1599. // find all the targets that are referring to this object
  1600. for (auto& target : targets)
  1601. if (xcodeFrameworks.contains (s[i]) || target->xcodeFrameworks.contains (s[i]))
  1602. target->frameworkIDs.add (frameworkID);
  1603. }
  1604. }
  1605. }
  1606. void addCustomResourceFolders() const
  1607. {
  1608. StringArray crf;
  1609. crf.addTokens (getCustomResourceFoldersString(), ":", "");
  1610. crf.trim();
  1611. for (int i = 0; i < crf.size(); ++i)
  1612. addCustomResourceFolder (crf[i]);
  1613. }
  1614. void addXcassets() const
  1615. {
  1616. String customXcassetsPath = getCustomXcassetsFolderString();
  1617. if (customXcassetsPath.isEmpty())
  1618. createXcassetsFolderFromIcons();
  1619. else
  1620. addCustomResourceFolder (customXcassetsPath, "folder.assetcatalog");
  1621. }
  1622. void addCustomResourceFolder (String folderPathRelativeToProjectFolder, const String fileType = "folder") const
  1623. {
  1624. String folderPath = RelativePath (folderPathRelativeToProjectFolder, RelativePath::projectFolder)
  1625. .rebased (projectFolder, getTargetFolder(), RelativePath::buildTargetFolder)
  1626. .toUnixStyle();
  1627. const String fileRefID (createFileRefID (folderPath));
  1628. addFileOrFolderReference (folderPath, "<group>", fileType);
  1629. resourceIDs.add (addBuildFile (folderPath, fileRefID, false, false));
  1630. resourceFileRefs.add (createFileRefID (folderPath));
  1631. }
  1632. //==============================================================================
  1633. void writeProjectFile (OutputStream& output) const
  1634. {
  1635. output << "// !$*UTF8*$!\n{\n"
  1636. "\tarchiveVersion = 1;\n"
  1637. "\tclasses = {\n\t};\n"
  1638. "\tobjectVersion = 46;\n"
  1639. "\tobjects = {\n\n";
  1640. Array<ValueTree*> objects;
  1641. objects.addArray (pbxBuildFiles);
  1642. objects.addArray (pbxFileReferences);
  1643. objects.addArray (pbxGroups);
  1644. objects.addArray (targetConfigs);
  1645. objects.addArray (projectConfigs);
  1646. objects.addArray (misc);
  1647. for (int i = 0; i < objects.size(); ++i)
  1648. {
  1649. ValueTree& o = *objects.getUnchecked(i);
  1650. output << "\t\t" << o.getType().toString() << " = {";
  1651. for (int j = 0; j < o.getNumProperties(); ++j)
  1652. {
  1653. const Identifier propertyName (o.getPropertyName(j));
  1654. String val (o.getProperty (propertyName).toString());
  1655. if (val.isEmpty() || (val.containsAnyOf (" \t;<>()=,&+-_@~\r\n\\#%^`*")
  1656. && ! (val.trimStart().startsWithChar ('(')
  1657. || val.trimStart().startsWithChar ('{'))))
  1658. val = "\"" + val + "\"";
  1659. output << propertyName.toString() << " = " << val << "; ";
  1660. }
  1661. output << "};\n";
  1662. }
  1663. output << "\t};\n\trootObject = " << createID ("__root") << ";\n}\n";
  1664. }
  1665. String addBuildFile (const String& path, const String& fileRefID, bool addToSourceBuildPhase, bool inhibitWarnings, Target* xcodeTarget = nullptr) const
  1666. {
  1667. String fileID (createID (path + "buildref"));
  1668. if (addToSourceBuildPhase)
  1669. {
  1670. if (xcodeTarget != nullptr) xcodeTarget->sourceIDs.add (fileID);
  1671. else sourceIDs.add (fileID);
  1672. }
  1673. ValueTree* v = new ValueTree (fileID);
  1674. v->setProperty ("isa", "PBXBuildFile", nullptr);
  1675. v->setProperty ("fileRef", fileRefID, nullptr);
  1676. if (inhibitWarnings)
  1677. v->setProperty ("settings", "{COMPILER_FLAGS = \"-w\"; }", nullptr);
  1678. pbxBuildFiles.add (v);
  1679. return fileID;
  1680. }
  1681. String addBuildFile (const RelativePath& path, bool addToSourceBuildPhase, bool inhibitWarnings, Target* xcodeTarget = nullptr) const
  1682. {
  1683. return addBuildFile (path.toUnixStyle(), createFileRefID (path), addToSourceBuildPhase, inhibitWarnings, xcodeTarget);
  1684. }
  1685. String addFileReference (String pathString) const
  1686. {
  1687. String sourceTree ("SOURCE_ROOT");
  1688. RelativePath path (pathString, RelativePath::unknown);
  1689. if (pathString.startsWith ("${"))
  1690. {
  1691. sourceTree = pathString.substring (2).upToFirstOccurrenceOf ("}", false, false);
  1692. pathString = pathString.fromFirstOccurrenceOf ("}/", false, false);
  1693. }
  1694. else if (path.isAbsolute())
  1695. {
  1696. sourceTree = "<absolute>";
  1697. }
  1698. String fileType = getFileType (path);
  1699. return addFileOrFolderReference (pathString, sourceTree, fileType);
  1700. }
  1701. String addFileOrFolderReference (String pathString, String sourceTree, String fileType) const
  1702. {
  1703. const String fileRefID (createFileRefID (pathString));
  1704. ScopedPointer<ValueTree> v (new ValueTree (fileRefID));
  1705. v->setProperty ("isa", "PBXFileReference", nullptr);
  1706. v->setProperty ("lastKnownFileType", fileType, nullptr);
  1707. v->setProperty (Ids::name, pathString.fromLastOccurrenceOf ("/", false, false), nullptr);
  1708. v->setProperty ("path", sanitisePath (pathString), nullptr);
  1709. v->setProperty ("sourceTree", sourceTree, nullptr);
  1710. const int existing = pbxFileReferences.indexOfSorted (*this, v);
  1711. if (existing >= 0)
  1712. {
  1713. // If this fails, there's either a string hash collision, or the same file is being added twice (incorrectly)
  1714. jassert (pbxFileReferences.getUnchecked (existing)->isEquivalentTo (*v));
  1715. }
  1716. else
  1717. {
  1718. pbxFileReferences.addSorted (*this, v.release());
  1719. }
  1720. return fileRefID;
  1721. }
  1722. public:
  1723. static int compareElements (const ValueTree* first, const ValueTree* second)
  1724. {
  1725. return first->getType().getCharPointer().compare (second->getType().getCharPointer());
  1726. }
  1727. private:
  1728. static String getFileType (const RelativePath& file)
  1729. {
  1730. if (file.hasFileExtension (cppFileExtensions)) return "sourcecode.cpp.cpp";
  1731. if (file.hasFileExtension (".mm")) return "sourcecode.cpp.objcpp";
  1732. if (file.hasFileExtension (".m")) return "sourcecode.c.objc";
  1733. if (file.hasFileExtension (".c")) return "sourcecode.c.c";
  1734. if (file.hasFileExtension (headerFileExtensions)) return "sourcecode.c.h";
  1735. if (file.hasFileExtension (asmFileExtensions)) return "sourcecode.c.asm";
  1736. if (file.hasFileExtension (".framework")) return "wrapper.framework";
  1737. if (file.hasFileExtension (".jpeg;.jpg")) return "image.jpeg";
  1738. if (file.hasFileExtension ("png;gif")) return "image" + file.getFileExtension();
  1739. if (file.hasFileExtension ("html;htm")) return "text.html";
  1740. if (file.hasFileExtension ("xml;zip;wav")) return "file" + file.getFileExtension();
  1741. if (file.hasFileExtension ("txt;rtf")) return "text" + file.getFileExtension();
  1742. if (file.hasFileExtension ("plist")) return "text.plist.xml";
  1743. if (file.hasFileExtension ("entitlements")) return "text.plist.xml";
  1744. if (file.hasFileExtension ("app")) return "wrapper.application";
  1745. if (file.hasFileExtension ("component;vst;plugin")) return "wrapper.cfbundle";
  1746. if (file.hasFileExtension ("xcodeproj")) return "wrapper.pb-project";
  1747. if (file.hasFileExtension ("a")) return "archive.ar";
  1748. if (file.hasFileExtension ("xcassets")) return "folder.assetcatalog";
  1749. return "file" + file.getFileExtension();
  1750. }
  1751. String addFile (const RelativePath& path, bool shouldBeCompiled, bool shouldBeAddedToBinaryResources,
  1752. bool shouldBeAddedToXcodeResources, bool inhibitWarnings, Target* xcodeTarget) const
  1753. {
  1754. const String pathAsString (path.toUnixStyle());
  1755. const String refID (addFileReference (path.toUnixStyle()));
  1756. if (shouldBeCompiled)
  1757. {
  1758. addBuildFile (pathAsString, refID, true, inhibitWarnings, xcodeTarget);
  1759. }
  1760. else if (! shouldBeAddedToBinaryResources || shouldBeAddedToXcodeResources)
  1761. {
  1762. const String fileType (getFileType (path));
  1763. if (shouldBeAddedToXcodeResources)
  1764. {
  1765. resourceIDs.add (addBuildFile (pathAsString, refID, false, false));
  1766. resourceFileRefs.add (refID);
  1767. }
  1768. }
  1769. return refID;
  1770. }
  1771. String addRezFile (const Project::Item& projectItem, const RelativePath& path) const
  1772. {
  1773. const String pathAsString (path.toUnixStyle());
  1774. const String refID (addFileReference (path.toUnixStyle()));
  1775. if (projectItem.isModuleCode())
  1776. {
  1777. if (Target* xcodeTarget = getTargetOfType (getTargetTypeFromFilePath (projectItem.getFile(), false)))
  1778. {
  1779. String rezFileID = addBuildFile (pathAsString, refID, false, false, xcodeTarget);
  1780. xcodeTarget->rezFileIDs.add (rezFileID);
  1781. return refID;
  1782. }
  1783. }
  1784. return String();
  1785. }
  1786. String getEntitlementsFileName() const
  1787. {
  1788. return project.getProjectFilenameRoot() + String (".entitlements");
  1789. }
  1790. String addEntitlementsFile() const
  1791. {
  1792. const char* sandboxEntitlement =
  1793. "<?xml version=\"1.0\" encoding=\"UTF-8\"?>"
  1794. "<!DOCTYPE plist PUBLIC \"-//Apple//DTD PLIST 1.0//EN\" \"http://www.apple.com/DTDs/PropertyList-1.0.dtd\">"
  1795. "<plist version=\"1.0\">"
  1796. "<dict>"
  1797. " <key>com.apple.security.app-sandbox</key>"
  1798. " <true/>"
  1799. "</dict>"
  1800. "</plist>";
  1801. File entitlementsFile = getTargetFolder().getChildFile (getEntitlementsFileName());
  1802. overwriteFileIfDifferentOrThrow (entitlementsFile, sandboxEntitlement);
  1803. RelativePath plistPath (entitlementsFile, getTargetFolder(), RelativePath::buildTargetFolder);
  1804. return addFile (plistPath, false, false, false, false, nullptr);
  1805. }
  1806. String addProjectItem (const Project::Item& projectItem) const
  1807. {
  1808. if (projectItem.isGroup())
  1809. {
  1810. StringArray childIDs;
  1811. for (int i = 0; i < projectItem.getNumChildren(); ++i)
  1812. {
  1813. const String childID (addProjectItem (projectItem.getChild(i)));
  1814. if (childID.isNotEmpty())
  1815. childIDs.add (childID);
  1816. }
  1817. return addGroup (projectItem, childIDs);
  1818. }
  1819. if (projectItem.shouldBeAddedToTargetProject())
  1820. {
  1821. const String itemPath (projectItem.getFilePath());
  1822. RelativePath path;
  1823. if (itemPath.startsWith ("${"))
  1824. path = RelativePath (itemPath, RelativePath::unknown);
  1825. else
  1826. path = RelativePath (projectItem.getFile(), getTargetFolder(), RelativePath::buildTargetFolder);
  1827. if (path.hasFileExtension (".r"))
  1828. return addRezFile (projectItem, path);
  1829. Target* xcodeTarget = nullptr;
  1830. if (projectItem.isModuleCode() && projectItem.shouldBeCompiled())
  1831. xcodeTarget = getTargetOfType (getTargetTypeFromFilePath (projectItem.getFile(), false));
  1832. return addFile (path, projectItem.shouldBeCompiled(),
  1833. projectItem.shouldBeAddedToBinaryResources(),
  1834. projectItem.shouldBeAddedToXcodeResources(),
  1835. projectItem.shouldInhibitWarnings(),
  1836. xcodeTarget);
  1837. }
  1838. return String();
  1839. }
  1840. String addFramework (const String& frameworkName) const
  1841. {
  1842. String path (frameworkName);
  1843. if (! File::isAbsolutePath (path))
  1844. path = "System/Library/Frameworks/" + path;
  1845. if (! path.endsWithIgnoreCase (".framework"))
  1846. path << ".framework";
  1847. const String fileRefID (createFileRefID (path));
  1848. addFileReference ((File::isAbsolutePath (frameworkName) ? "" : "${SDKROOT}/") + path);
  1849. frameworkFileIDs.add (fileRefID);
  1850. return addBuildFile (path, fileRefID, false, false);
  1851. }
  1852. void addGroup (const String& groupID, const String& groupName, const StringArray& childIDs) const
  1853. {
  1854. ValueTree* v = new ValueTree (groupID);
  1855. v->setProperty ("isa", "PBXGroup", nullptr);
  1856. v->setProperty ("children", indentParenthesisedList (childIDs), nullptr);
  1857. v->setProperty (Ids::name, groupName, nullptr);
  1858. v->setProperty ("sourceTree", "<group>", nullptr);
  1859. pbxGroups.add (v);
  1860. }
  1861. String addGroup (const Project::Item& item, StringArray& childIDs) const
  1862. {
  1863. const String groupName (item.getName());
  1864. const String groupID (getIDForGroup (item));
  1865. addGroup (groupID, groupName, childIDs);
  1866. return groupID;
  1867. }
  1868. void addProjectConfig (const String& configName, const StringArray& buildSettings) const
  1869. {
  1870. ValueTree* v = new ValueTree (createID ("projectconfigid_" + configName));
  1871. v->setProperty ("isa", "XCBuildConfiguration", nullptr);
  1872. v->setProperty ("buildSettings", indentBracedList (buildSettings), nullptr);
  1873. v->setProperty (Ids::name, configName, nullptr);
  1874. projectConfigs.add (v);
  1875. }
  1876. void addConfigList (Target& target, const OwnedArray <ValueTree>& configsToUse, const String& listID) const
  1877. {
  1878. ValueTree* v = new ValueTree (listID);
  1879. v->setProperty ("isa", "XCConfigurationList", nullptr);
  1880. v->setProperty ("buildConfigurations", indentParenthesisedList (target.configIDs), nullptr);
  1881. v->setProperty ("defaultConfigurationIsVisible", (int) 0, nullptr);
  1882. if (configsToUse[0] != nullptr)
  1883. v->setProperty ("defaultConfigurationName", configsToUse[0]->getProperty (Ids::name), nullptr);
  1884. misc.add (v);
  1885. }
  1886. void addProjectConfigList (const OwnedArray <ValueTree>& configsToUse, const String& listID) const
  1887. {
  1888. StringArray configIDs;
  1889. for (int i = 0; i < configsToUse.size(); ++i)
  1890. configIDs.add (configsToUse[i]->getType().toString());
  1891. ValueTree* v = new ValueTree (listID);
  1892. v->setProperty ("isa", "XCConfigurationList", nullptr);
  1893. v->setProperty ("buildConfigurations", indentParenthesisedList (configIDs), nullptr);
  1894. v->setProperty ("defaultConfigurationIsVisible", (int) 0, nullptr);
  1895. if (configsToUse[0] != nullptr)
  1896. v->setProperty ("defaultConfigurationName", configsToUse[0]->getProperty (Ids::name), nullptr);
  1897. misc.add (v);
  1898. }
  1899. void addProjectObject() const
  1900. {
  1901. ValueTree* const v = new ValueTree (createID ("__root"));
  1902. v->setProperty ("isa", "PBXProject", nullptr);
  1903. v->setProperty ("buildConfigurationList", createID ("__projList"), nullptr);
  1904. v->setProperty ("attributes", getProjectObjectAttributes(), nullptr);
  1905. v->setProperty ("compatibilityVersion", "Xcode 3.2", nullptr);
  1906. v->setProperty ("hasScannedForEncodings", (int) 0, nullptr);
  1907. v->setProperty ("mainGroup", createID ("__mainsourcegroup"), nullptr);
  1908. v->setProperty ("projectDirPath", "\"\"", nullptr);
  1909. v->setProperty ("projectRoot", "\"\"", nullptr);
  1910. String targetString = "(" + targetIDs.joinIntoString (", ") + ")";
  1911. v->setProperty ("targets", targetString, nullptr);
  1912. misc.add (v);
  1913. }
  1914. static Target::Type getTargetTypeFromFilePath (const File& file, bool returnSharedTargetIfNoValidSuffic)
  1915. {
  1916. if (LibraryModule::CompileUnit::hasSuffix (file, "_AU")) return Target::AudioUnitPlugIn;
  1917. else if (LibraryModule::CompileUnit::hasSuffix (file, "_AUv3")) return Target::AudioUnitv3PlugIn;
  1918. else if (LibraryModule::CompileUnit::hasSuffix (file, "_AAX")) return Target::AAXPlugIn;
  1919. else if (LibraryModule::CompileUnit::hasSuffix (file, "_RTAS")) return Target::RTASPlugIn;
  1920. else if (LibraryModule::CompileUnit::hasSuffix (file, "_VST2")) return Target::VSTPlugIn;
  1921. else if (LibraryModule::CompileUnit::hasSuffix (file, "_VST3")) return Target::VST3PlugIn;
  1922. else if (LibraryModule::CompileUnit::hasSuffix (file, "_Standalone")) return Target::StandalonePlugIn;
  1923. return (returnSharedTargetIfNoValidSuffic ? Target::SharedCodeTarget : Target::unspecified);
  1924. }
  1925. //==============================================================================
  1926. void removeMismatchedXcuserdata() const
  1927. {
  1928. File xcuserdata = getProjectBundle().getChildFile ("xcuserdata");
  1929. if (! xcuserdata.exists())
  1930. return;
  1931. if (! xcuserdataMatchesTargets (xcuserdata))
  1932. {
  1933. xcuserdata.deleteRecursively();
  1934. getProjectBundle().getChildFile ("project.xcworkspace").deleteRecursively();
  1935. }
  1936. }
  1937. bool xcuserdataMatchesTargets (const File& xcuserdata) const
  1938. {
  1939. Array<File> xcschemeManagementPlists;
  1940. xcuserdata.findChildFiles (xcschemeManagementPlists, File::findFiles, true, "xcschememanagement.plist");
  1941. for (auto& plist : xcschemeManagementPlists)
  1942. if (! xcschemeManagementPlistMatchesTargets (plist))
  1943. return false;
  1944. return true;
  1945. }
  1946. static StringArray parseNamesOfTargetsFromPlist (const XmlElement& dictXML)
  1947. {
  1948. forEachXmlChildElementWithTagName (dictXML, schemesKey, "key")
  1949. {
  1950. if (schemesKey->getAllSubText().trim().equalsIgnoreCase ("SchemeUserState"))
  1951. {
  1952. if (auto* dict = schemesKey->getNextElement())
  1953. {
  1954. if (dict->hasTagName ("dict"))
  1955. {
  1956. StringArray names;
  1957. forEachXmlChildElementWithTagName (*dict, key, "key")
  1958. names.add (key->getAllSubText().upToLastOccurrenceOf (".xcscheme", false, false).trim());
  1959. names.sort (false);
  1960. return names;
  1961. }
  1962. }
  1963. }
  1964. }
  1965. return StringArray();
  1966. }
  1967. StringArray getNamesOfTargets() const
  1968. {
  1969. StringArray names;
  1970. for (auto& target : targets)
  1971. names.add (target->getXCodeSchemeName());
  1972. names.sort (false);
  1973. return names;
  1974. }
  1975. bool xcschemeManagementPlistMatchesTargets (const File& plist) const
  1976. {
  1977. ScopedPointer<XmlElement> xml (XmlDocument::parse (plist));
  1978. if (xml != nullptr)
  1979. if (auto* dict = xml->getChildByName ("dict"))
  1980. return parseNamesOfTargetsFromPlist (*dict) == getNamesOfTargets();
  1981. return false;
  1982. }
  1983. //==============================================================================
  1984. struct AppIconType
  1985. {
  1986. const char* idiom;
  1987. const char* sizeString;
  1988. const char* filename;
  1989. const char* scale;
  1990. int size;
  1991. };
  1992. static Array<AppIconType> getiOSAppIconTypes()
  1993. {
  1994. AppIconType types[] =
  1995. {
  1996. { "iphone", "29x29", "Icon-29.png", "1x", 29 },
  1997. { "iphone", "29x29", "Icon-29@2x.png", "2x", 58 },
  1998. { "iphone", "29x29", "Icon-29@3x.png", "3x", 87 },
  1999. { "iphone", "40x40", "Icon-Spotlight-40@2x.png", "2x", 80 },
  2000. { "iphone", "40x40", "Icon-Spotlight-40@3x.png", "3x", 120 },
  2001. { "iphone", "57x57", "Icon.png", "1x", 57 },
  2002. { "iphone", "57x57", "Icon@2x.png", "2x", 114 },
  2003. { "iphone", "60x60", "Icon-60@2x.png", "2x", 120 },
  2004. { "iphone", "60x60", "Icon-@3x.png", "3x", 180 },
  2005. { "ipad", "29x29", "Icon-Small-1.png", "1x", 29 },
  2006. { "ipad", "29x29", "Icon-Small@2x-1.png", "2x", 58 },
  2007. { "ipad", "40x40", "Icon-Spotlight-40.png", "1x", 40 },
  2008. { "ipad", "40x40", "Icon-Spotlight-40@2x-1.png", "2x", 80 },
  2009. { "ipad", "50x50", "Icon-Small-50.png", "1x", 50 },
  2010. { "ipad", "50x50", "Icon-Small-50@2x.png", "2x", 100 },
  2011. { "ipad", "72x72", "Icon-72.png", "1x", 72 },
  2012. { "ipad", "72x72", "Icon-72@2x.png", "2x", 144 },
  2013. { "ipad", "76x76", "Icon-76.png", "1x", 76 },
  2014. { "ipad", "76x76", "Icon-76@2x.png", "2x", 152 },
  2015. { "ipad", "83.5x83.5", "Icon-83.5@2x.png", "2x", 167 }
  2016. };
  2017. return Array<AppIconType> (types, numElementsInArray (types));
  2018. }
  2019. static String getiOSAppIconContents()
  2020. {
  2021. const Array<AppIconType> types (getiOSAppIconTypes());
  2022. var images;
  2023. for (int i = 0; i < types.size(); ++i)
  2024. {
  2025. AppIconType type = types.getUnchecked(i);
  2026. DynamicObject::Ptr d = new DynamicObject();
  2027. d->setProperty ("idiom", type.idiom);
  2028. d->setProperty ("size", type.sizeString);
  2029. d->setProperty ("filename", type.filename);
  2030. d->setProperty ("scale", type.scale);
  2031. images.append (var (d));
  2032. }
  2033. return getiOSAssetContents (images);
  2034. }
  2035. String getProjectObjectAttributes() const
  2036. {
  2037. String attributes;
  2038. attributes << "{ LastUpgradeCheck = 0440; ";
  2039. if (projectType.isGUIApplication() || projectType.isAudioPlugin())
  2040. {
  2041. attributes << "TargetAttributes = { ";
  2042. for (auto& target : targets)
  2043. attributes << target->getTargetAttributes();
  2044. attributes << " }; ";
  2045. }
  2046. attributes << "}";
  2047. return attributes;
  2048. }
  2049. //==============================================================================
  2050. struct ImageType
  2051. {
  2052. const char* orientation;
  2053. const char* idiom;
  2054. const char* subtype;
  2055. const char* extent;
  2056. const char* scale;
  2057. const char* filename;
  2058. int width;
  2059. int height;
  2060. };
  2061. static Array<ImageType> getiOSLaunchImageTypes()
  2062. {
  2063. ImageType types[] =
  2064. {
  2065. { "portrait", "iphone", nullptr, "full-screen", "2x", "LaunchImage-iphone-2x.png", 640, 960 },
  2066. { "portrait", "iphone", "retina4", "full-screen", "2x", "LaunchImage-iphone-retina4.png", 640, 1136 },
  2067. { "portrait", "ipad", nullptr, "full-screen", "1x", "LaunchImage-ipad-portrait-1x.png", 768, 1024 },
  2068. { "landscape","ipad", nullptr, "full-screen", "1x", "LaunchImage-ipad-landscape-1x.png", 1024, 768 },
  2069. { "portrait", "ipad", nullptr, "full-screen", "2x", "LaunchImage-ipad-portrait-2x.png", 1536, 2048 },
  2070. { "landscape","ipad", nullptr, "full-screen", "2x", "LaunchImage-ipad-landscape-2x.png", 2048, 1536 }
  2071. };
  2072. return Array<ImageType> (types, numElementsInArray (types));
  2073. }
  2074. static String getiOSLaunchImageContents()
  2075. {
  2076. const Array<ImageType> types (getiOSLaunchImageTypes());
  2077. var images;
  2078. for (int i = 0; i < types.size(); ++i)
  2079. {
  2080. const ImageType& type = types.getReference(i);
  2081. DynamicObject::Ptr d = new DynamicObject();
  2082. d->setProperty ("orientation", type.orientation);
  2083. d->setProperty ("idiom", type.idiom);
  2084. d->setProperty ("extent", type.extent);
  2085. d->setProperty ("minimum-system-version", "7.0");
  2086. d->setProperty ("scale", type.scale);
  2087. d->setProperty ("filename", type.filename);
  2088. if (type.subtype != nullptr)
  2089. d->setProperty ("subtype", type.subtype);
  2090. images.append (var (d));
  2091. }
  2092. return getiOSAssetContents (images);
  2093. }
  2094. static void createiOSLaunchImageFiles (const File& launchImageSet)
  2095. {
  2096. const Array<ImageType> types (getiOSLaunchImageTypes());
  2097. for (int i = 0; i < types.size(); ++i)
  2098. {
  2099. const ImageType& type = types.getReference(i);
  2100. Image image (Image::ARGB, type.width, type.height, true); // (empty black image)
  2101. image.clear (image.getBounds(), Colours::black);
  2102. MemoryOutputStream pngData;
  2103. PNGImageFormat pngFormat;
  2104. pngFormat.writeImageToStream (image, pngData);
  2105. overwriteFileIfDifferentOrThrow (launchImageSet.getChildFile (type.filename), pngData);
  2106. }
  2107. }
  2108. //==============================================================================
  2109. static String getiOSAssetContents (var images)
  2110. {
  2111. DynamicObject::Ptr v (new DynamicObject());
  2112. var info (new DynamicObject());
  2113. info.getDynamicObject()->setProperty ("version", 1);
  2114. info.getDynamicObject()->setProperty ("author", "xcode");
  2115. v->setProperty ("images", images);
  2116. v->setProperty ("info", info);
  2117. return JSON::toString (var (v));
  2118. }
  2119. void createXcassetsFolderFromIcons() const
  2120. {
  2121. const File assets (getTargetFolder().getChildFile (project.getProjectFilenameRoot())
  2122. .getChildFile ("Images.xcassets"));
  2123. const File iconSet (assets.getChildFile ("AppIcon.appiconset"));
  2124. const File launchImage (assets.getChildFile ("LaunchImage.launchimage"));
  2125. overwriteFileIfDifferentOrThrow (iconSet.getChildFile ("Contents.json"), getiOSAppIconContents());
  2126. createiOSIconFiles (iconSet);
  2127. overwriteFileIfDifferentOrThrow (launchImage.getChildFile ("Contents.json"), getiOSLaunchImageContents());
  2128. createiOSLaunchImageFiles (launchImage);
  2129. RelativePath assetsPath (assets, getTargetFolder(), RelativePath::buildTargetFolder);
  2130. addFileReference (assetsPath.toUnixStyle());
  2131. resourceIDs.add (addBuildFile (assetsPath, false, false));
  2132. resourceFileRefs.add (createFileRefID (assetsPath));
  2133. }
  2134. //==============================================================================
  2135. static String indentBracedList (const StringArray& list) { return "{" + indentList (list, ";", 0, true) + " }"; }
  2136. static String indentParenthesisedList (const StringArray& list) { return "(" + indentList (list, ",", 1, false) + " )"; }
  2137. static String indentList (const StringArray& list, const String& separator, int extraTabs, bool shouldSort)
  2138. {
  2139. if (list.size() == 0)
  2140. return " ";
  2141. const String tabs ("\n" + String::repeatedString ("\t", extraTabs + 4));
  2142. if (shouldSort)
  2143. {
  2144. StringArray sorted (list);
  2145. sorted.sort (true);
  2146. return tabs + sorted.joinIntoString (separator + tabs) + separator;
  2147. }
  2148. return tabs + list.joinIntoString (separator + tabs) + separator;
  2149. }
  2150. String createID (String rootString) const
  2151. {
  2152. if (rootString.startsWith ("${"))
  2153. rootString = rootString.fromFirstOccurrenceOf ("}/", false, false);
  2154. rootString += project.getProjectUID();
  2155. return MD5 (rootString.toUTF8()).toHexString().substring (0, 24).toUpperCase();
  2156. }
  2157. String createFileRefID (const RelativePath& path) const { return createFileRefID (path.toUnixStyle()); }
  2158. String createFileRefID (const String& path) const { return createID ("__fileref_" + path); }
  2159. String getIDForGroup (const Project::Item& item) const { return createID (item.getID()); }
  2160. bool shouldFileBeCompiledByDefault (const RelativePath& file) const override
  2161. {
  2162. return file.hasFileExtension (sourceFileExtensions);
  2163. }
  2164. static String getOSXVersionName (int version)
  2165. {
  2166. jassert (version >= 4);
  2167. return "10." + String (version);
  2168. }
  2169. static String getSDKName (int version)
  2170. {
  2171. return getOSXVersionName (version) + " SDK";
  2172. }
  2173. void initialiseDependencyPathValues()
  2174. {
  2175. vst3Path.referTo (Value (new DependencyPathValueSource (getSetting (Ids::vst3Folder), Ids::vst3Path, TargetOS::osx)));
  2176. aaxPath. referTo (Value (new DependencyPathValueSource (getSetting (Ids::aaxFolder), Ids::aaxPath, TargetOS::osx)));
  2177. rtasPath.referTo (Value (new DependencyPathValueSource (getSetting (Ids::rtasFolder), Ids::rtasPath, TargetOS::osx)));
  2178. }
  2179. void addRTASPluginSettings()
  2180. {
  2181. xcodeCanUseDwarf = false;
  2182. extraSearchPaths.add ("$(DEVELOPER_DIR)/Headers/FlatCarbon");
  2183. extraSearchPaths.add ("$(SDKROOT)/Developer/Headers/FlatCarbon");
  2184. static const char* p[] = { "AlturaPorts/TDMPlugIns/PlugInLibrary/Controls",
  2185. "AlturaPorts/TDMPlugIns/PlugInLibrary/CoreClasses",
  2186. "AlturaPorts/TDMPlugIns/PlugInLibrary/DSPClasses",
  2187. "AlturaPorts/TDMPlugIns/PlugInLibrary/EffectClasses",
  2188. "AlturaPorts/TDMPlugIns/PlugInLibrary/MacBuild",
  2189. "AlturaPorts/TDMPlugIns/PlugInLibrary/Meters",
  2190. "AlturaPorts/TDMPlugIns/PlugInLibrary/ProcessClasses",
  2191. "AlturaPorts/TDMPlugIns/PlugInLibrary/ProcessClasses/Interfaces",
  2192. "AlturaPorts/TDMPlugIns/PlugInLibrary/RTASP_Adapt",
  2193. "AlturaPorts/TDMPlugIns/PlugInLibrary/Utilities",
  2194. "AlturaPorts/TDMPlugIns/PlugInLibrary/ViewClasses",
  2195. "AlturaPorts/TDMPlugIns/DSPManager/**",
  2196. "AlturaPorts/TDMPlugIns/SupplementalPlugInLib/Encryption",
  2197. "AlturaPorts/TDMPlugIns/SupplementalPlugInLib/GraphicsExtensions",
  2198. "AlturaPorts/TDMPlugIns/common/**",
  2199. "AlturaPorts/TDMPlugIns/common/PI_LibInterface",
  2200. "AlturaPorts/TDMPlugIns/PACEProtection/**",
  2201. "AlturaPorts/TDMPlugIns/SignalProcessing/**",
  2202. "AlturaPorts/OMS/Headers",
  2203. "AlturaPorts/Fic/Interfaces/**",
  2204. "AlturaPorts/Fic/Source/SignalNets",
  2205. "AlturaPorts/DSIPublicInterface/PublicHeaders",
  2206. "DAEWin/Include",
  2207. "AlturaPorts/DigiPublic/Interfaces",
  2208. "AlturaPorts/DigiPublic",
  2209. "AlturaPorts/NewFileLibs/DOA",
  2210. "AlturaPorts/NewFileLibs/Cmn",
  2211. "xplat/AVX/avx2/avx2sdk/inc",
  2212. "xplat/AVX/avx2/avx2sdk/utils" };
  2213. RelativePath rtasFolder (getRTASPathValue().toString(), RelativePath::projectFolder);
  2214. for (int i = 0; i < numElementsInArray (p); ++i)
  2215. addToExtraSearchPaths (rtasFolder.getChildFile (p[i]));
  2216. }
  2217. JUCE_DECLARE_NON_COPYABLE (XCodeProjectExporter)
  2218. };