forked from ZealanL/RocketSim
-
Notifications
You must be signed in to change notification settings - Fork 2
/
CMakeLists.txt
89 lines (72 loc) · 2.18 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
78
79
80
81
82
83
84
85
86
87
88
89
cmake_minimum_required(VERSION 3.26)
project(RocketSim)
find_package(Python3 COMPONENTS Interpreter Development.SABIModule NumPy REQUIRED)
include(CheckIPOSupported)
check_ipo_supported(RESULT IPO_SUPPORTED)
file(GLOB_RECURSE ROCKETSIM_BULLET3_SOURCES libsrc/bullet3-3.24/*.cpp)
file(GLOB_RECURSE ROCKETSIM_SOURCES src/*.cpp)
file(GLOB ROCKETSIM_PYTHON_SOURCES python-mtheall/*.cpp)
add_library(${PROJECT_NAME} MODULE)
set_target_properties(${PROJECT_NAME} PROPERTIES
PREFIX ""
)
if(WIN32)
set_target_properties(${PROJECT_NAME} PROPERTIES
OUTPUT_NAME ${PROJECT_NAME}
)
if(NOT CYGWIN)
set_target_properties(${PROJECT_NAME} PROPERTIES
SUFFIX .dyn
)
endif()
else()
set_target_properties(${PROJECT_NAME} PROPERTIES
OUTPUT_NAME ${PROJECT_NAME}.${Python3_SOSABI}
)
endif()
target_sources(${PROJECT_NAME} PRIVATE
${ROCKETSIM_BULLET3_SOURCES}
${ROCKETSIM_SOURCES}
${ROCKETSIM_PYTHON_SOURCES}
)
if(IPO_SUPPORTED)
set_target_properties(${PROJECT_NAME} PROPERTIES
INTERPROCEDURAL_OPTIMIZATION TRUE
INTERPROCEDURAL_OPTIMIZATION_DEBUG FALSE
INTERPROCEDURAL_OPTIMIZATION_RELEASE TRUE
INTERPROCEDURAL_OPTIMIZATION_RELWITHDEBINFO TRUE
INTERPROCEDURAL_OPTIMIZATION_MINSIZEREL TRUE
)
endif()
target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_20)
set_target_properties(${PROJECT_NAME} PROPERTIES C_VISIBILITY_PRESET hidden)
set_target_properties(${PROJECT_NAME} PROPERTIES CXX_VISIBILITY_PRESET hidden)
target_include_directories(${PROJECT_NAME} PRIVATE
${PROJECT_SOURCE_DIR}/libsrc
${PROJECT_SOURCE_DIR}/src
)
target_link_libraries(${PROJECT_NAME} PRIVATE Python3::SABIModule Python3::NumPy)
target_compile_definitions(${PROJECT_NAME} PRIVATE
PY_SSIZE_T_CLEAN=1
Py_LIMITED_API=0x03090000
NPY_NO_DEPRECATED_API=NPY_1_7_API_VERSION
PY_ARRAY_UNIQUE_SYMBOL=RocketSim_ARRAY_API
NO_IMPORT_ARRAY=1
RS_DONT_LOG=1
XXH_INLINE_ALL=1
XXH_STATIC_LINKING_ONLY=1
)
if(CMAKE_INSTALL_PREFIX MATCHES "cmeel.prefix")
install(TARGETS ${PROJECT_NAME}
LIBRARY DESTINATION ..
)
else()
execute_process(
COMMAND ${Python3_EXECUTABLE} -m site --user-site
OUTPUT_VARIABLE USER_SITE
OUTPUT_STRIP_TRAILING_WHITESPACE
)
install(TARGETS ${PROJECT_NAME}
LIBRARY DESTINATION ${USER_SITE}
)
endif()