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.

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