CMakeLists.txt 5.6 KB

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