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.

115 lines
4.8KB

  1. /*
  2. ==============================================================================
  3. This file is part of the dRowAudio JUCE module
  4. Copyright 2004-13 by dRowAudio.
  5. ------------------------------------------------------------------------------
  6. dRowAudio is provided under the terms of The MIT License (MIT):
  7. Permission is hereby granted, free of charge, to any person obtaining a copy
  8. of this software and associated documentation files (the "Software"), to deal
  9. in the Software without restriction, including without limitation the rights
  10. to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  11. copies of the Software, and to permit persons to whom the Software is
  12. furnished to do so, subject to the following conditions:
  13. The above copyright notice and this permission notice shall be included in all
  14. copies or substantial portions of the Software.
  15. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  16. IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  17. FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  18. AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  19. LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  20. OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
  21. SOFTWARE.
  22. ==============================================================================
  23. */
  24. #ifndef __DROWAUDIO_UNITYBUILDER_H__
  25. #define __DROWAUDIO_UNITYBUILDER_H__
  26. //==============================================================================
  27. /**
  28. UnityBuilder class.
  29. This is a helper class used to generate "unity build" files for quick
  30. compilation of projects. This class will take a source directory, scan it
  31. for all .h and .cpp files and create two build files which simply include
  32. their contents. This is very similar to how the JUCE modular system works
  33. and can be used to include source files in other projects and drastically
  34. speed up build times.
  35. If you need to set custom defines or pragmas use the setPreAndPostString method.
  36. */
  37. class UnityBuilder
  38. {
  39. public:
  40. //==============================================================================
  41. /** Creates a default UnityBuilder.
  42. Use the processDirectory method to actually perform the file generation.
  43. If you need additional options call the other set-up methods before process
  44. processDirectory;
  45. */
  46. UnityBuilder();
  47. /** Destructor. */
  48. ~UnityBuilder();
  49. /** Processes a directory for all .h and .cpp files and generates a unity header
  50. and cpp file.
  51. If the destination file has not been set this will generate files in the
  52. source directory named UnityBuild.h and UnityBuild.cpp.
  53. Note that this will not delete any exisiting files, if the target files
  54. already exist non-existent ones will be created with numbers in brackets.
  55. @param sourceDirectory The source directory to "unify".
  56. */
  57. bool processDirectory (const File& sourceDirectory);
  58. /** Sets the location and name of the output unity build files.
  59. Note that the extension of this file is not taken into account and will
  60. always generate a header and cpp file if needed.
  61. @param newDestinationFile The output location for the unity build files.
  62. */
  63. void setDestinationFile (const File& newDestinationFile);
  64. /** Sets a number of files to ignore.
  65. This may be useful of you have some working files that you don't currently
  66. want included in the unity build.
  67. Note that these Files can be directories and if so none of their child
  68. files will be included.
  69. @param filesToIgnore An arry of files ot ignore.
  70. */
  71. void setFilesToIgnore (const Array<File>& filesToIgnore);
  72. /** This enables you to include a block of text before and after the source
  73. files. This can be handy if you need extra defines or pragmas.
  74. @param preInclusionString The text to include before the files.
  75. @param postInclusionString The text to include after the files.
  76. */
  77. void setPreAndPostString (const String& preInclusionString,
  78. const String& postInclusionString);
  79. private:
  80. //==============================================================================
  81. String preInclusionString, postInclusionString;
  82. Array<File> filesToIgnore;
  83. File destinationFile;
  84. //==============================================================================
  85. JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (UnityBuilder);
  86. };
  87. #endif // __DROWAUDIO_UNITYBUILDER_H__