🛠️🐜 Antkeeper superbuild with dependencies included https://antkeeper.com
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.

111 lines
4.2 KiB

  1. # Crash Course: configuration
  2. <!--
  3. @cond TURN_OFF_DOXYGEN
  4. -->
  5. # Table of Contents
  6. * [Introduction](#introduction)
  7. * [Definitions](#definitions)
  8. * [ENTT_NOEXCEPTION](#entt_noexcept)
  9. * [ENTT_USE_ATOMIC](#entt_use_atomic)
  10. * [ENTT_ID_TYPE](#entt_id_type)
  11. * [ENTT_SPARSE_PAGE](#entt_sparse_page)
  12. * [ENTT_PACKED_PAGE](#entt_packed_page)
  13. * [ENTT_ASSERT](#entt_assert)
  14. * [ENTT_DISABLE_ASSERT](#entt_disable_assert)
  15. * [ENTT_NO_ETO](#entt_no_eto)
  16. * [ENTT_STANDARD_CPP](#entt_standard_cpp)
  17. <!--
  18. @endcond TURN_OFF_DOXYGEN
  19. -->
  20. # Introduction
  21. `EnTT` doesn't offer many hooks for customization but it certainly offers
  22. some.<br/>
  23. In the vast majority of cases, users will have no interest in changing the
  24. default parameters. For all other cases, the list of possible configurations
  25. with which it's possible to adjust the behavior of the library at runtime can be
  26. found below.
  27. # Definitions
  28. All options are intended as parameters to the compiler (or user-defined macros
  29. within the compilation units, if preferred).<br/>
  30. Each parameter can result in internal library definitions. It's not recommended
  31. to try to also modify these definitions, since there is no guarantee that they
  32. will remain stable over time unlike the options below.
  33. ## ENTT_NOEXCEPTION
  34. This parameter can be used to switch off exception handling in `EnTT`.<br/>
  35. To do this, simply define the variable without assigning any value to it. This
  36. is roughly equivalent to setting the compiler flag `-ff-noexceptions`.
  37. ## ENTT_USE_ATOMIC
  38. In general, `EnTT` doesn't offer primitives to support multi-threading. Many of
  39. the features can be split over multiple threads without any explicit control and
  40. the user is the only one who knows if and when a synchronization point is
  41. required.<br/>
  42. However, some features aren't easily accessible to users and can be made
  43. thread-safe by means of this definition.
  44. ## ENTT_ID_TYPE
  45. `entt::id_type` is directly controlled by this definition and widely used within
  46. the library.<br/>
  47. By default, its type is `std::uint32_t`. However, users can define a different
  48. default type if necessary.
  49. ## ENTT_SPARSE_PAGE
  50. It's known that the ECS module of `EnTT` is based on _sparse sets_. What is less
  51. known perhaps is that the sparse arrays are paged to reduce memory usage.<br/>
  52. Default size of pages (that is, the number of elements they contain) is 4096 but
  53. users can adjust it if appropriate. In all case, the chosen value **must** be a
  54. power of 2.
  55. ## ENTT_PACKED_PAGE
  56. Similar to sparse arrays, packed arrays of components are paginated as well. In
  57. However, int this case the aim isn't to reduce memory usage but to have pointer
  58. stability upon component creation.<br/>
  59. Default size of pages (that is, the number of elements they contain) is 1024 but
  60. users can adjust it if appropriate. In all case, the chosen value **must** be a
  61. power of 2.
  62. ## ENTT_ASSERT
  63. For performance reasons, `EnTT` doesn't use exceptions or any other control
  64. structures. In fact, it offers many features that result in undefined behavior
  65. if not used correctly.<br/>
  66. To get around this, the library relies on a lot of asserts for the purpose of
  67. detecting errors in debug builds. By default, it uses `assert` internally, but
  68. users are allowed to overwrite its behavior by setting this variable.
  69. ### ENTT_DISABLE_ASSERT
  70. Assertions may in turn affect performance to an extent when enabled. Whether
  71. `ENTT_ASSERT` is redefined or not, all asserts can be disabled at once by means
  72. of this definition.<br/>
  73. Note that `ENTT_DISABLE_ASSERT` takes precedence over the redefinition of
  74. `ENTT_ASSERT` and is therefore meant to disable all controls no matter what.
  75. ## ENTT_NO_ETO
  76. In order to reduce memory consumption and increase performance, empty types are
  77. never stored by the ECS module of `EnTT`.<br/>
  78. Use this variable to treat these types like all others and therefore to create a
  79. dedicated storage for them.
  80. ## ENTT_STANDARD_CPP
  81. `EnTT` mixes non-standard language features with others that are perfectly
  82. compliant to offer some of its functionalities.<br/>
  83. This definition will prevent the library from using non-standard techniques,
  84. that is, functionalities that aren't fully compliant with the standard C++.<br/>
  85. While there are no known portability issues at the time of this writing, this
  86. should make the library fully portable anyway if needed.