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.

88 lines
3.6KB

  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. #pragma once
  19. #include "../Helpers/jucer_MiscUtilities.h"
  20. #include "../../Project/Modules/jucer_AvailableModulesList.h"
  21. //==============================================================================
  22. class PIPGenerator
  23. {
  24. public:
  25. PIPGenerator (const File& pipFile, const File& outputDirectory = {},
  26. const File& pathToJUCEModules = {}, const File& pathToUserModules = {});
  27. //==============================================================================
  28. bool hasValidPIP() const noexcept { return ! metadata[Ids::name].toString().isEmpty(); }
  29. File getJucerFile() const noexcept { return outputDirectory.getChildFile (metadata[Ids::name].toString() + ".jucer"); }
  30. File getPIPFile() const noexcept { return useLocalCopy ? outputDirectory.getChildFile ("Source").getChildFile (pipFile.getFileName()) : pipFile; }
  31. String getMainClassName() const noexcept { return metadata[Ids::mainClass]; }
  32. File getOutputDirectory() const noexcept { return outputDirectory; }
  33. //==============================================================================
  34. Result createJucerFile();
  35. Result createMainCpp();
  36. private:
  37. //==============================================================================
  38. void addFileToTree (ValueTree& groupTree, const String& name, bool compile, const String& path);
  39. void createFiles (ValueTree& jucerTree);
  40. String getDocumentControllerClass() const;
  41. ValueTree createModulePathChild (const String& moduleID);
  42. ValueTree createBuildConfigChild (bool isDebug);
  43. ValueTree createExporterChild (const Identifier& exporterIdentifier);
  44. ValueTree createModuleChild (const String& moduleID);
  45. void addExporters (ValueTree& jucerTree);
  46. void addModules (ValueTree& jucerTree);
  47. Result setProjectSettings (ValueTree& jucerTree);
  48. void setModuleFlags (ValueTree& jucerTree);
  49. String getMainFileTextForType();
  50. //==============================================================================
  51. Array<File> replaceRelativeIncludesAndGetFilesToMove();
  52. bool copyRelativeFileToLocalSourceDirectory (const File&) const noexcept;
  53. StringArray getExtraPluginFormatsToBuild() const;
  54. String getPathForModule (const String&) const;
  55. File getExamplesDirectory() const;
  56. //==============================================================================
  57. File pipFile, outputDirectory, juceModulesPath, userModulesPath;
  58. std::unique_ptr<AvailableModulesList> availableUserModules;
  59. var metadata;
  60. bool isTemp = false, useLocalCopy = false;
  61. JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (PIPGenerator)
  62. };