-
Notifications
You must be signed in to change notification settings - Fork 94
/
CMakeLists.txt
executable file
·97 lines (82 loc) · 2.51 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
90
91
92
93
94
95
96
97
cmake_minimum_required(VERSION 3.11)
set(RAISIM_VERSION 1.1.8)
project(raisim VERSION ${RAISIM_VERSION} LANGUAGES CXX)
set(CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/cmake" ${CMAKE_MODULE_PATH})
# Include CMake helper modules
include(GNUInstallDirs)
# Build options
option(RAISIM_EXAMPLE "Build example applications." TRUE)
option(RAISIM_MATLAB "Build a matlab wrapper." FALSE)
option(RAISIM_PY "Build a python wrapper." FALSE)
option(RAISIM_DOC "Build a raisim documentation. You can find the latest doc in raisim.com." FALSE)
if (UNIX AND NOT APPLE AND NOT ANDROID AND NOT WEBGL AND NOT WIN32)
if(${CMAKE_SYSTEM_PROCESSOR} MATCHES "aarch64")
set(RAISIM_OS linux-arm)
else ()
set(RAISIM_OS linux)
endif ()
list(APPEND CMAKE_PREFIX_PATH ${CMAKE_CURRENT_SOURCE_DIR}/raisim/${RAISIM_OS})
elseif(APPLE)
execute_process(COMMAND sysctl -q hw.optional.arm64
OUTPUT_VARIABLE _sysctl_stdout
ERROR_VARIABLE _sysctl_stderr
RESULT_VARIABLE _sysctl_result
)
if(_sysctl_result EQUAL 0 AND _sysctl_stdout MATCHES "hw.optional.arm64: 1")
set(RAISIM_OS m1)
else()
set(RAISIM_OS mac)
endif()
list(APPEND CMAKE_PREFIX_PATH ${CMAKE_CURRENT_SOURCE_DIR}/raisim/${RAISIM_OS})
elseif(WIN32)
set(RAISIM_OS win32)
list(APPEND CMAKE_PREFIX_PATH ${CMAKE_CURRENT_SOURCE_DIR}/raisim/${RAISIM_OS})
list(APPEND CMAKE_PREFIX_PATH ${CMAKE_CURRENT_SOURCE_DIR}/thirdParty/Eigen3)
endif()
#==
# Package installation
#==
set(RAISIM_BIN_DIR ${RAISIM_OS})
message("-- Detected OS/Architecture is ${RAISIM_OS}")
if(WIN32)
install(
DIRECTORY
${CMAKE_CURRENT_LIST_DIR}/raisim/${RAISIM_BIN_DIR}/bin
DESTINATION
${CMAKE_INSTALL_PREFIX}
)
else()
install(
DIRECTORY
${CMAKE_CURRENT_LIST_DIR}/raisim/${RAISIM_BIN_DIR}/lib
DESTINATION
${CMAKE_INSTALL_PREFIX}
)
endif()
install(
DIRECTORY
${CMAKE_CURRENT_LIST_DIR}/raisim/${RAISIM_BIN_DIR}/include
DESTINATION
${CMAKE_INSTALL_PREFIX}
)
install(FILES package.xml DESTINATION "${CMAKE_INSTALL_DATADIR}/${PROJECT_NAME}")
if(RAISIM_ALL)
set(RAISIM_EXAMPLE TRUE)
set(RAISIM_MATLAB TRUE)
set(RAISIM_PY TRUE)
set(RAISIM_DOC TRUE)
endif()
if(RAISIM_EXAMPLE)
add_subdirectory(examples)
endif()
if(RAISIM_MATLAB)
add_subdirectory(raisimMatlab)
endif()
if(RAISIM_PY)
add_subdirectory(thirdParty/pybind11)
add_subdirectory(raisimPy)
endif()
if(RAISIM_DOC)
add_subdirectory(docs)
endif()
# EOF