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.

554 lines
30KB

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