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.

1222 lines
54KB

  1. /*
  2. ==============================================================================
  3. This file is part of the JUCE library - "Jules' Utility Class Extensions"
  4. Copyright 2004-10 by Raw Material Software Ltd.
  5. ------------------------------------------------------------------------------
  6. JUCE can be redistributed and/or modified under the terms of the GNU General
  7. Public License (Version 2), as published by the Free Software Foundation.
  8. A copy of the license is included in the JUCE distribution, or can be found
  9. online at www.gnu.org/licenses.
  10. JUCE is distributed in the hope that it will be useful, but WITHOUT ANY
  11. WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
  12. A PARTICULAR PURPOSE. See the GNU General Public License for more details.
  13. ------------------------------------------------------------------------------
  14. To release a closed-source product which uses JUCE, commercial licenses are
  15. available: visit www.rawmaterialsoftware.com/juce for more information.
  16. ==============================================================================
  17. */
  18. #ifndef __JUCER_PROJECTEXPORT_XCODE_JUCEHEADER__
  19. #define __JUCER_PROJECTEXPORT_XCODE_JUCEHEADER__
  20. #include "jucer_ProjectExporter.h"
  21. //==============================================================================
  22. class XCodeProjectExporter : public ProjectExporter
  23. {
  24. public:
  25. //==============================================================================
  26. static const char* getNameMac() { return "XCode (MacOSX)"; }
  27. static const char* getNameiOS() { return "XCode (iOS)"; }
  28. static const char* getValueTreeTypeName (bool iPhone) { return iPhone ? "XCODE_IPHONE" : "XCODE_MAC"; }
  29. //==============================================================================
  30. XCodeProjectExporter (Project& project_, const ValueTree& settings_, const bool iPhone_)
  31. : ProjectExporter (project_, settings_),
  32. iPhone (iPhone_)
  33. {
  34. name = iPhone ? getNameiOS() : getNameMac();
  35. projectIDSalt = hashCode64 (project.getProjectUID());
  36. if (getTargetLocation().toString().isEmpty())
  37. getTargetLocation() = getDefaultBuildsRootFolder() + (iPhone ? "iOS" : "MacOSX");
  38. if (getVSTFolder().toString().isEmpty())
  39. getVSTFolder() = "~/SDKs/vstsdk2.4";
  40. if (getRTASFolder().toString().isEmpty())
  41. getRTASFolder() = "~/SDKs/PT_80_SDK";
  42. if (getSettings() ["objCExtraSuffix"].isVoid())
  43. getObjCSuffix() = createAlphaNumericUID();
  44. }
  45. static XCodeProjectExporter* createForSettings (Project& project, const ValueTree& settings)
  46. {
  47. if (settings.hasType (getValueTreeTypeName (false)))
  48. return new XCodeProjectExporter (project, settings, false);
  49. else if (settings.hasType (getValueTreeTypeName (true)))
  50. return new XCodeProjectExporter (project, settings, true);
  51. return 0;
  52. }
  53. //==============================================================================
  54. Value getObjCSuffix() { return getSetting ("objCExtraSuffix"); }
  55. int getLaunchPreferenceOrderForCurrentOS()
  56. {
  57. #if JUCE_MAC
  58. return iPhone ? 1 : 2;
  59. #else
  60. return 0;
  61. #endif
  62. }
  63. bool isAvailableOnCurrentOS()
  64. {
  65. #if JUCE_MAC
  66. return true;
  67. #else
  68. return false;
  69. #endif
  70. }
  71. bool isPossibleForCurrentProject() { return project.isGUIApplication() || ! iPhone; }
  72. bool usesMMFiles() const { return true; }
  73. void createPropertyEditors (Array <PropertyComponent*>& props)
  74. {
  75. ProjectExporter::createPropertyEditors (props);
  76. props.add (new TextPropertyComponent (getObjCSuffix(), "Objective-C class name suffix", 64, false));
  77. props.getLast()->setTooltip ("Because objective-C linkage is done by string-matching, you can get horrible linkage mix-ups when different modules containing the "
  78. "same class-names are loaded simultaneously. This setting lets you provide a unique string that will be used in naming the obj-C classes in your executable to avoid this.");
  79. if (project.isGUIApplication() && ! iPhone)
  80. {
  81. props.add (new TextPropertyComponent (getSetting ("documentExtensions"), "Document file extensions", 128, false));
  82. props.getLast()->setTooltip ("A comma-separated list of file extensions for documents that your app can open.");
  83. }
  84. else if (iPhone)
  85. {
  86. props.add (new BooleanPropertyComponent (getSetting ("UIFileSharingEnabled"), "File Sharing Enabled", "Enabled"));
  87. props.getLast()->setTooltip ("Enable this to expose your app's files to iTunes.");
  88. props.add (new BooleanPropertyComponent (getSetting ("UIStatusBarHidden"), "Status Bar Hidden", "Enabled"));
  89. props.getLast()->setTooltip ("Enable this to disable the status bar in your app.");
  90. }
  91. }
  92. void launchProject()
  93. {
  94. getProjectBundle().startAsProcess();
  95. }
  96. //==============================================================================
  97. void create()
  98. {
  99. infoPlistFile = getTargetFolder().getChildFile ("Info.plist");
  100. createIconFile();
  101. File projectBundle (getProjectBundle());
  102. createDirectoryOrThrow (projectBundle);
  103. createObjects();
  104. File projectFile (projectBundle.getChildFile ("project.pbxproj"));
  105. {
  106. MemoryOutputStream mo;
  107. writeProjectFile (mo);
  108. overwriteFileIfDifferentOrThrow (projectFile, mo);
  109. }
  110. writeInfoPlistFile();
  111. }
  112. private:
  113. OwnedArray<ValueTree> pbxBuildFiles, pbxFileReferences, groups, misc, projectConfigs, targetConfigs;
  114. StringArray buildPhaseIDs, resourceIDs, sourceIDs, frameworkIDs;
  115. StringArray frameworkFileIDs, rezFileIDs, resourceFileRefs;
  116. File infoPlistFile, iconFile;
  117. int64 projectIDSalt;
  118. const bool iPhone;
  119. static const String sanitisePath (const String& path)
  120. {
  121. if (path.startsWithChar ('~'))
  122. return "$(HOME)" + path.substring (1);
  123. return path;
  124. }
  125. const File getProjectBundle() const { return getTargetFolder().getChildFile (project.getProjectFilenameRoot()).withFileExtension (".xcodeproj"); }
  126. bool hasPList() const { return ! (project.isLibrary() || project.isCommandLineApp()); }
  127. const String getAudioPluginBundleExtension() const { return "component"; }
  128. //==============================================================================
  129. void createObjects()
  130. {
  131. if (! project.isLibrary())
  132. addFrameworks();
  133. const String productName (project.getConfiguration (0).getTargetBinaryName().toString());
  134. if (project.isGUIApplication()) addBuildProduct ("wrapper.application", productName + ".app");
  135. else if (project.isCommandLineApp()) addBuildProduct ("compiled.mach-o.executable", productName);
  136. else if (project.isLibrary()) addBuildProduct ("archive.ar", getLibbedFilename (productName));
  137. else if (project.isAudioPlugin()) addBuildProduct ("wrapper.cfbundle", productName + "." + getAudioPluginBundleExtension());
  138. else if (project.isBrowserPlugin()) addBuildProduct ("wrapper.cfbundle", productName + ".plugin");
  139. else jassert (productName.isEmpty());
  140. if (hasPList())
  141. {
  142. RelativePath plistPath (infoPlistFile, getTargetFolder(), RelativePath::buildTargetFolder);
  143. addFileReference (plistPath);
  144. resourceFileRefs.add (createID (plistPath));
  145. }
  146. if (iconFile.exists())
  147. {
  148. RelativePath iconPath (iconFile, getTargetFolder(), RelativePath::buildTargetFolder);
  149. addFileReference (iconPath);
  150. resourceIDs.add (addBuildFile (iconPath, false, false));
  151. resourceFileRefs.add (createID (iconPath));
  152. }
  153. addProjectItem (project.getMainGroup());
  154. for (int i = 0; i < project.getNumConfigurations(); ++i)
  155. {
  156. Project::BuildConfiguration config (project.getConfiguration (i));
  157. addProjectConfig (config.getName().getValue(), getProjectSettings (config));
  158. addTargetConfig (config.getName().getValue(), getTargetSettings (config));
  159. }
  160. addConfigList (projectConfigs, createID ("__projList"));
  161. addConfigList (targetConfigs, createID ("__configList"));
  162. if (! project.isLibrary())
  163. addBuildPhase ("PBXResourcesBuildPhase", resourceIDs);
  164. if (rezFileIDs.size() > 0)
  165. addBuildPhase ("PBXRezBuildPhase", rezFileIDs);
  166. addBuildPhase ("PBXSourcesBuildPhase", sourceIDs);
  167. if (! project.isLibrary())
  168. addBuildPhase ("PBXFrameworksBuildPhase", frameworkIDs);
  169. if (project.isAudioPlugin())
  170. addPluginShellScriptPhase();
  171. addTargetObject();
  172. addProjectObject();
  173. }
  174. static const Image fixMacIconImageSize (Image& image)
  175. {
  176. const int w = image.getWidth();
  177. const int h = image.getHeight();
  178. if (w != h || (w != 16 && w != 32 && w != 48 && w != 64))
  179. {
  180. const int newSize = w >= 128 ? 128 : (w >= 64 ? 64 : (w >= 32 ? 32 : 16));
  181. Image newIm (Image::ARGB, newSize, newSize, true);
  182. Graphics g (newIm);
  183. g.drawImageWithin (image, 0, 0, newSize, newSize,
  184. RectanglePlacement::centred | RectanglePlacement::onlyReduceInSize, false);
  185. return newIm;
  186. }
  187. return image;
  188. }
  189. void writeIcnsFile (const Array<Image>& images, OutputStream& out)
  190. {
  191. MemoryOutputStream data;
  192. for (int i = 0; i < images.size(); ++i)
  193. {
  194. Image image (fixMacIconImageSize (images.getReference (i)));
  195. const int w = image.getWidth();
  196. const int h = image.getHeight();
  197. const char* type = nullptr;
  198. const char* maskType = nullptr;
  199. if (w == h)
  200. {
  201. if (w == 16) { type = "is32"; maskType = "s8mk"; }
  202. if (w == 32) { type = "il32"; maskType = "l8mk"; }
  203. if (w == 48) { type = "ih32"; maskType = "h8mk"; }
  204. if (w == 128) { type = "it32"; maskType = "t8mk"; }
  205. }
  206. if (type != nullptr)
  207. {
  208. data.write (type, 4);
  209. data.writeIntBigEndian (8 + 4 * w * h);
  210. const Image::BitmapData bitmap (image, Image::BitmapData::readOnly);
  211. int y;
  212. for (y = 0; y < h; ++y)
  213. {
  214. for (int x = 0; x < w; ++x)
  215. {
  216. const Colour pixel (bitmap.getPixelColour (x, y));
  217. data.writeByte ((char) pixel.getAlpha());
  218. data.writeByte ((char) pixel.getRed());
  219. data.writeByte ((char) pixel.getGreen());
  220. data.writeByte ((char) pixel.getBlue());
  221. }
  222. }
  223. data.write (maskType, 4);
  224. data.writeIntBigEndian (8 + w * h);
  225. for (y = 0; y < h; ++y)
  226. {
  227. for (int x = 0; x < w; ++x)
  228. {
  229. const Colour pixel (bitmap.getPixelColour (x, y));
  230. data.writeByte ((char) pixel.getAlpha());
  231. }
  232. }
  233. }
  234. }
  235. jassert (data.getDataSize() > 0); // no suitable sized images?
  236. out.write ("icns", 4);
  237. out.writeIntBigEndian (data.getDataSize() + 8);
  238. out << data;
  239. }
  240. void createIconFile()
  241. {
  242. Array<Image> images;
  243. Image bigIcon (project.getBigIcon());
  244. if (bigIcon.isValid())
  245. images.add (bigIcon);
  246. Image smallIcon (project.getSmallIcon());
  247. if (smallIcon.isValid())
  248. images.add (smallIcon);
  249. if (images.size() > 0)
  250. {
  251. MemoryOutputStream mo;
  252. writeIcnsFile (images, mo);
  253. iconFile = getTargetFolder().getChildFile ("Icon.icns");
  254. overwriteFileIfDifferentOrThrow (iconFile, mo);
  255. }
  256. }
  257. void writeInfoPlistFile()
  258. {
  259. if (! hasPList())
  260. return;
  261. XmlElement plist ("plist");
  262. XmlElement* dict = plist.createNewChildElement ("dict");
  263. if (iPhone)
  264. addPlistDictionaryKeyBool (dict, "LSRequiresIPhoneOS", true);
  265. addPlistDictionaryKey (dict, "CFBundleExecutable", "${EXECUTABLE_NAME}");
  266. addPlistDictionaryKey (dict, "CFBundleIconFile", iconFile.exists() ? iconFile.getFileName() : String::empty);
  267. addPlistDictionaryKey (dict, "CFBundleIdentifier", project.getBundleIdentifier().toString());
  268. addPlistDictionaryKey (dict, "CFBundleName", project.getProjectName().toString());
  269. if (project.isAudioPlugin())
  270. {
  271. addPlistDictionaryKey (dict, "CFBundlePackageType", "TDMw");
  272. addPlistDictionaryKey (dict, "CFBundleSignature", "PTul");
  273. }
  274. else
  275. {
  276. addPlistDictionaryKey (dict, "CFBundlePackageType", "APPL");
  277. addPlistDictionaryKey (dict, "CFBundleSignature", "????");
  278. }
  279. addPlistDictionaryKey (dict, "CFBundleShortVersionString", project.getVersion().toString());
  280. addPlistDictionaryKey (dict, "CFBundleVersion", project.getVersion().toString());
  281. StringArray documentExtensions;
  282. documentExtensions.addTokens (replacePreprocessorDefs (getAllPreprocessorDefs(), getSetting ("documentExtensions").toString()),
  283. ",", String::empty);
  284. documentExtensions.trim();
  285. documentExtensions.removeEmptyStrings (true);
  286. if (documentExtensions.size() > 0)
  287. {
  288. dict->createNewChildElement ("key")->addTextElement ("CFBundleDocumentTypes");
  289. XmlElement* dict2 = dict->createNewChildElement ("array")->createNewChildElement ("dict");
  290. for (int i = 0; i < documentExtensions.size(); ++i)
  291. {
  292. String ex (documentExtensions[i]);
  293. if (ex.startsWithChar ('.'))
  294. ex = ex.substring (1);
  295. dict2->createNewChildElement ("key")->addTextElement ("CFBundleTypeExtensions");
  296. dict2->createNewChildElement ("array")->createNewChildElement ("string")->addTextElement (ex);
  297. addPlistDictionaryKey (dict2, "CFBundleTypeName", ex);
  298. addPlistDictionaryKey (dict2, "CFBundleTypeRole", "Editor");
  299. addPlistDictionaryKey (dict2, "NSPersistentStoreTypeKey", "XML");
  300. }
  301. }
  302. if (getSetting ("UIFileSharingEnabled").getValue())
  303. addPlistDictionaryKeyBool (dict, "UIFileSharingEnabled", true);
  304. if (getSetting ("UIStatusBarHidden").getValue())
  305. addPlistDictionaryKeyBool (dict, "UIStatusBarHidden", true);
  306. MemoryOutputStream mo;
  307. plist.writeToStream (mo, "<!DOCTYPE plist PUBLIC \"-//Apple//DTD PLIST 1.0//EN\" \"http://www.apple.com/DTDs/PropertyList-1.0.dtd\">");
  308. overwriteFileIfDifferentOrThrow (infoPlistFile, mo);
  309. }
  310. const StringArray getHeaderSearchPaths (const Project::BuildConfiguration& config)
  311. {
  312. StringArray searchPaths (config.getHeaderSearchPaths());
  313. if (project.shouldAddVSTFolderToPath() && getVSTFolder().toString().isNotEmpty())
  314. searchPaths.add (rebaseFromProjectFolderToBuildTarget (RelativePath (getVSTFolder().toString(), RelativePath::projectFolder)).toUnixStyle());
  315. if (project.isAudioPlugin())
  316. {
  317. if (isAU())
  318. {
  319. searchPaths.add ("$(DEVELOPER_DIR)/Extras/CoreAudio/PublicUtility");
  320. searchPaths.add ("$(DEVELOPER_DIR)/Extras/CoreAudio/AudioUnits/AUPublic/Utility");
  321. }
  322. if (isRTAS())
  323. {
  324. searchPaths.add ("/Developer/Headers/FlatCarbon");
  325. static const char* rtasIncludePaths[] = { "AlturaPorts/TDMPlugIns/PlugInLibrary/Controls",
  326. "AlturaPorts/TDMPlugIns/PlugInLibrary/CoreClasses",
  327. "AlturaPorts/TDMPlugIns/PlugInLibrary/DSPClasses",
  328. "AlturaPorts/TDMPlugIns/PlugInLibrary/EffectClasses",
  329. "AlturaPorts/TDMPlugIns/PlugInLibrary/MacBuild",
  330. "AlturaPorts/TDMPlugIns/PlugInLibrary/Meters",
  331. "AlturaPorts/TDMPlugIns/PlugInLibrary/ProcessClasses",
  332. "AlturaPorts/TDMPlugIns/PlugInLibrary/ProcessClasses/Interfaces",
  333. "AlturaPorts/TDMPlugIns/PlugInLibrary/RTASP_Adapt",
  334. "AlturaPorts/TDMPlugIns/PlugInLibrary/Utilities",
  335. "AlturaPorts/TDMPlugIns/PlugInLibrary/ViewClasses",
  336. "AlturaPorts/TDMPlugIns/DSPManager/**",
  337. "AlturaPorts/TDMPlugIns/SupplementalPlugInLib/Encryption",
  338. "AlturaPorts/TDMPlugIns/SupplementalPlugInLib/GraphicsExtensions",
  339. "AlturaPorts/TDMPlugIns/common",
  340. "AlturaPorts/TDMPlugIns/common/PI_LibInterface",
  341. "AlturaPorts/TDMPlugIns/PACEProtection/**",
  342. "AlturaPorts/TDMPlugIns/SignalProcessing/**",
  343. "AlturaPorts/OMS/Headers",
  344. "AlturaPorts/Fic/Interfaces/**",
  345. "AlturaPorts/Fic/Source/SignalNets",
  346. "AlturaPorts/DSIPublicInterface/PublicHeaders",
  347. "DAEWin/Include",
  348. "AlturaPorts/DigiPublic/Interfaces",
  349. "AlturaPorts/DigiPublic",
  350. "AlturaPorts/NewFileLibs/DOA",
  351. "AlturaPorts/NewFileLibs/Cmn",
  352. "xplat/AVX/avx2/avx2sdk/inc",
  353. "xplat/AVX/avx2/avx2sdk/utils" };
  354. RelativePath sdkFolder (getRTASFolder().toString(), RelativePath::projectFolder);
  355. for (int i = 0; i < numElementsInArray (rtasIncludePaths); ++i)
  356. searchPaths.add (rebaseFromProjectFolderToBuildTarget (sdkFolder.getChildFile (rtasIncludePaths[i])).toUnixStyle());
  357. }
  358. }
  359. return searchPaths;
  360. }
  361. void getLinkerFlagsForStaticLibrary (const RelativePath& library, StringArray& flags, StringArray& librarySearchPaths)
  362. {
  363. jassert (library.getFileNameWithoutExtension().substring (0, 3) == "lib");
  364. flags.add ("-l" + library.getFileNameWithoutExtension().substring (3));
  365. String searchPath (library.toUnixStyle().upToLastOccurrenceOf ("/", false, false));
  366. if (! library.isAbsolute())
  367. searchPath = "$(SRCROOT)/" + searchPath;
  368. librarySearchPaths.add (sanitisePath (searchPath));
  369. }
  370. void getLinkerFlags (const Project::BuildConfiguration& config, StringArray& flags, StringArray& librarySearchPaths)
  371. {
  372. if (project.isAudioPlugin())
  373. {
  374. flags.add ("-bundle");
  375. if (isRTAS() && getRTASFolder().toString().isNotEmpty())
  376. {
  377. getLinkerFlagsForStaticLibrary (RelativePath (getRTASFolder().toString(), RelativePath::buildTargetFolder)
  378. .getChildFile (config.isDebug().getValue() ? "MacBag/Libs/Debug/libPluginLibrary.a"
  379. : "MacBag/Libs/Release/libPluginLibrary.a"),
  380. flags, librarySearchPaths);
  381. }
  382. }
  383. if (project.getJuceLinkageMode() == Project::useLinkedJuce)
  384. {
  385. RelativePath juceLib (getJucePathFromTargetFolder().getChildFile (config.isDebug().getValue() ? "bin/libjucedebug.a"
  386. : "bin/libjuce.a"));
  387. getLinkerFlagsForStaticLibrary (juceLib, flags, librarySearchPaths);
  388. }
  389. flags.add (replacePreprocessorTokens (config, getExtraLinkerFlags().toString()));
  390. flags.removeEmptyStrings (true);
  391. }
  392. const StringArray getProjectSettings (const Project::BuildConfiguration& config)
  393. {
  394. StringArray s;
  395. s.add ("ALWAYS_SEARCH_USER_PATHS = NO");
  396. s.add ("GCC_C_LANGUAGE_STANDARD = c99");
  397. s.add ("GCC_WARN_ABOUT_RETURN_TYPE = YES");
  398. s.add ("GCC_WARN_CHECK_SWITCH_STATEMENTS = YES");
  399. s.add ("GCC_WARN_UNUSED_VARIABLE = YES");
  400. s.add ("GCC_WARN_MISSING_PARENTHESES = YES");
  401. s.add ("GCC_WARN_NON_VIRTUAL_DESTRUCTOR = YES");
  402. s.add ("GCC_WARN_TYPECHECK_CALLS_TO_PRINTF = YES");
  403. s.add ("WARNING_CFLAGS = -Wreorder");
  404. s.add ("GCC_MODEL_TUNING = G5");
  405. if (project.isLibrary() || project.getJuceLinkageMode() == Project::useLinkedJuce)
  406. {
  407. s.add ("GCC_INLINES_ARE_PRIVATE_EXTERN = NO");
  408. s.add ("GCC_SYMBOLS_PRIVATE_EXTERN = NO");
  409. }
  410. else
  411. {
  412. s.add ("GCC_INLINES_ARE_PRIVATE_EXTERN = YES");
  413. }
  414. if (iPhone)
  415. {
  416. s.add ("\"CODE_SIGN_IDENTITY[sdk=iphoneos*]\" = \"iPhone Developer\"");
  417. s.add ("SDKROOT = iphoneos");
  418. s.add ("TARGETED_DEVICE_FAMILY = \"1,2\"");
  419. }
  420. s.add ("ZERO_LINK = NO");
  421. if (! isRTAS()) // (dwarf seems to be incompatible with the RTAS libs)
  422. s.add ("DEBUG_INFORMATION_FORMAT = \"dwarf\"");
  423. s.add ("PRODUCT_NAME = \"" + config.getTargetBinaryName().toString() + "\"");
  424. return s;
  425. }
  426. const StringArray getTargetSettings (const Project::BuildConfiguration& config)
  427. {
  428. StringArray s;
  429. const String arch (config.getMacArchitecture().toString());
  430. if (arch == Project::BuildConfiguration::osxArch_Native) s.add ("ARCHS = \"$(ARCHS_NATIVE)\"");
  431. else if (arch == Project::BuildConfiguration::osxArch_32BitUniversal) s.add ("ARCHS = \"$(ARCHS_STANDARD_32_BIT)\"");
  432. else if (arch == Project::BuildConfiguration::osxArch_64BitUniversal) s.add ("ARCHS = \"$(ARCHS_STANDARD_32_64_BIT)\"");
  433. else if (arch == Project::BuildConfiguration::osxArch_64Bit) s.add ("ARCHS = \"$(ARCHS_STANDARD_64_BIT)\"");
  434. s.add ("PREBINDING = NO");
  435. s.add ("HEADER_SEARCH_PATHS = \"" + replacePreprocessorTokens (config, getHeaderSearchPaths (config).joinIntoString (" ")) + " $(inherited)\"");
  436. s.add ("GCC_OPTIMIZATION_LEVEL = " + config.getGCCOptimisationFlag());
  437. s.add ("INFOPLIST_FILE = " + infoPlistFile.getFileName());
  438. const String extraFlags (replacePreprocessorTokens (config, getExtraCompilerFlags().toString()).trim());
  439. if (extraFlags.isNotEmpty())
  440. s.add ("OTHER_CPLUSPLUSFLAGS = " + extraFlags);
  441. if (project.isGUIApplication())
  442. {
  443. s.add ("INSTALL_PATH = \"$(HOME)/Applications\"");
  444. }
  445. else if (project.isAudioPlugin())
  446. {
  447. s.add ("LIBRARY_STYLE = Bundle");
  448. s.add ("INSTALL_PATH = \"$(HOME)/Library/Audio/Plug-Ins/Components/\"");
  449. s.add ("WRAPPER_EXTENSION = " + getAudioPluginBundleExtension());
  450. s.add ("GENERATE_PKGINFO_FILE = YES");
  451. s.add ("OTHER_REZFLAGS = \"-d ppc_$ppc -d i386_$i386 -d ppc64_$ppc64 -d x86_64_$x86_64"
  452. " -I /System/Library/Frameworks/CoreServices.framework/Frameworks/CarbonCore.framework/Versions/A/Headers"
  453. " -I \\\"$(DEVELOPER_DIR)/Extras/CoreAudio/AudioUnits/AUPublic/AUBase\\\"\"");
  454. }
  455. else if (project.isBrowserPlugin())
  456. {
  457. s.add ("LIBRARY_STYLE = Bundle");
  458. s.add ("INSTALL_PATH = \"/Library/Internet Plug-Ins/\"");
  459. }
  460. else if (project.isLibrary())
  461. {
  462. if (config.getTargetBinaryRelativePath().toString().isNotEmpty())
  463. {
  464. RelativePath binaryPath (config.getTargetBinaryRelativePath().toString(), RelativePath::projectFolder);
  465. binaryPath = binaryPath.rebased (project.getFile().getParentDirectory(), getTargetFolder(), RelativePath::buildTargetFolder);
  466. s.add ("DSTROOT = " + sanitisePath (binaryPath.toUnixStyle()));
  467. s.add ("SYMROOT = " + sanitisePath (binaryPath.toUnixStyle()));
  468. }
  469. s.add ("CONFIGURATION_BUILD_DIR = \"$(BUILD_DIR)\"");
  470. s.add ("DEPLOYMENT_LOCATION = YES");
  471. }
  472. else if (project.isCommandLineApp())
  473. {
  474. }
  475. else
  476. {
  477. jassertfalse;
  478. }
  479. if (! iPhone)
  480. {
  481. const String sdk (config.getMacSDKVersion().toString());
  482. const String sdkCompat (config.getMacCompatibilityVersion().toString());
  483. if (sdk == Project::BuildConfiguration::osxVersion10_4)
  484. {
  485. s.add ("SDKROOT = macosx10.4");
  486. s.add ("GCC_VERSION = 4.0");
  487. }
  488. else if (sdk == Project::BuildConfiguration::osxVersion10_5)
  489. {
  490. s.add ("SDKROOT = macosx10.5");
  491. }
  492. else if (sdk == Project::BuildConfiguration::osxVersion10_6)
  493. {
  494. s.add ("SDKROOT = macosx10.6");
  495. }
  496. if (sdkCompat == Project::BuildConfiguration::osxVersion10_4) s.add ("MACOSX_DEPLOYMENT_TARGET = 10.4");
  497. else if (sdkCompat == Project::BuildConfiguration::osxVersion10_5) s.add ("MACOSX_DEPLOYMENT_TARGET = 10.5");
  498. else if (sdkCompat == Project::BuildConfiguration::osxVersion10_6) s.add ("MACOSX_DEPLOYMENT_TARGET = 10.6");
  499. s.add ("MACOSX_DEPLOYMENT_TARGET_ppc = 10.4");
  500. }
  501. {
  502. StringArray linkerFlags, librarySearchPaths;
  503. getLinkerFlags (config, linkerFlags, librarySearchPaths);
  504. if (linkerFlags.size() > 0)
  505. s.add ("OTHER_LDFLAGS = \"" + linkerFlags.joinIntoString (" ") + "\"");
  506. if (librarySearchPaths.size() > 0)
  507. {
  508. String libPaths ("LIBRARY_SEARCH_PATHS = (\"$(inherited)\"");
  509. for (int i = 0; i < librarySearchPaths.size(); ++i)
  510. libPaths += ", \"\\\"" + librarySearchPaths[i] + "\\\"\"";
  511. s.add (libPaths + ")");
  512. }
  513. }
  514. StringPairArray defines;
  515. if (config.isDebug().getValue())
  516. {
  517. defines.set ("_DEBUG", "1");
  518. defines.set ("DEBUG", "1");
  519. s.add ("ONLY_ACTIVE_ARCH = YES");
  520. s.add ("COPY_PHASE_STRIP = NO");
  521. s.add ("GCC_DYNAMIC_NO_PIC = NO");
  522. s.add ("GCC_ENABLE_FIX_AND_CONTINUE = NO");
  523. }
  524. else
  525. {
  526. defines.set ("_NDEBUG", "1");
  527. defines.set ("NDEBUG", "1");
  528. s.add ("GCC_GENERATE_DEBUGGING_SYMBOLS = NO");
  529. s.add ("GCC_SYMBOLS_PRIVATE_EXTERN = YES");
  530. }
  531. {
  532. const String objCSuffix (getObjCSuffix().toString().trim());
  533. if (objCSuffix.isNotEmpty())
  534. defines.set ("JUCE_ObjCExtraSuffix", replacePreprocessorTokens (config, objCSuffix));
  535. }
  536. {
  537. defines = mergePreprocessorDefs (defines, getAllPreprocessorDefs (config));
  538. StringArray defsList;
  539. for (int i = 0; i < defines.size(); ++i)
  540. {
  541. String def (defines.getAllKeys()[i]);
  542. const String value (defines.getAllValues()[i]);
  543. if (value.isNotEmpty())
  544. def << "=" << value;
  545. defsList.add (def.quoted());
  546. }
  547. s.add ("GCC_PREPROCESSOR_DEFINITIONS = (" + indentList (defsList, ",") + ")");
  548. }
  549. return s;
  550. }
  551. void addFrameworks()
  552. {
  553. StringArray s;
  554. if (iPhone)
  555. {
  556. s.addTokens ("UIKit Foundation CoreGraphics CoreText AudioToolbox QuartzCore OpenGLES", false);
  557. }
  558. else
  559. {
  560. s.addTokens ("Cocoa Carbon IOKit CoreAudio CoreMIDI WebKit DiscRecording OpenGL QuartzCore QTKit QuickTime", false);
  561. if (isAU())
  562. s.addTokens ("AudioUnit CoreAudioKit AudioToolbox", false);
  563. else if (project.getJuceConfigFlag ("JUCE_PLUGINHOST_AU").toString() == Project::configFlagEnabled)
  564. s.addTokens ("AudioUnit CoreAudioKit", false);
  565. }
  566. for (int i = 0; i < s.size(); ++i)
  567. addFramework (s[i]);
  568. }
  569. //==============================================================================
  570. void writeProjectFile (OutputStream& output)
  571. {
  572. output << "// !$*UTF8*$!\n{\n"
  573. "\tarchiveVersion = 1;\n"
  574. "\tclasses = {\n\t};\n"
  575. "\tobjectVersion = 45;\n"
  576. "\tobjects = {\n\n";
  577. Array <ValueTree*> objects;
  578. objects.addArray (pbxBuildFiles);
  579. objects.addArray (pbxFileReferences);
  580. objects.addArray (groups);
  581. objects.addArray (targetConfigs);
  582. objects.addArray (projectConfigs);
  583. objects.addArray (misc);
  584. for (int i = 0; i < objects.size(); ++i)
  585. {
  586. ValueTree& o = *objects.getUnchecked(i);
  587. output << "\t\t" << o.getType().toString() << " = { ";
  588. for (int j = 0; j < o.getNumProperties(); ++j)
  589. {
  590. const Identifier propertyName (o.getPropertyName(j));
  591. String val (o.getProperty (propertyName).toString());
  592. if (val.isEmpty() || (val.containsAnyOf (" \t;<>()=,&+-_\r\n")
  593. && ! (val.trimStart().startsWithChar ('(')
  594. || val.trimStart().startsWithChar ('{'))))
  595. val = val.quoted();
  596. output << propertyName.toString() << " = " << val << "; ";
  597. }
  598. output << "};\n";
  599. }
  600. output << "\t};\n\trootObject = " << createID ("__root") << ";\n}\n";
  601. }
  602. static void addPlistDictionaryKey (XmlElement* xml, const String& key, const String& value)
  603. {
  604. xml->createNewChildElement ("key")->addTextElement (key);
  605. xml->createNewChildElement ("string")->addTextElement (value);
  606. }
  607. static void addPlistDictionaryKeyBool (XmlElement* xml, const String& key, const bool value)
  608. {
  609. xml->createNewChildElement ("key")->addTextElement (key);
  610. xml->createNewChildElement (value ? "true" : "false");
  611. }
  612. const String addBuildFile (const RelativePath& path, const String& fileRefID, bool addToSourceBuildPhase, bool inhibitWarnings)
  613. {
  614. String fileID (createID (path.toUnixStyle() + "buildref"));
  615. if (addToSourceBuildPhase)
  616. sourceIDs.add (fileID);
  617. ValueTree* v = new ValueTree (fileID);
  618. v->setProperty ("isa", "PBXBuildFile", 0);
  619. v->setProperty ("fileRef", fileRefID, 0);
  620. if (inhibitWarnings)
  621. v->setProperty ("settings", "{COMPILER_FLAGS = \"-w\"; }", 0);
  622. pbxBuildFiles.add (v);
  623. return fileID;
  624. }
  625. const String addBuildFile (const RelativePath& path, bool addToSourceBuildPhase, bool inhibitWarnings)
  626. {
  627. return addBuildFile (path, createID (path), addToSourceBuildPhase, inhibitWarnings);
  628. }
  629. void addFileReference (const RelativePath& path, const String& sourceTree, const String& lastKnownFileType, const String& fileRefID)
  630. {
  631. ValueTree* v = new ValueTree (fileRefID);
  632. v->setProperty ("isa", "PBXFileReference", 0);
  633. v->setProperty ("lastKnownFileType", lastKnownFileType, 0);
  634. v->setProperty (Ids::name, path.getFileName(), 0);
  635. v->setProperty ("path", sanitisePath (path.toUnixStyle()), 0);
  636. v->setProperty ("sourceTree", sourceTree, 0);
  637. pbxFileReferences.add (v);
  638. }
  639. const String addFileReference (const RelativePath& path)
  640. {
  641. const String fileRefID (createID (path));
  642. jassert (path.isAbsolute() || path.getRoot() == RelativePath::buildTargetFolder);
  643. addFileReference (path, path.isAbsolute() ? "<absolute>" : "SOURCE_ROOT",
  644. getFileType (path), fileRefID);
  645. return fileRefID;
  646. }
  647. static const String getFileType (const RelativePath& file)
  648. {
  649. if (file.hasFileExtension ("cpp;cc;cxx")) return "sourcecode.cpp.cpp";
  650. else if (file.hasFileExtension (".mm")) return "sourcecode.cpp.objcpp";
  651. else if (file.hasFileExtension (".m")) return "sourcecode.c.objc";
  652. else if (file.hasFileExtension (headerFileExtensions)) return "sourcecode.c.h";
  653. else if (file.hasFileExtension (".framework")) return "wrapper.framework";
  654. else if (file.hasFileExtension (".jpeg;.jpg")) return "image.jpeg";
  655. else if (file.hasFileExtension ("png;gif")) return "image" + file.getFileExtension();
  656. else if (file.hasFileExtension ("html;htm")) return "text.html";
  657. else if (file.hasFileExtension ("txt;rtf")) return "text" + file.getFileExtension();
  658. else if (file.hasFileExtension ("plist")) return "text.plist.xml";
  659. else if (file.hasFileExtension ("app")) return "wrapper.application";
  660. else if (file.hasFileExtension ("component;vst;plugin")) return "wrapper.cfbundle";
  661. else if (file.hasFileExtension ("xcodeproj")) return "wrapper.pb-project";
  662. else if (file.hasFileExtension ("a")) return "archive.ar";
  663. return "file" + file.getFileExtension();
  664. }
  665. const String addFile (const RelativePath& path, bool shouldBeCompiled, bool inhibitWarnings)
  666. {
  667. if (shouldBeCompiled)
  668. addBuildFile (path, true, inhibitWarnings);
  669. else if (path.hasFileExtension (".r"))
  670. rezFileIDs.add (addBuildFile (path, false, inhibitWarnings));
  671. return addFileReference (path);
  672. }
  673. const String addProjectItem (const Project::Item& projectItem)
  674. {
  675. if (projectItem.isGroup())
  676. {
  677. StringArray childIDs;
  678. for (int i = 0; i < projectItem.getNumChildren(); ++i)
  679. {
  680. const String childID (addProjectItem (projectItem.getChild(i)));
  681. if (childID.isNotEmpty())
  682. childIDs.add (childID);
  683. }
  684. return addGroup (projectItem, childIDs);
  685. }
  686. else
  687. {
  688. if (projectItem.shouldBeAddedToTargetProject())
  689. {
  690. const RelativePath path (projectItem.getFile(), getTargetFolder(), RelativePath::buildTargetFolder);
  691. return addFile (path, projectItem.shouldBeCompiled(), false);
  692. }
  693. }
  694. return String::empty;
  695. }
  696. void addFramework (const String& frameworkName)
  697. {
  698. const RelativePath path ("System/Library/Frameworks/" + frameworkName + ".framework", RelativePath::unknown);
  699. const String fileRefID (createID (path));
  700. addFileReference (path, "SDKROOT", getFileType (path), fileRefID);
  701. frameworkIDs.add (addBuildFile (path, fileRefID, false, false));
  702. frameworkFileIDs.add (fileRefID);
  703. }
  704. void addGroup (const String& groupID, const String& groupName, const StringArray& childIDs)
  705. {
  706. ValueTree* v = new ValueTree (groupID);
  707. v->setProperty ("isa", "PBXGroup", 0);
  708. v->setProperty ("children", "(" + indentList (childIDs, ",") + " )", 0);
  709. v->setProperty (Ids::name, groupName, 0);
  710. v->setProperty ("sourceTree", "<group>", 0);
  711. groups.add (v);
  712. }
  713. const String createGroup (const Array<RelativePath>& files, const String& groupName, const String& groupIDName, bool inhibitWarnings)
  714. {
  715. StringArray fileIDs;
  716. for (int i = 0; i < files.size(); ++i)
  717. {
  718. addFile (files.getReference(i), shouldFileBeCompiledByDefault (files.getReference(i)), inhibitWarnings);
  719. fileIDs.add (createID (files.getReference(i)));
  720. }
  721. const String groupID (createID (groupIDName));
  722. addGroup (groupID, groupName, fileIDs);
  723. return groupID;
  724. }
  725. const String addGroup (const Project::Item& item, StringArray& childIDs)
  726. {
  727. String groupName (item.getName().toString());
  728. if (item.isMainGroup())
  729. {
  730. groupName = "Source";
  731. // Add 'Juce Library Code' group
  732. if (juceWrapperFiles.size() > 0)
  733. childIDs.add (createGroup (juceWrapperFiles, project.getJuceCodeGroupName(), "__jucelibfiles", false));
  734. if (isVST())
  735. childIDs.add (createGroup (getVSTFilesRequired(), "Juce VST Wrapper", "__jucevstfiles", false));
  736. if (isAU())
  737. childIDs.add (createAUWrappersGroup());
  738. if (isRTAS())
  739. childIDs.add (createGroup (getRTASFilesRequired(), "Juce RTAS Wrapper", "__jucertasfiles", true));
  740. { // Add 'resources' group
  741. String resourcesGroupID (createID ("__resources"));
  742. addGroup (resourcesGroupID, "Resources", resourceFileRefs);
  743. childIDs.add (resourcesGroupID);
  744. }
  745. { // Add 'frameworks' group
  746. String frameworksGroupID (createID ("__frameworks"));
  747. addGroup (frameworksGroupID, "Frameworks", frameworkFileIDs);
  748. childIDs.add (frameworksGroupID);
  749. }
  750. { // Add 'products' group
  751. String productsGroupID (createID ("__products"));
  752. StringArray products;
  753. products.add (createID ("__productFileID"));
  754. addGroup (productsGroupID, "Products", products);
  755. childIDs.add (productsGroupID);
  756. }
  757. }
  758. String groupID (getIDForGroup (item));
  759. addGroup (groupID, groupName, childIDs);
  760. return groupID;
  761. }
  762. void addBuildProduct (const String& fileType, const String& binaryName)
  763. {
  764. ValueTree* v = new ValueTree (createID ("__productFileID"));
  765. v->setProperty ("isa", "PBXFileReference", 0);
  766. v->setProperty ("explicitFileType", fileType, 0);
  767. v->setProperty ("includeInIndex", (int) 0, 0);
  768. v->setProperty ("path", sanitisePath (binaryName), 0);
  769. v->setProperty ("sourceTree", "BUILT_PRODUCTS_DIR", 0);
  770. pbxFileReferences.add (v);
  771. }
  772. void addTargetConfig (const String& configName, const StringArray& buildSettings)
  773. {
  774. ValueTree* v = new ValueTree (createID ("targetconfigid_" + configName));
  775. v->setProperty ("isa", "XCBuildConfiguration", 0);
  776. v->setProperty ("buildSettings", "{" + indentList (buildSettings, ";") + " }", 0);
  777. v->setProperty (Ids::name, configName, 0);
  778. targetConfigs.add (v);
  779. }
  780. void addProjectConfig (const String& configName, const StringArray& buildSettings)
  781. {
  782. ValueTree* v = new ValueTree (createID ("projectconfigid_" + configName));
  783. v->setProperty ("isa", "XCBuildConfiguration", 0);
  784. v->setProperty ("buildSettings", "{" + indentList (buildSettings, ";") + " }", 0);
  785. v->setProperty (Ids::name, configName, 0);
  786. projectConfigs.add (v);
  787. }
  788. void addConfigList (const OwnedArray <ValueTree>& configsToUse, const String& listID)
  789. {
  790. StringArray configIDs;
  791. for (int i = 0; i < configsToUse.size(); ++i)
  792. configIDs.add (configsToUse[i]->getType().toString());
  793. ValueTree* v = new ValueTree (listID);
  794. v->setProperty ("isa", "XCConfigurationList", 0);
  795. v->setProperty ("buildConfigurations", "(" + indentList (configIDs, ",") + " )", 0);
  796. v->setProperty ("defaultConfigurationIsVisible", (int) 0, 0);
  797. if (configsToUse[0] != nullptr)
  798. v->setProperty ("defaultConfigurationName", configsToUse[0]->getProperty (Ids::name), 0);
  799. misc.add (v);
  800. }
  801. ValueTree* addBuildPhase (const String& phaseType, const StringArray& fileIds)
  802. {
  803. String phaseId (createID (phaseType + "resbuildphase"));
  804. buildPhaseIDs.add (phaseId);
  805. ValueTree* v = new ValueTree (phaseId);
  806. v->setProperty ("isa", phaseType, 0);
  807. v->setProperty ("buildActionMask", "2147483647", 0);
  808. v->setProperty ("files", "(" + indentList (fileIds, ",") + " )", 0);
  809. v->setProperty ("runOnlyForDeploymentPostprocessing", (int) 0, 0);
  810. misc.add (v);
  811. return v;
  812. }
  813. void addTargetObject()
  814. {
  815. ValueTree* v = new ValueTree (createID ("__target"));
  816. v->setProperty ("isa", "PBXNativeTarget", 0);
  817. v->setProperty ("buildConfigurationList", createID ("__configList"), 0);
  818. v->setProperty ("buildPhases", "(" + indentList (buildPhaseIDs, ",") + " )", 0);
  819. v->setProperty ("buildRules", "( )", 0);
  820. v->setProperty ("dependencies", "( )", 0);
  821. v->setProperty (Ids::name, project.getDocumentTitle(), 0);
  822. v->setProperty ("productName", project.getDocumentTitle(), 0);
  823. v->setProperty ("productReference", createID ("__productFileID"), 0);
  824. if (project.isGUIApplication())
  825. {
  826. v->setProperty ("productInstallPath", "$(HOME)/Applications", 0);
  827. v->setProperty ("productType", "com.apple.product-type.application", 0);
  828. }
  829. else if (project.isCommandLineApp())
  830. {
  831. v->setProperty ("productInstallPath", "/usr/bin", 0);
  832. v->setProperty ("productType", "com.apple.product-type.tool", 0);
  833. }
  834. else if (project.isAudioPlugin() || project.isBrowserPlugin())
  835. {
  836. v->setProperty ("productInstallPath", "$(HOME)/Library/Audio/Plug-Ins/Components/", 0);
  837. v->setProperty ("productType", "com.apple.product-type.bundle", 0);
  838. }
  839. else if (project.isLibrary())
  840. {
  841. v->setProperty ("productType", "com.apple.product-type.library.static", 0);
  842. }
  843. else
  844. jassertfalse; //xxx
  845. misc.add (v);
  846. }
  847. void addProjectObject()
  848. {
  849. ValueTree* v = new ValueTree (createID ("__root"));
  850. v->setProperty ("isa", "PBXProject", 0);
  851. v->setProperty ("buildConfigurationList", createID ("__projList"), 0);
  852. v->setProperty ("compatibilityVersion", "Xcode 3.1", 0);
  853. v->setProperty ("hasScannedForEncodings", (int) 0, 0);
  854. v->setProperty ("mainGroup", getIDForGroup (project.getMainGroup()), 0);
  855. v->setProperty ("projectDirPath", "\"\"", 0);
  856. v->setProperty ("projectRoot", "\"\"", 0);
  857. v->setProperty ("targets", "( " + createID ("__target") + " )", 0);
  858. misc.add (v);
  859. }
  860. void addPluginShellScriptPhase()
  861. {
  862. ValueTree* v = addBuildPhase ("PBXShellScriptBuildPhase", StringArray());
  863. v->setProperty (Ids::name, "Copy to the different plugin folders", 0);
  864. v->setProperty ("shellPath", "/bin/sh", 0);
  865. v->setProperty ("shellScript", String::fromUTF8 (BinaryData::AudioPluginXCodeScript_txt, BinaryData::AudioPluginXCodeScript_txtSize)
  866. .replace ("\\", "\\\\")
  867. .replace ("\"", "\\\"")
  868. .replace ("\r\n", "\\n")
  869. .replace ("\n", "\\n"), 0);
  870. }
  871. //==============================================================================
  872. static const String indentList (const StringArray& list, const String& separator)
  873. {
  874. if (list.size() == 0)
  875. return " ";
  876. return "\n\t\t\t\t" + list.joinIntoString (separator + "\n\t\t\t\t")
  877. + (separator == ";" ? separator : String::empty);
  878. }
  879. const String createID (const RelativePath& path) const
  880. {
  881. return createID (path.toUnixStyle());
  882. }
  883. const String createID (const String& rootString) const
  884. {
  885. static const char digits[] = "0123456789ABCDEF";
  886. char n[24];
  887. Random ran (projectIDSalt + hashCode64 (rootString));
  888. for (int i = 0; i < numElementsInArray (n); ++i)
  889. n[i] = digits [ran.nextInt (16)];
  890. return String (n, numElementsInArray (n));
  891. }
  892. const String getIDForGroup (const Project::Item& item) const
  893. {
  894. return createID (item.getID());
  895. }
  896. bool shouldFileBeCompiledByDefault (const RelativePath& file) const
  897. {
  898. return file.hasFileExtension (sourceFileExtensions);
  899. }
  900. //==============================================================================
  901. const Array<RelativePath> getRTASFilesRequired() const
  902. {
  903. Array<RelativePath> s;
  904. if (isRTAS())
  905. {
  906. const char* files[] = { JUCE_PLUGINS_PATH_RTAS "juce_RTAS_DigiCode1.cpp",
  907. JUCE_PLUGINS_PATH_RTAS "juce_RTAS_DigiCode2.cpp",
  908. JUCE_PLUGINS_PATH_RTAS "juce_RTAS_DigiCode3.cpp",
  909. JUCE_PLUGINS_PATH_RTAS "juce_RTAS_DigiCode_Header.h",
  910. JUCE_PLUGINS_PATH_RTAS "juce_RTAS_MacResources.r",
  911. JUCE_PLUGINS_PATH_RTAS "juce_RTAS_MacUtilities.mm",
  912. JUCE_PLUGINS_PATH_RTAS "juce_RTAS_Wrapper.cpp" };
  913. for (int i = 0; i < numElementsInArray (files); ++i)
  914. s.add (getJucePathFromTargetFolder().getChildFile (files[i]));
  915. }
  916. return s;
  917. }
  918. const String createAUWrappersGroup()
  919. {
  920. Array<RelativePath> auWrappers;
  921. const char* files[] = { JUCE_PLUGINS_PATH_AU "juce_AU_Resources.r",
  922. JUCE_PLUGINS_PATH_AU "juce_AU_Wrapper.mm" };
  923. int i;
  924. for (i = 0; i < numElementsInArray (files); ++i)
  925. auWrappers.add (getJucePathFromTargetFolder().getChildFile (files[i]));
  926. const char* appleAUFiles[] = { "Extras/CoreAudio/PublicUtility/CADebugMacros.h",
  927. "Extras/CoreAudio/PublicUtility/CAAUParameter.cpp",
  928. "Extras/CoreAudio/PublicUtility/CAAUParameter.h",
  929. "Extras/CoreAudio/PublicUtility/CAAudioChannelLayout.cpp",
  930. "Extras/CoreAudio/PublicUtility/CAAudioChannelLayout.h",
  931. "Extras/CoreAudio/PublicUtility/CAMutex.cpp",
  932. "Extras/CoreAudio/PublicUtility/CAMutex.h",
  933. "Extras/CoreAudio/PublicUtility/CAStreamBasicDescription.cpp",
  934. "Extras/CoreAudio/PublicUtility/CAStreamBasicDescription.h",
  935. "Extras/CoreAudio/PublicUtility/CAVectorUnitTypes.h",
  936. "Extras/CoreAudio/PublicUtility/CAVectorUnit.cpp",
  937. "Extras/CoreAudio/PublicUtility/CAVectorUnit.h",
  938. "Extras/CoreAudio/AudioUnits/AUPublic/AUViewBase/AUViewLocalizedStringKeys.h",
  939. "Extras/CoreAudio/AudioUnits/AUPublic/AUCarbonViewBase/AUCarbonViewDispatch.cpp",
  940. "Extras/CoreAudio/AudioUnits/AUPublic/AUCarbonViewBase/AUCarbonViewControl.cpp",
  941. "Extras/CoreAudio/AudioUnits/AUPublic/AUCarbonViewBase/AUCarbonViewControl.h",
  942. "Extras/CoreAudio/AudioUnits/AUPublic/AUCarbonViewBase/CarbonEventHandler.cpp",
  943. "Extras/CoreAudio/AudioUnits/AUPublic/AUCarbonViewBase/CarbonEventHandler.h",
  944. "Extras/CoreAudio/AudioUnits/AUPublic/AUCarbonViewBase/AUCarbonViewBase.cpp",
  945. "Extras/CoreAudio/AudioUnits/AUPublic/AUCarbonViewBase/AUCarbonViewBase.h",
  946. "Extras/CoreAudio/AudioUnits/AUPublic/AUBase/AUBase.cpp",
  947. "Extras/CoreAudio/AudioUnits/AUPublic/AUBase/AUBase.h",
  948. "Extras/CoreAudio/AudioUnits/AUPublic/AUBase/AUDispatch.cpp",
  949. "Extras/CoreAudio/AudioUnits/AUPublic/AUBase/AUDispatch.h",
  950. "Extras/CoreAudio/AudioUnits/AUPublic/AUBase/AUInputElement.cpp",
  951. "Extras/CoreAudio/AudioUnits/AUPublic/AUBase/AUInputElement.h",
  952. "Extras/CoreAudio/AudioUnits/AUPublic/AUBase/AUOutputElement.cpp",
  953. "Extras/CoreAudio/AudioUnits/AUPublic/AUBase/AUOutputElement.h",
  954. "Extras/CoreAudio/AudioUnits/AUPublic/AUBase/AUResources.r",
  955. "Extras/CoreAudio/AudioUnits/AUPublic/AUBase/AUScopeElement.cpp",
  956. "Extras/CoreAudio/AudioUnits/AUPublic/AUBase/AUScopeElement.h",
  957. "Extras/CoreAudio/AudioUnits/AUPublic/AUBase/ComponentBase.cpp",
  958. "Extras/CoreAudio/AudioUnits/AUPublic/AUBase/ComponentBase.h",
  959. "Extras/CoreAudio/AudioUnits/AUPublic/OtherBases/AUMIDIBase.cpp",
  960. "Extras/CoreAudio/AudioUnits/AUPublic/OtherBases/AUMIDIBase.h",
  961. "Extras/CoreAudio/AudioUnits/AUPublic/OtherBases/AUMIDIEffectBase.cpp",
  962. "Extras/CoreAudio/AudioUnits/AUPublic/OtherBases/AUMIDIEffectBase.h",
  963. "Extras/CoreAudio/AudioUnits/AUPublic/OtherBases/AUOutputBase.cpp",
  964. "Extras/CoreAudio/AudioUnits/AUPublic/OtherBases/AUOutputBase.h",
  965. "Extras/CoreAudio/AudioUnits/AUPublic/OtherBases/MusicDeviceBase.cpp",
  966. "Extras/CoreAudio/AudioUnits/AUPublic/OtherBases/MusicDeviceBase.h",
  967. "Extras/CoreAudio/AudioUnits/AUPublic/OtherBases/AUEffectBase.cpp",
  968. "Extras/CoreAudio/AudioUnits/AUPublic/OtherBases/AUEffectBase.h",
  969. "Extras/CoreAudio/AudioUnits/AUPublic/Utility/AUBuffer.cpp",
  970. "Extras/CoreAudio/AudioUnits/AUPublic/Utility/AUBuffer.h",
  971. "Extras/CoreAudio/AudioUnits/AUPublic/Utility/AUDebugDispatcher.cpp",
  972. "Extras/CoreAudio/AudioUnits/AUPublic/Utility/AUDebugDispatcher.h",
  973. "Extras/CoreAudio/AudioUnits/AUPublic/Utility/AUInputFormatConverter.h",
  974. "Extras/CoreAudio/AudioUnits/AUPublic/Utility/AUSilentTimeout.h",
  975. "Extras/CoreAudio/AudioUnits/AUPublic/Utility/AUTimestampGenerator.h" };
  976. StringArray fileIDs, appleFileIDs;
  977. for (i = 0; i < auWrappers.size(); ++i)
  978. {
  979. addFile (auWrappers.getReference(i), shouldFileBeCompiledByDefault (auWrappers.getReference(i)), false);
  980. fileIDs.add (createID (auWrappers.getReference(i)));
  981. }
  982. for (i = 0; i < numElementsInArray (appleAUFiles); ++i)
  983. {
  984. RelativePath file (appleAUFiles[i], RelativePath::unknown);
  985. const String fileRefID (createID (file));
  986. addFileReference (file, "DEVELOPER_DIR", getFileType (file), fileRefID);
  987. if (shouldFileBeCompiledByDefault (file))
  988. addBuildFile (file, fileRefID, true, true);
  989. appleFileIDs.add (fileRefID);
  990. }
  991. const String appleGroupID (createID ("__juceappleaufiles"));
  992. addGroup (appleGroupID, "Apple AU Files", appleFileIDs);
  993. fileIDs.add (appleGroupID);
  994. const String groupID (createID ("__juceaufiles"));
  995. addGroup (groupID, "Juce AU Wrapper", fileIDs);
  996. return groupID;
  997. }
  998. };
  999. #endif // __JUCER_PROJECTEXPORT_XCODE_JUCEHEADER__