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.

2805 lines
124KB

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