forked from psoetens/orocos-ocl
-
Notifications
You must be signed in to change notification settings - Fork 1
/
CMakeLists.txt
292 lines (228 loc) · 10.2 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
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
#
# Test CMake version
#
CMAKE_MINIMUM_REQUIRED(VERSION 2.2)
#MARK_AS_ADVANCED( FORCE CMAKE_BACKWARDS_COMPATIBILITY )
# for CMake 2.6 corrected behaviour (see "cmake --help-policy CMP0003")
IF(${CMAKE_MAJOR_VERSION} EQUAL 2 AND ${CMAKE_MINOR_VERSION} GREATER 4)
CMAKE_POLICY(SET CMP0003 NEW)
ENDIF(${CMAKE_MAJOR_VERSION} EQUAL 2 AND ${CMAKE_MINOR_VERSION} GREATER 4)
###################################################
# #
# Start project customization section #
# #
###################################################
PROJECT(orocos-ocl)
SET( OCL_VERSION 1.12.99 )
STRING( REGEX MATCHALL "[0-9]+" OCL_VERSIONS ${OCL_VERSION} )
LIST( GET OCL_VERSIONS 0 OCL_VERSION_MAJOR)
LIST( GET OCL_VERSIONS 1 OCL_VERSION_MINOR)
LIST( GET OCL_VERSIONS 2 OCL_VERSION_PATCH)
MESSAGE( "Orocos Component Library version ${VERSION} (${OCL_VERSION_MAJOR}.${OCL_VERSION_MINOR}.${OCL_VERSION_PATCH})" )
SET( PROJ_SOURCE_DIR ${orocos-ocl_SOURCE_DIR} )
SET( PROJ_BINARY_DIR ${orocos-ocl_BINARY_DIR} )
# Load the optional orocos-ocl.cmake file.
INCLUDE(${PROJ_SOURCE_DIR}/orocos-ocl.cmake OPTIONAL)
if (NOT EXISTS ${PROJ_SOURCE_DIR}/orocos-ocl.cmake)
# Setup the default settings
INCLUDE(${PROJ_SOURCE_DIR}/orocos-ocl.default.cmake)
MESSAGE(
"No orocos-ocl.cmake file loaded, using default settings."
"See orocos-ocl.default.cmake")
endif ()
IF(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
IF (MSVC)
SET(CMAKE_INSTALL_PREFIX
"C:/Program Files/orocos" CACHE PATH "Orocos install prefix" FORCE
)
set( OROCOS_INSTALL "C:/Program Files/orocos" CACHE PATH "RTT installation path")
ENDIF(MSVC)
ENDIF(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
INCLUDE(CTest)
ENABLE_TESTING()
IF(BUILD_TESTING)
SET(BUILDNAME "${BUILDNAME}" CACHE STRING "Name of build on the dashboard")
MARK_AS_ADVANCED(BUILDNAME)
ENDIF(BUILD_TESTING)
# Do not rely on environment variables to find the path, because that's confusing
IF(NOT CMAKE_INSTALL_PREFIX)
SET( CMAKE_INSTALL_PREFIX /usr/local CACHE PATH "Installation directory" FORCE)
MESSAGE( "Setting installation directory to ${CMAKE_INSTALL_PREFIX}" )
ENDIF(NOT CMAKE_INSTALL_PREFIX)
IF(NOT OROCOS_INSTALL)
SET( OROCOS_INSTALL ${CMAKE_INSTALL_PREFIX} CACHE PATH "The RTT installation directory.")
ENDIF(NOT OROCOS_INSTALL)
IF(NOT RTT_VVERSION)
SET( RTT_VVERSION "v${OCL_VERSION_MAJOR}.${OCL_VERSION_MINOR}.x" )
ENDIF(NOT RTT_VVERSION)
IF(NOT KDL_INSTALL)
SET( KDL_INSTALL ${CMAKE_INSTALL_PREFIX} CACHE PATH "The KDL installation directory.")
ENDIF(NOT KDL_INSTALL)
IF(NOT KDL_VVERSION)
SET( KDL_VVERSION "v0.4.x" )
ENDIF(NOT KDL_VVERSION)
IF(NOT BFL_INSTALL)
SET( BFL_INSTALL ${CMAKE_INSTALL_PREFIX} CACHE PATH "The BFL installation directory.")
ENDIF(NOT BFL_INSTALL)
IF(NOT COMEDI_INSTALL)
SET( COMEDI_INSTALL ${CMAKE_INSTALL_PREFIX} CACHE PATH "The COMEDI installation directory.")
ELSE(NOT COMEDI_INSTALL)
SET( COMEDI_INSTALL "${COMEDI_INSTALL}" CACHE PATH "The COMEDI installation directory.")
ENDIF(NOT COMEDI_INSTALL)
IF(NOT NETCDF_INSTALL)
SET( NETCDF_INSTALL ${CMAKE_INSTALL_PREFIX} CACHE PATH "The NETCDF installation directory.")
ENDIF(NOT NETCDF_INSTALL)
# The name of the resulting library.
#SET( COMPONENTS_LIBRARY orocos-components CACHE STRING "Name of the resulting library")
#INSTALL_TARGETS( /lib ${COMPONENTS_LIBRARY} )
# The dependencies of the COMPONENTS_LIBRARY
SET( COMPONENTS_LIBRARY_DEPS "" CACHE STRING "Dependencies of the resulting library")
# Toggle if the whole build gets in a single library.
#Broken: SET( GLOBAL_LIBRARY ON CACHE BOOL "Build a large ${COMPONENTS_LIBRARY} library")
# Toggle if individual libs must be built.
SET( LOCAL_LIBRARY ON ) # CACHE BOOL "Build a library for each component.")
# Toggle if an executable must be built.
#Broken: SET( STANDALONE_COMPONENTS OFF CACHE BOOL "Build an executable for each component.")
# Make compilation verbose by default
SET(CMAKE_VERBOSE_MAKEFILE FALSE)
###################################################
# #
# End project customization section #
# #
###################################################
if(OROCOS_TARGET STREQUAL "win32")
if (MSVC)
if (NOT MSVC80)
set(NUM_PARALLEL_BUILD 4 CACHE STRING "Number of parallel builds")
set(PARALLEL_FLAG "/MP${NUM_PARALLEL_BUILD}")
endif()
add_definitions(/wd4355 /wd4251 /wd4180 /wd4996 /bigobj ${PARALLEL_FLAG} /DBOOST_ALL_NO_LIB)
#list(APPEND OROCOS-RTT_LIBRARIES kernel32.lib user32.lib gdi32.lib winspool.lib shell32.lib ole32.lib oleaut32.lib uuid.lib comdlg32.lib advapi32.lib Ws2_32.lib winmm.lib)
endif()
set(CMAKE_DEBUG_POSTFIX "d")
endif(OROCOS_TARGET STREQUAL "win32")
###################################################
# #
# Do some global set-up & checking #
# #
###################################################
# Modules path (for searching FindXXX.cmake files)
list(APPEND CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/config")
#
# This is the first in the include path.
INCLUDE_DIRECTORIES( ${PROJ_SOURCE_DIR} ${PROJ_BINARY_DIR}/ocl )
# Put your 'flags' inhere if you want them to apear in the
# orocos-components.pc file. Various .cmake scripts below do
# this.
SET( ENV{OROCOS_COMPONENTS_CFLAGS} "")
SET( ENV{OROCOS_COMPONENTS_LINKFLAGS} "")
SET( ENV{OROCOS_COMPONENTS_REQUIRES} "")
INCLUDE(${PROJ_SOURCE_DIR}/config/global_setup.cmake)
INCLUDE(${PROJ_SOURCE_DIR}/config/component_rules.cmake)
## Find Orocos RTT.
INCLUDE (${PROJ_SOURCE_DIR}/config/FindOrocosRTT.cmake)
IF (OROCOS_RTT_1.4)
OROCOS_PKGCONFIG_REQUIRES("orocos-rtt-${OROCOS_TARGET}")
ELSE (OROCOS_RTT_1.4)
OROCOS_PKGCONFIG_REQUIRES("orocos-rtt")
ENDIF (OROCOS_RTT_1.4)
## Find KDL
INCLUDE (${PROJ_SOURCE_DIR}/config/FindKDL.cmake)
## Find BFL
INCLUDE (${PROJ_SOURCE_DIR}/config/FindBFL.cmake)
## Find Comedi
INCLUDE (${PROJ_SOURCE_DIR}/config/FindComedi.cmake)
## Find Netcdf
INCLUDE (${PROJ_SOURCE_DIR}/config/FindNetcdf.cmake)
## Uninstall target
CONFIGURE_FILE(
"${CMAKE_CURRENT_SOURCE_DIR}/config/cmake_uninstall.cmake.in"
"${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake"
IMMEDIATE @ONLY)
ADD_CUSTOM_TARGET(uninstall
"${CMAKE_COMMAND}" -P "${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake")
OPTION( NO_GPL "Set to 'ON' to exclude all GPL'd code" OFF)
IF(NO_GPL)
ADD_DEFINITIONS( -DNO_GPL )
ENDIF(NO_GPL)
###########################################################
# #
# Look for dependencies required by individual components #
# #
###########################################################
INCLUDE(${PROJ_SOURCE_DIR}/config/check_depend.cmake)
#First unset the LOCAL_LIBRARIES
SET(ENV{SELECTED_LIBS} "")
SET(ENV{SELECTED_DIRS} "")
ADD_SUBDIRECTORY( doc )
ADD_SUBDIRECTORY( ocl )
ADD_SUBDIRECTORY( taskbrowser )
ADD_SUBDIRECTORY( timer )
ADD_SUBDIRECTORY( helloworld )
ADD_SUBDIRECTORY( reporting )
ADD_SUBDIRECTORY( hardware )
ADD_SUBDIRECTORY( motion_control )
ADD_SUBDIRECTORY( viewer )
ADD_SUBDIRECTORY( deployment )
ADD_SUBDIRECTORY( bin )
MESSAGE("Selected Libraries: $ENV{SELECTED_LIBS}")
SET(SELECTED_LIBS $ENV{SELECTED_LIBS})
SET(OROCOS_COMPONENTS_LINKFLAGS "$ENV{OROCOS_COMPONENTS_LINKFLAGS}")
SET(OROCOS_COMPONENTS_CFLAGS "$ENV{OROCOS_COMPONENTS_CFLAGS}")
SET(OROCOS_COMPONENTS_REQUIRES "$ENV{OROCOS_COMPONENTS_REQUIRES}")
CONFIGURE_FILE( ${PROJ_SOURCE_DIR}/ocl/ocl-config.h.in ${PROJ_BINARY_DIR}/ocl/ocl-config.h @ONLY)
CONFIGURE_FILE( ${PROJ_SOURCE_DIR}/orocos-ocl.pc.in ${PROJ_BINARY_DIR}/orocos-ocl-${OROCOS_TARGET}.pc @ONLY)
INSTALL_FILES( /lib/pkgconfig FILES orocos-ocl-${OROCOS_TARGET}.pc)
INSTALL_FILES( /include/ocl FILES ocl/ocl-config.h)
#MESSAGE("Selected dirs: $ENV{SELECTED_DIRS}")
#SET(SELECTED_DIRS $ENV{SELECTED_DIRS})
CONFIGURE_FILE(Doxyfile.in Doxyfile @ONLY)
############################################################
## #
## Setup PACKAGING THIS IS EXPERIMENTAL/BETA/NOT USED #
## #
############################################################
IF ( "${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION}" STREQUAL "2.4" )
OPTION( CPACK_PACKAGES "Set to ON to build the packages. Requires cmake >2.4" OFF )
MARK_AS_ADVANCED( CPACK_PACKAGES )
IF (CPACK_PACKAGES)
INCLUDE(InstallRequiredSystemLibraries)
# ATTENTION: There is sometimes a _SOURCE_ version of an
# option as well, set both if necessary !
# Create .tar.gz and .tar.tbz2 files:
SET(CPACK_GENERATOR "TBZ2")
SET(CPACK_SOURCE_GENERATOR "TBZ2")
# The plain 'package' target works correctly.
SET(CPACK_IGNORE_FILES "/CVS/;/.svn/;.swp$;.#;/#;/build/")
# Since the 'package_source' target does a bold copy, define a list of
# files which should be excluded. Note that 'subpattern' matching is used,
# thus to exclude a directory use /mydir/
SET(CPACK_SOURCE_IGNORE_FILES "/CVS/;/.svn/;.swp$;.#;/#;/build/;~")
SET(CPACK_PACKAGE_DESCRIPTION_SUMMARY "Orocos Components")
SET(CPACK_PACKAGE_VENDOR "The Orocos Community")
SET(CPACK_PACKAGE_DESCRIPTION_FILE "${CMAKE_CURRENT_SOURCE_DIR}/README")
SET(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_CURRENT_SOURCE_DIR}/COPYING")
SET(CPACK_PACKAGE_MAJOR_VERSION "0")
SET(CPACK_PACKAGE_MINOR_VERSION "1")
SET(CPACK_PACKAGE_VERSION_PATCH "1")
SET(CPACK_PACKAGE_EXECUTABLES "OrocosExec" "Orocos Executable")
SET(CPACK_PACKAGE_INSTALL_DIRECTORY "${CMAKE_INSTALL_PREFIX}")
SET(CPACK_SOURCE_TOPLEVEL_TAG "src")
SET(CPACK_PACKAGE_FILE_NAME "orocos-ocl")
INCLUDE(CPack)
ENDIF (CPACK_PACKAGES)
ELSE ( "${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION}" STREQUAL "2.4" )
MESSAGE ( "Disabling packaging for version ${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION}")
ENDIF ( "${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION}" STREQUAL "2.4" )
#############################
# #
# Building Doxygen documents#
# #
#############################
ADD_CUSTOM_TARGET(docapi "doxygen" "Doxyfile")
## Debugging
OPTION( DISPLAY_FLAGS "Display cmake variables at end of configure step." OFF)
MARK_AS_ADVANCED(DISPLAY_FLAGS)
IF( DISPLAY_FLAGS )
INCLUDE(config/cmake_logging.cmake)
ENDIF( DISPLAY_FLAGS )