BsBuildManager.h 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100
  1. //********************************** Banshee Engine (www.banshee3d.com) **************************************************//
  2. //**************** Copyright (c) 2016 Marko Pintera ([email protected]). All rights reserved. **********************//
  3. #pragma once
  4. #include "BsEditorPrerequisites.h"
  5. #include "Reflection/BsIReflectable.h"
  6. #include "Utility/BsModule.h"
  7. #include "Build/BsPlatformInfo.h"
  8. namespace bs
  9. {
  10. /** @addtogroup Build
  11. * @{
  12. */
  13. /** Contains build information for a specific platform to be used by the build manager. */
  14. class BS_ED_EXPORT BuildData : public IReflectable
  15. {
  16. public:
  17. BuildData();
  18. PlatformType activePlatform;
  19. Vector<SPtr<PlatformInfo>> platformData;
  20. /************************************************************************/
  21. /* RTTI */
  22. /************************************************************************/
  23. public:
  24. friend class BuildDataRTTI;
  25. static RTTITypeBase* getRTTIStatic();
  26. RTTITypeBase* getRTTI() const override;
  27. };
  28. /** Types of various folders used by the build manager. */
  29. enum class BuildFolder
  30. {
  31. SourceRoot, /**< Absolute path to the root folder where all the prebuilt binaries and data exist. */
  32. DestinationRoot, /**< Absolute path to the root folder for a build for a specific platform. */
  33. NativeBinaries, /**< Folder where native binaries are stored. Relative to root. */
  34. BansheeReleaseAssemblies, /**< Folder where Banshee specific release assemblies are stored. Relative to root. */
  35. BansheeDebugAssemblies, /**< Folder where Banshee specific debug assemblies are stored. Relative to root. */
  36. Data /**< Folder where builtin data is stored. Relative to root. */
  37. };
  38. /** Handles building of the game executable and related files. */
  39. class BS_ED_EXPORT BuildManager : public Module<BuildManager>
  40. {
  41. public:
  42. BuildManager();
  43. /** Returns a list of available platforms the executable can be built for. */
  44. const Vector<PlatformType>& getAvailablePlatforms() const;
  45. /** Returns the currently active platform. */
  46. PlatformType getActivePlatform() const;
  47. /** Changes the active build platform. Might cause asset reimport. */
  48. void setActivePlatform(PlatformType type);
  49. /** Gets stored build setting for the active platform. */
  50. SPtr<PlatformInfo> getActivePlatformInfo() const;
  51. /** Gets stored build setting for a specific platform. */
  52. SPtr<PlatformInfo> getPlatformInfo(PlatformType type) const;
  53. /** Returns a list of file names (without extension) of all .NET assemblies required for a specific platform. */
  54. Vector<String> getFrameworkAssemblies(PlatformType type) const;
  55. /** Returns a list names of all native binaries required for a specific platform. */
  56. Vector<Path> getNativeBinaries(PlatformType type) const;
  57. /**
  58. * Returns a path to a specific folder used in the build process. See entries of BuildFolder enum for explanations
  59. * of individual folder types.
  60. */
  61. Path getBuildFolder(BuildFolder folder, PlatformType platform) const;
  62. /** Returns the absolute path of the pre-built executable for the specified platform. */
  63. Path getMainExecutable(PlatformType type) const;
  64. /** Returns a list of script defines for a specific platform. */
  65. String getDefines(PlatformType type) const;
  66. /** Stores build settings for all platforms in the specified file. */
  67. void save(const Path& outFile);
  68. /** Loads a previously stored list of build settings. */
  69. void load(const Path& inFile);
  70. /** Clears currently active build settings. */
  71. void clear();
  72. private:
  73. static const char* BUILD_FOLDER_NAME;
  74. SPtr<BuildData> mBuildData;
  75. };
  76. /** @} */
  77. }