cmake_minimum_required(VERSION 3.25) project(core) set(CMAKE_CXX_STANDARD 20) set(SRC "src/Logger.cpp" "src/Utility.cpp" "src/Error.cpp" "src/New.cpp" "src/Buffer.cpp" "src/Clock.cpp" "src/Random.cpp" "src/BitArray.cpp" "src/Math.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/FileReader.cpp" "src/ErrorSimulator.cpp" ) set(SRC_TESTS "test/Main.cpp" "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/ProbingHashMapTests.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" ) set(SRC_PERFORMANCE "performance/Main.cpp" "test/Test.cpp" ) if("${CMAKE_BUILD_TYPE}" STREQUAL "Release") set(COMPILE_OPTIONS -flto) set(DEBUG_LINK "") set(LOG_LEVEL 2) set(ERROR_SIMULATOR "") else() set(COMPILE_OPTIONS --coverage) set(DEBUG_LINK gcov) set(LOG_LEVEL 4) set(ERROR_SIMULATOR "ERROR_SIMULATOR") endif() add_library(core STATIC ${SRC}) target_compile_options(core PUBLIC ${COMPILE_OPTIONS} -fdiagnostics-color=always -fno-exceptions -fno-rtti -fno-threadsafe-statics -nostdinc++ -pedantic -pedantic-errors -Waligned-new=all -Wall -Walloca -Walloc-zero -Wanalyzer-too-complex -Warith-conversion -Warray-bounds=2 -Warray-parameter -Wattribute-alias=2 -Wbidi-chars=any -Wcast-align=strict -Wcast-qual -Wcatch-value=3 -Wcomma-subscript -Wconditionally-supported -Wconversion -Wctad-maybe-unsupported -Wctor-dtor-privacy -Wdate-time -Wdeprecated-copy-dtor -Wdeprecated-enum-enum-conversion -Wdeprecated-enum-float-conversion -Wdisabled-optimization -Wdouble-promotion -Wduplicated-branches -Wduplicated-cond -Weffc++ -Wenum-compare -Wenum-conversion -Werror -Wextra -Wextra-semi -Wfloat-equal -Wformat=2 -Wformat-overflow=2 -Wformat-signedness -Wformat-truncation=2 -Wframe-larger-than=8388608 -Wimplicit-fallthrough=5 -Winfinite-recursion -Winit-self -Winvalid-imported-macros -Winvalid-pch -Wlarger-than=1073741824 -Wlogical-op -Wmismatched-tags -Wmissing-braces -Wmissing-declarations -Wmissing-include-dirs -Wmultichar -Wmultiple-inheritance -Wnoexcept -Wnon-virtual-dtor -Wnormalized=nfkc -Wnull-dereference -Wold-style-cast -Woverlength-strings -Woverloaded-virtual -Wplacement-new=2 -Wredundant-decls -Wredundant-tags -Wregister -Wshadow -Wshift-overflow=2 -Wsign-conversion -Wsign-promo -Wstack-protector -Wstack-usage=8388608 -Wstrict-null-sentinel -Wstrict-overflow=5 -Wstringop-overflow=4 -Wsuggest-final-methods -Wsuggest-final-types -Wsuggest-override -Wswitch-enum -Wsynth -Wtrampolines -Wtrivial-auto-var-init -Wundef -Wunreachable-code -Wunused-const-variable=2 -Wunused-macros -Wuse-after-free=3 -Wvirtual-inheritance -Wvla -Wvolatile -Wwrite-strings -Wzero-as-null-pointer-constant ) target_compile_definitions(core PUBLIC CORE_LOG_LEVEL=${LOG_LEVEL} PRIVATE ${ERROR_SIMULATOR} ) target_link_libraries(core PUBLIC -nodefaultlibs c m PRIVATE ${DEBUG_LINK} ) 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)