forked from RobotLocomotion/drake
-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
47 lines (34 loc) · 1.34 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
# -*- mode: cmake -*-
# vi: set ft=cmake :
cmake_minimum_required(VERSION 3.5.1)
project(drake_matlab LANGUAGES CXX)
if(CMAKE_VERSION VERSION_LESS 3.10)
list(INSERT CMAKE_MODULE_PATH 0
"${PROJECT_SOURCE_DIR}/../third_party/com_kitware_gitlab_cmake_cmake/3.10/Modules"
)
endif()
include(CTest)
include(cmake/flags.cmake)
include(cmake/functions.cmake)
include(cmake/packages.cmake)
configure_file(addpath_drake.m addpath_drake.m COPYONLY)
install(FILES addpath_drake.m DESTINATION share/drake/matlab)
if(UNIX AND NOT APPLE)
# On Linux, force targets to use system Protobuf shared library instead of
# the shared library bundled with MATLAB. On macOS, the two shared libraries
# are correctly marked as ABI incompatible.
get_filename_component(MEX_LIBRARY_DIR "${Matlab_MEX_LIBRARY}" DIRECTORY)
get_filename_component(PROTOBUF_LIBRARY_DIR
"${Protobuf_LIBRARY_RELEASE}" DIRECTORY
)
set(CMAKE_INSTALL_RPATH
"$ORIGIN:$ORIGIN/../../../lib:${PROTOBUF_LIBRARY_DIR}:${MEX_LIBRARY_DIR}"
)
set(CMAKE_CXX_FLAGS "-Wl,-rpath,${PROTOBUF_LIBRARY_DIR} ${CMAKE_CXX_FLAGS}")
endif()
drake_matlab_add_mex(call_matlab_client call_matlab_client.cc)
target_link_libraries(call_matlab_client drake::drake protobuf::libprotobuf)
install(TARGETS call_matlab_client DESTINATION share/drake/matlab)
if(BUILD_TESTING)
add_subdirectory(test)
endif()