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.

1176 lines
47KB

  1. /*
  2. ==============================================================================
  3. This file is part of the JUCE library - "Jules' Utility Class Extensions"
  4. Copyright 2004-11 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. namespace
  22. {
  23. const char* const osxVersionDefault = "default";
  24. const char* const osxVersion10_4 = "10.4 SDK";
  25. const char* const osxVersion10_5 = "10.5 SDK";
  26. const char* const osxVersion10_6 = "10.6 SDK";
  27. const char* const osxVersion10_7 = "10.7 SDK";
  28. const char* const osxArch_Default = "default";
  29. const char* const osxArch_Native = "Native";
  30. const char* const osxArch_32BitUniversal = "32BitUniversal";
  31. const char* const osxArch_64BitUniversal = "64BitUniversal";
  32. const char* const osxArch_64Bit = "64BitIntel";
  33. }
  34. //==============================================================================
  35. class XCodeProjectExporter : public ProjectExporter
  36. {
  37. public:
  38. //==============================================================================
  39. static const char* getNameMac() { return "XCode (MacOSX)"; }
  40. static const char* getNameiOS() { return "XCode (iOS)"; }
  41. static const char* getValueTreeTypeName (bool iOS) { return iOS ? "XCODE_IPHONE" : "XCODE_MAC"; }
  42. //==============================================================================
  43. XCodeProjectExporter (Project& project_, const ValueTree& settings_, const bool iOS_)
  44. : ProjectExporter (project_, settings_),
  45. iOS (iOS_)
  46. {
  47. name = iOS ? getNameiOS() : getNameMac();
  48. if (getTargetLocationString().isEmpty())
  49. getTargetLocationValue() = getDefaultBuildsRootFolder() + (iOS ? "iOS" : "MacOSX");
  50. setValueIfVoid (getObjCSuffixValue(), createAlphaNumericUID());
  51. }
  52. static XCodeProjectExporter* createForSettings (Project& project, const ValueTree& settings)
  53. {
  54. if (settings.hasType (getValueTreeTypeName (false)))
  55. return new XCodeProjectExporter (project, settings, false);
  56. else if (settings.hasType (getValueTreeTypeName (true)))
  57. return new XCodeProjectExporter (project, settings, true);
  58. return nullptr;
  59. }
  60. //==============================================================================
  61. Value getObjCSuffixValue() { return getSetting ("objCExtraSuffix"); }
  62. String getObjCSuffixString() const { return settings ["objCExtraSuffix"]; }
  63. Value getPListToMergeValue() { return getSetting ("customPList"); }
  64. String getPListToMergeString() const { return settings ["customPList"]; }
  65. Value getExtraFrameworksValue() { return getSetting (Ids::extraFrameworks); }
  66. String getExtraFrameworksString() const { return settings [Ids::extraFrameworks]; }
  67. int getLaunchPreferenceOrderForCurrentOS()
  68. {
  69. #if JUCE_MAC
  70. return iOS ? 1 : 2;
  71. #else
  72. return 0;
  73. #endif
  74. }
  75. bool isAvailableOnCurrentOS()
  76. {
  77. #if JUCE_MAC
  78. return true;
  79. #else
  80. return false;
  81. #endif
  82. }
  83. bool isPossibleForCurrentProject() { return projectType.isGUIApplication() || ! iOS; }
  84. bool usesMMFiles() const { return true; }
  85. bool isXcode() const { return true; }
  86. bool isOSX() const { return ! iOS; }
  87. bool canCopeWithDuplicateFiles() { return true; }
  88. void createPropertyEditors (PropertyListBuilder& props)
  89. {
  90. ProjectExporter::createPropertyEditors (props);
  91. props.add (new TextPropertyComponent (getObjCSuffixValue(), "Objective-C class name suffix", 64, false),
  92. "Because objective-C linkage is done by string-matching, you can get horrible linkage mix-ups when different modules containing the "
  93. "same class-names are loaded simultaneously. This setting lets you provide a unique string that will be used in naming "
  94. "the obj-C classes in your executable to avoid this.");
  95. if (projectType.isGUIApplication() && ! iOS)
  96. {
  97. props.add (new TextPropertyComponent (getSetting ("documentExtensions"), "Document file extensions", 128, false),
  98. "A comma-separated list of file extensions for documents that your app can open.");
  99. }
  100. else if (iOS)
  101. {
  102. props.add (new BooleanPropertyComponent (getSetting ("UIFileSharingEnabled"), "File Sharing Enabled", "Enabled"),
  103. "Enable this to expose your app's files to iTunes.");
  104. props.add (new BooleanPropertyComponent (getSetting ("UIStatusBarHidden"), "Status Bar Hidden", "Enabled"),
  105. "Enable this to disable the status bar in your app.");
  106. }
  107. props.add (new TextPropertyComponent (getPListToMergeValue(), "Custom PList", 8192, true),
  108. "You can paste the contents of an XML PList file in here, and the settings that it contains will override any "
  109. "settings that the Introjucer creates. BEWARE! When doing this, be careful to remove from the XML any "
  110. "values that you DO want the introjucer to change!");
  111. props.add (new TextPropertyComponent (getExtraFrameworksValue(), "Extra Frameworks", 2048, false),
  112. "A comma-separated list of extra frameworks that should be added to the build. "
  113. "(Don't include the .framework extension in the name)");
  114. if (projectType.isLibrary())
  115. {
  116. const char* const libTypes[] = { "Static Library (.a)", "Dynamic Library (.dylib)", 0 };
  117. const int libTypeValues[] = { 1, 2, 0 };
  118. props.add (new ChoicePropertyComponent (getLibraryType(), "Library Type",
  119. StringArray (libTypes), Array<var> (libTypeValues)));
  120. }
  121. }
  122. void launchProject()
  123. {
  124. getProjectBundle().startAsProcess();
  125. }
  126. //==============================================================================
  127. void create (const OwnedArray<LibraryModule>&) const
  128. {
  129. infoPlistFile = getTargetFolder().getChildFile ("Info.plist");
  130. createIconFile();
  131. File projectBundle (getProjectBundle());
  132. createDirectoryOrThrow (projectBundle);
  133. createObjects();
  134. File projectFile (projectBundle.getChildFile ("project.pbxproj"));
  135. {
  136. MemoryOutputStream mo;
  137. writeProjectFile (mo);
  138. overwriteFileIfDifferentOrThrow (projectFile, mo);
  139. }
  140. writeInfoPlistFile();
  141. }
  142. protected:
  143. Value getLibraryType() { return getSetting (Ids::libraryType); }
  144. bool isStaticLibrary() const { return projectType.isLibrary() && (int) settings [Ids::libraryType] == 1; }
  145. //==============================================================================
  146. class XcodeBuildConfiguration : public BuildConfiguration
  147. {
  148. public:
  149. XcodeBuildConfiguration (Project& project, const ValueTree& settings)
  150. : BuildConfiguration (project, settings)
  151. {
  152. }
  153. Value getMacSDKVersionValue() { return getValue (Ids::osxSDK); }
  154. String getMacSDKVersion() const { return config [Ids::osxSDK]; }
  155. Value getMacCompatibilityVersionValue() { return getValue (Ids::osxCompatibility); }
  156. String getMacCompatibilityVersion() const { return config [Ids::osxCompatibility]; }
  157. Value getMacArchitectureValue() { return getValue (Ids::osxArchitecture); }
  158. String getMacArchitecture() const { return config [Ids::osxArchitecture]; }
  159. Value getCustomXcodeFlagsValue() { return getValue (Ids::customXcodeFlags); }
  160. String getCustomXcodeFlags() const { return config [Ids::customXcodeFlags]; }
  161. Value getCppLibTypeValue() { return getValue (Ids::cppLibType); }
  162. String getCppLibType() const { return config [Ids::cppLibType]; }
  163. void createPropertyEditors (PropertyListBuilder& props)
  164. {
  165. createBasicPropertyEditors (props);
  166. if (getMacSDKVersion().isEmpty())
  167. getMacSDKVersionValue() = osxVersionDefault;
  168. const char* osxVersions[] = { "Use Default", osxVersion10_4, osxVersion10_5, osxVersion10_6, osxVersion10_7, 0 };
  169. const char* osxVersionValues[] = { osxVersionDefault, osxVersion10_4, osxVersion10_5, osxVersion10_6, osxVersion10_7, 0 };
  170. props.add (new ChoicePropertyComponent (getMacSDKVersionValue(), "OSX Base SDK Version", StringArray (osxVersions), Array<var> (osxVersionValues)),
  171. "The version of OSX to link against in the XCode build.");
  172. if (getMacCompatibilityVersion().isEmpty())
  173. getMacCompatibilityVersionValue() = osxVersionDefault;
  174. props.add (new ChoicePropertyComponent (getMacCompatibilityVersionValue(), "OSX Compatibility Version", StringArray (osxVersions), Array<var> (osxVersionValues)),
  175. "The minimum version of OSX that the target binary will be compatible with.");
  176. const char* osxArch[] = { "Use Default", "Native architecture of build machine", "Universal Binary (32-bit)", "Universal Binary (64-bit)", "64-bit Intel", 0 };
  177. const char* osxArchValues[] = { osxArch_Default, osxArch_Native, osxArch_32BitUniversal, osxArch_64BitUniversal, osxArch_64Bit, 0 };
  178. if (getMacArchitecture().isEmpty())
  179. getMacArchitectureValue() = osxArch_Default;
  180. props.add (new ChoicePropertyComponent (getMacArchitectureValue(), "OSX Architecture", StringArray (osxArch), Array<var> (osxArchValues)),
  181. "The type of OSX binary that will be produced.");
  182. props.add (new TextPropertyComponent (getCustomXcodeFlagsValue(), "Custom Xcode flags", 8192, false),
  183. "A comma-separated list of custom Xcode setting flags which will be appended to the list of generated flags, "
  184. "e.g. MACOSX_DEPLOYMENT_TARGET_i386 = 10.5, VALID_ARCHS = \"ppc i386 x86_64\"");
  185. const char* cppLibNames[] = { "Use Default", "Use LLVM libc++", 0 };
  186. Array<var> cppLibValues;
  187. cppLibValues.add (var::null);
  188. cppLibValues.add ("libc++");
  189. props.add (new ChoicePropertyComponent (getCppLibTypeValue(), "C++ Library", StringArray (cppLibNames), cppLibValues),
  190. "The type of C++ std lib that will be linked.");
  191. }
  192. };
  193. BuildConfiguration::Ptr createBuildConfig (const ValueTree& settings) const
  194. {
  195. return new XcodeBuildConfiguration (project, settings);
  196. }
  197. private:
  198. mutable OwnedArray<ValueTree> pbxBuildFiles, pbxFileReferences, pbxGroups, misc, projectConfigs, targetConfigs;
  199. mutable StringArray buildPhaseIDs, resourceIDs, sourceIDs, frameworkIDs;
  200. mutable StringArray frameworkFileIDs, rezFileIDs, resourceFileRefs;
  201. mutable File infoPlistFile, iconFile;
  202. const bool iOS;
  203. static String sanitisePath (const String& path)
  204. {
  205. if (path.startsWithChar ('~'))
  206. return "$(HOME)" + path.substring (1);
  207. return path;
  208. }
  209. File getProjectBundle() const { return getTargetFolder().getChildFile (project.getProjectFilenameRoot()).withFileExtension (".xcodeproj"); }
  210. //==============================================================================
  211. void createObjects() const
  212. {
  213. addFrameworks();
  214. addMainBuildProduct();
  215. if (xcodeCreatePList)
  216. {
  217. RelativePath plistPath (infoPlistFile, getTargetFolder(), RelativePath::buildTargetFolder);
  218. addFileReference (plistPath.toUnixStyle());
  219. resourceFileRefs.add (createFileRefID (plistPath));
  220. }
  221. if (iconFile.exists())
  222. {
  223. RelativePath iconPath (iconFile, getTargetFolder(), RelativePath::buildTargetFolder);
  224. addFileReference (iconPath.toUnixStyle());
  225. resourceIDs.add (addBuildFile (iconPath, false, false));
  226. resourceFileRefs.add (createFileRefID (iconPath));
  227. }
  228. {
  229. StringArray topLevelGroupIDs;
  230. for (int i = 0; i < groups.size(); ++i)
  231. if (groups.getReference(i).getNumChildren() > 0)
  232. topLevelGroupIDs.add (addProjectItem (groups.getReference(i)));
  233. { // Add 'resources' group
  234. String resourcesGroupID (createID ("__resources"));
  235. addGroup (resourcesGroupID, "Resources", resourceFileRefs);
  236. topLevelGroupIDs.add (resourcesGroupID);
  237. }
  238. { // Add 'frameworks' group
  239. String frameworksGroupID (createID ("__frameworks"));
  240. addGroup (frameworksGroupID, "Frameworks", frameworkFileIDs);
  241. topLevelGroupIDs.add (frameworksGroupID);
  242. }
  243. { // Add 'products' group
  244. String productsGroupID (createID ("__products"));
  245. StringArray products;
  246. products.add (createID ("__productFileID"));
  247. addGroup (productsGroupID, "Products", products);
  248. topLevelGroupIDs.add (productsGroupID);
  249. }
  250. addGroup (createID ("__mainsourcegroup"), "Source", topLevelGroupIDs);
  251. }
  252. for (ConstConfigIterator config (*this); config.next();)
  253. {
  254. addProjectConfig (config->getName(), getProjectSettings (*config));
  255. addTargetConfig (config->getName(), getTargetSettings (dynamic_cast <const XcodeBuildConfiguration&> (*config)));
  256. }
  257. addConfigList (projectConfigs, createID ("__projList"));
  258. addConfigList (targetConfigs, createID ("__configList"));
  259. if (! isStaticLibrary())
  260. addBuildPhase ("PBXResourcesBuildPhase", resourceIDs);
  261. if (rezFileIDs.size() > 0)
  262. addBuildPhase ("PBXRezBuildPhase", rezFileIDs);
  263. addBuildPhase ("PBXSourcesBuildPhase", sourceIDs);
  264. if (! isStaticLibrary())
  265. addBuildPhase ("PBXFrameworksBuildPhase", frameworkIDs);
  266. addShellScriptPhase();
  267. addTargetObject();
  268. addProjectObject();
  269. }
  270. static Image fixMacIconImageSize (Image& image)
  271. {
  272. const int validSizes[] = { 16, 32, 48, 128 };
  273. const int w = image.getWidth();
  274. const int h = image.getHeight();
  275. int bestSize = 16;
  276. for (int i = 0; i < numElementsInArray (validSizes); ++i)
  277. {
  278. if (w == h && w == validSizes[i])
  279. return image;
  280. if (jmax (w, h) > validSizes[i])
  281. bestSize = validSizes[i];
  282. }
  283. return rescaleImageForIcon (image, bestSize);
  284. }
  285. void writeIcnsFile (const Array<Image>& images, OutputStream& out) const
  286. {
  287. MemoryOutputStream data;
  288. for (int i = 0; i < images.size(); ++i)
  289. {
  290. Image image (fixMacIconImageSize (images.getReference (i)));
  291. const int w = image.getWidth();
  292. const int h = image.getHeight();
  293. jassert (w == h);
  294. const char* type = nullptr;
  295. const char* maskType = nullptr;
  296. if (w == 16) { type = "is32"; maskType = "s8mk"; }
  297. if (w == 32) { type = "il32"; maskType = "l8mk"; }
  298. if (w == 48) { type = "ih32"; maskType = "h8mk"; }
  299. if (w == 128) { type = "it32"; maskType = "t8mk"; }
  300. if (type != nullptr)
  301. {
  302. data.write (type, 4);
  303. data.writeIntBigEndian (8 + 4 * w * h);
  304. const Image::BitmapData bitmap (image, Image::BitmapData::readOnly);
  305. int y;
  306. for (y = 0; y < h; ++y)
  307. {
  308. for (int x = 0; x < w; ++x)
  309. {
  310. const Colour pixel (bitmap.getPixelColour (x, y));
  311. data.writeByte ((char) pixel.getAlpha());
  312. data.writeByte ((char) pixel.getRed());
  313. data.writeByte ((char) pixel.getGreen());
  314. data.writeByte ((char) pixel.getBlue());
  315. }
  316. }
  317. data.write (maskType, 4);
  318. data.writeIntBigEndian (8 + w * h);
  319. for (y = 0; y < h; ++y)
  320. {
  321. for (int x = 0; x < w; ++x)
  322. {
  323. const Colour pixel (bitmap.getPixelColour (x, y));
  324. data.writeByte ((char) pixel.getAlpha());
  325. }
  326. }
  327. }
  328. }
  329. jassert (data.getDataSize() > 0); // no suitable sized images?
  330. out.write ("icns", 4);
  331. out.writeIntBigEndian (data.getDataSize() + 8);
  332. out << data;
  333. }
  334. void createIconFile() const
  335. {
  336. Array<Image> images;
  337. Image bigIcon (getBigIcon());
  338. if (bigIcon.isValid())
  339. images.add (bigIcon);
  340. Image smallIcon (getSmallIcon());
  341. if (smallIcon.isValid())
  342. images.add (smallIcon);
  343. if (images.size() > 0)
  344. {
  345. MemoryOutputStream mo;
  346. writeIcnsFile (images, mo);
  347. iconFile = getTargetFolder().getChildFile ("Icon.icns");
  348. overwriteFileIfDifferentOrThrow (iconFile, mo);
  349. }
  350. }
  351. void writeInfoPlistFile() const
  352. {
  353. if (! xcodeCreatePList)
  354. return;
  355. ScopedPointer<XmlElement> plist (XmlDocument::parse (getPListToMergeString()));
  356. if (plist == nullptr || ! plist->hasTagName ("plist"))
  357. plist = new XmlElement ("plist");
  358. XmlElement* dict = plist->getChildByName ("dict");
  359. if (dict == nullptr)
  360. dict = plist->createNewChildElement ("dict");
  361. if (iOS)
  362. addPlistDictionaryKeyBool (dict, "LSRequiresIPhoneOS", true);
  363. addPlistDictionaryKey (dict, "CFBundleExecutable", "${EXECUTABLE_NAME}");
  364. addPlistDictionaryKey (dict, "CFBundleIconFile", iconFile.exists() ? iconFile.getFileName() : String::empty);
  365. addPlistDictionaryKey (dict, "CFBundleIdentifier", project.getBundleIdentifier().toString());
  366. addPlistDictionaryKey (dict, "CFBundleName", projectName);
  367. addPlistDictionaryKey (dict, "CFBundlePackageType", xcodePackageType);
  368. addPlistDictionaryKey (dict, "CFBundleSignature", xcodeBundleSignature);
  369. addPlistDictionaryKey (dict, "CFBundleShortVersionString", project.getVersionString());
  370. addPlistDictionaryKey (dict, "CFBundleVersion", project.getVersionString());
  371. addPlistDictionaryKey (dict, "NSHumanReadableCopyright", project.getCompanyName().toString());
  372. StringArray documentExtensions;
  373. documentExtensions.addTokens (replacePreprocessorDefs (getAllPreprocessorDefs(), settings ["documentExtensions"]),
  374. ",", String::empty);
  375. documentExtensions.trim();
  376. documentExtensions.removeEmptyStrings (true);
  377. if (documentExtensions.size() > 0)
  378. {
  379. dict->createNewChildElement ("key")->addTextElement ("CFBundleDocumentTypes");
  380. XmlElement* dict2 = dict->createNewChildElement ("array")->createNewChildElement ("dict");
  381. for (int i = 0; i < documentExtensions.size(); ++i)
  382. {
  383. String ex (documentExtensions[i]);
  384. if (ex.startsWithChar ('.'))
  385. ex = ex.substring (1);
  386. dict2->createNewChildElement ("key")->addTextElement ("CFBundleTypeExtensions");
  387. dict2->createNewChildElement ("array")->createNewChildElement ("string")->addTextElement (ex);
  388. addPlistDictionaryKey (dict2, "CFBundleTypeName", ex);
  389. addPlistDictionaryKey (dict2, "CFBundleTypeRole", "Editor");
  390. addPlistDictionaryKey (dict2, "NSPersistentStoreTypeKey", "XML");
  391. }
  392. }
  393. if (settings ["UIFileSharingEnabled"])
  394. addPlistDictionaryKeyBool (dict, "UIFileSharingEnabled", true);
  395. if (settings ["UIStatusBarHidden"])
  396. addPlistDictionaryKeyBool (dict, "UIStatusBarHidden", true);
  397. for (int i = 0; i < xcodeExtraPListEntries.size(); ++i)
  398. dict->addChildElement (new XmlElement (xcodeExtraPListEntries.getReference(i)));
  399. MemoryOutputStream mo;
  400. plist->writeToStream (mo, "<!DOCTYPE plist PUBLIC \"-//Apple//DTD PLIST 1.0//EN\" \"http://www.apple.com/DTDs/PropertyList-1.0.dtd\">");
  401. overwriteFileIfDifferentOrThrow (infoPlistFile, mo);
  402. }
  403. StringArray getHeaderSearchPaths (const BuildConfiguration& config) const
  404. {
  405. StringArray searchPaths (extraSearchPaths);
  406. searchPaths.addArray (config.getHeaderSearchPaths());
  407. searchPaths.removeDuplicates (false);
  408. return searchPaths;
  409. }
  410. static void getLinkerFlagsForStaticLibrary (const RelativePath& library, StringArray& flags, StringArray& librarySearchPaths)
  411. {
  412. jassert (library.getFileNameWithoutExtension().substring (0, 3) == "lib");
  413. flags.add ("-l" + library.getFileNameWithoutExtension().substring (3));
  414. String searchPath (library.toUnixStyle().upToLastOccurrenceOf ("/", false, false));
  415. if (! library.isAbsolute())
  416. searchPath = "$(SRCROOT)/" + searchPath;
  417. librarySearchPaths.add (sanitisePath (searchPath));
  418. }
  419. void getLinkerFlags (const BuildConfiguration& config, StringArray& flags, StringArray& librarySearchPaths) const
  420. {
  421. if (xcodeIsBundle)
  422. flags.add ("-bundle");
  423. const Array<RelativePath>& extraLibs = config.isDebug() ? xcodeExtraLibrariesDebug
  424. : xcodeExtraLibrariesRelease;
  425. for (int i = 0; i < extraLibs.size(); ++i)
  426. getLinkerFlagsForStaticLibrary (extraLibs.getReference(i), flags, librarySearchPaths);
  427. flags.add (replacePreprocessorTokens (config, getExtraLinkerFlagsString()));
  428. flags.removeEmptyStrings (true);
  429. }
  430. StringArray getProjectSettings (const BuildConfiguration& config) const
  431. {
  432. StringArray s;
  433. s.add ("ALWAYS_SEARCH_USER_PATHS = NO");
  434. s.add ("GCC_C_LANGUAGE_STANDARD = c99");
  435. s.add ("GCC_WARN_ABOUT_RETURN_TYPE = YES");
  436. s.add ("GCC_WARN_CHECK_SWITCH_STATEMENTS = YES");
  437. s.add ("GCC_WARN_UNUSED_VARIABLE = YES");
  438. s.add ("GCC_WARN_MISSING_PARENTHESES = YES");
  439. s.add ("GCC_WARN_NON_VIRTUAL_DESTRUCTOR = YES");
  440. s.add ("GCC_WARN_TYPECHECK_CALLS_TO_PRINTF = YES");
  441. s.add ("WARNING_CFLAGS = -Wreorder");
  442. s.add ("GCC_MODEL_TUNING = G5");
  443. if (projectType.isLibrary())
  444. {
  445. s.add ("GCC_INLINES_ARE_PRIVATE_EXTERN = NO");
  446. s.add ("GCC_SYMBOLS_PRIVATE_EXTERN = NO");
  447. }
  448. else
  449. {
  450. s.add ("GCC_INLINES_ARE_PRIVATE_EXTERN = YES");
  451. }
  452. if (iOS)
  453. {
  454. s.add ("\"CODE_SIGN_IDENTITY[sdk=iphoneos*]\" = \"iPhone Developer\"");
  455. s.add ("SDKROOT = iphoneos");
  456. s.add ("TARGETED_DEVICE_FAMILY = \"1,2\"");
  457. }
  458. s.add ("ZERO_LINK = NO");
  459. if (xcodeCanUseDwarf)
  460. s.add ("DEBUG_INFORMATION_FORMAT = \"dwarf\"");
  461. s.add ("PRODUCT_NAME = \"" + config.getTargetBinaryNameString() + "\"");
  462. return s;
  463. }
  464. StringArray getTargetSettings (const XcodeBuildConfiguration& config) const
  465. {
  466. StringArray s;
  467. {
  468. String srcRoot = rebaseFromProjectFolderToBuildTarget (RelativePath (".", RelativePath::projectFolder)).toUnixStyle();
  469. if (srcRoot.endsWith ("/."))
  470. srcRoot = srcRoot.dropLastCharacters (2);
  471. s.add ("SRCROOT = " + srcRoot.quoted());
  472. }
  473. const String arch (config.getMacArchitecture());
  474. if (arch == osxArch_Native) s.add ("ARCHS = \"$(ARCHS_NATIVE)\"");
  475. else if (arch == osxArch_32BitUniversal) s.add ("ARCHS = \"$(ARCHS_STANDARD_32_BIT)\"");
  476. else if (arch == osxArch_64BitUniversal) s.add ("ARCHS = \"$(ARCHS_STANDARD_32_64_BIT)\"");
  477. else if (arch == osxArch_64Bit) s.add ("ARCHS = \"$(ARCHS_STANDARD_64_BIT)\"");
  478. s.add ("HEADER_SEARCH_PATHS = \"" + replacePreprocessorTokens (config, getHeaderSearchPaths (config).joinIntoString (" ")) + " $(inherited)\"");
  479. s.add ("GCC_OPTIMIZATION_LEVEL = " + config.getGCCOptimisationFlag());
  480. s.add ("INFOPLIST_FILE = " + infoPlistFile.getFileName());
  481. const String extraFlags (replacePreprocessorTokens (config, getExtraCompilerFlagsString()).trim());
  482. if (extraFlags.isNotEmpty())
  483. s.add ("OTHER_CPLUSPLUSFLAGS = \"" + extraFlags + "\"");
  484. if (xcodeProductInstallPath.isNotEmpty())
  485. s.add ("INSTALL_PATH = \"" + xcodeProductInstallPath + "\"");
  486. if (xcodeIsBundle)
  487. {
  488. s.add ("LIBRARY_STYLE = Bundle");
  489. s.add ("WRAPPER_EXTENSION = " + xcodeBundleExtension.substring (1));
  490. s.add ("GENERATE_PKGINFO_FILE = YES");
  491. }
  492. if (xcodeOtherRezFlags.isNotEmpty())
  493. s.add ("OTHER_REZFLAGS = \"" + xcodeOtherRezFlags + "\"");
  494. if (projectType.isLibrary())
  495. {
  496. if (config.getTargetBinaryRelativePathString().isNotEmpty())
  497. {
  498. RelativePath binaryPath (config.getTargetBinaryRelativePathString(), RelativePath::projectFolder);
  499. binaryPath = binaryPath.rebased (projectFolder, getTargetFolder(), RelativePath::buildTargetFolder);
  500. s.add ("DSTROOT = " + sanitisePath (binaryPath.toUnixStyle()));
  501. s.add ("SYMROOT = " + sanitisePath (binaryPath.toUnixStyle()));
  502. }
  503. s.add ("CONFIGURATION_BUILD_DIR = \"$(BUILD_DIR)\"");
  504. s.add ("DEPLOYMENT_LOCATION = YES");
  505. }
  506. String gccVersion ("com.apple.compilers.llvm.clang.1_0");
  507. if (! iOS)
  508. {
  509. const String sdk (config.getMacSDKVersion());
  510. const String sdkCompat (config.getMacCompatibilityVersion());
  511. if (sdk == osxVersion10_5) s.add ("SDKROOT = macosx10.5");
  512. else if (sdk == osxVersion10_6) s.add ("SDKROOT = macosx10.6");
  513. else if (sdk == osxVersion10_7) s.add ("SDKROOT = macosx10.7");
  514. if (sdkCompat == osxVersion10_4) s.add ("MACOSX_DEPLOYMENT_TARGET = 10.4");
  515. else if (sdkCompat == osxVersion10_5) s.add ("MACOSX_DEPLOYMENT_TARGET = 10.5");
  516. else if (sdkCompat == osxVersion10_6) s.add ("MACOSX_DEPLOYMENT_TARGET = 10.6");
  517. else if (sdkCompat == osxVersion10_7) s.add ("MACOSX_DEPLOYMENT_TARGET = 10.7");
  518. s.add ("MACOSX_DEPLOYMENT_TARGET_ppc = 10.4");
  519. s.add ("SDKROOT_ppc = macosx10.5");
  520. if (xcodeExcludedFiles64Bit.isNotEmpty())
  521. {
  522. s.add ("EXCLUDED_SOURCE_FILE_NAMES = \"$(EXCLUDED_SOURCE_FILE_NAMES_$(CURRENT_ARCH))\"");
  523. s.add ("EXCLUDED_SOURCE_FILE_NAMES_x86_64 = " + xcodeExcludedFiles64Bit);
  524. }
  525. }
  526. s.add ("GCC_VERSION = " + gccVersion);
  527. s.add ("CLANG_CXX_LANGUAGE_STANDARD = \"c++0x\"");
  528. if (config.getCppLibType().isNotEmpty())
  529. s.add ("CLANG_CXX_LIBRARY = " + config.getCppLibType().quoted());
  530. {
  531. StringArray linkerFlags, librarySearchPaths;
  532. getLinkerFlags (config, linkerFlags, librarySearchPaths);
  533. if (linkerFlags.size() > 0)
  534. s.add ("OTHER_LDFLAGS = \"" + linkerFlags.joinIntoString (" ") + "\"");
  535. librarySearchPaths.addArray (config.getLibrarySearchPaths());
  536. librarySearchPaths.removeDuplicates (false);
  537. if (librarySearchPaths.size() > 0)
  538. {
  539. String libPaths ("LIBRARY_SEARCH_PATHS = (\"$(inherited)\"");
  540. for (int i = 0; i < librarySearchPaths.size(); ++i)
  541. libPaths += ", \"\\\"" + librarySearchPaths[i] + "\\\"\"";
  542. s.add (libPaths + ")");
  543. }
  544. }
  545. StringPairArray defines;
  546. if (config.isDebug())
  547. {
  548. defines.set ("_DEBUG", "1");
  549. defines.set ("DEBUG", "1");
  550. s.add ("ONLY_ACTIVE_ARCH = YES");
  551. s.add ("COPY_PHASE_STRIP = NO");
  552. s.add ("GCC_DYNAMIC_NO_PIC = NO");
  553. }
  554. else
  555. {
  556. defines.set ("_NDEBUG", "1");
  557. defines.set ("NDEBUG", "1");
  558. s.add ("GCC_GENERATE_DEBUGGING_SYMBOLS = NO");
  559. s.add ("GCC_SYMBOLS_PRIVATE_EXTERN = YES");
  560. }
  561. {
  562. const String objCSuffix (getObjCSuffixString().trim());
  563. if (objCSuffix.isNotEmpty())
  564. defines.set ("JUCE_ObjCExtraSuffix", replacePreprocessorTokens (config, objCSuffix));
  565. }
  566. {
  567. defines = mergePreprocessorDefs (defines, getAllPreprocessorDefs (config));
  568. StringArray defsList;
  569. for (int i = 0; i < defines.size(); ++i)
  570. {
  571. String def (defines.getAllKeys()[i]);
  572. const String value (defines.getAllValues()[i]);
  573. if (value.isNotEmpty())
  574. def << "=" << value;
  575. defsList.add (def.quoted());
  576. }
  577. s.add ("GCC_PREPROCESSOR_DEFINITIONS = (" + indentList (defsList, ",") + ")");
  578. }
  579. s.addTokens (config.getCustomXcodeFlags(), ",", "\"'");
  580. s.trim();
  581. s.removeEmptyStrings();
  582. s.removeDuplicates (false);
  583. return s;
  584. }
  585. void addFrameworks() const
  586. {
  587. if (! isStaticLibrary())
  588. {
  589. StringArray s (xcodeFrameworks);
  590. s.addTokens (getExtraFrameworksString(), ",;", "\"'");
  591. s.trim();
  592. s.removeDuplicates (true);
  593. s.sort (true);
  594. for (int i = 0; i < s.size(); ++i)
  595. addFramework (s[i]);
  596. }
  597. }
  598. //==============================================================================
  599. void writeProjectFile (OutputStream& output) const
  600. {
  601. output << "// !$*UTF8*$!\n{\n"
  602. "\tarchiveVersion = 1;\n"
  603. "\tclasses = {\n\t};\n"
  604. "\tobjectVersion = 46;\n"
  605. "\tobjects = {\n\n";
  606. Array <ValueTree*> objects;
  607. objects.addArray (pbxBuildFiles);
  608. objects.addArray (pbxFileReferences);
  609. objects.addArray (pbxGroups);
  610. objects.addArray (targetConfigs);
  611. objects.addArray (projectConfigs);
  612. objects.addArray (misc);
  613. for (int i = 0; i < objects.size(); ++i)
  614. {
  615. ValueTree& o = *objects.getUnchecked(i);
  616. output << "\t\t" << o.getType().toString() << " = { ";
  617. for (int j = 0; j < o.getNumProperties(); ++j)
  618. {
  619. const Identifier propertyName (o.getPropertyName(j));
  620. String val (o.getProperty (propertyName).toString());
  621. if (val.isEmpty() || (val.containsAnyOf (" \t;<>()=,&+-_\r\n")
  622. && ! (val.trimStart().startsWithChar ('(')
  623. || val.trimStart().startsWithChar ('{'))))
  624. val = val.quoted();
  625. output << propertyName.toString() << " = " << val << "; ";
  626. }
  627. output << "};\n";
  628. }
  629. output << "\t};\n\trootObject = " << createID ("__root") << ";\n}\n";
  630. }
  631. static void addPlistDictionaryKey (XmlElement* xml, const String& key, const String& value)
  632. {
  633. forEachXmlChildElementWithTagName (*xml, e, "key")
  634. {
  635. if (e->getAllSubText().trim().equalsIgnoreCase (key))
  636. {
  637. if (e->getNextElement() != nullptr && e->getNextElement()->hasTagName ("key"))
  638. {
  639. // try to fix broken plist format..
  640. xml->removeChildElement (e, true);
  641. break;
  642. }
  643. else
  644. {
  645. return; // (value already exists)
  646. }
  647. }
  648. }
  649. xml->createNewChildElement ("key") ->addTextElement (key);
  650. xml->createNewChildElement ("string")->addTextElement (value);
  651. }
  652. static void addPlistDictionaryKeyBool (XmlElement* xml, const String& key, const bool value)
  653. {
  654. xml->createNewChildElement ("key")->addTextElement (key);
  655. xml->createNewChildElement (value ? "true" : "false");
  656. }
  657. String addBuildFile (const String& path, const String& fileRefID, bool addToSourceBuildPhase, bool inhibitWarnings) const
  658. {
  659. String fileID (createID (path + "buildref"));
  660. if (addToSourceBuildPhase)
  661. sourceIDs.add (fileID);
  662. ValueTree* v = new ValueTree (fileID);
  663. v->setProperty ("isa", "PBXBuildFile", 0);
  664. v->setProperty ("fileRef", fileRefID, 0);
  665. if (inhibitWarnings)
  666. v->setProperty ("settings", "{COMPILER_FLAGS = \"-w\"; }", 0);
  667. pbxBuildFiles.add (v);
  668. return fileID;
  669. }
  670. String addBuildFile (const RelativePath& path, bool addToSourceBuildPhase, bool inhibitWarnings) const
  671. {
  672. return addBuildFile (path.toUnixStyle(), createFileRefID (path), addToSourceBuildPhase, inhibitWarnings);
  673. }
  674. String addFileReference (String pathString) const
  675. {
  676. String sourceTree ("SOURCE_ROOT");
  677. RelativePath path (pathString, RelativePath::unknown);
  678. if (pathString.startsWith ("${"))
  679. {
  680. sourceTree = pathString.substring (2).upToFirstOccurrenceOf ("}", false, false);
  681. pathString = pathString.fromFirstOccurrenceOf ("}/", false, false);
  682. }
  683. else if (path.isAbsolute())
  684. {
  685. sourceTree = "<absolute>";
  686. }
  687. const String fileRefID (createFileRefID (pathString));
  688. ScopedPointer<ValueTree> v (new ValueTree (fileRefID));
  689. v->setProperty ("isa", "PBXFileReference", 0);
  690. v->setProperty ("lastKnownFileType", getFileType (path), 0);
  691. v->setProperty (Ids::name, pathString.fromLastOccurrenceOf ("/", false, false), 0);
  692. v->setProperty ("path", sanitisePath (pathString), 0);
  693. v->setProperty ("sourceTree", sourceTree, 0);
  694. const int existing = pbxFileReferences.indexOfSorted (*this, v);
  695. if (existing >= 0)
  696. {
  697. // If this fails, there's either a string hash collision, or the same file is being added twice (incorrectly)
  698. jassert (pbxFileReferences.getUnchecked (existing)->isEquivalentTo (*v));
  699. }
  700. else
  701. {
  702. pbxFileReferences.addSorted (*this, v.release());
  703. }
  704. return fileRefID;
  705. }
  706. public:
  707. static int compareElements (const ValueTree* first, const ValueTree* second)
  708. {
  709. return first->getType().getCharPointer().compare (second->getType().getCharPointer());
  710. }
  711. private:
  712. static String getFileType (const RelativePath& file)
  713. {
  714. if (file.hasFileExtension ("cpp;cc;cxx")) return "sourcecode.cpp.cpp";
  715. else if (file.hasFileExtension (".mm")) return "sourcecode.cpp.objcpp";
  716. else if (file.hasFileExtension (".m")) return "sourcecode.c.objc";
  717. else if (file.hasFileExtension (headerFileExtensions)) return "sourcecode.c.h";
  718. else if (file.hasFileExtension (".framework")) return "wrapper.framework";
  719. else if (file.hasFileExtension (".jpeg;.jpg")) return "image.jpeg";
  720. else if (file.hasFileExtension ("png;gif")) return "image" + file.getFileExtension();
  721. else if (file.hasFileExtension ("html;htm")) return "text.html";
  722. else if (file.hasFileExtension ("xml;zip;wav")) return "file" + file.getFileExtension();
  723. else if (file.hasFileExtension ("txt;rtf")) return "text" + file.getFileExtension();
  724. else if (file.hasFileExtension ("plist")) return "text.plist.xml";
  725. else if (file.hasFileExtension ("app")) return "wrapper.application";
  726. else if (file.hasFileExtension ("component;vst;plugin")) return "wrapper.cfbundle";
  727. else if (file.hasFileExtension ("xcodeproj")) return "wrapper.pb-project";
  728. else if (file.hasFileExtension ("a")) return "archive.ar";
  729. return "file" + file.getFileExtension();
  730. }
  731. String addFile (const RelativePath& path, bool shouldBeCompiled, bool inhibitWarnings) const
  732. {
  733. const String pathAsString (path.toUnixStyle());
  734. const String refID (addFileReference (path.toUnixStyle()));
  735. if (shouldBeCompiled)
  736. {
  737. if (path.hasFileExtension (".r"))
  738. rezFileIDs.add (addBuildFile (pathAsString, refID, false, inhibitWarnings));
  739. else
  740. addBuildFile (pathAsString, refID, true, inhibitWarnings);
  741. }
  742. return refID;
  743. }
  744. String addProjectItem (const Project::Item& projectItem) const
  745. {
  746. if (projectItem.isGroup())
  747. {
  748. StringArray childIDs;
  749. for (int i = 0; i < projectItem.getNumChildren(); ++i)
  750. {
  751. const String childID (addProjectItem (projectItem.getChild(i)));
  752. if (childID.isNotEmpty())
  753. childIDs.add (childID);
  754. }
  755. return addGroup (projectItem, childIDs);
  756. }
  757. else
  758. {
  759. if (projectItem.shouldBeAddedToTargetProject())
  760. {
  761. String itemPath (projectItem.getFilePath());
  762. bool inhibitWarnings = projectItem.shouldInhibitWarnings();
  763. if (itemPath.startsWith ("${"))
  764. {
  765. const RelativePath path (itemPath, RelativePath::unknown);
  766. return addFile (path, projectItem.shouldBeCompiled(), inhibitWarnings);
  767. }
  768. else
  769. {
  770. const RelativePath path (projectItem.getFile(), getTargetFolder(), RelativePath::buildTargetFolder);
  771. return addFile (path, projectItem.shouldBeCompiled(), inhibitWarnings);
  772. }
  773. }
  774. }
  775. return String::empty;
  776. }
  777. void addFramework (const String& frameworkName) const
  778. {
  779. const String path ("System/Library/Frameworks/" + frameworkName + ".framework");
  780. const String fileRefID (createFileRefID (path));
  781. addFileReference ("${SDKROOT}/" + path);
  782. frameworkIDs.add (addBuildFile (path, fileRefID, false, false));
  783. frameworkFileIDs.add (fileRefID);
  784. }
  785. void addGroup (const String& groupID, const String& groupName, const StringArray& childIDs) const
  786. {
  787. ValueTree* v = new ValueTree (groupID);
  788. v->setProperty ("isa", "PBXGroup", 0);
  789. v->setProperty ("children", "(" + indentList (childIDs, ",") + " )", 0);
  790. v->setProperty (Ids::name, groupName, 0);
  791. v->setProperty ("sourceTree", "<group>", 0);
  792. pbxGroups.add (v);
  793. }
  794. String addGroup (const Project::Item& item, StringArray& childIDs) const
  795. {
  796. const String groupName (item.getName());
  797. const String groupID (getIDForGroup (item));
  798. addGroup (groupID, groupName, childIDs);
  799. return groupID;
  800. }
  801. void addMainBuildProduct() const
  802. {
  803. jassert (xcodeFileType.isNotEmpty());
  804. jassert (xcodeBundleExtension.isEmpty() || xcodeBundleExtension.startsWithChar('.'));
  805. String productName (getConfiguration(0)->getTargetBinaryName().toString());
  806. if (xcodeFileType == "archive.ar")
  807. productName = getLibbedFilename (productName);
  808. else
  809. productName += xcodeBundleExtension;
  810. addBuildProduct (xcodeFileType, productName);
  811. }
  812. void addBuildProduct (const String& fileType, const String& binaryName) const
  813. {
  814. ValueTree* v = new ValueTree (createID ("__productFileID"));
  815. v->setProperty ("isa", "PBXFileReference", 0);
  816. v->setProperty ("explicitFileType", fileType, 0);
  817. v->setProperty ("includeInIndex", (int) 0, 0);
  818. v->setProperty ("path", sanitisePath (binaryName), 0);
  819. v->setProperty ("sourceTree", "BUILT_PRODUCTS_DIR", 0);
  820. pbxFileReferences.add (v);
  821. }
  822. void addTargetConfig (const String& configName, const StringArray& buildSettings) const
  823. {
  824. ValueTree* v = new ValueTree (createID ("targetconfigid_" + configName));
  825. v->setProperty ("isa", "XCBuildConfiguration", 0);
  826. v->setProperty ("buildSettings", "{" + indentList (buildSettings, ";") + " }", 0);
  827. v->setProperty (Ids::name, configName, 0);
  828. targetConfigs.add (v);
  829. }
  830. void addProjectConfig (const String& configName, const StringArray& buildSettings) const
  831. {
  832. ValueTree* v = new ValueTree (createID ("projectconfigid_" + configName));
  833. v->setProperty ("isa", "XCBuildConfiguration", 0);
  834. v->setProperty ("buildSettings", "{" + indentList (buildSettings, ";") + " }", 0);
  835. v->setProperty (Ids::name, configName, 0);
  836. projectConfigs.add (v);
  837. }
  838. void addConfigList (const OwnedArray <ValueTree>& configsToUse, const String& listID) const
  839. {
  840. StringArray configIDs;
  841. for (int i = 0; i < configsToUse.size(); ++i)
  842. configIDs.add (configsToUse[i]->getType().toString());
  843. ValueTree* v = new ValueTree (listID);
  844. v->setProperty ("isa", "XCConfigurationList", 0);
  845. v->setProperty ("buildConfigurations", "(" + indentList (configIDs, ",") + " )", 0);
  846. v->setProperty ("defaultConfigurationIsVisible", (int) 0, 0);
  847. if (configsToUse[0] != nullptr)
  848. v->setProperty ("defaultConfigurationName", configsToUse[0]->getProperty (Ids::name), 0);
  849. misc.add (v);
  850. }
  851. ValueTree* addBuildPhase (const String& phaseType, const StringArray& fileIds) const
  852. {
  853. String phaseId (createID (phaseType + "resbuildphase"));
  854. buildPhaseIDs.add (phaseId);
  855. ValueTree* v = new ValueTree (phaseId);
  856. v->setProperty ("isa", phaseType, 0);
  857. v->setProperty ("buildActionMask", "2147483647", 0);
  858. v->setProperty ("files", "(" + indentList (fileIds, ",") + " )", 0);
  859. v->setProperty ("runOnlyForDeploymentPostprocessing", (int) 0, 0);
  860. misc.add (v);
  861. return v;
  862. }
  863. void addTargetObject() const
  864. {
  865. ValueTree* const v = new ValueTree (createID ("__target"));
  866. v->setProperty ("isa", "PBXNativeTarget", 0);
  867. v->setProperty ("buildConfigurationList", createID ("__configList"), 0);
  868. v->setProperty ("buildPhases", "(" + indentList (buildPhaseIDs, ",") + " )", 0);
  869. v->setProperty ("buildRules", "( )", 0);
  870. v->setProperty ("dependencies", "( )", 0);
  871. v->setProperty (Ids::name, projectName, 0);
  872. v->setProperty ("productName", projectName, 0);
  873. v->setProperty ("productReference", createID ("__productFileID"), 0);
  874. if (xcodeProductInstallPath.isNotEmpty())
  875. v->setProperty ("productInstallPath", xcodeProductInstallPath, 0);
  876. jassert (xcodeProductType.isNotEmpty());
  877. v->setProperty ("productType", xcodeProductType, 0);
  878. misc.add (v);
  879. }
  880. void addProjectObject() const
  881. {
  882. ValueTree* const v = new ValueTree (createID ("__root"));
  883. v->setProperty ("isa", "PBXProject", 0);
  884. v->setProperty ("buildConfigurationList", createID ("__projList"), 0);
  885. v->setProperty ("compatibilityVersion", "Xcode 3.2", 0);
  886. v->setProperty ("hasScannedForEncodings", (int) 0, 0);
  887. v->setProperty ("mainGroup", createID ("__mainsourcegroup"), 0);
  888. v->setProperty ("projectDirPath", "\"\"", 0);
  889. v->setProperty ("projectRoot", "\"\"", 0);
  890. v->setProperty ("targets", "( " + createID ("__target") + " )", 0);
  891. misc.add (v);
  892. }
  893. void addShellScriptPhase() const
  894. {
  895. if (xcodeShellScript.isNotEmpty())
  896. {
  897. ValueTree* const v = addBuildPhase ("PBXShellScriptBuildPhase", StringArray());
  898. v->setProperty (Ids::name, xcodeShellScriptTitle, 0);
  899. v->setProperty ("shellPath", "/bin/sh", 0);
  900. v->setProperty ("shellScript", xcodeShellScript.replace ("\\", "\\\\")
  901. .replace ("\"", "\\\"")
  902. .replace ("\r\n", "\\n")
  903. .replace ("\n", "\\n"), 0);
  904. }
  905. }
  906. //==============================================================================
  907. static String indentList (const StringArray& list, const String& separator)
  908. {
  909. if (list.size() == 0)
  910. return " ";
  911. return "\n\t\t\t\t" + list.joinIntoString (separator + "\n\t\t\t\t")
  912. + (separator == ";" ? separator : String::empty);
  913. }
  914. String createID (String rootString) const
  915. {
  916. if (rootString.startsWith ("${"))
  917. rootString = rootString.fromFirstOccurrenceOf ("}/", false, false);
  918. rootString += project.getProjectUID();
  919. return MD5 (rootString.toUTF8()).toHexString().substring (0, 24).toUpperCase();
  920. }
  921. String createFileRefID (const RelativePath& path) const
  922. {
  923. return createFileRefID (path.toUnixStyle());
  924. }
  925. String createFileRefID (const String& path) const
  926. {
  927. return createID ("__fileref_" + path);
  928. }
  929. String getIDForGroup (const Project::Item& item) const
  930. {
  931. return createID (item.getID());
  932. }
  933. bool shouldFileBeCompiledByDefault (const RelativePath& file) const
  934. {
  935. return file.hasFileExtension (sourceFileExtensions);
  936. }
  937. };
  938. #endif // __JUCER_PROJECTEXPORT_XCODE_JUCEHEADER__