forked from HoangGiang93/mujoco_sim
-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
125 lines (111 loc) · 3.71 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
cmake_minimum_required(VERSION 3.10)
project(mujoco_sim)
## Compile as C++11, supported in ROS Kinetic and newer
# add_compile_options(-std=c++11)
## Find catkin macros and libraries
## if COMPONENTS list like find_package(catkin REQUIRED COMPONENTS xyz)
## is used, also find other catkin packages
find_package(catkin REQUIRED COMPONENTS
roscpp
rospy
std_msgs
mujoco_msgs
roslib
controller_manager
tf2_ros
urdf
)
find_package(Doxygen)
if (DOXYGEN_FOUND)
# set output file
set(DOXYGEN_OUT ${PROJECT_SOURCE_DIR}/docs/Doxyfile)
# note the option ALL which allows to build the docs together with the application
add_custom_target( doc_doxygen ALL
COMMAND ${DOXYGEN_EXECUTABLE} ${DOXYGEN_OUT}
WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}/docs
COMMENT "Generating API documentation with Doxygen"
VERBATIM )
else (DOXYGEN_FOUND)
message("Doxygen need to be installed to generate the doxygen documentation")
endif (DOXYGEN_FOUND)
set(MUJOCO mujoco)
add_custom_command(OUTPUT ${MUJOCO}_build
WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}
COMMAND $(MAKE) mujoco
VERBATIM
)
add_custom_target(${MUJOCO} DEPENDS ${MUJOCO}_build)
###################################
## catkin specific configuration ##
###################################
## The catkin_package macro generates cmake config files for your package
## Declare things to be passed to dependent projects
## INCLUDE_DIRS: uncomment this if your package contains header files
## LIBRARIES: libraries you create in this project that dependent projects also need
## CATKIN_DEPENDS: catkin_packages dependent projects also need
## DEPENDS: system dependencies of this project that dependent projects also need
catkin_package(
INCLUDE_DIRS include/mujoco_sim
# LIBRARIES
CATKIN_DEPENDS roscpp rospy std_msgs roslib
# DEPENDS
)
###########
## Build ##
###########
set(MUJOCO_SOURCE_DIR ${PROJECT_SOURCE_DIR}/build/mujoco-2.3.7)
## Specify additional locations of header files
## Your package locations should be listed before other locations
include_directories(
${catkin_INCLUDE_DIRS}
${PROJECT_SOURCE_DIR}/include/mujoco_sim
${MUJOCO_SOURCE_DIR}/include
)
set(MUJOCO_COMPILE_NODE mujoco_compile_node)
add_executable(${MUJOCO_COMPILE_NODE} src/mujoco_compile.cpp)
add_dependencies(${MUJOCO_COMPILE_NODE} ${MUJOCO})
target_link_libraries(${MUJOCO_COMPILE_NODE}
${catkin_LIBRARIES}
${MUJOCO_SOURCE_DIR}/lib/libmujoco.so
tinyxml2
)
set(MUJOCO_SIM_HEADLESS_NODE mujoco_sim_headless_node)
add_executable(${MUJOCO_SIM_HEADLESS_NODE} src/mujoco_sim_headless.cpp)
add_dependencies(${MUJOCO_SIM_HEADLESS_NODE} ${MUJOCO})
add_library(${MUJOCO_SIM_HEADLESS_NODE}_lib
${PROJECT_SOURCE_DIR}/src/mujoco_sim/mj_hw_interface.cpp
${PROJECT_SOURCE_DIR}/src/mujoco_sim/mj_ros.cpp
${PROJECT_SOURCE_DIR}/src/mujoco_sim/mj_model.cpp
${PROJECT_SOURCE_DIR}/src/mujoco_sim/mj_sim.cpp
)
add_dependencies(${MUJOCO_SIM_HEADLESS_NODE}_lib ${MUJOCO})
target_link_libraries(${MUJOCO_SIM_HEADLESS_NODE}
${catkin_LIBRARIES}
${MUJOCO_SIM_HEADLESS_NODE}_lib
${MUJOCO_SOURCE_DIR}/lib/libmujoco.so
$ENV{ROS_ROOT}/../../lib/liburdf.so
tinyxml2
zmq
jsoncpp
)
set(MUJOCO_SIM_NODE mujoco_sim_node)
add_executable(${MUJOCO_SIM_NODE} src/mujoco_sim.cpp)
add_dependencies(${MUJOCO_SIM_NODE} ${MUJOCO})
add_library(${MUJOCO_SIM_NODE}_lib
${PROJECT_SOURCE_DIR}/src/mujoco_sim/mj_visual.cpp
)
add_dependencies(${MUJOCO_SIM_NODE}_lib ${MUJOCO})
target_link_libraries(${MUJOCO_SIM_NODE}
${catkin_LIBRARIES}
${MUJOCO_SIM_HEADLESS_NODE}_lib
${MUJOCO_SIM_NODE}_lib
${MUJOCO_SOURCE_DIR}/lib/libmujoco.so
$ENV{ROS_ROOT}/../../lib/liburdf.so
tinyxml2
zmq
jsoncpp
glfw
GL
)
catkin_install_python(PROGRAMS script/mujoco_to_usd.py
DESTINATION ${CATKIN_PACKAGE_BIN_DESTINATION})