BsBuildManager.h 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123
  1. #pragma once
  2. #include "BsEditorPrerequisites.h"
  3. #include "BsIReflectable.h"
  4. #include "BsModule.h"
  5. #include "BsPlatformInfo.h"
  6. namespace BansheeEngine
  7. {
  8. /**
  9. * @brief Contains build information for a specific platform to be
  10. * used by the build manager.
  11. */
  12. class BS_ED_EXPORT BuildData : public IReflectable
  13. {
  14. public:
  15. BuildData();
  16. PlatformType activePlatform;
  17. Vector<SPtr<PlatformInfo>> platformData;
  18. /************************************************************************/
  19. /* RTTI */
  20. /************************************************************************/
  21. public:
  22. friend class BuildDataRTTI;
  23. static RTTITypeBase* getRTTIStatic();
  24. virtual RTTITypeBase* getRTTI() const override;
  25. };
  26. /**
  27. * @brief Types of various folders used by the build manager.
  28. */
  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. /**
  39. * @brief Handles building of the game executable and related files.
  40. */
  41. class BS_ED_EXPORT BuildManager : public Module<BuildManager>
  42. {
  43. public:
  44. BuildManager();
  45. /**
  46. * @brief Returns a list of available platforms the executable can be built for.
  47. */
  48. const Vector<PlatformType>& getAvailablePlatforms() const;
  49. /**
  50. * @brief Returns the currently active platform.
  51. */
  52. PlatformType getActivePlatform() const;
  53. /**
  54. * @brief Changes the active build platform. Might cause asset reimport.
  55. */
  56. void setActivePlatform(PlatformType type);
  57. /**
  58. * @brief Gets stored build setting for the active platform.
  59. */
  60. SPtr<PlatformInfo> getActivePlatformInfo() const;
  61. /**
  62. * @brief Gets stored build setting for a specific platform.
  63. */
  64. SPtr<PlatformInfo> getPlatformInfo(PlatformType type) const;
  65. /**
  66. * @brief Returns a list of file names (without extension) of all .NET assemblies required for a specific platform.
  67. */
  68. Vector<WString> getFrameworkAssemblies(PlatformType type) const;
  69. /**
  70. * @brief Returns a list names of all native binaries required for a specific platform.
  71. */
  72. Vector<Path> getNativeBinaries(PlatformType type) const;
  73. /**
  74. * @brief Returns a path to a specific folder used in the build process. See entries of
  75. * BuildFolder enum for explanations of individual folder types.
  76. */
  77. Path getBuildFolder(BuildFolder folder, PlatformType platform) const;
  78. /**
  79. * @brief Returns the absolute path of the pre-built executable for the specified platform.
  80. */
  81. Path getMainExecutable(PlatformType type) const;
  82. /**
  83. * @brief Returns a list of script defines for a specific platform.
  84. */
  85. WString getDefines(PlatformType type) const;
  86. /**
  87. * @brief Stores build settings for all platforms in the specified file.
  88. */
  89. void save(const Path& outFile);
  90. /**
  91. * @brief Loads a previously stored list of build settings.
  92. */
  93. void load(const Path& inFile);
  94. /**
  95. * @brief Clears currently active build settings.
  96. */
  97. void clear();
  98. private:
  99. static const WString BUILD_FOLDER_NAME;
  100. SPtr<BuildData> mBuildData;
  101. };
  102. }