123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247 |
- 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(LINK_OPTIONS -flto)
- set(LOG_LEVEL 2)
- set(ERROR_SIMULATOR "")
- else()
- if(CMAKE_CXX_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_CXX_COMPILER_ID STREQUAL "GNU")
- set(MORE_WARNINGS
- -Waligned-new=all
- -Walloc-zero
- -Wanalyzer-too-complex
- -Warith-conversion
- -Warray-bounds=2
- -Wattribute-alias=2
- -Wbidi-chars=any
- -Wcast-align=strict
- -Wcatch-value=3
- -Wcomma-subscript
- -Wconditionally-supported
- -Wduplicated-branches
- -Wduplicated-cond
- -Wformat-overflow=2
- -Wformat-signedness
- -Wformat-truncation=2
- -Wimplicit-fallthrough=5
- -Winvalid-imported-macros
- -Wlogical-op
- -Wmultiple-inheritance
- -Wnoexcept
- -Wnormalized=nfkc
- -Wplacement-new=2
- -Wredundant-tags
- -Wshift-overflow=2
- -Wstack-usage=8388608
- -Wstrict-null-sentinel
- -Wstringop-overflow=4
- -Wsuggest-final-methods
- -Wsuggest-final-types
- -Wtrampolines
- -Wtrivial-auto-var-init
- -Wunused-const-variable=2
- -Wuse-after-free=3
- -Wvirtual-inheritance
- -Wvolatile
- )
- 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
- -Wall
- -Walloca
- -Warray-parameter
- -Wcast-qual
- -Wconversion
- -Wctad-maybe-unsupported
- -Wctor-dtor-privacy
- -Wdate-time
- -Wdeprecated-copy-dtor
- -Wdeprecated-enum-enum-conversion
- -Wdeprecated-enum-float-conversion
- -Wdisabled-optimization
- -Wdouble-promotion
- -Weffc++
- -Wenum-compare
- -Wenum-conversion
- -Werror
- -Wextra
- -Wextra-semi
- -Wfloat-equal
- -Wformat=2
- -Wframe-larger-than=8388608
- -Winfinite-recursion
- -Winit-self
- -Winvalid-pch
- -Wlarger-than=1073741824
- -Wmismatched-tags
- -Wmissing-braces
- -Wmissing-declarations
- -Wmissing-include-dirs
- -Wmultichar
- -Wnon-virtual-dtor
- -Wnull-dereference
- -Wold-style-cast
- -Woverlength-strings
- -Woverloaded-virtual
- -Wredundant-decls
- -Wregister
- -Wshadow
- -Wsign-conversion
- -Wsign-promo
- -Wstack-protector
- -Wstrict-overflow=5
- -Wsuggest-override
- -Wswitch-enum
- -Wsynth
- -Wundef
- -Wunreachable-code
- -Wunused-macros
- -Wvla
- -Wwrite-strings
- -Wzero-as-null-pointer-constant
- ${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)
|