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.

1130 lines
47KB

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