-
Notifications
You must be signed in to change notification settings - Fork 1
/
CMakeLists.txt
executable file
·72 lines (58 loc) · 1.56 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
cmake_minimum_required(VERSION 2.8.3)
project(matlab_cpp_interface)
find_package(catkin REQUIRED COMPONENTS roscpp message_generation message_runtime cmake_modules)
set(CMAKE_CXX_FLAGS "-std=c++11 -fPIC")
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${CMAKE_CURRENT_SOURCE_DIR}/cmake)
find_package(Matlab REQUIRED QUIET)
find_package(Eigen3 REQUIRED)
find_package(Boost REQUIRED COMPONENTS thread)
if(${MATLAB_FOUND})
catkin_package(
INCLUDE_DIRS include ${MATLAB_INCLUDE_DIR} ${EIGEN3_INCLUDE_DIR} ${Boost_INCLUDE_DIRS}
LIBRARIES mxArrayWrapper matlabMatFile matlabEngine ${MATLAB_LIBRARIES}
)
include_directories(
include
test
${EIGEN3_INCLUDE_DIR}
${catkin_INCLUDE_DIRS}
${MATLAB_INCLUDE_DIR}
)
add_library(mxArrayWrapper STATIC
src/internal/MxArrayWrapper.cpp
src/internal/MxArrayNDimWrapper.cpp
)
add_library(matlabMatFile STATIC
src/MatFile.cpp
)
add_library(matlabEngine STATIC
src/Engine.cpp
)
add_executable(matlabTest test/test_main.cpp)
add_executable(matlabROSTest test/ros_test_main.cpp)
target_link_libraries(matlabMatFile
mxArrayWrapper
${MATLAB_LIBRARIES}
)
target_link_libraries(matlabEngine
mxArrayWrapper
${MATLAB_LIBRARIES}
)
target_link_libraries(matlabTest
matlabMatFile
matlabEngine
mxArrayWrapper
${MATLAB_LIBRARIES}
)
target_link_libraries(matlabROSTest
matlabMatFile
matlabEngine
mxArrayWrapper
${catkin_LIBRARIES}
${Boost_LIBRARIES}
${MATLAB_LIBRARIES}
)
else(${MATLAB_FOUND})
message(WARNING "MATLAB NOT FOUND, WILL NOT COMPILE THIS PACKAGE")
catkin_package()
endif(${MATLAB_FOUND})