BsBuildManager.h 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122
  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. BansheeAssemblies, /**< Folder where Banshee specific assemblies are stored. Relative to root. */
  35. Data /**< Folder where builtin data is stored. Relative to root. */
  36. };
  37. /**
  38. * @brief Handles building of the game executable and related files.
  39. */
  40. class BS_ED_EXPORT BuildManager : public Module<BuildManager>
  41. {
  42. public:
  43. BuildManager();
  44. /**
  45. * @brief Returns a list of available platforms the executable can be built for.
  46. */
  47. const Vector<PlatformType>& getAvailablePlatforms() const;
  48. /**
  49. * @brief Returns the currently active platform.
  50. */
  51. PlatformType getActivePlatform() const;
  52. /**
  53. * @brief Changes the active build platform. Might cause asset reimport.
  54. */
  55. void setActivePlatform(PlatformType type);
  56. /**
  57. * @brief Gets stored build setting for the active platform.
  58. */
  59. SPtr<PlatformInfo> getActivePlatformInfo() const;
  60. /**
  61. * @brief Gets stored build setting for a specific platform.
  62. */
  63. SPtr<PlatformInfo> getPlatformInfo(PlatformType type) const;
  64. /**
  65. * @brief Returns a list of file names (without extension) of all .NET assemblies required for a specific platform.
  66. */
  67. Vector<WString> getFrameworkAssemblies(PlatformType type) const;
  68. /**
  69. * @brief Returns a list names of all native binaries required for a specific platform.
  70. */
  71. Vector<Path> getNativeBinaries(PlatformType type) const;
  72. /**
  73. * @brief Returns a path to a specific folder used in the build process. See entries of
  74. * BuildFolder enum for explanations of individual folder types.
  75. */
  76. Path getBuildFolder(BuildFolder folder, PlatformType platform) const;
  77. /**
  78. * @brief Returns the absolute path of the pre-built executable for the specified platform.
  79. */
  80. Path getMainExecutable(PlatformType type) const;
  81. /**
  82. * @brief Returns a list of script defines for a specific platform.
  83. */
  84. WString getDefines(PlatformType type) const;
  85. /**
  86. * @brief Stores build settings for all platforms in the specified file.
  87. */
  88. void save(const Path& outFile);
  89. /**
  90. * @brief Loads a previously stored list of build settings.
  91. */
  92. void load(const Path& inFile);
  93. /**
  94. * @brief Clears currently active build settings.
  95. */
  96. void clear();
  97. private:
  98. static const WString BUILD_FOLDER_NAME;
  99. SPtr<BuildData> mBuildData;
  100. };
  101. }