BsPrerequisitesUtil.h 9.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284
  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 "Prerequisites/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", "internal" and "private".
  171. * Usable on types 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. * - ex - Excludes an enum or struct member from being generated in script code. Supported values are "true" or "false".
  191. * By default all struct & enum members are exported.
  192. * - in - When enabled ensures only the interop C# method is generated, but not a public one. It is instead expected
  193. * the user will manually implement the public method. Supported values are "true" or "false". Default is "false".
  194. * Only supported on methods.
  195. * - m - Specifies the name of the module to place the entry in. This determines the documentation group, and may also
  196. * determine namespace and/or module (e.g. m:Animation to place it in the Animation module). Usable on types.
  197. */
  198. #if BS_COMPILER == BS_COMPILER_CLANG
  199. /** @ref scriptBindingMacro */
  200. #define BS_SCRIPT_EXPORT(...) __attribute__((annotate("se," #__VA_ARGS__)))
  201. #else
  202. /** @ref scriptBindingMacro */
  203. #define BS_SCRIPT_EXPORT(...)
  204. #endif
  205. // Short-hand names for various built-in types
  206. #include "Prerequisites/BsTypes.h"
  207. #include "Allocators/BsMemoryAllocator.h"
  208. // Useful threading defines
  209. #include "Threading/BsThreadDefines.h"
  210. // Commonly used standard headers
  211. #include "Prerequisites/BsStdHeaders.h"
  212. // Forward declarations
  213. #include "Prerequisites/BsFwdDeclUtil.h"
  214. #include "Prerequisites/BsRTTIPrerequisites.h"
  215. #include "String/BsString.h"
  216. #include "String/BsStringID.h"
  217. #include "Utility/BsMessageHandlerFwd.h"
  218. #include "Utility/BsFlags.h"
  219. #include "Utility/BsUtil.h"
  220. #include "Utility/BsEvent.h"
  221. #include "Utility/BsPlatformUtility.h"
  222. #include "Utility/BsNonCopyable.h"
  223. #include "FileSystem/BsPath.h"
  224. #include "Error/BsCrashHandler.h"