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.7KB

  1. /*
  2. ==============================================================================
  3. This file is part of the JUCE library - "Jules' Utility Class Extensions"
  4. Copyright 2004-11 by Raw Material Software Ltd.
  5. ------------------------------------------------------------------------------
  6. JUCE can be redistributed and/or modified under the terms of the GNU General
  7. Public License (Version 2), as published by the Free Software Foundation.
  8. A copy of the license is included in the JUCE distribution, or can be found
  9. online at www.gnu.org/licenses.
  10. JUCE is distributed in the hope that it will be useful, but WITHOUT ANY
  11. WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
  12. A PARTICULAR PURPOSE. See the GNU General Public License for more details.
  13. ------------------------------------------------------------------------------
  14. To release a closed-source product which uses JUCE, commercial licenses are
  15. available: visit www.rawmaterialsoftware.com/juce for more information.
  16. ==============================================================================
  17. */
  18. #ifndef __JUCER_MODULE_JUCEHEADER__
  19. #define __JUCER_MODULE_JUCEHEADER__
  20. #include "../jucer_Headers.h"
  21. #include "jucer_Project.h"
  22. class ProjectExporter;
  23. class ProjectSaver;
  24. //==============================================================================
  25. class LibraryModule
  26. {
  27. public:
  28. LibraryModule (const File& file);
  29. LibraryModule (const var& moduleInfo);
  30. bool isValid() const;
  31. String getID() const { return moduleInfo ["id"].toString(); }
  32. String getVersion() const { return moduleInfo ["version"].toString(); }
  33. String getName() const { return moduleInfo ["name"].toString(); }
  34. String getDescription() const { return moduleInfo ["description"].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 (Array<File>& files) const;
  41. static String getInfoFileName() { return "juce_module_info"; }
  42. var moduleInfo;
  43. private:
  44. File moduleFile, moduleFolder;
  45. mutable Array<File> sourceFiles;
  46. File getInclude (const File& folder) const;
  47. File getLocalIncludeFolder (ProjectSaver& projectSaver) 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. void rescan (const File& newModulesFolder);
  75. void rescan();
  76. File getModulesFolder() const { return moduleFolder; }
  77. File getModuleFolder (const String& uid) const;
  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;
  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 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__