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.

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