BsBuildManager.h 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125
  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 "BsIReflectable.h"
  6. #include "BsModule.h"
  7. #include "BsPlatformInfo.h"
  8. namespace BansheeEngine
  9. {
  10. /**
  11. * @brief Contains build information for a specific platform to be
  12. * used by the build manager.
  13. */
  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. virtual RTTITypeBase* getRTTI() const override;
  27. };
  28. /**
  29. * @brief Types of various folders used by the build manager.
  30. */
  31. enum class BuildFolder
  32. {
  33. SourceRoot, /**< Absolute path to the root folder where all the prebuilt binaries and data exist. */
  34. DestinationRoot, /**< Absolute path to the root folder for a build for a specific platform. */
  35. NativeBinaries, /**< Folder where native binaries are stored. Relative to root. */
  36. BansheeReleaseAssemblies, /**< Folder where Banshee specific release assemblies are stored. Relative to root. */
  37. BansheeDebugAssemblies, /**< Folder where Banshee specific debug assemblies are stored. Relative to root. */
  38. Data /**< Folder where builtin data is stored. Relative to root. */
  39. };
  40. /**
  41. * @brief Handles building of the game executable and related files.
  42. */
  43. class BS_ED_EXPORT BuildManager : public Module<BuildManager>
  44. {
  45. public:
  46. BuildManager();
  47. /**
  48. * @brief Returns a list of available platforms the executable can be built for.
  49. */
  50. const Vector<PlatformType>& getAvailablePlatforms() const;
  51. /**
  52. * @brief Returns the currently active platform.
  53. */
  54. PlatformType getActivePlatform() const;
  55. /**
  56. * @brief Changes the active build platform. Might cause asset reimport.
  57. */
  58. void setActivePlatform(PlatformType type);
  59. /**
  60. * @brief Gets stored build setting for the active platform.
  61. */
  62. SPtr<PlatformInfo> getActivePlatformInfo() const;
  63. /**
  64. * @brief Gets stored build setting for a specific platform.
  65. */
  66. SPtr<PlatformInfo> getPlatformInfo(PlatformType type) const;
  67. /**
  68. * @brief Returns a list of file names (without extension) of all .NET assemblies required for a specific platform.
  69. */
  70. Vector<WString> getFrameworkAssemblies(PlatformType type) const;
  71. /**
  72. * @brief Returns a list names of all native binaries required for a specific platform.
  73. */
  74. Vector<Path> getNativeBinaries(PlatformType type) const;
  75. /**
  76. * @brief Returns a path to a specific folder used in the build process. See entries of
  77. * BuildFolder enum for explanations of individual folder types.
  78. */
  79. Path getBuildFolder(BuildFolder folder, PlatformType platform) const;
  80. /**
  81. * @brief Returns the absolute path of the pre-built executable for the specified platform.
  82. */
  83. Path getMainExecutable(PlatformType type) const;
  84. /**
  85. * @brief Returns a list of script defines for a specific platform.
  86. */
  87. WString getDefines(PlatformType type) const;
  88. /**
  89. * @brief Stores build settings for all platforms in the specified file.
  90. */
  91. void save(const Path& outFile);
  92. /**
  93. * @brief Loads a previously stored list of build settings.
  94. */
  95. void load(const Path& inFile);
  96. /**
  97. * @brief Clears currently active build settings.
  98. */
  99. void clear();
  100. private:
  101. static const WString BUILD_FOLDER_NAME;
  102. SPtr<BuildData> mBuildData;
  103. };
  104. }