CMakeLists.txt 5.7 KB

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