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.

80 lines
3.3KB

  1. /*
  2. ==============================================================================
  3. This file is part of the JUCE 6 technical preview.
  4. Copyright (c) 2020 - Raw Material Software Limited
  5. You may use this code under the terms of the GPL v3
  6. (see www.gnu.org/licenses).
  7. For this technical preview, this file is not subject to commercial licensing.
  8. JUCE IS PROVIDED "AS IS" WITHOUT ANY WARRANTY, AND ALL WARRANTIES, WHETHER
  9. EXPRESSED OR IMPLIED, INCLUDING MERCHANTABILITY AND FITNESS FOR PURPOSE, ARE
  10. DISCLAIMED.
  11. ==============================================================================
  12. */
  13. #pragma once
  14. #include "../Helpers/jucer_MiscUtilities.h"
  15. #include "../../Project/Modules/jucer_AvailableModulesList.h"
  16. //==============================================================================
  17. class PIPGenerator
  18. {
  19. public:
  20. PIPGenerator (const File& pipFile, const File& outputDirectory = {},
  21. const File& pathToJUCEModules = {}, const File& pathToUserModules = {});
  22. //==============================================================================
  23. bool hasValidPIP() const noexcept { return ! metadata[Ids::name].toString().isEmpty(); }
  24. File getJucerFile() noexcept { return outputDirectory.getChildFile (metadata[Ids::name].toString() + ".jucer"); }
  25. File getPIPFile() noexcept { return useLocalCopy ? outputDirectory.getChildFile ("Source").getChildFile (pipFile.getFileName()) : pipFile; }
  26. String getMainClassName() const noexcept { return metadata[Ids::mainClass]; }
  27. File getOutputDirectory() const noexcept { return outputDirectory; }
  28. //==============================================================================
  29. Result createJucerFile();
  30. Result createMainCpp();
  31. private:
  32. //==============================================================================
  33. void addFileToTree (ValueTree& groupTree, const String& name, bool compile, const String& path);
  34. void createFiles (ValueTree& jucerTree);
  35. ValueTree createModulePathChild (const String& moduleID);
  36. ValueTree createBuildConfigChild (bool isDebug);
  37. ValueTree createExporterChild (const String& exporterName);
  38. ValueTree createModuleChild (const String& moduleID);
  39. void addExporters (ValueTree& jucerTree);
  40. void addModules (ValueTree& jucerTree);
  41. Result setProjectSettings (ValueTree& jucerTree);
  42. void setModuleFlags (ValueTree& jucerTree);
  43. String getMainFileTextForType();
  44. //==============================================================================
  45. Array<File> replaceRelativeIncludesAndGetFilesToMove();
  46. bool copyRelativeFileToLocalSourceDirectory (const File&) const noexcept;
  47. StringArray getExtraPluginFormatsToBuild() const;
  48. String getPathForModule (const String&) const;
  49. File getExamplesDirectory() const;
  50. //==============================================================================
  51. File pipFile, outputDirectory, juceModulesPath, userModulesPath;
  52. std::unique_ptr<AvailableModulesList> availableUserModules;
  53. var metadata;
  54. bool isTemp = false, useLocalCopy = false;
  55. JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (PIPGenerator)
  56. };