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.

151 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 (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 File getLocalModulesFolder (Project*);
  100. static void setLocalModulesFolder (const File& newFile);
  101. static File getModulesFolderForJuceOrModulesFolder (const File& f);
  102. static File getModulesFolderForExporter (const ProjectExporter&);
  103. StringArray getExtraDependenciesNeeded (Project&, const Module&);
  104. //==============================================================================
  105. OwnedArray<Module> modules;
  106. private:
  107. File moduleFolder;
  108. void sort();
  109. };
  110. #endif // __JUCER_MODULE_JUCEHEADER__