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.

569 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 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. {
  197. RelativePath path (exporter.rebaseFromProjectFolderToBuildTarget (RelativePath (vstFolder, RelativePath::projectFolder)));
  198. if (exporter.isVisualStudio())
  199. exporter.extraSearchPaths.add (path.toWindowsStyle());
  200. else if (exporter.isLinux() || exporter.isXcode())
  201. exporter.extraSearchPaths.insert (0, path.toUnixStyle());
  202. }
  203. }
  204. static void createVSTPathEditor (ProjectExporter& exporter, PropertyListBuilder& props, bool isVST3)
  205. {
  206. const String vstFormat (isVST3 ? "VST3" : "VST");
  207. props.add (new DependencyPathPropertyComponent (exporter.getVSTPathValue (isVST3),
  208. vstFormat + " Folder"),
  209. "If you're building a " + vstFormat + ", this must be the folder containing the " + vstFormat + " SDK. This should be an absolute path.");
  210. }
  211. static inline void prepareExporter (ProjectExporter& exporter, ProjectSaver& projectSaver, bool isVST3)
  212. {
  213. fixMissingXcodePostBuildScript (exporter);
  214. writePluginCharacteristicsFile (projectSaver);
  215. exporter.makefileTargetSuffix = ".so";
  216. Project::Item group (Project::Item::createGroup (const_cast<ProjectExporter&> (exporter).getProject(),
  217. "Juce VST Wrapper", "__jucevstfiles"));
  218. RelativePath juceWrapperFolder (exporter.getProject().getGeneratedCodeFolder(),
  219. exporter.getTargetFolder(), RelativePath::buildTargetFolder);
  220. addVSTFolderToPath (exporter, isVST3);
  221. if (exporter.isWindows())
  222. exporter.extraSearchPaths.add (juceWrapperFolder.toWindowsStyle());
  223. else if (exporter.isLinux())
  224. exporter.extraSearchPaths.add (juceWrapperFolder.toUnixStyle());
  225. if (exporter.isVisualStudio())
  226. {
  227. if (! exporter.getExtraLinkerFlagsString().contains ("/FORCE:multiple"))
  228. exporter.getExtraLinkerFlags() = exporter.getExtraLinkerFlags().toString() + " /FORCE:multiple";
  229. RelativePath modulePath (exporter.rebaseFromProjectFolderToBuildTarget (RelativePath (exporter.getPathForModuleString ("juce_audio_plugin_client"),
  230. RelativePath::projectFolder)
  231. .getChildFile ("juce_audio_plugin_client")
  232. .getChildFile ("VST3")));
  233. for (ProjectExporter::ConfigIterator config (exporter); config.next();)
  234. {
  235. if (config->getValue (Ids::useRuntimeLibDLL).getValue().isVoid())
  236. config->getValue (Ids::useRuntimeLibDLL) = true;
  237. if (isVST3)
  238. if (config->getValue (Ids::postbuildCommand).toString().isEmpty())
  239. config->getValue (Ids::postbuildCommand) = "copy /Y \"$(OutDir)\\$(TargetFileName)\" \"$(OutDir)\\$(TargetName).vst3\"";
  240. }
  241. }
  242. if (exporter.isLinux())
  243. exporter.makefileExtraLinkerFlags.add ("-Wl,--no-undefined");
  244. }
  245. static inline void createPropertyEditors (ProjectExporter& exporter, PropertyListBuilder& props, bool isVST3)
  246. {
  247. fixMissingXcodePostBuildScript (exporter);
  248. createVSTPathEditor (exporter, props, isVST3);
  249. }
  250. }
  251. //==============================================================================
  252. namespace RTASHelpers
  253. {
  254. static RelativePath getRTASRelativeFolderPath (ProjectExporter& exporter)
  255. {
  256. return RelativePath (exporter.getRTASPathValue().toString(), RelativePath::projectFolder);
  257. }
  258. static bool isExporterSupported (ProjectExporter& exporter)
  259. {
  260. return exporter.isVisualStudio() || exporter.isXcode();
  261. }
  262. static void addExtraSearchPaths (ProjectExporter& exporter)
  263. {
  264. RelativePath rtasFolder (getRTASRelativeFolderPath (exporter));
  265. if (exporter.isVisualStudio())
  266. {
  267. RelativePath juceWrapperFolder (exporter.getProject().getGeneratedCodeFolder(),
  268. exporter.getTargetFolder(), RelativePath::buildTargetFolder);
  269. exporter.extraSearchPaths.add (juceWrapperFolder.toWindowsStyle());
  270. static const char* p[] = { "AlturaPorts/TDMPlugins/PluginLibrary/EffectClasses",
  271. "AlturaPorts/TDMPlugins/PluginLibrary/ProcessClasses",
  272. "AlturaPorts/TDMPlugins/PluginLibrary/ProcessClasses/Interfaces",
  273. "AlturaPorts/TDMPlugins/PluginLibrary/Utilities",
  274. "AlturaPorts/TDMPlugins/PluginLibrary/RTASP_Adapt",
  275. "AlturaPorts/TDMPlugins/PluginLibrary/CoreClasses",
  276. "AlturaPorts/TDMPlugins/PluginLibrary/Controls",
  277. "AlturaPorts/TDMPlugins/PluginLibrary/Meters",
  278. "AlturaPorts/TDMPlugins/PluginLibrary/ViewClasses",
  279. "AlturaPorts/TDMPlugins/PluginLibrary/DSPClasses",
  280. "AlturaPorts/TDMPlugins/PluginLibrary/Interfaces",
  281. "AlturaPorts/TDMPlugins/common",
  282. "AlturaPorts/TDMPlugins/common/Platform",
  283. "AlturaPorts/TDMPlugins/common/Macros",
  284. "AlturaPorts/TDMPlugins/SignalProcessing/Public",
  285. "AlturaPorts/TDMPlugIns/DSPManager/Interfaces",
  286. "AlturaPorts/SADriver/Interfaces",
  287. "AlturaPorts/DigiPublic/Interfaces",
  288. "AlturaPorts/DigiPublic",
  289. "AlturaPorts/Fic/Interfaces/DAEClient",
  290. "AlturaPorts/NewFileLibs/Cmn",
  291. "AlturaPorts/NewFileLibs/DOA",
  292. "AlturaPorts/AlturaSource/PPC_H",
  293. "AlturaPorts/AlturaSource/AppSupport",
  294. "AvidCode/AVX2sdk/AVX/avx2/avx2sdk/inc",
  295. "xplat/AVX/avx2/avx2sdk/inc" };
  296. for (int i = 0; i < numElementsInArray (p); ++i)
  297. exporter.addToExtraSearchPaths (rtasFolder.getChildFile (p[i]));
  298. }
  299. else if (exporter.isXcode())
  300. {
  301. exporter.extraSearchPaths.add ("$(DEVELOPER_DIR)/Headers/FlatCarbon");
  302. exporter.extraSearchPaths.add ("$(SDKROOT)/Developer/Headers/FlatCarbon");
  303. static const char* p[] = { "AlturaPorts/TDMPlugIns/PlugInLibrary/Controls",
  304. "AlturaPorts/TDMPlugIns/PlugInLibrary/CoreClasses",
  305. "AlturaPorts/TDMPlugIns/PlugInLibrary/DSPClasses",
  306. "AlturaPorts/TDMPlugIns/PlugInLibrary/EffectClasses",
  307. "AlturaPorts/TDMPlugIns/PlugInLibrary/MacBuild",
  308. "AlturaPorts/TDMPlugIns/PlugInLibrary/Meters",
  309. "AlturaPorts/TDMPlugIns/PlugInLibrary/ProcessClasses",
  310. "AlturaPorts/TDMPlugIns/PlugInLibrary/ProcessClasses/Interfaces",
  311. "AlturaPorts/TDMPlugIns/PlugInLibrary/RTASP_Adapt",
  312. "AlturaPorts/TDMPlugIns/PlugInLibrary/Utilities",
  313. "AlturaPorts/TDMPlugIns/PlugInLibrary/ViewClasses",
  314. "AlturaPorts/TDMPlugIns/DSPManager/**",
  315. "AlturaPorts/TDMPlugIns/SupplementalPlugInLib/Encryption",
  316. "AlturaPorts/TDMPlugIns/SupplementalPlugInLib/GraphicsExtensions",
  317. "AlturaPorts/TDMPlugIns/common/**",
  318. "AlturaPorts/TDMPlugIns/common/PI_LibInterface",
  319. "AlturaPorts/TDMPlugIns/PACEProtection/**",
  320. "AlturaPorts/TDMPlugIns/SignalProcessing/**",
  321. "AlturaPorts/OMS/Headers",
  322. "AlturaPorts/Fic/Interfaces/**",
  323. "AlturaPorts/Fic/Source/SignalNets",
  324. "AlturaPorts/DSIPublicInterface/PublicHeaders",
  325. "DAEWin/Include",
  326. "AlturaPorts/DigiPublic/Interfaces",
  327. "AlturaPorts/DigiPublic",
  328. "AlturaPorts/NewFileLibs/DOA",
  329. "AlturaPorts/NewFileLibs/Cmn",
  330. "xplat/AVX/avx2/avx2sdk/inc",
  331. "xplat/AVX/avx2/avx2sdk/utils" };
  332. for (int i = 0; i < numElementsInArray (p); ++i)
  333. exporter.addToExtraSearchPaths (rtasFolder.getChildFile (p[i]));
  334. }
  335. }
  336. static inline void prepareExporter (ProjectExporter& exporter, ProjectSaver& projectSaver)
  337. {
  338. if (isExporterSupported (exporter))
  339. {
  340. fixMissingXcodePostBuildScript (exporter);
  341. const RelativePath rtasFolder (getRTASRelativeFolderPath (exporter));
  342. if (exporter.isVisualStudio())
  343. {
  344. exporter.msvcTargetSuffix = ".dpm";
  345. exporter.msvcExtraPreprocessorDefs.set ("JucePlugin_WinBag_path",
  346. createRebasedPath (exporter,
  347. rtasFolder.getChildFile ("WinBag")));
  348. exporter.msvcDelayLoadedDLLs = "DAE.dll; DigiExt.dll; DSI.dll; PluginLib.dll; "
  349. "DSPManager.dll; DSPManager.dll; DSPManagerClientLib.dll; RTASClientLib.dll";
  350. if (! exporter.getExtraLinkerFlagsString().contains ("/FORCE:multiple"))
  351. exporter.getExtraLinkerFlags() = exporter.getExtraLinkerFlags().toString() + " /FORCE:multiple";
  352. RelativePath modulePath (exporter.rebaseFromProjectFolderToBuildTarget (RelativePath (exporter.getPathForModuleString ("juce_audio_plugin_client"),
  353. RelativePath::projectFolder)
  354. .getChildFile ("juce_audio_plugin_client")
  355. .getChildFile ("RTAS")));
  356. for (ProjectExporter::ConfigIterator config (exporter); config.next();)
  357. {
  358. config->getValue (Ids::msvcModuleDefinitionFile) = modulePath.getChildFile ("juce_RTAS_WinExports.def").toWindowsStyle();
  359. if (config->getValue (Ids::useRuntimeLibDLL).getValue().isVoid())
  360. config->getValue (Ids::useRuntimeLibDLL) = true;
  361. if (config->getValue (Ids::postbuildCommand).toString().isEmpty())
  362. config->getValue (Ids::postbuildCommand)
  363. = "copy /Y "
  364. + modulePath.getChildFile ("juce_RTAS_WinResources.rsr").toWindowsStyle().quoted()
  365. + " \"$(TargetPath)\".rsr";
  366. }
  367. }
  368. else
  369. {
  370. exporter.xcodeCanUseDwarf = false;
  371. exporter.xcodeExtraLibrariesDebug.add (rtasFolder.getChildFile ("MacBag/Libs/Debug/libPluginLibrary.a"));
  372. exporter.xcodeExtraLibrariesRelease.add (rtasFolder.getChildFile ("MacBag/Libs/Release/libPluginLibrary.a"));
  373. }
  374. writePluginCharacteristicsFile (projectSaver);
  375. addExtraSearchPaths (exporter);
  376. }
  377. }
  378. static inline void createPropertyEditors (ProjectExporter& exporter, PropertyListBuilder& props)
  379. {
  380. if (isExporterSupported (exporter))
  381. {
  382. fixMissingXcodePostBuildScript (exporter);
  383. props.add (new DependencyPathPropertyComponent (exporter.getRTASPathValue(),
  384. "RTAS Folder"),
  385. "If you're building an RTAS, this must be the folder containing the RTAS SDK. This should be an absolute path.");
  386. }
  387. }
  388. }
  389. //==============================================================================
  390. namespace AUHelpers
  391. {
  392. static inline void prepareExporter (ProjectExporter& exporter, ProjectSaver& projectSaver)
  393. {
  394. writePluginCharacteristicsFile (projectSaver);
  395. if (exporter.isXcode())
  396. {
  397. exporter.xcodeFrameworks.addTokens ("AudioUnit CoreAudioKit", false);
  398. XmlElement plistKey ("key");
  399. plistKey.addTextElement ("AudioComponents");
  400. XmlElement plistEntry ("array");
  401. XmlElement* dict = plistEntry.createNewChildElement ("dict");
  402. Project& project = exporter.getProject();
  403. addPlistDictionaryKey (dict, "name", getPluginManufacturer (project).toString()
  404. + ": " + getPluginName (project).toString());
  405. addPlistDictionaryKey (dict, "description", getPluginDesc (project).toString());
  406. addPlistDictionaryKey (dict, "factoryFunction", getPluginAUExportPrefix (project).toString() + "Factory");
  407. addPlistDictionaryKey (dict, "manufacturer", getPluginManufacturerCode (project).toString().trim().substring (0, 4));
  408. addPlistDictionaryKey (dict, "type", getAUMainTypeCode (project));
  409. addPlistDictionaryKey (dict, "subtype", getPluginCode (project).toString().trim().substring (0, 4));
  410. addPlistDictionaryKeyInt (dict, "version", project.getVersionAsHexInteger());
  411. exporter.xcodeExtraPListEntries.add (plistKey);
  412. exporter.xcodeExtraPListEntries.add (plistEntry);
  413. fixMissingXcodePostBuildScript (exporter);
  414. }
  415. }
  416. }
  417. //==============================================================================
  418. namespace AAXHelpers
  419. {
  420. static RelativePath getAAXRelativeFolderPath (ProjectExporter& exporter)
  421. {
  422. return RelativePath (exporter.getAAXPathValue().toString(), RelativePath::projectFolder);
  423. }
  424. static bool isExporterSupported (ProjectExporter& exporter)
  425. {
  426. return exporter.isVisualStudio() || exporter.isXcode();
  427. }
  428. static void addExtraSearchPaths (ProjectExporter& exporter)
  429. {
  430. const RelativePath aaxFolder (getAAXRelativeFolderPath (exporter));
  431. exporter.addToExtraSearchPaths (aaxFolder);
  432. exporter.addToExtraSearchPaths (aaxFolder.getChildFile ("Interfaces"));
  433. exporter.addToExtraSearchPaths (aaxFolder.getChildFile ("Interfaces").getChildFile ("ACF"));
  434. }
  435. static inline void prepareExporter (ProjectExporter& exporter, ProjectSaver& projectSaver)
  436. {
  437. if (isExporterSupported (exporter))
  438. {
  439. fixMissingXcodePostBuildScript (exporter);
  440. const RelativePath aaxLibsFolder (getAAXRelativeFolderPath (exporter).getChildFile ("Libs"));
  441. if (exporter.isVisualStudio())
  442. {
  443. for (ProjectExporter::ConfigIterator config (exporter); config.next();)
  444. if (config->getValue (Ids::useRuntimeLibDLL).getValue().isVoid())
  445. config->getValue (Ids::useRuntimeLibDLL) = true;
  446. exporter.msvcExtraPreprocessorDefs.set ("JucePlugin_AAXLibs_path",
  447. createRebasedPath (exporter, aaxLibsFolder));
  448. }
  449. else
  450. {
  451. exporter.xcodeExtraLibrariesDebug.add (aaxLibsFolder.getChildFile ("Debug/libAAXLibrary.a"));
  452. exporter.xcodeExtraLibrariesRelease.add (aaxLibsFolder.getChildFile ("Release/libAAXLibrary.a"));
  453. }
  454. writePluginCharacteristicsFile (projectSaver);
  455. addExtraSearchPaths (exporter);
  456. }
  457. }
  458. static inline void createPropertyEditors (ProjectExporter& exporter, PropertyListBuilder& props)
  459. {
  460. if (isExporterSupported (exporter))
  461. {
  462. fixMissingXcodePostBuildScript (exporter);
  463. props.add (new DependencyPathPropertyComponent (exporter.getAAXPathValue(),
  464. "AAX SDK Folder"),
  465. "If you're building an AAX, this must be the folder containing the AAX SDK. This should be an absolute path.");
  466. }
  467. }
  468. }
  469. #endif // JUCER_AUDIOPLUGINMODULE_H_INCLUDED