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.

574 lines
31KB

  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. #ifndef JUCER_AUDIOPLUGINMODULE_H_INCLUDED
  18. #define JUCER_AUDIOPLUGINMODULE_H_INCLUDED
  19. #include "../Application/jucer_GlobalPreferences.h"
  20. //==============================================================================
  21. namespace
  22. {
  23. inline Value shouldBuildVST (Project& project) { return project.getProjectValue ("buildVST"); }
  24. inline Value shouldBuildVST3 (Project& project) { return project.getProjectValue ("buildVST3"); }
  25. inline Value shouldBuildAU (Project& project) { return project.getProjectValue ("buildAU"); }
  26. inline Value shouldBuildRTAS (Project& project) { return project.getProjectValue ("buildRTAS"); }
  27. inline Value shouldBuildAAX (Project& project) { return project.getProjectValue ("buildAAX"); }
  28. inline Value getPluginName (Project& project) { return project.getProjectValue ("pluginName"); }
  29. inline Value getPluginDesc (Project& project) { return project.getProjectValue ("pluginDesc"); }
  30. inline Value getPluginManufacturer (Project& project) { return project.getProjectValue ("pluginManufacturer"); }
  31. inline Value getPluginManufacturerCode (Project& project) { return project.getProjectValue ("pluginManufacturerCode"); }
  32. inline Value getPluginCode (Project& project) { return project.getProjectValue ("pluginCode"); }
  33. inline Value getPluginChannelConfigs (Project& project) { return project.getProjectValue ("pluginChannelConfigs"); }
  34. inline Value getPluginIsSynth (Project& project) { return project.getProjectValue ("pluginIsSynth"); }
  35. inline Value getPluginWantsMidiInput (Project& project) { return project.getProjectValue ("pluginWantsMidiIn"); }
  36. inline Value getPluginProducesMidiOut (Project& project) { return project.getProjectValue ("pluginProducesMidiOut"); }
  37. inline Value getPluginIsMidiEffectPlugin (Project& project) { return project.getProjectValue ("pluginIsMidiEffectPlugin"); }
  38. inline Value getPluginEditorNeedsKeyFocus (Project& project) { return project.getProjectValue ("pluginEditorRequiresKeys"); }
  39. inline Value getPluginVSTCategory (Project& project) { return project.getProjectValue ("pluginVSTCategory"); }
  40. inline Value getPluginAUExportPrefix (Project& project) { return project.getProjectValue ("pluginAUExportPrefix"); }
  41. inline Value getPluginAUMainType (Project& project) { return project.getProjectValue ("pluginAUMainType"); }
  42. inline Value getPluginRTASCategory (Project& project) { return project.getProjectValue ("pluginRTASCategory"); }
  43. inline Value getPluginRTASBypassDisabled (Project& project) { return project.getProjectValue ("pluginRTASDisableBypass"); }
  44. inline Value getPluginRTASMultiMonoDisabled (Project& project) { return project.getProjectValue ("pluginRTASDisableMultiMono"); }
  45. inline Value getPluginAAXCategory (Project& project) { return project.getProjectValue ("pluginAAXCategory"); }
  46. inline Value getPluginAAXBypassDisabled (Project& project) { return project.getProjectValue ("pluginAAXDisableBypass"); }
  47. inline Value getPluginAAXMultiMonoDisabled (Project& project) { return project.getProjectValue ("pluginAAXDisableMultiMono"); }
  48. inline String getPluginRTASCategoryCode (Project& project)
  49. {
  50. if (static_cast<bool> (getPluginIsSynth (project).getValue()))
  51. return "ePlugInCategory_SWGenerators";
  52. String s (getPluginRTASCategory (project).toString());
  53. if (s.isEmpty())
  54. s = "ePlugInCategory_None";
  55. return s;
  56. }
  57. inline String getAUMainTypeString (Project& project)
  58. {
  59. String s (getPluginAUMainType (project).toString());
  60. if (s.isEmpty())
  61. {
  62. if (getPluginIsSynth (project).getValue()) s = "kAudioUnitType_MusicDevice";
  63. else if (getPluginWantsMidiInput (project).getValue()) s = "kAudioUnitType_MusicEffect";
  64. else s = "kAudioUnitType_Effect";
  65. }
  66. return s;
  67. }
  68. inline String getAUMainTypeCode (Project& project)
  69. {
  70. String s (getPluginAUMainType (project).toString());
  71. if (s.isEmpty())
  72. {
  73. if (getPluginIsMidiEffectPlugin (project).getValue()) s = "aumi";
  74. else if (getPluginIsSynth (project).getValue()) s = "aumu";
  75. else if (getPluginWantsMidiInput (project).getValue()) s = "aumf";
  76. else s = "aufx";
  77. }
  78. return s;
  79. }
  80. inline String getPluginVSTCategoryString (Project& project)
  81. {
  82. String s (getPluginVSTCategory (project).toString().trim());
  83. if (s.isEmpty())
  84. s = static_cast<bool> (getPluginIsSynth (project).getValue()) ? "kPlugCategSynth"
  85. : "kPlugCategEffect";
  86. return s;
  87. }
  88. inline int countMaxPluginChannels (const String& configString, bool isInput)
  89. {
  90. StringArray configs;
  91. configs.addTokens (configString, ", {}", StringRef());
  92. configs.trim();
  93. configs.removeEmptyStrings();
  94. jassert ((configs.size() & 1) == 0); // looks like a syntax error in the configs?
  95. int maxVal = 0;
  96. for (int i = (isInput ? 0 : 1); i < configs.size(); i += 2)
  97. maxVal = jmax (maxVal, configs[i].getIntValue());
  98. return maxVal;
  99. }
  100. inline String valueToBool (const Value& v)
  101. {
  102. return static_cast<bool> (v.getValue()) ? "1" : "0";
  103. }
  104. inline String valueToStringLiteral (const var& v)
  105. {
  106. return CppTokeniserFunctions::addEscapeChars (v.toString()).quoted();
  107. }
  108. inline String valueToCharLiteral (const var& v)
  109. {
  110. return CppTokeniserFunctions::addEscapeChars (v.toString().trim().substring (0, 4)).quoted ('\'');
  111. }
  112. inline void writePluginCharacteristicsFile (ProjectSaver& projectSaver)
  113. {
  114. Project& project = projectSaver.project;
  115. StringPairArray flags;
  116. flags.set ("JucePlugin_Build_VST", valueToBool (shouldBuildVST (project)));
  117. flags.set ("JucePlugin_Build_VST3", valueToBool (shouldBuildVST3 (project)));
  118. flags.set ("JucePlugin_Build_AU", valueToBool (shouldBuildAU (project)));
  119. flags.set ("JucePlugin_Build_RTAS", valueToBool (shouldBuildRTAS (project)));
  120. flags.set ("JucePlugin_Build_AAX", valueToBool (shouldBuildAAX (project)));
  121. flags.set ("JucePlugin_Name", valueToStringLiteral (getPluginName (project)));
  122. flags.set ("JucePlugin_Desc", valueToStringLiteral (getPluginDesc (project)));
  123. flags.set ("JucePlugin_Manufacturer", valueToStringLiteral (getPluginManufacturer (project)));
  124. flags.set ("JucePlugin_ManufacturerWebsite", valueToStringLiteral (project.getCompanyWebsite()));
  125. flags.set ("JucePlugin_ManufacturerEmail", valueToStringLiteral (project.getCompanyEmail()));
  126. flags.set ("JucePlugin_ManufacturerCode", valueToCharLiteral (getPluginManufacturerCode (project)));
  127. flags.set ("JucePlugin_PluginCode", valueToCharLiteral (getPluginCode (project)));
  128. flags.set ("JucePlugin_IsSynth", valueToBool (getPluginIsSynth (project)));
  129. flags.set ("JucePlugin_WantsMidiInput", valueToBool (getPluginWantsMidiInput (project)));
  130. flags.set ("JucePlugin_ProducesMidiOutput", valueToBool (getPluginProducesMidiOut (project)));
  131. flags.set ("JucePlugin_IsMidiEffect", valueToBool (getPluginIsMidiEffectPlugin (project)));
  132. flags.set ("JucePlugin_EditorRequiresKeyboardFocus", valueToBool (getPluginEditorNeedsKeyFocus (project)));
  133. flags.set ("JucePlugin_Version", project.getVersionString());
  134. flags.set ("JucePlugin_VersionCode", project.getVersionAsHex());
  135. flags.set ("JucePlugin_VersionString", valueToStringLiteral (project.getVersionString()));
  136. flags.set ("JucePlugin_VSTUniqueID", "JucePlugin_PluginCode");
  137. flags.set ("JucePlugin_VSTCategory", getPluginVSTCategoryString (project));
  138. flags.set ("JucePlugin_AUMainType", getAUMainTypeString (project));
  139. flags.set ("JucePlugin_AUSubType", "JucePlugin_PluginCode");
  140. flags.set ("JucePlugin_AUExportPrefix", getPluginAUExportPrefix (project).toString());
  141. flags.set ("JucePlugin_AUExportPrefixQuoted", valueToStringLiteral (getPluginAUExportPrefix (project)));
  142. flags.set ("JucePlugin_AUManufacturerCode", "JucePlugin_ManufacturerCode");
  143. flags.set ("JucePlugin_CFBundleIdentifier", project.getBundleIdentifier().toString());
  144. flags.set ("JucePlugin_RTASCategory", getPluginRTASCategoryCode (project));
  145. flags.set ("JucePlugin_RTASManufacturerCode", "JucePlugin_ManufacturerCode");
  146. flags.set ("JucePlugin_RTASProductId", "JucePlugin_PluginCode");
  147. flags.set ("JucePlugin_RTASDisableBypass", valueToBool (getPluginRTASBypassDisabled (project)));
  148. flags.set ("JucePlugin_RTASDisableMultiMono", valueToBool (getPluginRTASMultiMonoDisabled (project)));
  149. flags.set ("JucePlugin_AAXIdentifier", project.getAAXIdentifier().toString());
  150. flags.set ("JucePlugin_AAXManufacturerCode", "JucePlugin_ManufacturerCode");
  151. flags.set ("JucePlugin_AAXProductId", "JucePlugin_PluginCode");
  152. flags.set ("JucePlugin_AAXCategory", getPluginAAXCategory (project).toString());
  153. flags.set ("JucePlugin_AAXDisableBypass", valueToBool (getPluginAAXBypassDisabled (project)));
  154. flags.set ("JucePlugin_AAXDisableMultiMono", valueToBool (getPluginAAXMultiMonoDisabled (project)));
  155. {
  156. String plugInChannelConfig = getPluginChannelConfigs (project).toString();
  157. if (plugInChannelConfig.isNotEmpty())
  158. {
  159. flags.set ("JucePlugin_MaxNumInputChannels", String (countMaxPluginChannels (plugInChannelConfig, true)));
  160. flags.set ("JucePlugin_MaxNumOutputChannels", String (countMaxPluginChannels (plugInChannelConfig, false)));
  161. flags.set ("JucePlugin_PreferredChannelConfigurations", plugInChannelConfig);
  162. }
  163. }
  164. MemoryOutputStream mem;
  165. mem << "//==============================================================================" << newLine
  166. << "// Audio plugin settings.." << newLine
  167. << newLine;
  168. for (int i = 0; i < flags.size(); ++i)
  169. {
  170. mem << "#ifndef " << flags.getAllKeys()[i] << newLine
  171. << " #define " << flags.getAllKeys()[i].paddedRight (' ', 32) << " "
  172. << flags.getAllValues()[i] << newLine
  173. << "#endif" << newLine;
  174. }
  175. projectSaver.setExtraAppConfigFileContent (mem.toString());
  176. }
  177. inline static void fixMissingXcodePostBuildScript (ProjectExporter& exporter)
  178. {
  179. if (exporter.isXcode() && exporter.settings [Ids::postbuildCommand].toString().isEmpty())
  180. exporter.getSetting (Ids::postbuildCommand) = String::fromUTF8 (BinaryData::AudioPluginXCodeScript_txt,
  181. BinaryData::AudioPluginXCodeScript_txtSize);
  182. }
  183. inline String createEscapedStringForVersion (ProjectExporter& exporter, const String& text)
  184. {
  185. // (VS10 automatically adds escape characters to the quotes for this definition)
  186. return exporter.getVisualStudioVersion() < 10 ? CppTokeniserFunctions::addEscapeChars (text.quoted())
  187. : CppTokeniserFunctions::addEscapeChars (text).quoted();
  188. }
  189. inline String createRebasedPath (ProjectExporter& exporter, const RelativePath& path)
  190. {
  191. return createEscapedStringForVersion (exporter,
  192. exporter.rebaseFromProjectFolderToBuildTarget (path)
  193. .toWindowsStyle());
  194. }
  195. }
  196. //==============================================================================
  197. namespace VSTHelpers
  198. {
  199. inline bool isExporterSupported (ProjectExporter& exporter)
  200. {
  201. return ! exporter.isAndroid();
  202. }
  203. inline void addVSTFolderToPath (ProjectExporter& exporter, bool isVST3)
  204. {
  205. const String vstFolder (exporter.getVSTPathValue (isVST3).toString());
  206. if (vstFolder.isNotEmpty())
  207. exporter.addToExtraSearchPaths (RelativePath (vstFolder, RelativePath::projectFolder), 0);
  208. }
  209. inline void createVSTPathEditor (ProjectExporter& exporter, PropertyListBuilder& props, bool isVST3)
  210. {
  211. const String vstFormat (isVST3 ? "VST3" : "VST");
  212. props.add (new DependencyPathPropertyComponent (exporter.getVSTPathValue (isVST3),
  213. vstFormat + " Folder"),
  214. "If you're building a " + vstFormat + ", this must be the folder containing the " + vstFormat + " SDK. This should be an absolute path.");
  215. }
  216. inline void prepareExporter (ProjectExporter& exporter, ProjectSaver& projectSaver, bool isVST3)
  217. {
  218. if (isExporterSupported (exporter))
  219. {
  220. fixMissingXcodePostBuildScript (exporter);
  221. writePluginCharacteristicsFile (projectSaver);
  222. exporter.makefileTargetSuffix = ".so";
  223. Project::Item group (Project::Item::createGroup (const_cast<ProjectExporter&> (exporter).getProject(),
  224. "Juce VST Wrapper", "__jucevstfiles"));
  225. addVSTFolderToPath (exporter, isVST3);
  226. if (exporter.isVisualStudio())
  227. {
  228. if (! exporter.getExtraLinkerFlagsString().contains ("/FORCE:multiple"))
  229. exporter.getExtraLinkerFlags() = exporter.getExtraLinkerFlags().toString() + " /FORCE:multiple";
  230. RelativePath modulePath (exporter.rebaseFromProjectFolderToBuildTarget (RelativePath (exporter.getPathForModuleString ("juce_audio_plugin_client"),
  231. RelativePath::projectFolder)
  232. .getChildFile ("juce_audio_plugin_client")
  233. .getChildFile ("VST3")));
  234. for (ProjectExporter::ConfigIterator config (exporter); config.next();)
  235. {
  236. if (config->getValue (Ids::useRuntimeLibDLL).getValue().isVoid())
  237. config->getValue (Ids::useRuntimeLibDLL) = true;
  238. if (isVST3)
  239. if (config->getValue (Ids::postbuildCommand).toString().isEmpty())
  240. config->getValue (Ids::postbuildCommand) = "copy /Y \"$(OutDir)\\$(TargetFileName)\" \"$(OutDir)\\$(TargetName).vst3\"";
  241. }
  242. }
  243. if (exporter.isLinux())
  244. exporter.makefileExtraLinkerFlags.add ("-Wl,--no-undefined");
  245. }
  246. }
  247. inline void createPropertyEditors (ProjectExporter& exporter, PropertyListBuilder& props, bool isVST3)
  248. {
  249. if (isExporterSupported (exporter))
  250. {
  251. fixMissingXcodePostBuildScript (exporter);
  252. createVSTPathEditor (exporter, props, isVST3);
  253. }
  254. }
  255. }
  256. //==============================================================================
  257. namespace RTASHelpers
  258. {
  259. inline RelativePath getRTASRelativeFolderPath (ProjectExporter& exporter)
  260. {
  261. return RelativePath (exporter.getRTASPathValue().toString(), RelativePath::projectFolder);
  262. }
  263. inline bool isExporterSupported (ProjectExporter& exporter)
  264. {
  265. return exporter.isVisualStudio() || exporter.isXcode();
  266. }
  267. inline void addExtraSearchPaths (ProjectExporter& exporter)
  268. {
  269. RelativePath rtasFolder (getRTASRelativeFolderPath (exporter));
  270. if (exporter.isVisualStudio())
  271. {
  272. RelativePath juceWrapperFolder (exporter.getProject().getGeneratedCodeFolder(),
  273. exporter.getTargetFolder(), RelativePath::buildTargetFolder);
  274. exporter.extraSearchPaths.add (juceWrapperFolder.toWindowsStyle());
  275. static const char* p[] = { "AlturaPorts/TDMPlugins/PluginLibrary/EffectClasses",
  276. "AlturaPorts/TDMPlugins/PluginLibrary/ProcessClasses",
  277. "AlturaPorts/TDMPlugins/PluginLibrary/ProcessClasses/Interfaces",
  278. "AlturaPorts/TDMPlugins/PluginLibrary/Utilities",
  279. "AlturaPorts/TDMPlugins/PluginLibrary/RTASP_Adapt",
  280. "AlturaPorts/TDMPlugins/PluginLibrary/CoreClasses",
  281. "AlturaPorts/TDMPlugins/PluginLibrary/Controls",
  282. "AlturaPorts/TDMPlugins/PluginLibrary/Meters",
  283. "AlturaPorts/TDMPlugins/PluginLibrary/ViewClasses",
  284. "AlturaPorts/TDMPlugins/PluginLibrary/DSPClasses",
  285. "AlturaPorts/TDMPlugins/PluginLibrary/Interfaces",
  286. "AlturaPorts/TDMPlugins/common",
  287. "AlturaPorts/TDMPlugins/common/Platform",
  288. "AlturaPorts/TDMPlugins/common/Macros",
  289. "AlturaPorts/TDMPlugins/SignalProcessing/Public",
  290. "AlturaPorts/TDMPlugIns/DSPManager/Interfaces",
  291. "AlturaPorts/SADriver/Interfaces",
  292. "AlturaPorts/DigiPublic/Interfaces",
  293. "AlturaPorts/DigiPublic",
  294. "AlturaPorts/Fic/Interfaces/DAEClient",
  295. "AlturaPorts/NewFileLibs/Cmn",
  296. "AlturaPorts/NewFileLibs/DOA",
  297. "AlturaPorts/AlturaSource/PPC_H",
  298. "AlturaPorts/AlturaSource/AppSupport",
  299. "AvidCode/AVX2sdk/AVX/avx2/avx2sdk/inc",
  300. "xplat/AVX/avx2/avx2sdk/inc" };
  301. for (int i = 0; i < numElementsInArray (p); ++i)
  302. exporter.addToExtraSearchPaths (rtasFolder.getChildFile (p[i]));
  303. }
  304. else if (exporter.isXcode())
  305. {
  306. exporter.extraSearchPaths.add ("$(DEVELOPER_DIR)/Headers/FlatCarbon");
  307. exporter.extraSearchPaths.add ("$(SDKROOT)/Developer/Headers/FlatCarbon");
  308. static const char* p[] = { "AlturaPorts/TDMPlugIns/PlugInLibrary/Controls",
  309. "AlturaPorts/TDMPlugIns/PlugInLibrary/CoreClasses",
  310. "AlturaPorts/TDMPlugIns/PlugInLibrary/DSPClasses",
  311. "AlturaPorts/TDMPlugIns/PlugInLibrary/EffectClasses",
  312. "AlturaPorts/TDMPlugIns/PlugInLibrary/MacBuild",
  313. "AlturaPorts/TDMPlugIns/PlugInLibrary/Meters",
  314. "AlturaPorts/TDMPlugIns/PlugInLibrary/ProcessClasses",
  315. "AlturaPorts/TDMPlugIns/PlugInLibrary/ProcessClasses/Interfaces",
  316. "AlturaPorts/TDMPlugIns/PlugInLibrary/RTASP_Adapt",
  317. "AlturaPorts/TDMPlugIns/PlugInLibrary/Utilities",
  318. "AlturaPorts/TDMPlugIns/PlugInLibrary/ViewClasses",
  319. "AlturaPorts/TDMPlugIns/DSPManager/**",
  320. "AlturaPorts/TDMPlugIns/SupplementalPlugInLib/Encryption",
  321. "AlturaPorts/TDMPlugIns/SupplementalPlugInLib/GraphicsExtensions",
  322. "AlturaPorts/TDMPlugIns/common/**",
  323. "AlturaPorts/TDMPlugIns/common/PI_LibInterface",
  324. "AlturaPorts/TDMPlugIns/PACEProtection/**",
  325. "AlturaPorts/TDMPlugIns/SignalProcessing/**",
  326. "AlturaPorts/OMS/Headers",
  327. "AlturaPorts/Fic/Interfaces/**",
  328. "AlturaPorts/Fic/Source/SignalNets",
  329. "AlturaPorts/DSIPublicInterface/PublicHeaders",
  330. "DAEWin/Include",
  331. "AlturaPorts/DigiPublic/Interfaces",
  332. "AlturaPorts/DigiPublic",
  333. "AlturaPorts/NewFileLibs/DOA",
  334. "AlturaPorts/NewFileLibs/Cmn",
  335. "xplat/AVX/avx2/avx2sdk/inc",
  336. "xplat/AVX/avx2/avx2sdk/utils" };
  337. for (int i = 0; i < numElementsInArray (p); ++i)
  338. exporter.addToExtraSearchPaths (rtasFolder.getChildFile (p[i]));
  339. }
  340. }
  341. inline void prepareExporter (ProjectExporter& exporter, ProjectSaver& projectSaver)
  342. {
  343. if (isExporterSupported (exporter))
  344. {
  345. fixMissingXcodePostBuildScript (exporter);
  346. const RelativePath rtasFolder (getRTASRelativeFolderPath (exporter));
  347. if (exporter.isVisualStudio())
  348. {
  349. exporter.msvcTargetSuffix = ".dpm";
  350. exporter.msvcExtraPreprocessorDefs.set ("JucePlugin_WinBag_path",
  351. createRebasedPath (exporter,
  352. rtasFolder.getChildFile ("WinBag")));
  353. exporter.msvcDelayLoadedDLLs = "DAE.dll; DigiExt.dll; DSI.dll; PluginLib.dll; "
  354. "DSPManager.dll; DSPManager.dll; DSPManagerClientLib.dll; RTASClientLib.dll";
  355. if (! exporter.getExtraLinkerFlagsString().contains ("/FORCE:multiple"))
  356. exporter.getExtraLinkerFlags() = exporter.getExtraLinkerFlags().toString() + " /FORCE:multiple";
  357. RelativePath modulePath (exporter.rebaseFromProjectFolderToBuildTarget (RelativePath (exporter.getPathForModuleString ("juce_audio_plugin_client"),
  358. RelativePath::projectFolder)
  359. .getChildFile ("juce_audio_plugin_client")
  360. .getChildFile ("RTAS")));
  361. for (ProjectExporter::ConfigIterator config (exporter); config.next();)
  362. {
  363. config->getValue (Ids::msvcModuleDefinitionFile) = modulePath.getChildFile ("juce_RTAS_WinExports.def").toWindowsStyle();
  364. if (config->getValue (Ids::useRuntimeLibDLL).getValue().isVoid())
  365. config->getValue (Ids::useRuntimeLibDLL) = true;
  366. if (config->getValue (Ids::postbuildCommand).toString().isEmpty())
  367. config->getValue (Ids::postbuildCommand)
  368. = "copy /Y "
  369. + modulePath.getChildFile ("juce_RTAS_WinResources.rsr").toWindowsStyle().quoted()
  370. + " \"$(TargetPath)\".rsr";
  371. }
  372. }
  373. else
  374. {
  375. exporter.xcodeCanUseDwarf = false;
  376. exporter.xcodeExtraLibrariesDebug.add (rtasFolder.getChildFile ("MacBag/Libs/Debug/libPluginLibrary.a"));
  377. exporter.xcodeExtraLibrariesRelease.add (rtasFolder.getChildFile ("MacBag/Libs/Release/libPluginLibrary.a"));
  378. }
  379. writePluginCharacteristicsFile (projectSaver);
  380. addExtraSearchPaths (exporter);
  381. }
  382. }
  383. inline void createPropertyEditors (ProjectExporter& exporter, PropertyListBuilder& props)
  384. {
  385. if (isExporterSupported (exporter))
  386. {
  387. fixMissingXcodePostBuildScript (exporter);
  388. props.add (new DependencyPathPropertyComponent (exporter.getRTASPathValue(),
  389. "RTAS Folder"),
  390. "If you're building an RTAS, this must be the folder containing the RTAS SDK. This should be an absolute path.");
  391. }
  392. }
  393. }
  394. //==============================================================================
  395. namespace AUHelpers
  396. {
  397. inline void prepareExporter (ProjectExporter& exporter, ProjectSaver& projectSaver)
  398. {
  399. writePluginCharacteristicsFile (projectSaver);
  400. if (exporter.isXcode())
  401. {
  402. exporter.xcodeFrameworks.addTokens ("AudioUnit CoreAudioKit", false);
  403. XmlElement plistKey ("key");
  404. plistKey.addTextElement ("AudioComponents");
  405. XmlElement plistEntry ("array");
  406. XmlElement* dict = plistEntry.createNewChildElement ("dict");
  407. Project& project = exporter.getProject();
  408. addPlistDictionaryKey (dict, "name", getPluginManufacturer (project).toString()
  409. + ": " + getPluginName (project).toString());
  410. addPlistDictionaryKey (dict, "description", getPluginDesc (project).toString());
  411. addPlistDictionaryKey (dict, "factoryFunction", getPluginAUExportPrefix (project).toString() + "Factory");
  412. addPlistDictionaryKey (dict, "manufacturer", getPluginManufacturerCode (project).toString().trim().substring (0, 4));
  413. addPlistDictionaryKey (dict, "type", getAUMainTypeCode (project));
  414. addPlistDictionaryKey (dict, "subtype", getPluginCode (project).toString().trim().substring (0, 4));
  415. addPlistDictionaryKeyInt (dict, "version", project.getVersionAsHexInteger());
  416. exporter.xcodeExtraPListEntries.add (plistKey);
  417. exporter.xcodeExtraPListEntries.add (plistEntry);
  418. fixMissingXcodePostBuildScript (exporter);
  419. }
  420. }
  421. }
  422. //==============================================================================
  423. namespace AAXHelpers
  424. {
  425. inline RelativePath getAAXRelativeFolderPath (ProjectExporter& exporter)
  426. {
  427. return RelativePath (exporter.getAAXPathValue().toString(), RelativePath::projectFolder);
  428. }
  429. inline bool isExporterSupported (ProjectExporter& exporter)
  430. {
  431. return exporter.isVisualStudio() || exporter.isXcode();
  432. }
  433. inline void addExtraSearchPaths (ProjectExporter& exporter)
  434. {
  435. const RelativePath aaxFolder (getAAXRelativeFolderPath (exporter));
  436. exporter.addToExtraSearchPaths (aaxFolder);
  437. exporter.addToExtraSearchPaths (aaxFolder.getChildFile ("Interfaces"));
  438. exporter.addToExtraSearchPaths (aaxFolder.getChildFile ("Interfaces").getChildFile ("ACF"));
  439. }
  440. inline void prepareExporter (ProjectExporter& exporter, ProjectSaver& projectSaver)
  441. {
  442. if (isExporterSupported (exporter))
  443. {
  444. fixMissingXcodePostBuildScript (exporter);
  445. const RelativePath aaxLibsFolder (getAAXRelativeFolderPath (exporter).getChildFile ("Libs"));
  446. if (exporter.isVisualStudio())
  447. {
  448. for (ProjectExporter::ConfigIterator config (exporter); config.next();)
  449. if (config->getValue (Ids::useRuntimeLibDLL).getValue().isVoid())
  450. config->getValue (Ids::useRuntimeLibDLL) = true;
  451. exporter.msvcExtraPreprocessorDefs.set ("JucePlugin_AAXLibs_path",
  452. createRebasedPath (exporter, aaxLibsFolder));
  453. }
  454. else
  455. {
  456. exporter.xcodeExtraLibrariesDebug.add (aaxLibsFolder.getChildFile ("Debug/libAAXLibrary.a"));
  457. exporter.xcodeExtraLibrariesRelease.add (aaxLibsFolder.getChildFile ("Release/libAAXLibrary.a"));
  458. }
  459. writePluginCharacteristicsFile (projectSaver);
  460. addExtraSearchPaths (exporter);
  461. }
  462. }
  463. inline void createPropertyEditors (ProjectExporter& exporter, PropertyListBuilder& props)
  464. {
  465. if (isExporterSupported (exporter))
  466. {
  467. fixMissingXcodePostBuildScript (exporter);
  468. props.add (new DependencyPathPropertyComponent (exporter.getAAXPathValue(),
  469. "AAX SDK Folder"),
  470. "If you're building an AAX, this must be the folder containing the AAX SDK. This should be an absolute path.");
  471. }
  472. }
  473. }
  474. #endif // JUCER_AUDIOPLUGINMODULE_H_INCLUDED