~robot3d-team/robot3d/trunk

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
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
##########################################################################################
#
#  88888888ba               88                                ad888888b,  88888888ba,
#  88      "8b              88                         ,d    d8"     "88  88      `"8b
#  88      ,8P              88                         88            a8P  88        `8b
#  88aaaaaa8P'  ,adPPYba,   88,dPPYba,    ,adPPYba,  MM88MMM      aad8"   88         88
#  88""""88'   a8"     "8a  88P'    "8a  a8"     "8a   88         ""Y8,   88         88
#  88    `8b   8b       d8  88       d8  8b       d8   88            "8b  88         8P
#  88     `8b  "8a,   ,a8"  88b,   ,a8"  "8a,   ,a8"   88,   Y8,     a88  88      .a8P
#  88      `8b  `"YbbdP"'   8Y"Ybbd8"'    `"YbbdP"'    "Y888  "Y888888P'  88888888Y"'
#
##########################################################################################
# Part of the Robot3D simulator, a 3D robot simulator for modular robotics. This makefile
# is part of a cmake build system. The simulator is developed within the FP7 European
# projects Replicator and Symbrion. The namespace "sr" is an abbreviation of those project
# names. The code falls under the Lesser General Public License (LGPL GNU v3).

# Author:	 Anne C. van Rossum (Almende B.V.)
# Date: 	 Aug. 17, 2010
#
# URLs used to create this CMakeLists.txt file:
#   http://www.cmake.org/cmake/help/cmake_tutorial.html
#   http://brunoabinader.blogspot.com/2009/12/how-cmake-simplifies-build-process-part.html
#   http://rachid.koucha.free.fr/tech_corner/cmake_manual.html
# ASCII Art generated by: http://www.network-science.de/ascii/ with font "univers".
#
# Copyright © 2010 Anne van Rossum <anne@almende.com>
##########################################################################################

# I am not sure what the proper version number should be
CMAKE_MINIMUM_REQUIRED(VERSION 2.6)

# The project name (sets all _SOURCE_DIR)
PROJECT(ROBOT3D)

# The directory with all the FindXXX modules
SET(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake/Modules/")

# The macro below forces the build directory to be different from source directory:
INCLUDE( MacroEnsureOutOfSourceBuild )
MACRO_ENSURE_OUT_OF_SOURCE_BUILD(
	"${PROJECT_NAME} requires an out of source build."
)

INCLUDE(UtilityMacros)

# Versioning
SET(ROBOT3D_VERSION_MAJOR 0)
SET(ROBOT3D_VERSION_MINOR 1)

# Policies
# Remove policy warning as indicated by: cmake --help-policy CMP0015
if(POLICY CMP0015)
	cmake_policy(SET CMP0015 OLD) 
endif()

##############################################################################
# Use the FindXXX utility classes

# OpenGL, obviously, for graphics
FIND_PACKAGE(OpenGL REQUIRED)

# OpenCV is necessary for the "yarpviewer", so it did not seem like a problem
# to add it as a dependency. For the moment it is only used to quickly send an
# image over YARP, so the dependency can be removed easily in the future.
FIND_PACKAGE(OpenCV REQUIRED)

# Currently we use the ODE dynamics engine, Delta3D allows for the use of
# other simulators, we need to look into that
FIND_PACKAGE(ODE REQUIRED)

# The game engine is of course necessary, we might be more specific about
# versioning later on
FIND_PACKAGE(Delta3D REQUIRED)

# The CEGUI system is used for the GUIs, might be replaced by Qt later
FIND_PACKAGE(CEGUI REQUIRED)

# The OpenScenGraph libraries
FIND_PACKAGE(OSG REQUIRED)
FIND_PACKAGE(osgShadow REQUIRED)

# The Xerces XML parser is used, it might be replaced by TinyXML or another
# lightweight XML parser
FIND_PACKAGE(XercesC REQUIRED)

# We only need the filesystem library from Boost (and the bind?)
FIND_PACKAGE(Boost REQUIRED COMPONENTS filesystem system)

# The directories where includes (.h, .hpp, .so) files can be found
INCLUDE_DIRECTORIES("${PROJECT_SOURCE_DIR}/inc")

# A series of customizable options
#   We have to add here flags like BUILD_AUDIO etc
OPTION( BUILD_SHARED_LIBS "Set to OFF to build static libraries" ON)

# The header files of required libraries are located in

INCLUDE_DIRECTORIES(${DELTA3D_INCLUDE_DIR})
INCLUDE_DIRECTORIES(${ODE_INCLUDE_DIR})
INCLUDE_DIRECTORIES(${CEGUI_INCLUDE_DIR})
INCLUDE_DIRECTORIES(${OPENCV_INCLUDE_DIR})
INCLUDE_DIRECTORIES(${OSG_INCLUDE_DIR})
INCLUDE_DIRECTORIES(${OSGSHADOW_INCLUDE_DIR})
INCLUDE_DIRECTORIES(${XERCES_INCLUDE_DIR})
INCLUDE_DIRECTORIES(${Boost_INCLUDE_DIR})

# The libraries itself can be found as
# Be careful to include either LIBRARY or LIBRARIES, terminology depends per FindXXX file
SET(LIBS ${LIBS} ${ODE_LIBRARY})
SET(LIBS ${LIBS} ${CEGUI_LIBRARY})
SET(LIBS ${LIBS} ${OPENCV_LIBRARIES})
SET(LIBS ${LIBS} ${XERCES_LIBRARY})
SET(LIBS ${LIBS} ${Boost_LIBRARIES})
SET(LIBS ${LIBS} ${OSG_LIBRARIES})
SET(LIBS ${LIBS} ${OSGSHADOW_LIBRARIES})
# SET(LIBS ${LIBS} ${YARP_LIBRARIES})
SET(LIBS ${LIBS} pthread)

SET(LIB_NAME ${LIB_NAME} OSG_LIBRARY)
SET(LIB_NAME ${LIB_NAME} OSGUTIL_LIBRARY)
SET(LIB_NAME ${LIB_NAME} OSGDB_LIBRARY)
SET(LIB_NAME ${LIB_NAME} OSGTEXT_LIBRARY)
SET(LIB_NAME ${LIB_NAME} OSGTERRAIN_LIBRARY)
SET(LIB_NAME ${LIB_NAME} OSGFX_LIBRARY)
SET(LIB_NAME ${LIB_NAME} OSGVIEWER_LIBRARY)
SET(LIB_NAME ${LIB_NAME} OSGGA_LIBRARY)
SET(LIB_NAME ${LIB_NAME} OSGPARTICLE_LIBRARY)
SET(LIB_NAME ${LIB_NAME} OSGSIM_LIBRARY)
SET(LIB_NAME ${LIB_NAME} OSGSHADOW_LIBRARY)

SET(LIB_NAME ${LIB_NAME} DTUTIL_LIBRARY)
SET(LIB_NAME ${LIB_NAME} DTCORE_LIBRARY)
SET(LIB_NAME ${LIB_NAME} DTABC_LIBRARY)
SET(LIB_NAME ${LIB_NAME} DTDAL_LIBRARY)
SET(LIB_NAME ${LIB_NAME} DTAI_LIBRARY)
SET(LIB_NAME ${LIB_NAME} DTGAME_LIBRARY)
SET(LIB_NAME ${LIB_NAME} DTAUDIO_LIBRARY)
SET(LIB_NAME ${LIB_NAME} DTGUI_LIBRARY)
SET(LIB_NAME ${LIB_NAME} DTINSPECTORQT_LIBRARY)
SET(LIB_NAME ${LIB_NAME} DTACTORS_LIBRARY)
SET(LIB_NAME ${LIB_NAME} DTANIM_LIBRARY)
SET(LIB_NAME ${LIB_NAME} DTLMS_LIBRARY)
SET(LIB_NAME ${LIB_NAME} DTQT_LIBRARY)

# Compiler flags
#SET(CMAKE_CXX_FLAGS "-g -Wall -Weffc++ -DdSINGLE") #-fstack-protector-all")

# We need to pass "no-as-needed" to the linker for cmake 2.8.5, or srCore is 
# not compiled into libRobot3D.so and CreateGameEntryPoint cannot be found
SET(CMAKE_C_FLAGS "-DdSINGLE -Wl,--no-as-needed")
SET(CMAKE_CXX_FLAGS "-DdSINGLE -Wl,--no-as-needed")
SET(CMAKE_CXX_FLAGS_DEBUG "-g -O0 -Wall -D_GLIBCXX_DEBUG")

SET(CMAKE_SHARED_LIBRARY_SONAME_C_FLAG "-Wl,-soname,")

# Some debug information
MESSAGE("${PROJECT_NAME} is using CXX flags: ${CMAKE_CXX_FLAGS}")
MESSAGE ("Libraries included: ${LIBS}")
MESSAGE ("Include directories: ${CEGUI_INCLUDE_DIR}")
MESSAGE ("CMAKE_SOURCE_DIR: ${CMAKE_SOURCE_DIR}")

# RPATH
SET(CMAKE_SKIP_BUILD_RPATH  FALSE)
SET(CMAKE_BUILD_WITH_INSTALL_RPATH FALSE) 
ADD_TO_RPATH_IF_NOT_SYSTEM("${CMAKE_INSTALL_PREFIX}/lib")

# Include directories of the project
ADD_SUBDIRECTORY (src)
ADD_SUBDIRECTORY (inc)

# The directories in which the linker can search for libraries
LINK_DIRECTORIES(src/srCore src/srSensor src/srActuator src/srFactory src/srRobot)

# Linking the main
ADD_LIBRARY(Robot3D SHARED inc/srCore/export.h)
SET_TARGET_PROPERTIES(Robot3D PROPERTIES LINKER_LANGUAGE C)


TARGET_LINK_LIBRARIES(Robot3D srCore srSensor srActuator srFactory srRobot ${LIBS})
LINK_WITH_VARIABLES(Robot3D ${LIB_NAME})

INSTALL(TARGETS Robot3D DESTINATION ${CMAKE_INSTALL_PREFIX}/lib)