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.

1089 lines
46KB

  1. /*
  2. ==============================================================================
  3. This file is part of the JUCE library.
  4. Copyright (c) 2017 - ROLI Ltd.
  5. JUCE is an open source library subject to commercial or open-source
  6. licensing.
  7. By using JUCE, you agree to the terms of both the JUCE 5 End-User License
  8. Agreement and JUCE 5 Privacy Policy (both updated and effective as of the
  9. 27th April 2017).
  10. End User License Agreement: www.juce.com/juce-5-licence
  11. Privacy Policy: www.juce.com/juce-5-privacy-policy
  12. Or: You may also use this code under the terms of the GPL v3 (see
  13. www.gnu.org/licenses).
  14. JUCE IS PROVIDED "AS IS" WITHOUT ANY WARRANTY, AND ALL WARRANTIES, WHETHER
  15. EXPRESSED OR IMPLIED, INCLUDING MERCHANTABILITY AND FITNESS FOR PURPOSE, ARE
  16. DISCLAIMED.
  17. ==============================================================================
  18. */
  19. #include "../Application/jucer_Headers.h"
  20. #include "jucer_ProjectExporter.h"
  21. #include "jucer_ProjectSaver.h"
  22. #include "jucer_ProjectExport_Make.h"
  23. #include "jucer_ProjectExport_MSVC.h"
  24. #include "jucer_ProjectExport_Xcode.h"
  25. #include "jucer_ProjectExport_Android.h"
  26. #include "jucer_ProjectExport_CodeBlocks.h"
  27. #include "jucer_ProjectExport_CLion.h"
  28. #include "../Utility/UI/PropertyComponents/jucer_FilePathPropertyComponent.h"
  29. //==============================================================================
  30. static void addType (Array<ProjectExporter::ExporterTypeInfo>& list,
  31. const char* name, const void* iconData, int iconDataSize)
  32. {
  33. ProjectExporter::ExporterTypeInfo type = { name, iconData, iconDataSize };
  34. list.add (type);
  35. }
  36. Array<ProjectExporter::ExporterTypeInfo> ProjectExporter::getExporterTypes()
  37. {
  38. Array<ProjectExporter::ExporterTypeInfo> types;
  39. addType (types, XcodeProjectExporter::getNameMac(), BinaryData::export_xcode_svg, BinaryData::export_xcode_svgSize);
  40. addType (types, XcodeProjectExporter::getNameiOS(), BinaryData::export_xcode_svg, BinaryData::export_xcode_svgSize);
  41. addType (types, MSVCProjectExporterVC2019::getName(), BinaryData::export_visualStudio_svg, BinaryData::export_visualStudio_svgSize);
  42. addType (types, MSVCProjectExporterVC2017::getName(), BinaryData::export_visualStudio_svg, BinaryData::export_visualStudio_svgSize);
  43. addType (types, MSVCProjectExporterVC2015::getName(), BinaryData::export_visualStudio_svg, BinaryData::export_visualStudio_svgSize);
  44. addType (types, MakefileProjectExporter::getNameLinux(), BinaryData::export_linux_svg, BinaryData::export_linux_svgSize);
  45. addType (types, AndroidProjectExporter::getName(), BinaryData::export_android_svg, BinaryData::export_android_svgSize);
  46. addType (types, CodeBlocksProjectExporter::getNameWindows(), BinaryData::export_codeBlocks_svg, BinaryData::export_codeBlocks_svgSize);
  47. addType (types, CodeBlocksProjectExporter::getNameLinux(), BinaryData::export_codeBlocks_svg, BinaryData::export_codeBlocks_svgSize);
  48. addType (types, CLionProjectExporter::getName(), BinaryData::export_clion_svg, BinaryData::export_clion_svgSize);
  49. return types;
  50. }
  51. ProjectExporter* ProjectExporter::createNewExporter (Project& project, const int index)
  52. {
  53. ProjectExporter* exp = nullptr;
  54. switch (index)
  55. {
  56. case 0: exp = new XcodeProjectExporter (project, ValueTree (XcodeProjectExporter ::getValueTreeTypeName (false)), false); break;
  57. case 1: exp = new XcodeProjectExporter (project, ValueTree (XcodeProjectExporter ::getValueTreeTypeName (true)), true); break;
  58. case 2: exp = new MSVCProjectExporterVC2019 (project, ValueTree (MSVCProjectExporterVC2019 ::getValueTreeTypeName())); break;
  59. case 3: exp = new MSVCProjectExporterVC2017 (project, ValueTree (MSVCProjectExporterVC2017 ::getValueTreeTypeName())); break;
  60. case 4: exp = new MSVCProjectExporterVC2015 (project, ValueTree (MSVCProjectExporterVC2015 ::getValueTreeTypeName())); break;
  61. case 5: exp = new MakefileProjectExporter (project, ValueTree (MakefileProjectExporter ::getValueTreeTypeName())); break;
  62. case 6: exp = new AndroidProjectExporter (project, ValueTree (AndroidProjectExporter ::getValueTreeTypeName())); break;
  63. case 7: exp = new CodeBlocksProjectExporter (project, ValueTree (CodeBlocksProjectExporter ::getValueTreeTypeName (CodeBlocksProjectExporter::windowsTarget)), CodeBlocksProjectExporter::windowsTarget); break;
  64. case 8: exp = new CodeBlocksProjectExporter (project, ValueTree (CodeBlocksProjectExporter ::getValueTreeTypeName (CodeBlocksProjectExporter::linuxTarget)), CodeBlocksProjectExporter::linuxTarget); break;
  65. case 9: exp = new CLionProjectExporter (project, ValueTree (CLionProjectExporter ::getValueTreeTypeName())); break;
  66. default: break;
  67. }
  68. exp->createDefaultConfigs();
  69. exp->createDefaultModulePaths();
  70. return exp;
  71. }
  72. StringArray ProjectExporter::getExporterNames()
  73. {
  74. StringArray s;
  75. for (auto& e : getExporterTypes())
  76. s.add (e.name);
  77. return s;
  78. }
  79. StringArray ProjectExporter::getExporterValueTreeNames()
  80. {
  81. StringArray s;
  82. for (auto& n : getExporterNames())
  83. s.add (getValueTreeNameForExporter (n));
  84. return s;
  85. }
  86. String ProjectExporter::getValueTreeNameForExporter (const String& exporterName)
  87. {
  88. if (exporterName == XcodeProjectExporter::getNameMac())
  89. return XcodeProjectExporter::getValueTreeTypeName (false);
  90. if (exporterName == XcodeProjectExporter::getNameiOS())
  91. return XcodeProjectExporter::getValueTreeTypeName (true);
  92. if (exporterName == MSVCProjectExporterVC2019::getName())
  93. return MSVCProjectExporterVC2019::getValueTreeTypeName();
  94. if (exporterName == MSVCProjectExporterVC2017::getName())
  95. return MSVCProjectExporterVC2017::getValueTreeTypeName();
  96. if (exporterName == MSVCProjectExporterVC2015::getName())
  97. return MSVCProjectExporterVC2015::getValueTreeTypeName();
  98. if (exporterName == MakefileProjectExporter::getNameLinux())
  99. return MakefileProjectExporter::getValueTreeTypeName();
  100. if (exporterName == AndroidProjectExporter::getName())
  101. return AndroidProjectExporter::getValueTreeTypeName();
  102. if (exporterName == CodeBlocksProjectExporter::getNameLinux())
  103. return CodeBlocksProjectExporter::getValueTreeTypeName (CodeBlocksProjectExporter::CodeBlocksOS::linuxTarget);
  104. if (exporterName == CodeBlocksProjectExporter::getNameWindows())
  105. return CodeBlocksProjectExporter::getValueTreeTypeName (CodeBlocksProjectExporter::CodeBlocksOS::windowsTarget);
  106. if (exporterName == CLionProjectExporter::getName())
  107. return CLionProjectExporter::getValueTreeTypeName();
  108. return {};
  109. }
  110. String ProjectExporter::getTargetFolderForExporter (const String& exporterValueTreeName)
  111. {
  112. if (exporterValueTreeName == "XCODE_MAC") return "MacOSX";
  113. if (exporterValueTreeName == "XCODE_IPHONE") return "iOS";
  114. if (exporterValueTreeName == "VS2019") return "VisualStudio2019";
  115. if (exporterValueTreeName == "VS2017") return "VisualStudio2017";
  116. if (exporterValueTreeName == "VS2015") return "VisualStudio2015";
  117. if (exporterValueTreeName == "LINUX_MAKE") return "LinuxMakefile";
  118. if (exporterValueTreeName == "ANDROIDSTUDIO") return "Android";
  119. if (exporterValueTreeName == "CODEBLOCKS_WINDOWS") return "CodeBlocksWindows";
  120. if (exporterValueTreeName == "CODEBLOCKS_LINUX") return "CodeBlocksLinux";
  121. if (exporterValueTreeName == "CLION") return "CLion";
  122. return {};
  123. }
  124. StringArray ProjectExporter::getAllDefaultBuildsFolders()
  125. {
  126. StringArray folders;
  127. folders.add (getDefaultBuildsRootFolder() + "iOS");
  128. folders.add (getDefaultBuildsRootFolder() + "MacOSX");
  129. folders.add (getDefaultBuildsRootFolder() + "VisualStudio2019");
  130. folders.add (getDefaultBuildsRootFolder() + "VisualStudio2017");
  131. folders.add (getDefaultBuildsRootFolder() + "VisualStudio2015");
  132. folders.add (getDefaultBuildsRootFolder() + "LinuxMakefile");
  133. folders.add (getDefaultBuildsRootFolder() + "CodeBlocksWindows");
  134. folders.add (getDefaultBuildsRootFolder() + "CodeBlocksLinux");
  135. folders.add (getDefaultBuildsRootFolder() + "Android");
  136. folders.add (getDefaultBuildsRootFolder() + "CLion");
  137. return folders;
  138. }
  139. String ProjectExporter::getCurrentPlatformExporterName()
  140. {
  141. #if JUCE_MAC
  142. return XcodeProjectExporter::getNameMac();
  143. #elif JUCE_WINDOWS
  144. return MSVCProjectExporterVC2019::getName();
  145. #elif JUCE_LINUX
  146. return MakefileProjectExporter::getNameLinux();
  147. #else
  148. #error // huh?
  149. #endif
  150. }
  151. ProjectExporter* ProjectExporter::createNewExporter (Project& project, const String& name)
  152. {
  153. return createNewExporter (project, getExporterNames().indexOf (name));
  154. }
  155. ProjectExporter* ProjectExporter::createExporter (Project& project, const ValueTree& settings)
  156. {
  157. ProjectExporter* exp = MSVCProjectExporterVC2019 ::createForSettings (project, settings);
  158. if (exp == nullptr) exp = MSVCProjectExporterVC2017 ::createForSettings (project, settings);
  159. if (exp == nullptr) exp = MSVCProjectExporterVC2015 ::createForSettings (project, settings);
  160. if (exp == nullptr) exp = XcodeProjectExporter ::createForSettings (project, settings);
  161. if (exp == nullptr) exp = MakefileProjectExporter ::createForSettings (project, settings);
  162. if (exp == nullptr) exp = AndroidProjectExporter ::createForSettings (project, settings);
  163. if (exp == nullptr) exp = CodeBlocksProjectExporter ::createForSettings (project, settings);
  164. if (exp == nullptr) exp = CLionProjectExporter ::createForSettings (project, settings);
  165. jassert (exp != nullptr);
  166. return exp;
  167. }
  168. bool ProjectExporter::canProjectBeLaunched (Project* project)
  169. {
  170. if (project != nullptr)
  171. {
  172. const char* types[] =
  173. {
  174. #if JUCE_MAC
  175. XcodeProjectExporter::getValueTreeTypeName (false),
  176. XcodeProjectExporter::getValueTreeTypeName (true),
  177. #elif JUCE_WINDOWS
  178. MSVCProjectExporterVC2019::getValueTreeTypeName(),
  179. MSVCProjectExporterVC2017::getValueTreeTypeName(),
  180. MSVCProjectExporterVC2015::getValueTreeTypeName(),
  181. #elif JUCE_LINUX
  182. // (this doesn't currently launch.. not really sure what it would do on linux)
  183. //MakefileProjectExporter::getValueTreeTypeName(),
  184. #endif
  185. AndroidProjectExporter::getValueTreeTypeName(),
  186. nullptr
  187. };
  188. for (const char** type = types; *type != nullptr; ++type)
  189. if (project->getExporters().getChildWithName (*type).isValid())
  190. return true;
  191. }
  192. return false;
  193. }
  194. //==============================================================================
  195. ProjectExporter::ProjectExporter (Project& p, const ValueTree& state)
  196. : settings (state),
  197. project (p),
  198. projectType (p.getProjectType()),
  199. projectName (p.getProjectNameString()),
  200. projectFolder (p.getProjectFolder()),
  201. targetLocationValue (settings, Ids::targetFolder, getUndoManager()),
  202. extraCompilerFlagsValue (settings, Ids::extraCompilerFlags, getUndoManager()),
  203. extraLinkerFlagsValue (settings, Ids::extraLinkerFlags, getUndoManager()),
  204. externalLibrariesValue (settings, Ids::externalLibraries, getUndoManager()),
  205. userNotesValue (settings, Ids::userNotes, getUndoManager()),
  206. gnuExtensionsValue (settings, Ids::enableGNUExtensions, getUndoManager()),
  207. bigIconValue (settings, Ids::bigIcon, getUndoManager()),
  208. smallIconValue (settings, Ids::smallIcon, getUndoManager()),
  209. extraPPDefsValue (settings, Ids::extraDefs, getUndoManager())
  210. {
  211. projectCompilerFlagSchemesValue = project.getProjectValue (Ids::compilerFlagSchemes);
  212. projectCompilerFlagSchemesValue.addListener (this);
  213. updateCompilerFlagValues();
  214. }
  215. ProjectExporter::~ProjectExporter()
  216. {
  217. }
  218. void ProjectExporter::updateDeprecatedProjectSettingsInteractively() {}
  219. String ProjectExporter::getName() const
  220. {
  221. if (! getAllDefaultBuildsFolders().contains (getTargetLocationString()))
  222. return name + " - " + getTargetLocationString();
  223. return name;
  224. }
  225. File ProjectExporter::getTargetFolder() const
  226. {
  227. return project.resolveFilename (getTargetLocationString());
  228. }
  229. RelativePath ProjectExporter::rebaseFromProjectFolderToBuildTarget (const RelativePath& path) const
  230. {
  231. return path.rebased (project.getProjectFolder(), getTargetFolder(), RelativePath::buildTargetFolder);
  232. }
  233. bool ProjectExporter::shouldFileBeCompiledByDefault (const File& file) const
  234. {
  235. return file.hasFileExtension (cOrCppFileExtensions)
  236. || file.hasFileExtension (asmFileExtensions);
  237. }
  238. void ProjectExporter::updateCompilerFlagValues()
  239. {
  240. compilerFlagSchemesMap.clear();
  241. for (auto& scheme : project.getCompilerFlagSchemes())
  242. compilerFlagSchemesMap.set (scheme, { settings, scheme, getUndoManager() });
  243. }
  244. //==============================================================================
  245. void ProjectExporter::createPropertyEditors (PropertyListBuilder& props)
  246. {
  247. if (! isCLion())
  248. {
  249. props.add (new TextPropertyComponent (targetLocationValue, "Target Project Folder", 2048, false),
  250. "The location of the folder in which the " + name + " project will be created. "
  251. "This path can be absolute, but it's much more sensible to make it relative to the jucer project directory.");
  252. if ((shouldBuildTargetType (ProjectType::Target::VSTPlugIn) && project.shouldBuildVST()) || (project.isVSTPluginHost() && supportsTargetType (ProjectType::Target::VSTPlugIn)))
  253. {
  254. props.add (new FilePathPropertyComponent (vstLegacyPathValueWrapper.wrappedValue, "VST (Legacy) SDK Folder", true,
  255. getTargetOSForExporter() == TargetOS::getThisOS(), "*", project.getProjectFolder()),
  256. "If you're building a VST plug-in or host, you can use this field to override the global VST (Legacy) SDK path with a project-specific path. "
  257. "This can be an absolute path, or a path relative to the Projucer project file.");
  258. }
  259. if ((shouldBuildTargetType (ProjectType::Target::VST3PlugIn) && project.shouldBuildVST3()) || (project.isVST3PluginHost() && supportsTargetType (ProjectType::Target::VST3PlugIn)))
  260. {
  261. props.add (new FilePathPropertyComponent (vst3PathValueWrapper.wrappedValue, "VST3 SDK Folder", true,
  262. getTargetOSForExporter() == TargetOS::getThisOS(), "*", project.getProjectFolder()),
  263. "If you're building a VST3 plug-in or host, you can use this field to override the global VST3 SDK path with a project-specific path. "
  264. "This can be an absolute path, or a path relative to the Projucer project file.");
  265. }
  266. if (shouldBuildTargetType (ProjectType::Target::AAXPlugIn) && project.shouldBuildAAX())
  267. {
  268. props.add (new FilePathPropertyComponent (aaxPathValueWrapper.wrappedValue, "AAX SDK Folder", true,
  269. getTargetOSForExporter() == TargetOS::getThisOS(), "*", project.getProjectFolder()),
  270. "If you're building an AAX plug-in, this must be the folder containing the AAX SDK. This can be an absolute path, or a path relative to the Projucer project file.");
  271. }
  272. if (shouldBuildTargetType (ProjectType::Target::RTASPlugIn) && project.shouldBuildRTAS())
  273. {
  274. props.add (new FilePathPropertyComponent (rtasPathValueWrapper.wrappedValue, "RTAS SDK Folder", true,
  275. getTargetOSForExporter() == TargetOS::getThisOS(), "*", project.getProjectFolder()),
  276. "If you're building an RTAS plug-in, this must be the folder containing the RTAS SDK. This can be an absolute path, or a path relative to the Projucer project file.");
  277. }
  278. props.add (new TextPropertyComponent (extraPPDefsValue, "Extra Preprocessor Definitions", 32768, true),
  279. "Extra preprocessor definitions. Use the form \"NAME1=value NAME2=value\", using whitespace, commas, "
  280. "or new-lines to separate the items - to include a space or comma in a definition, precede it with a backslash.");
  281. props.add (new TextPropertyComponent (extraCompilerFlagsValue, "Extra Compiler Flags", 8192, true),
  282. "Extra command-line flags to be passed to the compiler. This string can contain references to preprocessor definitions in the "
  283. "form ${NAME_OF_DEFINITION}, which will be replaced with their values.");
  284. for (HashMap<String, ValueWithDefault>::Iterator i (compilerFlagSchemesMap); i.next();)
  285. props.add (new TextPropertyComponent (compilerFlagSchemesMap.getReference (i.getKey()), "Compiler Flags for " + i.getKey().quoted(), 8192, false),
  286. "The exporter-specific compiler flags that will be added to files using this scheme.");
  287. props.add (new TextPropertyComponent (extraLinkerFlagsValue, "Extra Linker Flags", 8192, true),
  288. "Extra command-line flags to be passed to the linker. You might want to use this for adding additional libraries. "
  289. "This string can contain references to preprocessor definitions in the form ${NAME_OF_VALUE}, which will be replaced with their values.");
  290. props.add (new TextPropertyComponent (externalLibrariesValue, "External Libraries to Link", 8192, true),
  291. "Additional libraries to link (one per line). You should not add any platform specific decoration to these names. "
  292. "This string can contain references to preprocessor definitions in the form ${NAME_OF_VALUE}, which will be replaced with their values.");
  293. if (! isVisualStudio())
  294. props.add (new ChoicePropertyComponent (gnuExtensionsValue, "GNU Compiler Extensions"),
  295. "Enabling this will use the GNU C++ language standard variant for compilation.");
  296. createIconProperties (props);
  297. }
  298. createExporterProperties (props);
  299. props.add (new TextPropertyComponent (userNotesValue, "Notes", 32768, true),
  300. "Extra comments: This field is not used for code or project generation, it's just a space where you can express your thoughts.");
  301. }
  302. void ProjectExporter::createIconProperties (PropertyListBuilder& props)
  303. {
  304. OwnedArray<Project::Item> images;
  305. project.findAllImageItems (images);
  306. StringArray choices;
  307. Array<var> ids;
  308. choices.add ("<None>");
  309. ids.add (var());
  310. for (int i = 0; i < images.size(); ++i)
  311. {
  312. choices.add (images.getUnchecked(i)->getName());
  313. ids.add (images.getUnchecked(i)->getID());
  314. }
  315. props.add (new ChoicePropertyComponent (smallIconValue, "Icon (Small)", choices, ids),
  316. "Sets an icon to use for the executable.");
  317. props.add (new ChoicePropertyComponent (bigIconValue, "Icon (Large)", choices, ids),
  318. "Sets an icon to use for the executable.");
  319. }
  320. //==============================================================================
  321. void ProjectExporter::addSettingsForProjectType (const ProjectType& type)
  322. {
  323. addVSTPathsIfPluginOrHost();
  324. if (type.isAudioPlugin())
  325. addCommonAudioPluginSettings();
  326. addPlatformSpecificSettingsForProjectType (type);
  327. }
  328. void ProjectExporter::addVSTPathsIfPluginOrHost()
  329. {
  330. if (((shouldBuildTargetType (ProjectType::Target::VSTPlugIn) && project.shouldBuildVST()) || project.isVSTPluginHost())
  331. || ((shouldBuildTargetType (ProjectType::Target::VST3PlugIn) && project.shouldBuildVST3()) || project.isVST3PluginHost()))
  332. {
  333. addLegacyVSTFolderToPathIfSpecified();
  334. addVST3FolderToPath();
  335. }
  336. }
  337. void ProjectExporter::addCommonAudioPluginSettings()
  338. {
  339. if (shouldBuildTargetType (ProjectType::Target::AAXPlugIn))
  340. addAAXFoldersToPath();
  341. // Note: RTAS paths are platform-dependent, impl -> addPlatformSpecificSettingsForProjectType
  342. }
  343. void ProjectExporter::addLegacyVSTFolderToPathIfSpecified()
  344. {
  345. auto vstFolder = getVSTLegacyPathString();
  346. if (vstFolder.isNotEmpty())
  347. addToExtraSearchPaths (RelativePath (vstFolder, RelativePath::projectFolder), 0);
  348. }
  349. RelativePath ProjectExporter::getInternalVST3SDKPath()
  350. {
  351. return getModuleFolderRelativeToProject ("juce_audio_processors")
  352. .getChildFile ("format_types")
  353. .getChildFile ("VST3_SDK");
  354. }
  355. void ProjectExporter::addVST3FolderToPath()
  356. {
  357. auto vst3Folder = getVST3PathString();
  358. if (vst3Folder.isNotEmpty())
  359. addToExtraSearchPaths (RelativePath (vst3Folder, RelativePath::projectFolder), 0);
  360. else
  361. addToExtraSearchPaths (getInternalVST3SDKPath(), 0);
  362. }
  363. void ProjectExporter::addAAXFoldersToPath()
  364. {
  365. auto aaxFolder = getAAXPathString();
  366. if (aaxFolder.isNotEmpty())
  367. {
  368. RelativePath aaxFolderPath (aaxFolder, RelativePath::projectFolder);
  369. addToExtraSearchPaths (aaxFolderPath);
  370. addToExtraSearchPaths (aaxFolderPath.getChildFile ("Interfaces"));
  371. addToExtraSearchPaths (aaxFolderPath.getChildFile ("Interfaces").getChildFile ("ACF"));
  372. }
  373. }
  374. //==============================================================================
  375. StringPairArray ProjectExporter::getAllPreprocessorDefs (const BuildConfiguration& config, const ProjectType::Target::Type targetType) const
  376. {
  377. auto defs = mergePreprocessorDefs (config.getAllPreprocessorDefs(),
  378. parsePreprocessorDefs (getExporterPreprocessorDefsString()));
  379. addDefaultPreprocessorDefs (defs);
  380. addTargetSpecificPreprocessorDefs (defs, targetType);
  381. return defs;
  382. }
  383. StringPairArray ProjectExporter::getAllPreprocessorDefs() const
  384. {
  385. auto defs = mergePreprocessorDefs (project.getPreprocessorDefs(),
  386. parsePreprocessorDefs (getExporterPreprocessorDefsString()));
  387. addDefaultPreprocessorDefs (defs);
  388. return defs;
  389. }
  390. void ProjectExporter::addTargetSpecificPreprocessorDefs (StringPairArray& defs, const ProjectType::Target::Type targetType) const
  391. {
  392. std::pair<String, ProjectType::Target::Type> targetFlags[] = {
  393. {"JucePlugin_Build_VST", ProjectType::Target::VSTPlugIn},
  394. {"JucePlugin_Build_VST3", ProjectType::Target::VST3PlugIn},
  395. {"JucePlugin_Build_AU", ProjectType::Target::AudioUnitPlugIn},
  396. {"JucePlugin_Build_AUv3", ProjectType::Target::AudioUnitv3PlugIn},
  397. {"JucePlugin_Build_RTAS", ProjectType::Target::RTASPlugIn},
  398. {"JucePlugin_Build_AAX", ProjectType::Target::AAXPlugIn},
  399. {"JucePlugin_Build_Standalone", ProjectType::Target::StandalonePlugIn},
  400. {"JucePlugin_Build_Unity", ProjectType::Target::UnityPlugIn}
  401. };
  402. if (targetType == ProjectType::Target::SharedCodeTarget)
  403. {
  404. for (auto& flag : targetFlags)
  405. defs.set (flag.first, (shouldBuildTargetType (flag.second) ? "1" : "0"));
  406. defs.set ("JUCE_SHARED_CODE", "1");
  407. }
  408. else if (targetType != ProjectType::Target::unspecified)
  409. {
  410. for (auto& flag : targetFlags)
  411. defs.set (flag.first, (targetType == flag.second ? "1" : "0"));
  412. }
  413. }
  414. void ProjectExporter::addDefaultPreprocessorDefs (StringPairArray& defs) const
  415. {
  416. defs.set (getExporterIdentifierMacro(), "1");
  417. defs.set ("JUCE_APP_VERSION", project.getVersionString());
  418. defs.set ("JUCE_APP_VERSION_HEX", project.getVersionAsHex());
  419. }
  420. String ProjectExporter::replacePreprocessorTokens (const ProjectExporter::BuildConfiguration& config,
  421. const String& sourceString) const
  422. {
  423. return replacePreprocessorDefs (getAllPreprocessorDefs (config, ProjectType::Target::unspecified), sourceString);
  424. }
  425. void ProjectExporter::copyMainGroupFromProject()
  426. {
  427. jassert (itemGroups.size() == 0);
  428. itemGroups.add (project.getMainGroup().createCopy());
  429. }
  430. Project::Item& ProjectExporter::getModulesGroup()
  431. {
  432. if (modulesGroup == nullptr)
  433. {
  434. jassert (itemGroups.size() > 0); // must call copyMainGroupFromProject before this.
  435. itemGroups.add (Project::Item::createGroup (project, "JUCE Modules", "__modulesgroup__", true));
  436. modulesGroup = &(itemGroups.getReference (itemGroups.size() - 1));
  437. }
  438. return *modulesGroup;
  439. }
  440. void ProjectExporter::addProjectPathToBuildPathList (StringArray& pathList, const RelativePath& pathFromProjectFolder, int index) const
  441. {
  442. auto localPath = RelativePath (rebaseFromProjectFolderToBuildTarget (pathFromProjectFolder));
  443. auto path = isVisualStudio() ? localPath.toWindowsStyle() : localPath.toUnixStyle();
  444. if (! pathList.contains (path))
  445. pathList.insert (index, path);
  446. }
  447. void ProjectExporter::addToModuleLibPaths (const RelativePath& pathFromProjectFolder)
  448. {
  449. addProjectPathToBuildPathList (moduleLibSearchPaths, pathFromProjectFolder);
  450. }
  451. void ProjectExporter::addToExtraSearchPaths (const RelativePath& pathFromProjectFolder, int index)
  452. {
  453. addProjectPathToBuildPathList (extraSearchPaths, pathFromProjectFolder, index);
  454. }
  455. static var getStoredPathForModule (const String& id, const ProjectExporter& exp)
  456. {
  457. return getAppSettings().getStoredPath (isJUCEModule (id) ? Ids::defaultJuceModulePath : Ids::defaultUserModulePath,
  458. exp.getTargetOSForExporter()).get();
  459. }
  460. ValueWithDefault ProjectExporter::getPathForModuleValue (const String& moduleID)
  461. {
  462. auto* um = getUndoManager();
  463. auto paths = settings.getOrCreateChildWithName (Ids::MODULEPATHS, um);
  464. auto m = paths.getChildWithProperty (Ids::ID, moduleID);
  465. if (! m.isValid())
  466. {
  467. m = ValueTree (Ids::MODULEPATH);
  468. m.setProperty (Ids::ID, moduleID, um);
  469. paths.appendChild (m, um);
  470. }
  471. return { m, Ids::path, um, getStoredPathForModule (moduleID, *this) };
  472. }
  473. String ProjectExporter::getPathForModuleString (const String& moduleID) const
  474. {
  475. auto exporterPath = settings.getChildWithName (Ids::MODULEPATHS)
  476. .getChildWithProperty (Ids::ID, moduleID) [Ids::path].toString();
  477. if (exporterPath.isEmpty() || project.getEnabledModules().shouldUseGlobalPath (moduleID))
  478. return getStoredPathForModule (moduleID, *this);
  479. return exporterPath;
  480. }
  481. void ProjectExporter::removePathForModule (const String& moduleID)
  482. {
  483. auto paths = settings.getChildWithName (Ids::MODULEPATHS);
  484. auto m = paths.getChildWithProperty (Ids::ID, moduleID);
  485. paths.removeChild (m, project.getUndoManagerFor (settings));
  486. }
  487. TargetOS::OS ProjectExporter::getTargetOSForExporter() const
  488. {
  489. auto targetOS = TargetOS::unknown;
  490. if (isWindows()) targetOS = TargetOS::windows;
  491. else if (isOSX() || isiOS()) targetOS = TargetOS::osx;
  492. else if (isLinux()) targetOS = TargetOS::linux;
  493. else if (isAndroid() || isCLion()) targetOS = TargetOS::getThisOS();
  494. return targetOS;
  495. }
  496. RelativePath ProjectExporter::getModuleFolderRelativeToProject (const String& moduleID) const
  497. {
  498. if (project.getEnabledModules().shouldCopyModuleFilesLocally (moduleID))
  499. return RelativePath (project.getRelativePathForFile (project.getLocalModuleFolder (moduleID)),
  500. RelativePath::projectFolder);
  501. auto path = getPathForModuleString (moduleID);
  502. if (path.isEmpty())
  503. return getLegacyModulePath (moduleID).getChildFile (moduleID);
  504. return RelativePath (path, RelativePath::projectFolder).getChildFile (moduleID);
  505. }
  506. String ProjectExporter::getLegacyModulePath() const
  507. {
  508. return getSettingString ("juceFolder");
  509. }
  510. RelativePath ProjectExporter::getLegacyModulePath (const String& moduleID) const
  511. {
  512. if (project.getEnabledModules().shouldCopyModuleFilesLocally (moduleID))
  513. return RelativePath (project.getRelativePathForFile (project.getGeneratedCodeFolder()
  514. .getChildFile ("modules")
  515. .getChildFile (moduleID)), RelativePath::projectFolder);
  516. auto oldJucePath = getLegacyModulePath();
  517. if (oldJucePath.isEmpty())
  518. return RelativePath();
  519. RelativePath p (oldJucePath, RelativePath::projectFolder);
  520. if (p.getFileName() != "modules")
  521. p = p.getChildFile ("modules");
  522. return p.getChildFile (moduleID);
  523. }
  524. void ProjectExporter::updateOldModulePaths()
  525. {
  526. auto oldPath = getLegacyModulePath();
  527. if (oldPath.isNotEmpty())
  528. {
  529. for (int i = project.getEnabledModules().getNumModules(); --i >= 0;)
  530. {
  531. auto modID = project.getEnabledModules().getModuleID (i);
  532. getPathForModuleValue (modID) = getLegacyModulePath (modID).getParentDirectory().toUnixStyle();
  533. }
  534. settings.removeProperty ("juceFolder", nullptr);
  535. }
  536. }
  537. static bool areCompatibleExporters (const ProjectExporter& p1, const ProjectExporter& p2)
  538. {
  539. return (p1.isVisualStudio() && p2.isVisualStudio())
  540. || (p1.isXcode() && p2.isXcode())
  541. || (p1.isMakefile() && p2.isMakefile())
  542. || (p1.isAndroidStudio() && p2.isAndroidStudio())
  543. || (p1.isCodeBlocks() && p2.isCodeBlocks() && p1.isWindows() != p2.isLinux());
  544. }
  545. void ProjectExporter::createDefaultModulePaths()
  546. {
  547. for (Project::ExporterIterator exporter (project); exporter.next();)
  548. {
  549. if (areCompatibleExporters (*this, *exporter))
  550. {
  551. for (int i = project.getEnabledModules().getNumModules(); --i >= 0;)
  552. {
  553. auto modID = project.getEnabledModules().getModuleID (i);
  554. getPathForModuleValue (modID) = exporter->getPathForModuleValue (modID);
  555. }
  556. return;
  557. }
  558. }
  559. for (Project::ExporterIterator exporter (project); exporter.next();)
  560. {
  561. if (exporter->canLaunchProject())
  562. {
  563. for (int i = project.getEnabledModules().getNumModules(); --i >= 0;)
  564. {
  565. auto modID = project.getEnabledModules().getModuleID (i);
  566. getPathForModuleValue (modID) = exporter->getPathForModuleValue (modID);
  567. }
  568. return;
  569. }
  570. }
  571. for (int i = project.getEnabledModules().getNumModules(); --i >= 0;)
  572. {
  573. auto modID = project.getEnabledModules().getModuleID (i);
  574. getPathForModuleValue (modID) = "../../juce";
  575. }
  576. }
  577. //==============================================================================
  578. ValueTree ProjectExporter::getConfigurations() const
  579. {
  580. return settings.getChildWithName (Ids::CONFIGURATIONS);
  581. }
  582. int ProjectExporter::getNumConfigurations() const
  583. {
  584. return getConfigurations().getNumChildren();
  585. }
  586. ProjectExporter::BuildConfiguration::Ptr ProjectExporter::getConfiguration (int index) const
  587. {
  588. return createBuildConfig (getConfigurations().getChild (index));
  589. }
  590. bool ProjectExporter::hasConfigurationNamed (const String& nameToFind) const
  591. {
  592. auto configs = getConfigurations();
  593. for (int i = configs.getNumChildren(); --i >= 0;)
  594. if (configs.getChild(i) [Ids::name].toString() == nameToFind)
  595. return true;
  596. return false;
  597. }
  598. String ProjectExporter::getUniqueConfigName (String nm) const
  599. {
  600. auto nameRoot = nm;
  601. while (CharacterFunctions::isDigit (nameRoot.getLastCharacter()))
  602. nameRoot = nameRoot.dropLastCharacters (1);
  603. nameRoot = nameRoot.trim();
  604. int suffix = 2;
  605. while (hasConfigurationNamed (name))
  606. nm = nameRoot + " " + String (suffix++);
  607. return nm;
  608. }
  609. void ProjectExporter::addNewConfigurationFromExisting (const BuildConfiguration& configToCopy)
  610. {
  611. auto configs = getConfigurations();
  612. if (! configs.isValid())
  613. {
  614. settings.addChild (ValueTree (Ids::CONFIGURATIONS), 0, project.getUndoManagerFor (settings));
  615. configs = getConfigurations();
  616. }
  617. ValueTree newConfig (Ids::CONFIGURATION);
  618. newConfig = configToCopy.config.createCopy();
  619. newConfig.setProperty (Ids::name, configToCopy.getName(), nullptr);
  620. configs.appendChild (newConfig, project.getUndoManagerFor (configs));
  621. }
  622. void ProjectExporter::addNewConfiguration (bool isDebugConfig)
  623. {
  624. auto configs = getConfigurations();
  625. if (! configs.isValid())
  626. {
  627. settings.addChild (ValueTree (Ids::CONFIGURATIONS), 0, project.getUndoManagerFor (settings));
  628. configs = getConfigurations();
  629. }
  630. ValueTree newConfig (Ids::CONFIGURATION);
  631. newConfig.setProperty (Ids::isDebug, isDebugConfig, project.getUndoManagerFor (settings));
  632. configs.appendChild (newConfig, project.getUndoManagerFor (settings));
  633. }
  634. void ProjectExporter::BuildConfiguration::removeFromExporter()
  635. {
  636. ValueTree configs (config.getParent());
  637. configs.removeChild (config, project.getUndoManagerFor (configs));
  638. }
  639. void ProjectExporter::createDefaultConfigs()
  640. {
  641. settings.getOrCreateChildWithName (Ids::CONFIGURATIONS, nullptr);
  642. for (int i = 0; i < 2; ++i)
  643. {
  644. auto isDebug = i == 0;
  645. addNewConfiguration (isDebug);
  646. BuildConfiguration::Ptr config (getConfiguration (i));
  647. config->getValue (Ids::name) = (isDebug ? "Debug" : "Release");
  648. }
  649. }
  650. std::unique_ptr<Drawable> ProjectExporter::getBigIcon() const
  651. {
  652. return project.getMainGroup().findItemWithID (settings [Ids::bigIcon]).loadAsImageFile();
  653. }
  654. std::unique_ptr<Drawable> ProjectExporter::getSmallIcon() const
  655. {
  656. return project.getMainGroup().findItemWithID (settings [Ids::smallIcon]).loadAsImageFile();
  657. }
  658. Image ProjectExporter::getBestIconForSize (int size, bool returnNullIfNothingBigEnough) const
  659. {
  660. Drawable* im = nullptr;
  661. auto im1 = getSmallIcon();
  662. auto im2 = getBigIcon();
  663. if (im1 != nullptr && im2 != nullptr)
  664. {
  665. if (im1->getWidth() >= size && im2->getWidth() >= size)
  666. im = im1->getWidth() < im2->getWidth() ? im1.get() : im2.get();
  667. else if (im1->getWidth() >= size)
  668. im = im1.get();
  669. else if (im2->getWidth() >= size)
  670. im = im2.get();
  671. }
  672. else
  673. {
  674. im = im1 != nullptr ? im1.get() : im2.get();
  675. }
  676. if (im == nullptr)
  677. return {};
  678. if (returnNullIfNothingBigEnough && im->getWidth() < size && im->getHeight() < size)
  679. return {};
  680. return rescaleImageForIcon (*im, size);
  681. }
  682. Image ProjectExporter::rescaleImageForIcon (Drawable& d, const int size)
  683. {
  684. if (auto* drawableImage = dynamic_cast<DrawableImage*> (&d))
  685. {
  686. auto im = SoftwareImageType().convert (drawableImage->getImage());
  687. if (im.getWidth() == size && im.getHeight() == size)
  688. return im;
  689. // (scale it down in stages for better resampling)
  690. while (im.getWidth() > 2 * size && im.getHeight() > 2 * size)
  691. im = im.rescaled (im.getWidth() / 2,
  692. im.getHeight() / 2);
  693. Image newIm (Image::ARGB, size, size, true, SoftwareImageType());
  694. Graphics g (newIm);
  695. g.drawImageWithin (im, 0, 0, size, size,
  696. RectanglePlacement::centred | RectanglePlacement::onlyReduceInSize, false);
  697. return newIm;
  698. }
  699. Image im (Image::ARGB, size, size, true, SoftwareImageType());
  700. Graphics g (im);
  701. d.drawWithin (g, im.getBounds().toFloat(), RectanglePlacement::centred, 1.0f);
  702. return im;
  703. }
  704. //==============================================================================
  705. ProjectExporter::ConfigIterator::ConfigIterator (ProjectExporter& e)
  706. : index (-1), exporter (e)
  707. {
  708. }
  709. bool ProjectExporter::ConfigIterator::next()
  710. {
  711. if (++index >= exporter.getNumConfigurations())
  712. return false;
  713. config = exporter.getConfiguration (index);
  714. return true;
  715. }
  716. ProjectExporter::ConstConfigIterator::ConstConfigIterator (const ProjectExporter& exporter_)
  717. : index (-1), exporter (exporter_)
  718. {
  719. }
  720. bool ProjectExporter::ConstConfigIterator::next()
  721. {
  722. if (++index >= exporter.getNumConfigurations())
  723. return false;
  724. config = exporter.getConfiguration (index);
  725. return true;
  726. }
  727. //==============================================================================
  728. ProjectExporter::BuildConfiguration::BuildConfiguration (Project& p, const ValueTree& configNode, const ProjectExporter& e)
  729. : config (configNode), project (p), exporter (e),
  730. isDebugValue (config, Ids::isDebug, getUndoManager(), getValue (Ids::isDebug)),
  731. configNameValue (config, Ids::name, getUndoManager(), "Build Configuration"),
  732. targetNameValue (config, Ids::targetName, getUndoManager(), project.getProjectFilenameRootString()),
  733. targetBinaryPathValue (config, Ids::binaryPath, getUndoManager()),
  734. recommendedWarningsValue (config, Ids::recommendedWarnings, getUndoManager()),
  735. optimisationLevelValue (config, Ids::optimisation, getUndoManager()),
  736. linkTimeOptimisationValue (config, Ids::linkTimeOptimisation, getUndoManager(), ! isDebug()),
  737. ppDefinesValue (config, Ids::defines, getUndoManager()),
  738. headerSearchPathValue (config, Ids::headerPath, getUndoManager()),
  739. librarySearchPathValue (config, Ids::libraryPath, getUndoManager()),
  740. userNotesValue (config, Ids::userNotes, getUndoManager())
  741. {
  742. recommendedCompilerWarningFlags["LLVM"] = { "-Wall", "-Wshadow-all", "-Wshorten-64-to-32", "-Wstrict-aliasing", "-Wuninitialized", "-Wunused-parameter",
  743. "-Wconversion", "-Wsign-compare", "-Wint-conversion", "-Wconditional-uninitialized", "-Woverloaded-virtual",
  744. "-Wreorder", "-Wconstant-conversion", "-Wsign-conversion", "-Wunused-private-field", "-Wbool-conversion",
  745. "-Wextra-semi", "-Wunreachable-code", "-Wzero-as-null-pointer-constant", "-Wcast-align",
  746. "-Winconsistent-missing-destructor-override", "-Wshift-sign-overflow", "-Wnullable-to-nonnull-conversion",
  747. "-Wno-missing-field-initializers", "-Wno-ignored-qualifiers",
  748. "-Wswitch-enum"
  749. };
  750. recommendedCompilerWarningFlags["GCC"] = { "-Wall", "-Wextra", "-Wstrict-aliasing", "-Wuninitialized", "-Wunused-parameter", "-Wsign-compare",
  751. "-Woverloaded-virtual", "-Wreorder", "-Wsign-conversion", "-Wunreachable-code",
  752. "-Wzero-as-null-pointer-constant", "-Wcast-align", "-Wno-implicit-fallthrough",
  753. "-Wno-maybe-uninitialized", "-Wno-missing-field-initializers", "-Wno-ignored-qualifiers",
  754. "-Wswitch-enum", "-Wredundant-decls"
  755. };
  756. recommendedCompilerWarningFlags["GCC-7"] = recommendedCompilerWarningFlags["GCC"];
  757. recommendedCompilerWarningFlags["GCC-7"].add ("-Wno-strict-overflow");
  758. }
  759. ProjectExporter::BuildConfiguration::~BuildConfiguration()
  760. {
  761. }
  762. String ProjectExporter::BuildConfiguration::getGCCOptimisationFlag() const
  763. {
  764. switch (getOptimisationLevelInt())
  765. {
  766. case gccO0: return "0";
  767. case gccO1: return "1";
  768. case gccO2: return "2";
  769. case gccO3: return "3";
  770. case gccOs: return "s";
  771. case gccOfast: return "fast";
  772. default: break;
  773. }
  774. return "0";
  775. }
  776. void ProjectExporter::BuildConfiguration::addGCCOptimisationProperty (PropertyListBuilder& props)
  777. {
  778. props.add (new ChoicePropertyComponent (optimisationLevelValue, "Optimisation",
  779. { "-O0 (no optimisation)", "-Os (minimise code size)", "-O1 (fast)", "-O2 (faster)",
  780. "-O3 (fastest with safe optimisations)", "-Ofast (uses aggressive optimisations)" },
  781. { gccO0, gccOs, gccO1, gccO2, gccO3, gccOfast }),
  782. "The optimisation level for this configuration");
  783. }
  784. void ProjectExporter::BuildConfiguration::addRecommendedLinuxCompilerWarningsProperty (PropertyListBuilder& props)
  785. {
  786. props.add (new ChoicePropertyComponent (recommendedWarningsValue, "Add Recommended Compiler Warning Flags",
  787. { "GCC", "GCC 7 and below", "LLVM", "Disabled" },
  788. { "GCC", "GCC-7", "LLVM", "" }),
  789. "Enable this to add a set of recommended compiler warning flags.");
  790. recommendedWarningsValue.setDefault ("");
  791. }
  792. void ProjectExporter::BuildConfiguration::addRecommendedLLVMCompilerWarningsProperty (PropertyListBuilder& props)
  793. {
  794. props.add (new ChoicePropertyComponent (recommendedWarningsValue, "Add Recommended Compiler Warning Flags",
  795. { "Enabled", "Disabled" },
  796. { "LLVM", "" }),
  797. "Enable this to add a set of recommended compiler warning flags.");
  798. recommendedWarningsValue.setDefault ("");
  799. }
  800. StringArray ProjectExporter::BuildConfiguration::getRecommendedCompilerWarningFlags() const
  801. {
  802. auto label = recommendedWarningsValue.get().toString();
  803. auto it = recommendedCompilerWarningFlags.find (label);
  804. if (it != recommendedCompilerWarningFlags.end())
  805. return it->second;
  806. return {};
  807. }
  808. void ProjectExporter::BuildConfiguration::createPropertyEditors (PropertyListBuilder& props)
  809. {
  810. if (exporter.supportsUserDefinedConfigurations())
  811. props.add (new TextPropertyComponent (configNameValue, "Name", 96, false),
  812. "The name of this configuration.");
  813. props.add (new ChoicePropertyComponent (isDebugValue, "Debug Mode"),
  814. "If enabled, this means that the configuration should be built with debug symbols.");
  815. props.add (new TextPropertyComponent (targetNameValue, "Binary Name", 256, false),
  816. "The filename to use for the destination binary executable file. If you don't add a suffix to this name, "
  817. "a suitable platform-specific suffix will be added automatically.");
  818. props.add (new TextPropertyComponent (targetBinaryPathValue, "Binary Location", 1024, false),
  819. "The folder in which the finished binary should be placed. Leave this blank to cause the binary to be placed "
  820. "in its default location in the build folder.");
  821. props.addSearchPathProperty (headerSearchPathValue, "Header Search Paths", "Extra header search paths.");
  822. props.addSearchPathProperty (librarySearchPathValue, "Extra Library Search Paths", "Extra library search paths.");
  823. props.add (new TextPropertyComponent (ppDefinesValue, "Preprocessor Definitions", 32768, true),
  824. "Extra preprocessor definitions. Use the form \"NAME1=value NAME2=value\", using whitespace, commas, or "
  825. "new-lines to separate the items - to include a space or comma in a definition, precede it with a backslash.");
  826. props.add (new ChoicePropertyComponent (linkTimeOptimisationValue, "Link-Time Optimisation"),
  827. "Enable this to perform link-time code optimisation. This is recommended for release builds.");
  828. createConfigProperties (props);
  829. props.add (new TextPropertyComponent (userNotesValue, "Notes", 32768, true),
  830. "Extra comments: This field is not used for code or project generation, it's just a space where you can express your thoughts.");
  831. }
  832. StringPairArray ProjectExporter::BuildConfiguration::getAllPreprocessorDefs() const
  833. {
  834. return mergePreprocessorDefs (project.getPreprocessorDefs(),
  835. parsePreprocessorDefs (getBuildConfigPreprocessorDefsString()));
  836. }
  837. StringPairArray ProjectExporter::BuildConfiguration::getUniquePreprocessorDefs() const
  838. {
  839. auto perConfigurationDefs = parsePreprocessorDefs (getBuildConfigPreprocessorDefsString());
  840. auto globalDefs = project.getPreprocessorDefs();
  841. for (int i = 0; i < globalDefs.size(); ++i)
  842. {
  843. auto globalKey = globalDefs.getAllKeys()[i];
  844. int idx = perConfigurationDefs.getAllKeys().indexOf (globalKey);
  845. if (idx >= 0)
  846. {
  847. auto globalValue = globalDefs.getAllValues()[i];
  848. if (globalValue == perConfigurationDefs.getAllValues()[idx])
  849. perConfigurationDefs.remove (idx);
  850. }
  851. }
  852. return perConfigurationDefs;
  853. }
  854. StringArray ProjectExporter::BuildConfiguration::getHeaderSearchPaths() const
  855. {
  856. return getSearchPathsFromString (getHeaderSearchPathString() + ';' + project.getHeaderSearchPathsString());
  857. }
  858. StringArray ProjectExporter::BuildConfiguration::getLibrarySearchPaths() const
  859. {
  860. auto separator = exporter.isVisualStudio() ? "\\" : "/";
  861. auto s = getSearchPathsFromString (getLibrarySearchPathString());
  862. for (auto path : exporter.moduleLibSearchPaths)
  863. s.add (path + separator + getModuleLibraryArchName());
  864. return s;
  865. }
  866. String ProjectExporter::getExternalLibraryFlags (const BuildConfiguration& config) const
  867. {
  868. auto libraries = StringArray::fromTokens (getExternalLibrariesString(), ";\n", "\"'");
  869. libraries.removeEmptyStrings (true);
  870. if (libraries.size() != 0)
  871. return replacePreprocessorTokens (config, "-l" + libraries.joinIntoString (" -l")).trim();
  872. return {};
  873. }