CMakeLists.txt 5.7 KB

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