-
Notifications
You must be signed in to change notification settings - Fork 10
/
CMakeLists.txt
140 lines (110 loc) · 3.93 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
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
if(${CMAKE_VERSION} VERSION_LESS 3.20)
set(message "CMake >= 3.20 is required for mc-rtc-superbuild")
if(UNIX)
if(APPLE)
set(SCRIPT_SUFFIX macos)
else()
set(SCRIPT_SUFFIX linux)
endif()
set(message "${message}\nYou can run:\n${CMAKE_SOURCE_DIR}/utils/bootstrap-${SCRIPT_SUFFIX}.sh\nto prepare your system for mc-rtc-superbuild")
else()
set(message "${message}\nYou can download a recent version of CMake from https://cmake.org/download/")
endif()
message(FATAL_ERROR ${message})
endif()
cmake_minimum_required(VERSION 3.20)
if(${CMAKE_SOURCE_DIR} STREQUAL ${CMAKE_BINARY_DIR})
message(FATAL_ERROR "Do not run cmake inside mc-rtc-superbuild folder, it will break.
Please remove CMakeCache.txt and the CMakeFiles folder that were just created")
endif()
project(mc_rtc_superbuild LANGUAGES C CXX)
include(CTest)
enable_testing()
if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES AND NOT ENV{CMAKE_BUILD_TYPE})
message(STATUS "Setting default build type to RelWithDebInfo as none was provided")
set(CMAKE_BUILD_TYPE "RelWithDebInfo" CACHE STRING "Choose the type of a build" FORCE)
endif()
if(EMSCRIPTEN)
if(NOT DEFINED ENV{EMSDK})
message(FATAL_ERROR "EMSDK not present in environment")
endif()
set(CMAKE_INSTALL_PREFIX "$ENV{EMSDK}/upstream/emscripten/system" CACHE PATH "" FORCE)
endif()
include(cmake/project.cmake)
if(APPLE)
include(cmake/macos-dependencies.cmake)
endif()
if(WIN32)
include(cmake/win32-dependencies.cmake)
endif()
if(EMSCRIPTEN)
include(cmake/emscripten-dependencies.cmake)
endif()
if(UNIX AND NOT APPLE AND NOT EMSCRIPTEN)
include(cmake/linux-dependencies.cmake)
endif()
include(mc_rtc.cmake)
add_subdirectory(robots)
set_property(GLOBAL PROPERTY ADDED_EXTENSIONS)
add_subdirectory(extensions)
### Personal projects can go here although that is not recommended
### PERSONAL_PROJECTS
### No more personal projects past this point
message("
mc-rtc-superbuild is now ready, the following special targets are available:
- clone: clone all projects into their location
- update: update all the projects at once
- uninstall: uninstall all the project at once
You can also use the [COMMAND]-[NAME] form to update particular projects
Or use your regular build command to build all projects
")
set(RC_FILE ".bashrc")
set(RC_EXT ".bash")
if("$ENV{SHELL}" STREQUAL "/usr/bin/zsh" OR "$ENV{SHELL}" STREQUAL "/bin/zsh")
set(RC_FILE ".zshrc")
set(RC_EXT ".zsh")
endif()
set(FINAL_MESSAGE
"
Source will be cloned in ${SOURCE_DESTINATION}
Please add the following lines to your ${RC_FILE} file:
export PATH=${CMAKE_INSTALL_PREFIX}/bin:$PATH
export PKG_CONFIG_PATH=${CMAKE_INSTALL_PREFIX}/lib/pkgconfig:$PKG_CONFIG_PATH"
)
if(APPLE)
set(FINAL_MESSAGE "${FINAL_MESSAGE}
export DYLD_LIBRARY_PATH=${CMAKE_INSTALL_PREFIX}/lib:$DYLD_LIBRARY_PATH")
elseif(UNIX)
set(FINAL_MESSAGE "${FINAL_MESSAGE}
export LD_LIBRARY_PATH=${CMAKE_INSTALL_PREFIX}/lib:$LD_LIBRARY_PATH")
endif()
if(MC_RTC_SUPERBUILD_DEFAULT_PYTHON AND NOT PYTHON_BINDING_USER_INSTALL)
set(FINAL_MESSAGE "${FINAL_MESSAGE}
export PYTHONPATH=${EXTRA_PYTHONPATH}:$PYTHONPATH")
endif()
if(WITH_ROS_SUPPORT)
get_property(ID GLOBAL PROPERTY PREVIOUS_CATKIN_WORKSPACE)
if(NOT "${ID}" STREQUAL "")
get_property(DIR GLOBAL PROPERTY CATKIN_WORKSPACE_${ID}_DIR)
if(ROS_IS_ROS2)
set(ROS_SETUP_PATH "${DIR}/install/setup${RC_EXT}")
else()
set(ROS_SETUP_PATH "${DIR}/devel/setup${RC_EXT}")
endif()
set(FINAL_MESSAGE "${FINAL_MESSAGE}
export ROS_PARALLEL_JOBS=\"$ENV{ROS_PARALLEL_JOBS}\"
source ${ROS_SETUP_PATH}
")
endif()
endif()
if(WIN32)
if(MC_RTC_SUPERBUILD_SET_ENVIRONMENT)
set(FINAL_MESSAGE "${FINAL_MESSAGE}
This has already been set in your environment. Please open a new shell for the change to take effect.")
endif()
endif()
message("${FINAL_MESSAGE}")
install(CODE "message(\"\")")
install(CODE "message(\"Installation done\")")
install(CODE "message(\"\")")
install(CODE "message(\"${FINAL_MESSAGE}\")")