BsPrerequisitesUtil.h 5.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233
  1. //********************************** Banshee Engine (www.banshee3d.com) **************************************************//
  2. //**************** Copyright (c) 2016 Marko Pintera ([email protected]). All rights reserved. **********************//
  3. #pragma once
  4. #include <assert.h>
  5. /** @defgroup Layers Layers
  6. * Core layers of the engine.
  7. * @{
  8. */
  9. /** @defgroup Utility Utility
  10. * Lowest layer of the engine containing a collection of very decoupled and separate systems that are
  11. * likely to be used throughout all of the higher layers.
  12. * @{
  13. */
  14. /** @defgroup Math Math
  15. * Variety of general purpose math functionality.
  16. */
  17. /** @defgroup RTTI RTTI
  18. * Run-time type information defining and querying.
  19. */
  20. /** @defgroup Serialization Serialization
  21. * Serialization and deserialization of native objects.
  22. */
  23. /** @defgroup Memory Memory
  24. * Allocators, deallocators and memory manipulation.
  25. */
  26. /** @defgroup Containers Containers
  27. * Templated commonly used containers.
  28. */
  29. /** @defgroup Debug Debug
  30. * Various debugging helpers.
  31. */
  32. /** @defgroup Error Error handling
  33. * Handling and reporting errors.
  34. */
  35. /** @defgroup Filesystem File system
  36. * Manipulating, reading and writing files.
  37. */
  38. /** @defgroup General General
  39. * General utility functionality that doesn't fit in any other category.
  40. */
  41. /** @defgroup Image Image
  42. * Manipulating images.
  43. */
  44. /** @defgroup String String
  45. * String manipulation.
  46. */
  47. /** @defgroup Testing Testing
  48. * Running unit tests.
  49. */
  50. /** @defgroup Threading Threading
  51. * Thread manipulation and synchronization.
  52. */
  53. /** @cond RTTI */
  54. /** @defgroup RTTI-Impl-Utility RTTI types
  55. * RTTI implementations for classes within the utility layer.
  56. */
  57. /** @endcond */
  58. /** @defgroup Platform-Utility Platform
  59. * Platform specific functionality.
  60. */
  61. /** @defgroup Internal-Utility [INTERNAL]
  62. * Low-level classes and methods not meant for normal use, useful for those that are modifying the engine.
  63. * @{
  64. */
  65. /** @defgroup Error-Internal Error handling
  66. * Handling and reporting errors.
  67. */
  68. /** @defgroup General-Internal General
  69. * Utility functionality that doesn't fit in any other category.
  70. */
  71. /** @defgroup Memory-Internal Memory
  72. * Allocators, deallocators and memory manipulation.
  73. */
  74. /** @defgroup Platform-Utility-Internal Platform
  75. * Platform specific functionality.
  76. */
  77. /** @defgroup RTTI-Internal RTTI
  78. * Run-time type information defining and querying.
  79. */
  80. /** @defgroup Serialization-Internal Serialization
  81. * Serialization and deserialization of native objects.
  82. */
  83. /** @defgroup String-Internal String
  84. * String manipulation.
  85. */
  86. /** @defgroup Threading-Internal Threading
  87. * Thread manipulation and synchronization.
  88. */
  89. /** @} */
  90. /** @} */
  91. /** @} */
  92. /** @defgroup Plugins Plugins
  93. * Implementations of various systems defined in the core layers.
  94. */
  95. /** @defgroup Implementation [IMPLEMENTATION]
  96. * Very specialized base classes, templates and helper code used for construction of more concrete types.
  97. */
  98. // 0 - No thread support
  99. // 1 - Render system is thread safe (TODO: NOT WORKING and will probably be removed)
  100. // 2 - Thread support but render system can only be accessed from main thread
  101. #define BS_THREAD_SUPPORT 2
  102. #define BS_PROFILING_ENABLED 1
  103. // Versions
  104. #define BS_VER_DEV 1
  105. #define BS_VER_PREVIEW 2
  106. #define BS_VER BS_VER_DEV
  107. // Platform-specific stuff
  108. #include "BsPlatformDefines.h"
  109. #if BS_COMPILER == BS_COMPILER_MSVC
  110. // TODO - This is not deactivated anywhere, therefore it applies to any file that includes this header.
  111. // - Right now I don't have an easier way to apply these warnings globally so I'm keeping it this way.
  112. // Secure versions aren't multiplatform, so we won't be using them
  113. #define _CRT_SECURE_NO_WARNINGS
  114. // disable: "<type> needs to have dll-interface to be used by clients'
  115. // Happens on STL member variables which are not public therefore is ok
  116. # pragma warning (disable: 4251)
  117. // disable: 'X' Function call with parameters that may be unsafe
  118. # pragma warning(disable: 4996)
  119. // disable: decorated name length exceeded, name was truncated
  120. // Happens with really long type names. Even fairly standard use
  121. // of std::unordered_map with custom parameters, meaning I can't
  122. // really do much to avoid it. It shouldn't effect execution
  123. // but might cause problems if you compile library
  124. // with one compiler and use it in another.
  125. # pragma warning(disable: 4503)
  126. // disable: C++ exception handler used, but unwind semantics are not enabled
  127. // We don't care about this as any exception is meant to crash the program.
  128. # pragma warning(disable: 4530)
  129. #endif
  130. // Windows Settings
  131. #if BS_PLATFORM == BS_PLATFORM_WIN32
  132. // Win32 compilers use _DEBUG for specifying debug builds.
  133. // for MinGW, we set DEBUG
  134. # if defined(_DEBUG) || defined(DEBUG)
  135. # define BS_DEBUG_MODE 1
  136. # else
  137. # define BS_DEBUG_MODE 0
  138. # endif
  139. #endif
  140. // Linux/Apple Settings
  141. #if BS_PLATFORM == BS_PLATFORM_LINUX || BS_PLATFORM == BS_PLATFORM_OSX
  142. // A quick define to overcome different names for the same function
  143. # define stricmp strcasecmp
  144. # ifdef DEBUG
  145. # define BS_DEBUG_MODE 1
  146. # else
  147. # define BS_DEBUG_MODE 0
  148. # endif
  149. #endif
  150. #if BS_DEBUG_MODE
  151. #define BS_DEBUG_ONLY(x) x
  152. #define BS_ASSERT(x) assert(x)
  153. #else
  154. #define BS_DEBUG_ONLY(x)
  155. #define BS_ASSERT(x)
  156. #endif
  157. // Short-hand names for various built-in types
  158. #include "BsTypes.h"
  159. #include "BsMemoryAllocator.h"
  160. // Useful threading defines
  161. #include "BsThreadDefines.h"
  162. // Commonly used standard headers
  163. #include "BsStdHeaders.h"
  164. // Forward declarations
  165. #include "BsFwdDeclUtil.h"
  166. #include "BsRTTIPrerequisites.h"
  167. #include "BsFlags.h"
  168. #include "BsString.h"
  169. #include "BsMessageHandlerFwd.h"
  170. #include "BsUtil.h"
  171. #include "BsPath.h"
  172. #include "BsStringID.h"
  173. #include "BsEvent.h"
  174. #include "BsPlatformUtility.h"
  175. #include "BsCrashHandler.h"