|
@@ -0,0 +1,220 @@
|
|
|
|
+cmake_minimum_required(VERSION 3.25)
|
|
|
|
+project(core)
|
|
|
|
+
|
|
|
|
+set(CMAKE_CXX_STANDARD 20)
|
|
|
|
+
|
|
|
|
+set(SRC
|
|
|
|
+ "src/Logger.c"
|
|
|
|
+ #"src/Utility.cpp"
|
|
|
|
+ #"src/Error.cpp"
|
|
|
|
+ #"src/New.cpp"
|
|
|
|
+ #"src/Buffer.cpp"
|
|
|
|
+ #"src/Clock.cpp"
|
|
|
|
+ #"src/Random.cpp"
|
|
|
|
+ #"src/BitArray.cpp"
|
|
|
|
+ #"src/Vector.cpp"
|
|
|
|
+ #"src/Quaternion.cpp"
|
|
|
|
+ #"src/Matrix.cpp"
|
|
|
|
+ #"src/Box.cpp"
|
|
|
|
+ #"src/Plane.cpp"
|
|
|
|
+ #"src/Frustum.cpp"
|
|
|
|
+ #"src/View.cpp"
|
|
|
|
+ #"src/Thread.cpp"
|
|
|
|
+ #"src/Mutex.cpp"
|
|
|
|
+ #"src/SpinLock.cpp"
|
|
|
|
+ #"src/FileReader.cpp"
|
|
|
|
+ #"src/ErrorSimulator.cpp"
|
|
|
|
+ #"src/ArrayString.cpp"
|
|
|
|
+)
|
|
|
|
+
|
|
|
|
+set(SRC_TESTS
|
|
|
|
+ "test/Main.c"
|
|
|
|
+ #"test/Test.cpp"
|
|
|
|
+ #"test/modules/ArrayTests.cpp"
|
|
|
|
+ #"test/modules/ArrayStringTests.cpp"
|
|
|
|
+ #"test/modules/UtilityTests.cpp"
|
|
|
|
+ #"test/modules/ArrayListTests.cpp"
|
|
|
|
+ #"test/modules/BitArrayTests.cpp"
|
|
|
|
+ #"test/modules/MathTests.cpp"
|
|
|
|
+ #"test/modules/ListTests.cpp"
|
|
|
|
+ #"test/modules/LinkedListTests.cpp"
|
|
|
|
+ #"test/modules/UniquePointerTests.cpp"
|
|
|
|
+ #"test/modules/HashMapTests.cpp"
|
|
|
|
+ #"test/modules/StackTests.cpp"
|
|
|
|
+ #"test/modules/RingBufferTests.cpp"
|
|
|
|
+ #"test/modules/ComponentsTests.cpp"
|
|
|
|
+ #"test/modules/VectorTests.cpp"
|
|
|
|
+ #"test/modules/QuaternionTests.cpp"
|
|
|
|
+ #"test/modules/MatrixTests.cpp"
|
|
|
|
+ #"test/modules/BoxTests.cpp"
|
|
|
|
+ #"test/modules/BufferedValueTests.cpp"
|
|
|
|
+ #"test/modules/PlaneTests.cpp"
|
|
|
|
+ #"test/modules/FrustumTests.cpp"
|
|
|
|
+ #"test/modules/ViewTests.cpp"
|
|
|
|
+ #"test/modules/MatrixStackTests.cpp"
|
|
|
|
+ #"test/modules/ColorTests.cpp"
|
|
|
|
+ #"test/modules/BufferTests.cpp"
|
|
|
|
+ #"test/modules/ClockTests.cpp"
|
|
|
|
+ #"test/modules/RandomTests.cpp"
|
|
|
|
+ #"test/modules/ThreadTests.cpp"
|
|
|
|
+ #"test/modules/FileReaderTests.cpp"
|
|
|
|
+ #"test/modules/ErrorTests.cpp"
|
|
|
|
+ #"test/modules/NewTests.cpp"
|
|
|
|
+ #"test/modules/HashedStringTests.cpp"
|
|
|
|
+)
|
|
|
|
+
|
|
|
|
+set(SRC_PERFORMANCE
|
|
|
|
+ #"performance/Main.cpp"
|
|
|
|
+ #"test/Test.cpp"
|
|
|
|
+)
|
|
|
|
+
|
|
|
|
+if("${CMAKE_BUILD_TYPE}" STREQUAL "Release")
|
|
|
|
+ set(COMPILE_OPTIONS -flto)
|
|
|
|
+ set(LINK_OPTIONS -flto)
|
|
|
|
+ set(LOG_LEVEL 2)
|
|
|
|
+ set(ERROR_SIMULATOR "")
|
|
|
|
+else()
|
|
|
|
+ if(CMAKE_C_COMPILER_ID STREQUAL "GNU")
|
|
|
|
+ set(COMPILE_OPTIONS --coverage)
|
|
|
|
+ endif()
|
|
|
|
+ set(LINK_OPTIONS gcov)
|
|
|
|
+ set(LOG_LEVEL 4)
|
|
|
|
+ set(ERROR_SIMULATOR "ERROR_SIMULATOR")
|
|
|
|
+endif()
|
|
|
|
+
|
|
|
|
+if(CMAKE_C_COMPILER_ID STREQUAL "GNU")
|
|
|
|
+ set(MORE_WARNINGS
|
|
|
|
+ -Walloc-zero
|
|
|
|
+ -Wanalyzer-too-complex
|
|
|
|
+ -Warith-conversion
|
|
|
|
+ -Warray-bounds=2
|
|
|
|
+ -Wattribute-alias=2
|
|
|
|
+ -Wbidi-chars=any
|
|
|
|
+ -Wcast-align=strict
|
|
|
|
+ -Wduplicated-branches
|
|
|
|
+ -Wduplicated-cond
|
|
|
|
+ -Wformat-overflow=2
|
|
|
|
+ -Wformat-signedness
|
|
|
|
+ -Wformat-truncation=2
|
|
|
|
+ -Wimplicit-fallthrough=5
|
|
|
|
+ -Wjump-misses-init
|
|
|
|
+ -Wlogical-op
|
|
|
|
+ -Wnormalized=nfkc
|
|
|
|
+ -Wshift-overflow=2
|
|
|
|
+ -Wstack-usage=8388608
|
|
|
|
+ -Wstringop-overflow=4
|
|
|
|
+ -Wtrampolines
|
|
|
|
+ -Wtrivial-auto-var-init
|
|
|
|
+ -Wunused-const-variable=2
|
|
|
|
+ -Wuse-after-free=3
|
|
|
|
+ )
|
|
|
|
+endif()
|
|
|
|
+
|
|
|
|
+add_library(core STATIC ${SRC})
|
|
|
|
+target_compile_options(core PUBLIC
|
|
|
|
+ ${COMPILE_OPTIONS}
|
|
|
|
+ -Wall
|
|
|
|
+ -Walloca
|
|
|
|
+ -Warray-parameter
|
|
|
|
+ -Wbad-function-cast
|
|
|
|
+ -Wcast-qual
|
|
|
|
+ -Wconversion
|
|
|
|
+ -Wdate-time
|
|
|
|
+ -Wdisabled-optimization
|
|
|
|
+ -Wdouble-promotion
|
|
|
|
+ -Wenum-compare
|
|
|
|
+ -Wenum-conversion
|
|
|
|
+ -Werror
|
|
|
|
+ -Wextra
|
|
|
|
+ -Wfloat-equal
|
|
|
|
+ -Wformat=2
|
|
|
|
+ -Wframe-larger-than=8388608
|
|
|
|
+ -Winfinite-recursion
|
|
|
|
+ -Winit-self
|
|
|
|
+ -Winvalid-pch
|
|
|
|
+ -Wlarger-than=1073741824
|
|
|
|
+ -Wmissing-braces
|
|
|
|
+ -Wmissing-declarations
|
|
|
|
+ -Wmissing-include-dirs
|
|
|
|
+ -Wmissing-prototypes
|
|
|
|
+ -Wmultichar
|
|
|
|
+ -Wnarrowing
|
|
|
|
+ -Wnested-externs
|
|
|
|
+ -Wnull-dereference
|
|
|
|
+ -Wold-style-definition
|
|
|
|
+ -Woverlength-strings
|
|
|
|
+ -Wredundant-decls
|
|
|
|
+ -Wshadow
|
|
|
|
+ -Wsign-conversion
|
|
|
|
+ -Wstack-protector
|
|
|
|
+ -Wstrict-overflow=2
|
|
|
|
+ -Wstrict-prototypes
|
|
|
|
+ -Wswitch-enum
|
|
|
|
+ -Wundef
|
|
|
|
+ -Wunreachable-code
|
|
|
|
+ -Wvla
|
|
|
|
+ -Wwrite-strings
|
|
|
|
+ -fdiagnostics-color=always
|
|
|
|
+ -pedantic
|
|
|
|
+ -pedantic-errors
|
|
|
|
+ ${MORE_WARNINGS}
|
|
|
|
+)
|
|
|
|
+target_compile_definitions(core
|
|
|
|
+ PUBLIC CORE_LOG_LEVEL=${LOG_LEVEL}
|
|
|
|
+ PRIVATE ${ERROR_SIMULATOR}
|
|
|
|
+)
|
|
|
|
+target_link_libraries(core
|
|
|
|
+ PUBLIC -nodefaultlibs c m
|
|
|
|
+ PRIVATE ${LINK_OPTIONS}
|
|
|
|
+)
|
|
|
|
+#target_sources(core PUBLIC
|
|
|
|
+# FILE_SET HEADERS
|
|
|
|
+# BASE_DIRS include
|
|
|
|
+# FILES
|
|
|
|
+# ./include/core/data/Stack.hpp
|
|
|
|
+# ./include/core/data/HashMap.hpp
|
|
|
|
+# ./include/core/data/Components.hpp
|
|
|
|
+# ./include/core/data/ArrayList.hpp
|
|
|
|
+# ./include/core/data/ProbingHashMap.hpp
|
|
|
|
+# ./include/core/data/List.hpp
|
|
|
|
+# ./include/core/data/LinkedList.hpp
|
|
|
|
+# ./include/core/data/BitArray.hpp
|
|
|
|
+# ./include/core/data/Array.hpp
|
|
|
|
+# ./include/core/data/RingBuffer.hpp
|
|
|
|
+# ./include/core/thread/Thread.hpp
|
|
|
|
+# ./include/core/utils/HashCode.hpp
|
|
|
|
+# ./include/core/utils/New.hpp
|
|
|
|
+# ./include/core/utils/Check.hpp
|
|
|
|
+# ./include/core/utils/Buffer.hpp
|
|
|
|
+# ./include/core/utils/Random.hpp
|
|
|
|
+# ./include/core/utils/UniquePointer.hpp
|
|
|
|
+# ./include/core/utils/Types.hpp
|
|
|
|
+# ./include/core/utils/Color.hpp
|
|
|
|
+# ./include/core/utils/Logger.hpp
|
|
|
|
+# ./include/core/utils/ArrayString.hpp
|
|
|
|
+# ./include/core/utils/Utility.hpp
|
|
|
|
+# ./include/core/utils/Meta.hpp
|
|
|
|
+# ./include/core/utils/AlignedData.hpp
|
|
|
|
+# ./include/core/utils/Clock.hpp
|
|
|
|
+# ./include/core/utils/Error.hpp
|
|
|
|
+# ./include/core/math/Quaternion.hpp
|
|
|
|
+# ./include/core/math/Box.hpp
|
|
|
|
+# ./include/core/math/Frustum.hpp
|
|
|
|
+# ./include/core/math/Vector.hpp
|
|
|
|
+# ./include/core/math/Matrix.hpp
|
|
|
|
+# ./include/core/math/View.hpp
|
|
|
|
+# ./include/core/math/BufferedValue.hpp
|
|
|
|
+# ./include/core/math/Plane.hpp
|
|
|
|
+# ./include/core/math/MatrixStack.hpp
|
|
|
|
+# ./include/core/math/Math.hpp
|
|
|
|
+# ./include/core/io/File.hpp
|
|
|
|
+# ./include/core/io/FileReader.hpp
|
|
|
|
+#)
|
|
|
|
+#install(TARGETS core FILE_SET HEADERS)
|
|
|
|
+
|
|
|
|
+add_executable(test ${SRC_TESTS})
|
|
|
|
+target_link_libraries(test PRIVATE core)
|
|
|
|
+target_compile_definitions(test PRIVATE ${ERROR_SIMULATOR})
|
|
|
|
+
|
|
|
|
+#add_executable(performance ${SRC_PERFORMANCE})
|
|
|
|
+#target_link_libraries(performance PRIVATE core)
|