forked from s-nakaoka/openhrp-plugin
-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathCMakeLists.txt
162 lines (129 loc) · 4.22 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
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
# @author Shin'ichiro Nakaoka
option(BUILD_OPENHRP_PLUGIN "Building OpenHRPPlugin" OFF)
option(BUILD_OPENHRP_PLUGIN_FOR_3_0 "Building OpenHRPPlugin for OpenHRP 3.0.x" OFF)
option(BUILD_OPENHRP_MODEL_LOADER "Building OpenHRPModelLoader" OFF)
option(CHOREONOID_PLUGIN_LINK_USE_KEYWORD "Choreonoid plugin should use the PUBLIC link keyword" ON)
if(CHOREONOID_PLUGIN_LINK_USE_KEYWORD)
set(LINK_KEYWORD PUBLIC)
else()
set(LINK_KEYWORD)
endif()
# set(CMAKE_BUILD_TYPE Debug)
if(BUILD_OPENHRP_PLUGIN)
if(NOT BUILD_OPENRTM_PLUGIN)
message(FATAL_ERROR "OpenHRP Plugin requires OpenRTMPlugin.")
endif()
if(BUILD_OPENHRP_PLUGIN_FOR_3_0)
set(versions 3.1 3.0)
else()
set(versions 3.1)
endif()
if(UNIX AND NOT APPLE)
# Is this necessary to use both plugins for version 3.0 and 3.1 at the same time ?
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -Wl,-Bsymbolic")
endif()
try_compile(HAS_OLD_COLLISION_LINK_PAIR ${CMAKE_CURRENT_BINARY_DIR}/cmake/try-compile
SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/cmake/detect-old-collision-link-pair.cpp
COMPILE_DEFINITIONS -I${PROJECT_SOURCE_DIR}/include -I${PROJECT_SOURCE_DIR} -I${EIGEN3_INCLUDE_DIRS}
)
add_definitions(${OPENRTM_DEFINITIONS})
include_directories(${CMAKE_CURRENT_BINARY_DIR} ${OPENRTM_INCLUDE_DIRS})
link_directories(${OPENRTM_LIBRARY_DIRS})
foreach(version ${versions})
#-------------------- Sutbs & Skeletons -------------------------
set(idls
OpenHRPCommon
ModelLoader
DynamicsSimulator
CollisionDetector
ViewSimulator
Controller
OnlineViewer
)
if(version EQUAL 3.0)
set(defver "OPENHRP_3_0")
else()
set(defver "OPENHRP_3_1")
set(idls ${idls}
World
InterpreterService
ClockGenerator)
endif()
set(sources
OpenHRPControllerBase.cpp
)
set(headers
OpenHRPControllerBase.h
)
set(target CnoidOpenHRP${version})
set(idl_cpp_files "")
set(idl_h_files "")
idl_compile_cpp(idl_cpp_files idl_h_files corba/OpenHRP/${version} ${idls})
add_cnoid_library(${target} STATIC ${sources} ${idl_cpp_files} ${idl_h_files})
target_compile_definitions(${target} PUBLIC ${defver})
if(HAS_OLD_COLLISION_LINK_PAIR)
target_compile_definitions(${target} PUBLIC HAS_OLD_COLLISION_LINK_PAIR)
endif()
target_link_libraries(${target} ${LINK_KEYWORD} CnoidCorba)
apply_common_setting_for_library(${target} "${headers}")
# Plugin
set(target CnoidOpenHRP${version}Plugin)
set(sources
OpenHRPPlugin.cpp
DynamicsSimulator_impl.cpp
OpenHRPControllerItem.cpp
OnlineViewerServer.cpp
OpenHRPOnlineViewerItem.cpp
)
if(version EQUAL 3.1)
set(sources ${sources}
OpenHRPInterpreterServiceItem.cpp
OpenHRPClockGeneratorItem.cpp
)
endif()
set(headers
exportdecl.h
OpenHRPInterpreterServiceItem.h
)
if(MSVC)
add_compile_options(${OPENRTM_CFLAGS})
endif()
make_gettext_mofiles(${target} mofiles)
add_cnoid_plugin(${target} SHARED ${sources} ${headers} ${mofiles})
target_compile_definitions(${target} PUBLIC ${defver})
if(version EQUAL 3.0)
target_link_libraries(${target} ${LINK_KEYWORD} CnoidBodyPlugin CnoidOpenHRP${version})
else()
target_link_libraries(${target} ${LINK_KEYWORD} CnoidOpenRTMPlugin CnoidBodyPlugin CnoidOpenHRP${version})
endif()
apply_common_setting_for_plugin(${target} "${headers}")
endforeach()
if(ENABLE_PYTHON AND USE_PYBIND11)
add_subdirectory(pybind11)
elseif(BUILD_BOOST_PYTHON_MODULES)
add_subdirectory(boostpython)
endif()
add_subdirectory(sample)
endif()
if(BUILD_OPENHRP_MODEL_LOADER)
set(target cnoid-openhrp-model-loader)
set(sources
ShapeSetInfo_impl.cpp
SceneInfo_impl.cpp
BodyInfo_impl.cpp
ModelLoader_impl.cpp
ModelLoaderUtil.cpp
ModelLoaderServer.cpp
)
set(idls
OpenHRPCommon
ModelLoader
ViewSimulator
World
)
set(idl_cpp_files "")
set(idl_h_files "")
idl_compile_cpp(idl_cpp_files idl_h_files corba/OpenHRPModelLoader ${idls})
add_cnoid_executable(${target} ${sources} ${idl_cpp_files})
target_link_libraries(${target} CnoidCorba CnoidBody ${OMNIDYNAMIC_LIBRARIES})
endif()