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

  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. 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;
  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__