CMakeLists.txt 5.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226
  1. cmake_minimum_required(VERSION 3.25)
  2. project(core)
  3. set(CMAKE_CXX_STANDARD 20)
  4. set(SRC
  5. "src/Logger.cpp"
  6. "src/Utility.cpp"
  7. "src/Error.cpp"
  8. "src/New.cpp"
  9. "src/Buffer.cpp"
  10. "src/Clock.cpp"
  11. "src/Random.cpp"
  12. "src/BitArray.cpp"
  13. "src/Math.cpp"
  14. "src/Vector.cpp"
  15. "src/Quaternion.cpp"
  16. "src/Matrix.cpp"
  17. "src/Box.cpp"
  18. "src/Plane.cpp"
  19. "src/Frustum.cpp"
  20. "src/View.cpp"
  21. "src/Thread.cpp"
  22. "src/FileReader.cpp"
  23. "src/ErrorSimulator.cpp"
  24. )
  25. set(SRC_TESTS
  26. "test/Main.cpp"
  27. "test/Test.cpp"
  28. "test/modules/ArrayTests.cpp"
  29. "test/modules/ArrayStringTests.cpp"
  30. "test/modules/UtilityTests.cpp"
  31. "test/modules/ArrayListTests.cpp"
  32. "test/modules/BitArrayTests.cpp"
  33. "test/modules/MathTests.cpp"
  34. "test/modules/ListTests.cpp"
  35. "test/modules/LinkedListTests.cpp"
  36. "test/modules/UniquePointerTests.cpp"
  37. "test/modules/HashMapTests.cpp"
  38. "test/modules/ProbingHashMapTests.cpp"
  39. "test/modules/StackTests.cpp"
  40. "test/modules/RingBufferTests.cpp"
  41. "test/modules/ComponentsTests.cpp"
  42. "test/modules/VectorTests.cpp"
  43. "test/modules/QuaternionTests.cpp"
  44. "test/modules/MatrixTests.cpp"
  45. "test/modules/BoxTests.cpp"
  46. "test/modules/BufferedValueTests.cpp"
  47. "test/modules/PlaneTests.cpp"
  48. "test/modules/FrustumTests.cpp"
  49. "test/modules/ViewTests.cpp"
  50. "test/modules/MatrixStackTests.cpp"
  51. "test/modules/ColorTests.cpp"
  52. "test/modules/BufferTests.cpp"
  53. "test/modules/ClockTests.cpp"
  54. "test/modules/RandomTests.cpp"
  55. "test/modules/ThreadTests.cpp"
  56. "test/modules/FileReaderTests.cpp"
  57. "test/modules/ErrorTests.cpp"
  58. "test/modules/NewTests.cpp"
  59. )
  60. set(SRC_PERFORMANCE
  61. "performance/Main.cpp"
  62. "test/Test.cpp"
  63. )
  64. add_library(core STATIC ${SRC})
  65. target_compile_options(core PUBLIC
  66. --coverage
  67. -fdiagnostics-color=always
  68. -fno-exceptions
  69. -fno-rtti
  70. -fno-threadsafe-statics
  71. -nostdinc++
  72. -pedantic
  73. -pedantic-errors
  74. -Waligned-new=all
  75. -Wall
  76. -Walloca
  77. -Walloc-zero
  78. -Wanalyzer-too-complex
  79. -Warith-conversion
  80. -Warray-bounds=2
  81. -Warray-parameter
  82. -Wattribute-alias=2
  83. -Wbidi-chars=any
  84. -Wcast-align=strict
  85. -Wcast-qual
  86. -Wcatch-value=3
  87. -Wcomma-subscript
  88. -Wconditionally-supported
  89. -Wconversion
  90. -Wctad-maybe-unsupported
  91. -Wctor-dtor-privacy
  92. -Wdate-time
  93. -Wdeprecated-copy-dtor
  94. -Wdeprecated-enum-enum-conversion
  95. -Wdeprecated-enum-float-conversion
  96. -Wdisabled-optimization
  97. -Wdouble-promotion
  98. -Wduplicated-branches
  99. -Wduplicated-cond
  100. -Weffc++
  101. -Wenum-compare
  102. -Wenum-conversion
  103. -Werror
  104. -Wextra
  105. -Wextra-semi
  106. -Wfloat-equal
  107. -Wformat=2
  108. -Wformat-overflow=2
  109. -Wformat-signedness
  110. -Wformat-truncation=2
  111. -Wframe-larger-than=8388608
  112. -Wimplicit-fallthrough=5
  113. -Winfinite-recursion
  114. -Winit-self
  115. -Winvalid-imported-macros
  116. -Winvalid-pch
  117. -Wlarger-than=1073741824
  118. -Wlogical-op
  119. -Wmismatched-tags
  120. -Wmissing-braces
  121. -Wmissing-declarations
  122. -Wmissing-include-dirs
  123. -Wmultichar
  124. -Wmultiple-inheritance
  125. -Wnoexcept
  126. -Wnon-virtual-dtor
  127. -Wnormalized=nfkc
  128. -Wnull-dereference
  129. -Wold-style-cast
  130. -Woverlength-strings
  131. -Woverloaded-virtual
  132. -Wplacement-new=2
  133. -Wredundant-decls
  134. -Wredundant-tags
  135. -Wregister
  136. -Wshadow
  137. -Wshift-overflow=2
  138. -Wsign-conversion
  139. -Wsign-promo
  140. -Wstack-protector
  141. -Wstack-usage=8388608
  142. -Wstrict-null-sentinel
  143. -Wstrict-overflow=5
  144. -Wstringop-overflow=4
  145. -Wsuggest-final-methods
  146. -Wsuggest-final-types
  147. -Wsuggest-override
  148. -Wswitch-enum
  149. -Wsynth
  150. -Wtrampolines
  151. -Wtrivial-auto-var-init
  152. -Wundef
  153. -Wunreachable-code
  154. -Wunused-const-variable=2
  155. -Wunused-macros
  156. -Wuse-after-free=3
  157. -Wvirtual-inheritance
  158. -Wvla
  159. -Wvolatile
  160. -Wwrite-strings
  161. -Wzero-as-null-pointer-constant
  162. )
  163. target_compile_definitions(core
  164. PUBLIC CORE_LOG_LEVEL=4
  165. PRIVATE ERROR_SIMULATOR=true
  166. )
  167. target_link_libraries(core
  168. PUBLIC -nodefaultlibs c m
  169. PRIVATE gcov
  170. )
  171. target_sources(core PUBLIC
  172. FILE_SET HEADERS
  173. BASE_DIRS include
  174. FILES
  175. ./include/core/data/Stack.hpp
  176. ./include/core/data/HashMap.hpp
  177. ./include/core/data/Components.hpp
  178. ./include/core/data/ArrayList.hpp
  179. ./include/core/data/ProbingHashMap.hpp
  180. ./include/core/data/List.hpp
  181. ./include/core/data/LinkedList.hpp
  182. ./include/core/data/BitArray.hpp
  183. ./include/core/data/Array.hpp
  184. ./include/core/data/RingBuffer.hpp
  185. ./include/core/thread/Thread.hpp
  186. ./include/core/utils/HashCode.hpp
  187. ./include/core/utils/New.hpp
  188. ./include/core/utils/Check.hpp
  189. ./include/core/utils/Buffer.hpp
  190. ./include/core/utils/Random.hpp
  191. ./include/core/utils/UniquePointer.hpp
  192. ./include/core/utils/Types.hpp
  193. ./include/core/utils/Color.hpp
  194. ./include/core/utils/Logger.hpp
  195. ./include/core/utils/ArrayString.hpp
  196. ./include/core/utils/Utility.hpp
  197. ./include/core/utils/Meta.hpp
  198. ./include/core/utils/AlignedData.hpp
  199. ./include/core/utils/Clock.hpp
  200. ./include/core/utils/Error.hpp
  201. ./include/core/math/Quaternion.hpp
  202. ./include/core/math/Box.hpp
  203. ./include/core/math/Frustum.hpp
  204. ./include/core/math/Vector.hpp
  205. ./include/core/math/Matrix.hpp
  206. ./include/core/math/View.hpp
  207. ./include/core/math/BufferedValue.hpp
  208. ./include/core/math/Plane.hpp
  209. ./include/core/math/MatrixStack.hpp
  210. ./include/core/math/Math.hpp
  211. ./include/core/io/File.hpp
  212. ./include/core/io/FileReader.hpp
  213. )
  214. install(TARGETS core FILE_SET HEADERS)
  215. add_executable(test ${SRC_TESTS})
  216. target_link_libraries(test PRIVATE core)
  217. target_compile_definitions(test PRIVATE ERROR_SIMULATOR=true)
  218. add_executable(performance ${SRC_PERFORMANCE})
  219. target_link_libraries(performance PRIVATE core)