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.

152 lines
5.6KB

  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. const File& getFolder() const { return moduleFolder; }
  35. void writeIncludes (ProjectSaver&, OutputStream&);
  36. void prepareExporter (ProjectExporter&, ProjectSaver&) const;
  37. void createPropertyEditors (ProjectExporter&, PropertyListBuilder&) const;
  38. void getConfigFlags (Project&, OwnedArray<Project::ConfigFlag>& flags) const;
  39. void getLocalCompiledFiles (const File& localModuleFolder, Array<File>& files) const;
  40. void findBrowseableFiles (const File& localModuleFolder, Array<File>& files) const;
  41. File getLocalFolderFor (Project&) const;
  42. static String getInfoFileName() { return "juce_module_info"; }
  43. var moduleInfo;
  44. private:
  45. File moduleFile, moduleFolder;
  46. mutable Array<File> sourceFiles;
  47. File getInclude (const File& folder) const;
  48. static bool fileTargetMatches (ProjectExporter& exporter, const String& target);
  49. struct FileSorter
  50. {
  51. static int compareElements (const File& f1, const File& f2)
  52. {
  53. return f1.getFileName().compareIgnoreCase (f2.getFileName());
  54. }
  55. };
  56. void findWildcardMatches (const File& localModuleFolder, const String& wildcardPath, Array<File>& result) const;
  57. void findAndAddCompiledCode (ProjectExporter&, ProjectSaver&, const File& localModuleFolder, Array<File>& result) const;
  58. void addBrowsableCode (ProjectExporter&, const Array<File>& compiled, const File& localModuleFolder) const;
  59. void createLocalHeaderWrapper (ProjectSaver&, const File& originalHeader, const File& localHeader) const;
  60. RelativePath getModuleRelativeToProject (ProjectExporter&) const;
  61. RelativePath getModuleOrLocalCopyRelativeToProject (ProjectExporter&, const File& localModuleFolder) const;
  62. bool isPluginClient() const;
  63. bool isAUPluginHost (const Project&) const;
  64. bool isVSTPluginHost (const Project&) const;
  65. };
  66. //==============================================================================
  67. class ModuleList
  68. {
  69. public:
  70. ModuleList();
  71. ModuleList (const ModuleList&);
  72. ModuleList& operator= (const ModuleList&);
  73. //==============================================================================
  74. Result rescan (const File& newModulesFolder);
  75. void rescan();
  76. File getModulesFolder() const { return moduleFolder; }
  77. bool loadFromWebsite();
  78. LibraryModule* loadModule (const String& uid) const;
  79. void getDependencies (const String& moduleID, StringArray& dependencies) const;
  80. void createDependencies (const String& moduleID, OwnedArray<LibraryModule>& modules) const;
  81. //==============================================================================
  82. struct Module
  83. {
  84. LibraryModule* create() const;
  85. String uid, version, name, description;
  86. File file;
  87. URL url;
  88. bool operator== (const Module&) const;
  89. bool operator!= (const Module&) const;
  90. };
  91. const Module* findModuleInfo (const String& uid) const;
  92. bool operator== (const ModuleList&) const;
  93. //==============================================================================
  94. static bool isJuceFolder (const File& folder);
  95. static bool isModulesFolder (const File& folder);
  96. static bool isJuceOrModulesFolder (const File& folder);
  97. static File getDefaultModulesFolder (Project*);
  98. static bool isLocalModulesFolderValid();
  99. static bool isLibraryNewerThanIntrojucer();
  100. static File getLocalModulesFolder (Project*);
  101. static void setLocalModulesFolder (const File& newFile);
  102. static File getModulesFolderForJuceOrModulesFolder (const File& f);
  103. static File getModulesFolderForExporter (const ProjectExporter&);
  104. StringArray getExtraDependenciesNeeded (Project&, const Module&);
  105. //==============================================================================
  106. OwnedArray<Module> modules;
  107. private:
  108. File moduleFolder;
  109. void sort();
  110. };
  111. #endif // __JUCER_MODULE_JUCEHEADER__