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.

153 lines
5.7KB

  1. /*
  2. ==============================================================================
  3. This file is part of the JUCE library.
  4. Copyright (c) 2013 - Raw Material Software Ltd.
  5. Permission is granted to use this software under the terms of either:
  6. a) the GPL v2 (or any later version)
  7. b) the Affero GPL v3
  8. Details of these licenses can be found at: www.gnu.org/licenses
  9. JUCE is distributed in the hope that it will be useful, but WITHOUT ANY
  10. WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
  11. A PARTICULAR PURPOSE. See the GNU General Public License for more details.
  12. ------------------------------------------------------------------------------
  13. To release a closed-source product which uses JUCE, commercial licenses are
  14. available: visit www.juce.com for more information.
  15. ==============================================================================
  16. */
  17. #ifndef __JUCER_MODULE_JUCEHEADER__
  18. #define __JUCER_MODULE_JUCEHEADER__
  19. #include "../jucer_Headers.h"
  20. #include "jucer_Project.h"
  21. class ProjectExporter;
  22. class ProjectSaver;
  23. //==============================================================================
  24. class LibraryModule
  25. {
  26. public:
  27. LibraryModule (const File& file);
  28. LibraryModule (const var& moduleInfo);
  29. bool isValid() const;
  30. String getID() const { return moduleInfo ["id"].toString(); }
  31. String getVersion() const { return moduleInfo ["version"].toString(); }
  32. String getName() const { return moduleInfo ["name"].toString(); }
  33. String getDescription() const { return moduleInfo ["description"].toString(); }
  34. String getLicense() const { return moduleInfo ["license"].toString(); }
  35. const File& getFolder() const { return moduleFolder; }
  36. void writeIncludes (ProjectSaver&, OutputStream&);
  37. void prepareExporter (ProjectExporter&, ProjectSaver&) const;
  38. void createPropertyEditors (ProjectExporter&, PropertyListBuilder&) const;
  39. void getConfigFlags (Project&, OwnedArray<Project::ConfigFlag>& flags) const;
  40. void getLocalCompiledFiles (const File& localModuleFolder, Array<File>& files) const;
  41. void findBrowseableFiles (const File& localModuleFolder, Array<File>& files) const;
  42. File getLocalFolderFor (Project&) const;
  43. static String getInfoFileName() { return "juce_module_info"; }
  44. var moduleInfo;
  45. private:
  46. File moduleFile, moduleFolder;
  47. mutable Array<File> sourceFiles;
  48. File getInclude (const File& folder) const;
  49. static bool fileTargetMatches (ProjectExporter& exporter, const String& target);
  50. struct FileSorter
  51. {
  52. static int compareElements (const File& f1, const File& f2)
  53. {
  54. return f1.getFileName().compareIgnoreCase (f2.getFileName());
  55. }
  56. };
  57. void findWildcardMatches (const File& localModuleFolder, const String& wildcardPath, Array<File>& result) const;
  58. void findAndAddCompiledCode (ProjectExporter&, ProjectSaver&, const File& localModuleFolder, Array<File>& result) const;
  59. void addBrowsableCode (ProjectExporter&, const Array<File>& compiled, const File& localModuleFolder) const;
  60. void createLocalHeaderWrapper (ProjectSaver&, const File& originalHeader, const File& localHeader) const;
  61. RelativePath getModuleRelativeToProject (ProjectExporter&) const;
  62. RelativePath getModuleOrLocalCopyRelativeToProject (ProjectExporter&, const File& localModuleFolder) const;
  63. bool isPluginClient() const;
  64. bool isAUPluginHost (const Project&) const;
  65. bool isVSTPluginHost (const Project&) const;
  66. };
  67. //==============================================================================
  68. class ModuleList
  69. {
  70. public:
  71. ModuleList();
  72. ModuleList (const ModuleList&);
  73. ModuleList& operator= (const ModuleList&);
  74. //==============================================================================
  75. Result rescan (const File& newModulesFolder);
  76. void rescan();
  77. File getModulesFolder() const { return moduleFolder; }
  78. bool loadFromWebsite();
  79. LibraryModule* loadModule (const String& uid) const;
  80. void getDependencies (const String& moduleID, StringArray& dependencies) const;
  81. void createDependencies (const String& moduleID, OwnedArray<LibraryModule>& modules) const;
  82. //==============================================================================
  83. struct Module
  84. {
  85. LibraryModule* create() const;
  86. String uid, version, name, description, license;
  87. File file;
  88. URL url;
  89. bool operator== (const Module&) const;
  90. bool operator!= (const Module&) const;
  91. };
  92. const Module* findModuleInfo (const String& uid) const;
  93. bool operator== (const ModuleList&) const;
  94. //==============================================================================
  95. static bool isJuceFolder (const File& folder);
  96. static bool isModulesFolder (const File& folder);
  97. static bool isJuceOrModulesFolder (const File& folder);
  98. static File getDefaultModulesFolder (Project*);
  99. static bool isLocalModulesFolderValid();
  100. static bool isLibraryNewerThanIntrojucer();
  101. static File getLocalModulesFolder (Project*);
  102. static void setLocalModulesFolder (const File& newFile);
  103. static File getModulesFolderForJuceOrModulesFolder (const File& f);
  104. static File getModulesFolderForExporter (const ProjectExporter&);
  105. StringArray getExtraDependenciesNeeded (Project&, const Module&);
  106. //==============================================================================
  107. OwnedArray<Module> modules;
  108. private:
  109. File moduleFolder;
  110. void sort();
  111. };
  112. #endif // __JUCER_MODULE_JUCEHEADER__