BsPrerequisitesUtil.h 8.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277
  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. * User facing API for the engine core, categorized per layer.
  7. * @{
  8. */
  9. /** @defgroup Utility Utility
  10. * Lowest layer of the engine containing various utility and helper classes.
  11. * @{
  12. */
  13. /** @defgroup Containers Containers
  14. * Templated commonly used containers.
  15. */
  16. /** @defgroup Debug Debug
  17. * Various debugging helpers.
  18. */
  19. /** @defgroup Error Error handling
  20. * Handling and reporting errors.
  21. */
  22. /** @defgroup Filesystem File system
  23. * Manipulating, reading and writing files.
  24. */
  25. /** @defgroup General General
  26. * General utility functionality that doesn't fit in any other category.
  27. */
  28. /** @defgroup Image Image
  29. * Manipulating images.
  30. */
  31. /** @defgroup Math Math
  32. * Variety of general purpose math functionality.
  33. */
  34. /** @defgroup Memory Memory
  35. * Allocators, deallocators and memory manipulation.
  36. */
  37. /** @defgroup Platform-Utility Platform
  38. * %Platform specific functionality.
  39. */
  40. /** @defgroup RTTI RTTI
  41. * Run-time type information defining and querying.
  42. */
  43. /** @cond RTTI */
  44. /** @defgroup RTTI-Impl-Utility RTTI types
  45. * RTTI implementations for classes within the utility layer.
  46. */
  47. /** @endcond */
  48. /** @defgroup Serialization Serialization
  49. * Serialization and deserialization of native objects.
  50. */
  51. /** @defgroup String String
  52. * String manipulation.
  53. */
  54. /** @defgroup Testing Testing
  55. * Running unit tests.
  56. */
  57. /** @defgroup Threading Threading
  58. * Thread manipulation and synchronization.
  59. */
  60. /** @} */
  61. /** @} */
  62. /** @defgroup Internals Internals
  63. * Non-user-facing low-level classes and methods, useful primarily to those modifying the engine.
  64. * @{
  65. */
  66. /** @defgroup Utility-Internal Utility
  67. * Lowest layer of the engine containing various utility and helper classes.
  68. * @{
  69. */
  70. /** @defgroup Error-Internal Error handling
  71. * Handling and reporting errors.
  72. */
  73. /** @defgroup General-Internal General
  74. * Utility functionality that doesn't fit in any other category.
  75. */
  76. /** @defgroup Memory-Internal Memory
  77. * Allocators, deallocators and memory manipulation.
  78. */
  79. /** @defgroup Platform-Utility-Internal Platform
  80. * Platform specific functionality.
  81. */
  82. /** @defgroup RTTI-Internal RTTI
  83. * Run-time type information defining and querying.
  84. */
  85. /** @defgroup Serialization-Internal Serialization
  86. * Serialization and deserialization of native objects.
  87. */
  88. /** @defgroup String-Internal String
  89. * String manipulation.
  90. */
  91. /** @defgroup Threading-Internal Threading
  92. * Thread manipulation and synchronization.
  93. */
  94. /** @} */
  95. /** @} */
  96. /** @defgroup Plugins Plugins
  97. * Reference documentation for implementations of various plugins, useful primarily to those extending the engine.
  98. */
  99. /** @defgroup Implementation [IMPLEMENTATION]
  100. * Very specialized base classes, templates and helper code used for construction of more concrete types.
  101. */
  102. // 0 - No thread support
  103. // 1 - Render system is thread safe (TODO: NOT WORKING and will probably be removed)
  104. // 2 - Thread support but render system can only be accessed from main thread
  105. #define BS_THREAD_SUPPORT 2
  106. #define BS_PROFILING_ENABLED 1
  107. // Config from the build system
  108. #include "BsFrameworkConfig.h"
  109. // Platform-specific stuff
  110. #include "BsPlatformDefines.h"
  111. #if BS_COMPILER == BS_COMPILER_MSVC
  112. // TODO - This is not deactivated anywhere, therefore it applies to any file that includes this header.
  113. // - Right now I don't have an easier way to apply these warnings globally so I'm keeping it this way.
  114. // Secure versions aren't multiplatform, so we won't be using them
  115. #if !defined(_CRT_SECURE_NO_WARNINGS)
  116. #define _CRT_SECURE_NO_WARNINGS
  117. #endif
  118. // disable: "<type> needs to have dll-interface to be used by clients'
  119. // Happens on STL member variables which are not public therefore is ok
  120. # pragma warning (disable: 4251)
  121. // disable: 'X' Function call with parameters that may be unsafe
  122. # pragma warning(disable: 4996)
  123. // disable: decorated name length exceeded, name was truncated
  124. // Happens with really long type names. Even fairly standard use
  125. // of std::unordered_map with custom parameters, meaning I can't
  126. // really do much to avoid it. It shouldn't effect execution
  127. // but might cause problems if you compile library
  128. // with one compiler and use it in another.
  129. # pragma warning(disable: 4503)
  130. // disable: C++ exception handler used, but unwind semantics are not enabled
  131. // We don't care about this as any exception is meant to crash the program.
  132. # pragma warning(disable: 4530)
  133. #endif
  134. // Windows Settings
  135. #if BS_PLATFORM == BS_PLATFORM_WIN32
  136. // Win32 compilers use _DEBUG for specifying debug builds.
  137. // for MinGW, we set DEBUG
  138. # if defined(_DEBUG) || defined(DEBUG)
  139. # define BS_DEBUG_MODE 1
  140. # else
  141. # define BS_DEBUG_MODE 0
  142. # endif
  143. #endif
  144. // Linux/Apple Settings
  145. #if BS_PLATFORM == BS_PLATFORM_LINUX || BS_PLATFORM == BS_PLATFORM_OSX
  146. // A quick define to overcome different names for the same function
  147. # define stricmp strcasecmp
  148. # ifdef DEBUG
  149. # define BS_DEBUG_MODE 1
  150. # else
  151. # define BS_DEBUG_MODE 0
  152. # endif
  153. #endif
  154. #if BS_DEBUG_MODE
  155. #define BS_DEBUG_ONLY(x) x
  156. #define BS_ASSERT(x) assert(x)
  157. #else
  158. #define BS_DEBUG_ONLY(x)
  159. #define BS_ASSERT(x)
  160. #endif
  161. // Script binding defines
  162. /**
  163. * @page scriptBindingMacro Script binding exports
  164. *
  165. * Marks the specific type or a method to be exported to the scripting API. Supports a variety of options which can
  166. * be specified in the "option:value" format, where multiple options are separated by commas, with no whitespace.
  167. *
  168. * Supported options:
  169. * - n - Specify a different name for the type in the scripting API (e.g. "n:MyName"). Usable on types and methods.
  170. * - v - Specify a different visibility (default is public). Supported values are "public" and "internal". Usable on types
  171. * and methods.
  172. * - f - Specify the name of the output file(s) for the script object and its potential wrappers. If not specified
  173. * the name of the type will be used for the file. Usable on types only.
  174. * - pl - Specify whether the type is plain or not (default is false). Supported values are "true" or "false". Plain
  175. * types don't have script interop objects generated, instead their are generated in script code as plain data
  176. * types. No methods are exposed, but all data members and constructors are copied. Usable on types only.
  177. * - e - Specify that a method is external and is to be appended to some script class. Such methods must be static
  178. * and as the first parameter accept the instance of the class they operate on. Value of this option should be
  179. * the name of the class to attach this method to. Methods with this parameter must also be part of a class
  180. * with this option. Usable on types and methods.
  181. * - ec - Similar to "e", but specifies an external constructor. Such method must have a return value that returns
  182. * an instance of the class its registered for. Value of this option should be the name of the class to attach
  183. * this method to. Methods with this parameter must also be part of a class with the "e" option. Usable on methods
  184. * only.
  185. * - pr - Specify the method should be exported as a property in script code. Supported values are "getter" or "setter".
  186. * Getter methods must return a single value and accept no parameters, while setter methods must accept one
  187. * parameter and return no values. Usable on methods only.
  188. * - ed - Specify that a type should be exported for use in the editor only. Supported values are "true" or "false".
  189. * Usable on types only.
  190. */
  191. #if BS_COMPILER == BS_COMPILER_CLANG
  192. /** @copydoc scriptBindingMacro */
  193. #define BS_SCRIPT_EXPORT(...) __attribute__((annotate("se," #__VA_ARGS__)))
  194. #else
  195. /** @copydoc scriptBindingMacro */
  196. #define BS_SCRIPT_EXPORT(...)
  197. #endif
  198. // Short-hand names for various built-in types
  199. #include "BsTypes.h"
  200. #include "BsMemoryAllocator.h"
  201. // Useful threading defines
  202. #include "BsThreadDefines.h"
  203. // Commonly used standard headers
  204. #include "BsStdHeaders.h"
  205. // Forward declarations
  206. #include "BsFwdDeclUtil.h"
  207. #include "BsRTTIPrerequisites.h"
  208. #include "BsFlags.h"
  209. #include "BsString.h"
  210. #include "BsMessageHandlerFwd.h"
  211. #include "BsUtil.h"
  212. #include "BsPath.h"
  213. #include "BsStringID.h"
  214. #include "BsEvent.h"
  215. #include "BsPlatformUtility.h"
  216. #include "BsCrashHandler.h"
  217. #include "BsNonCopyable.h"