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.

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