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.

128 lines
5.6KB

  1. /*
  2. ==============================================================================
  3. This file is part of the JUCE library - "Jules' Utility Class Extensions"
  4. Copyright 2004-10 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_PROJECTEXPORTER_JUCEHEADER__
  19. #define __JUCER_PROJECTEXPORTER_JUCEHEADER__
  20. #include "../jucer_Headers.h"
  21. #include "jucer_Project.h"
  22. //==============================================================================
  23. class ProjectExporter
  24. {
  25. protected:
  26. //==============================================================================
  27. ProjectExporter (Project& project, const ValueTree& settings);
  28. public:
  29. virtual ~ProjectExporter();
  30. static int getNumExporters();
  31. static const StringArray getExporterNames();
  32. static ProjectExporter* createNewExporter (Project& project, const int index);
  33. static ProjectExporter* createExporter (Project& project, const ValueTree& settings);
  34. static ProjectExporter* createPlatformDefaultExporter (Project& project);
  35. //=============================================================================
  36. virtual bool isDefaultFormatForCurrentOS() = 0;
  37. virtual bool isPossibleForCurrentProject() = 0;
  38. virtual bool usesMMFiles() const = 0;
  39. virtual void createPropertyEditors (Array <PropertyComponent*>& props);
  40. virtual void launchProject() = 0;
  41. virtual const String create() = 0;
  42. virtual bool shouldFileBeCompiledByDefault (const RelativePath& path) const;
  43. //==============================================================================
  44. const String getName() const { return name; }
  45. const File getTargetFolder() const;
  46. const ValueTree& getSettings() const { return settings; }
  47. Value getSetting (const Identifier& name_) const { return settings.getPropertyAsValue (name_, project.getUndoManagerFor (settings)); }
  48. Value getJuceFolder() const { return getSetting (Ids::juceFolder); }
  49. Value getTargetLocation() const { return getSetting (Ids::targetFolder); }
  50. Value getVSTFolder() const { return getSetting (Ids::vstFolder); }
  51. Value getRTASFolder() const { return getSetting (Ids::rtasFolder); }
  52. Value getAUFolder() const { return getSetting (Ids::auFolder); }
  53. bool isVST() const { return (bool) project.isAudioPlugin() && (bool) project.shouldBuildVST().getValue(); }
  54. bool isRTAS() const { return (bool) project.isAudioPlugin() && (bool) project.shouldBuildRTAS().getValue(); }
  55. bool isAU() const { return (bool) project.isAudioPlugin() && (bool) project.shouldBuildAU().getValue(); }
  56. Value getExtraCompilerFlags() const { return getSetting (Ids::extraCompilerFlags); }
  57. Value getExtraLinkerFlags() const { return getSetting (Ids::extraLinkerFlags); }
  58. Value getExporterPreprocessorDefs() const { return getSetting (Ids::extraDefs); }
  59. const StringPairArray getAllPreprocessorDefs (const Project::BuildConfiguration& config) const; // includes inherited ones..
  60. const String replacePreprocessorTokens (const Project::BuildConfiguration& config,
  61. const String& sourceString) const;
  62. // This adds the quotes, and may return angle-brackets, eg: <foo/bar.h> or normal quotes.
  63. const String getIncludePathForFileInJuceFolder (const String& pathFromJuceFolder, const File& targetIncludeFile) const;
  64. const String getExporterIdentifierMacro() const
  65. {
  66. return "JUCER_" + settings.getType() + "_"
  67. + String::toHexString (settings [Ids::targetFolder].toString().hashCode()).toUpperCase();
  68. }
  69. Array<RelativePath> juceWrapperFiles;
  70. RelativePath juceWrapperFolder;
  71. protected:
  72. //==============================================================================
  73. Project& project;
  74. ValueTree settings;
  75. String name;
  76. const RelativePath getJucePathFromTargetFolder() const;
  77. const String getDefaultBuildsRootFolder() const { return "Builds/"; }
  78. const Array<RelativePath> getVSTFilesRequired() const;
  79. static const String getLibbedFilename (String name)
  80. {
  81. if (! name.startsWith ("lib"))
  82. name = "lib" + name;
  83. if (! name.endsWithIgnoreCase (".a"))
  84. name = name + ".a";
  85. return name;
  86. }
  87. const RelativePath rebaseFromProjectFolderToBuildTarget (const RelativePath& path) const;
  88. private:
  89. ProjectExporter (const ProjectExporter&);
  90. ProjectExporter& operator= (const ProjectExporter&);
  91. };
  92. #endif // __JUCER_PROJECTEXPORTER_JUCEHEADER__