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
|
cmake_minimum_required(VERSION 2.4.6)
include($ENV{ROS_ROOT}/core/rosbuild/rosbuild.cmake)
# Set the build type. Options are:
# Coverage : w/ debug symbols, w/o optimization, w/ code-coverage
# Debug : w/ debug symbols, w/o optimization
# Release : w/o debug symbols, w/ optimization
# RelWithDebInfo : w/ debug symbols, w/ optimization
# MinSizeRel : w/o debug symbols, w/ optimization, stripped binaries
set(ROS_BUILD_TYPE Debug)
rosbuild_init()
rosbuild_find_ros_package(parallel_quickstep)
if (parallel_quickstep_PACKAGE_PATH)
message("Found parallel_quickstep, will compile with this functionality")
add_definitions(-DUSE_PARALLEL)
set( PQ_LIBRARY "parallel_quickstep" )
set( PQ_LINKFLAGS "-Wl,-rpath,${parallel_quickstep_PACKAGE_PATH}/lib -L${parallel_quickstep_PACKAGE_PATH}/lib")
set( PQ_CXXFLAGS "-I${parallel_quickstep_PACKAGE_PATH}/include/")
message("Parallel_quickstep cxxflags: ${PQ_CXXFLAGS}")
else (parallel_quickstep_PACKAGE_PATH)
message("Unable to find parallel_quickstep, single-threaded solutions only enabled")
set( PQ_LIBRARY "" )
endif (parallel_quickstep_PACKAGE_PATH)
#set the default path for built executables to the "bin" directory
set(EXECUTABLE_OUTPUT_PATH ${PROJECT_SOURCE_DIR}/../bin)
#set the default path for built libraries to the "lib" directory
set(LIBRARY_OUTPUT_PATH ${PROJECT_SOURCE_DIR}/../lib)
#uncomment if you have defined messages
#rosbuild_genmsg()
#uncomment if you have defined services
#rosbuild_gensrv()
#common commands for building c++ executables and libraries
# this SHOULD work, but causes segfaults on plugin execution. (no idea why!)
#rosbuild_add_library(${PROJECT_NAME} src/csiro_oderavemain.cpp include/${PROJECT_NAME}/csiro_odephysics.h include/${PROJECT_NAME}/csiro_odespace.h include/${PROJECT_NAME}/csiroplugindefs.h)
rosbuild_add_library(test_multicontroller test/csiro_test_multicontroller.cpp)
rosbuild_add_library(test_car_multicontroller test/test_car_multicontroller.cpp)
#target_link_libraries(${PROJECT_NAME} another_library)
#rosbuild_add_boost_directories()
#rosbuild_link_boost(${PROJECT_NAME} thread)
#rosbuild_add_executable(example examples/example.cpp)
#target_link_libraries(example ${PROJECT_NAME})
###### BELOW IS DEPRECATED (if above works) ######
# Specific target rules for ode plugin
execute_process(COMMAND rospack find openrave OUTPUT_VARIABLE OPENRAVE_DIR)
find_package(OpenRAVE REQUIRED)
include(${CMAKE_CURRENT_SOURCE_DIR}/FindODE.cmake)
INCLUDE(CheckCXXSourceCompiles)
if(ODE_LIBRARY_FOUND)
string(REGEX REPLACE "[\r\n]" "" OPENRAVE_LIB_DIR "${OPENRAVE_DIR}/lib")
string(REGEX REPLACE "[\r\n]" "" OPENRAVE_INC_DIR "${OPENRAVE_DIR}/include")
link_directories(${OPENRAVE_LIB_DIR} ${ODE_LINK_DIRS})
include_directories(${OPENRAVE_INC_DIR} ${ODE_INCLUDE_DIRS} ${CMAKE_CURRENT_SOURCE_DIR})
add_definitions("-fno-strict-aliasing -Wall -ggdb")
add_library(CSIROoderave SHARED src/csiro_oderavemain.cpp include/${PROJECT_NAME}/csiro_odephysics.h include/${PROJECT_NAME}/csiro_odespace.h include/${PROJECT_NAME}/csiroplugindefs.h)
set(CMAKE_REQUIRED_INCLUDES ${ODE_INCLUDE_DIRS})
set(CMAKE_REQUIRED_FLAGS "${ODE_CXXFLAGS}")
check_cxx_source_compiles("
#include <ode/ode.h>
#include <rave/rave.h>
typedef int dTriIndex;
int main()
{
return 0;
}"
NEED_TRIINDEX)
set(CMAKE_REQUIRED_FLAGS "")
if( NEED_TRIINDEX )
set(ODE_CXXFLAGS "${ODE_CXXFLAGS} -DNEED_DTRIINDEX_TYPEDEF")
message(STATUS "NEED_TRIINDEX SET")
endif()
message(STATUS "ODE and OPENRAVE found, building ode physics plugin with precision=${ODE_PRECISION}")
add_dependencies(CSIROoderave libopenrave ode)
set_target_properties(CSIROoderave PROPERTIES COMPILE_FLAGS "${ODE_CXXFLAGS} -DODE_HAVE_ALLOCATE_DATA_THREAD ${PQ_CXXFLAGS} ${OpenRAVE_CXX_FLAGS}" LINK_FLAGS "${PQ_LINKFLAGS} ${OpenRAVE_LINK_FLAGS}")
target_link_libraries(CSIROoderave ${OpenRAVE_LIBRARIES} ${ODE_LIBRARY} ${PQ_LIBRARY})
else()
message(STATUS "Could not find ODE. Check dependancy on the opende ROS package or install ODE from http://www.ode.org")
endif()
|