2024-04-26 02:43:38 +00:00
|
|
|
cmake_minimum_required(VERSION 3.22.1)
|
2024-04-26 06:52:16 +00:00
|
|
|
project(SC_3D_CollisionDetectionHelpers CXX)
|
2024-04-26 02:43:38 +00:00
|
|
|
|
2024-04-26 06:52:16 +00:00
|
|
|
set(SC_3D_CollisionDetectionHelpers_SOURCES "${CMAKE_CURRENT_SOURCE_DIR}/src/sc_sacd.cpp")
|
|
|
|
set(SC_3D_CollisionDetectionHelpers_HEADERS "${CMAKE_CURRENT_SOURCE_DIR}/src/sc_sacd.h")
|
2024-04-26 02:43:38 +00:00
|
|
|
|
2024-04-26 06:52:16 +00:00
|
|
|
add_library(SC_3D_CollisionDetectionHelpers ${SC_3D_CollisionDetectionHelpers_SOURCES})
|
2024-04-26 02:43:38 +00:00
|
|
|
|
2024-04-26 06:52:16 +00:00
|
|
|
set_target_properties(SC_3D_CollisionDetectionHelpers PROPERTIES VERSION 1.0.0 SOVERSION 1)
|
2024-04-26 02:43:38 +00:00
|
|
|
|
|
|
|
if(NOT DEFINED CMAKE_BUILD_TYPE OR "${CMAKE_BUILD_TYPE}" STREQUAL "")
|
|
|
|
message("Defaulting to \"Debug\" build type.")
|
|
|
|
set(CMAKE_BUILD_TYPE "Debug" CACHE STRING "Build type" FORCE)
|
|
|
|
else()
|
|
|
|
message("Using build type \"${CMAKE_BUILD_TYPE}\".")
|
|
|
|
endif()
|
|
|
|
|
2024-04-26 06:52:16 +00:00
|
|
|
target_compile_options(SC_3D_CollisionDetectionHelpers PUBLIC
|
2024-04-26 02:43:38 +00:00
|
|
|
$<IF:$<CONFIG:Debug>,-Og,-fno-delete-null-pointer-checks -fno-strict-overflow -fno-strict-aliasing -ftrivial-auto-var-init=zero>
|
|
|
|
-Wall -Wformat -Wformat=2 -Wconversion -Wimplicit-fallthrough
|
|
|
|
-U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=3
|
|
|
|
-D_GLIBCXX_ASSERTIONS
|
|
|
|
-fstrict-flex-arrays=3
|
|
|
|
-fstack-clash-protection -fstack-protector-strong
|
|
|
|
-fPIC
|
|
|
|
)
|
|
|
|
|
2024-04-26 06:52:16 +00:00
|
|
|
target_link_options(SC_3D_CollisionDetectionHelpers PUBLIC
|
2024-04-26 02:43:38 +00:00
|
|
|
$<IF:$<CONFIG:Debug>,-Og,-fno-delete-null-pointer-checks -fno-strict-overflow -fno-strict-aliasing -ftrivial-auto-var-init=zero>
|
|
|
|
-Wall -Wformat -Wformat=2 -Wconversion -Wimplicit-fallthrough
|
|
|
|
-U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=3
|
|
|
|
-D_GLIBCXX_ASSERTIONS
|
|
|
|
-fstrict-flex-arrays=3
|
|
|
|
-fstack-clash-protection -fstack-protector-strong
|
|
|
|
-Wl,-z,noexecstack
|
|
|
|
-Wl,-z,relro -Wl,-z,now
|
|
|
|
-fPIC
|
|
|
|
)
|
2024-04-26 04:27:03 +00:00
|
|
|
|
|
|
|
add_executable(UnitTest src/test.cpp)
|
2024-04-26 06:52:16 +00:00
|
|
|
target_link_libraries(UnitTest SC_3D_CollisionDetectionHelpers)
|
2024-04-26 04:27:03 +00:00
|
|
|
target_include_directories(UnitTest PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}/src")
|
2024-04-26 06:44:24 +00:00
|
|
|
target_compile_features(UnitTest PUBLIC cxx_std_20)
|
2024-04-26 04:27:03 +00:00
|
|
|
|
|
|
|
target_compile_options(UnitTest PUBLIC
|
|
|
|
$<IF:$<CONFIG:Debug>,-Og,-fno-delete-null-pointer-checks -fno-strict-overflow -fno-strict-aliasing -ftrivial-auto-var-init=zero>
|
|
|
|
-Wall -Wformat -Wformat=2 -Wconversion -Wimplicit-fallthrough
|
|
|
|
-U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=3
|
|
|
|
-D_GLIBCXX_ASSERTIONS
|
|
|
|
-fstrict-flex-arrays=3
|
|
|
|
-fstack-clash-protection -fstack-protector-strong
|
|
|
|
-fPIE
|
|
|
|
)
|
|
|
|
|
|
|
|
target_link_options(UnitTest PUBLIC
|
|
|
|
$<IF:$<CONFIG:Debug>,-Og,-fno-delete-null-pointer-checks -fno-strict-overflow -fno-strict-aliasing -ftrivial-auto-var-init=zero>
|
|
|
|
-Wall -Wformat -Wformat=2 -Wconversion -Wimplicit-fallthrough
|
|
|
|
-U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=3
|
|
|
|
-D_GLIBCXX_ASSERTIONS
|
|
|
|
-fstrict-flex-arrays=3
|
|
|
|
-fstack-clash-protection -fstack-protector-strong
|
|
|
|
-Wl,-z,nodlopen -Wl,-z,noexecstack
|
|
|
|
-Wl,-z,relro -Wl,-z,now
|
|
|
|
-fPIE
|
|
|
|
-pie
|
|
|
|
)
|
2024-04-26 06:52:16 +00:00
|
|
|
|
|
|
|
install(TARGETS SC_3D_CollisionDetectionHelpers DESTINATION "lib")
|
|
|
|
install(FILES ${SC_3D_CollisionDetectionHelpers_HEADERS} DESTINATION "include")
|