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.

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