forked from SecondHalfGames/JoltC
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCMakeLists.txt
77 lines (58 loc) · 2.43 KB
/
CMakeLists.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
cmake_minimum_required(VERSION 3.16 FATAL_ERROR)
# When turning this option on, the library will be compiled using doubles for positions. This allows for much bigger worlds.
option(DOUBLE_PRECISION "Use double precision math" OFF)
# Number of bits to use in ObjectLayer. Can be 16 or 32.
option(OBJECT_LAYER_BITS "Number of bits in ObjectLayer" 16)
include(CMakeDependentOption)
# Ability to toggle between the static and DLL versions of the MSVC runtime library
# Windows Store only supports the DLL version
cmake_dependent_option(USE_STATIC_MSVC_RUNTIME_LIBRARY "Use the static MSVC runtime library" ON "MSVC;NOT WINDOWS_STORE" OFF)
if (USE_STATIC_MSVC_RUNTIME_LIBRARY)
set(CMAKE_MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>")
endif()
# Only do this when we're at the top level, see: https://gitlab.kitware.com/cmake/cmake/-/issues/24181
if (CMAKE_CURRENT_SOURCE_DIR STREQUAL CMAKE_SOURCE_DIR)
set(CMAKE_CONFIGURATION_TYPES "Debug;Release")
endif()
project(JoltC VERSION 0.1
DESCRIPTION "C Wrapper for Jolt Physics"
LANGUAGES C CXX)
add_library(joltc STATIC
JoltC/JoltC.h
JoltC/JoltC.cpp
JoltC/Enums.h
JoltC/Functions.h
)
target_compile_features(joltc PUBLIC cxx_std_17)
target_include_directories(joltc PUBLIC . JoltPhysics)
if (WIN32)
target_link_libraries(joltc PUBLIC ../../libs-win/libJolt.a)
else ()
target_link_libraries(joltc PUBLIC ../../libs-linux/libJolt.a)
endif ()
install(TARGETS joltc DESTINATION lib)
if(MSVC)
target_compile_options(joltc PRIVATE /W4)
# Ignore 'unreferenced function with internal linkage'
target_compile_options(joltc PRIVATE /wd4505)
else()
target_compile_options(joltc PRIVATE -Wall -Wextra -Wpedantic)
endif()
if (DOUBLE_PRECISION)
target_compile_definitions(joltc PUBLIC JPC_DOUBLE_PRECISION)
endif()
if (OBJECT_LAYER_BITS)
target_compile_definitions(joltc PUBLIC JPC_OBJECT_LAYER_BITS=${OBJECT_LAYER_BITS})
endif()
# if (CMAKE_CURRENT_SOURCE_DIR STREQUAL CMAKE_SOURCE_DIR)
# add_executable(HelloWorld
# HelloWorld/main.cpp
# )
# # cxx_std_20 gives us designated initializers, bringing us closer to Actual C.
# target_compile_features(HelloWorld PRIVATE cxx_std_20)
# # Eventually we should switch back to Actual C:
# # set_property(TARGET HelloWorld PROPERTY C_STANDARD 23)
# target_include_directories(HelloWorld PUBLIC .)
# target_link_libraries(HelloWorld PUBLIC joltc)
# endif()
# add_subdirectory(JoltPhysics/Build)