-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
executable file
·228 lines (169 loc) · 7.31 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
###########################################################
# Top level CMakeLists.txt file for the MOOS Project
# pnewman@robots.ox.ac.uk
###########################################################
CMAKE_MINIMUM_REQUIRED(VERSION 2.6)
if(COMMAND cmake_policy)
cmake_policy(SET CMP0003 NEW)
endif(COMMAND cmake_policy)
###########################################################
PROJECT(MOOS)
###########################################################
############# CORE ? ################
SET( BUILD_CORE_MOOS ON CACHE BOOL "Build Core MOOS")
IF(BUILD_CORE_MOOS)
#here we name all the things we want built as part of the core MOOS
SET(BUILD_DIRS ${BUILD_DIRS} Core)
ENDIF(BUILD_CORE_MOOS)
IF(CMAKE_COMPILER_IS_GNUCXX)
SET( WALL_ON OFF CACHE BOOL "tell me about all compiler warnings (-Wall) ")
IF(WALL_ON)
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall")
ENDIF( WALL_ON)
ELSE(CMAKE_COMPILER_IS_GNUCXX)
IF(MSVC)
SET( WALL_ON OFF CACHE BOOL "tell me about all compiler warnings (-Wall) ")
IF(WALL_ON)
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall")
ENDIF(WALL_ON)
ELSE(MSVC)
# Other compilers go here
ENDIF(MSVC)
ENDIF(CMAKE_COMPILER_IS_GNUCXX)
############# ESSENTIAL APPS ? ################
SET( BUILD_ESSENTIAL_MOOS ON CACHE BOOL "Build Essential MOOS Processes (like pLogger pAntler etc)")
IF(BUILD_ESSENTIAL_MOOS)
#here we name all the things we want built as part of the Essential MOOS
SET(BUILD_DIRS ${BUILD_DIRS} Essentials)
ENDIF(BUILD_ESSENTIAL_MOOS)
############# CONTROL AND NAV ? ################
SET( BUILD_CONTROL_AND_NAV OFF CACHE BOOL "Build control and navigation Apps iRemote pHelm pNav")
IF(BUILD_CONTROL_AND_NAV)
#here we name all the things we want built under the navigation and control heading
SET(BUILD_DIRS ${BUILD_DIRS} NavigationAndControl )
ENDIF(BUILD_CONTROL_AND_NAV)
############# TOOLS ? ################
SET( BUILD_TOOLS OFF CACHE BOOL "Build GUI tools, simulators and matlab access")
IF(BUILD_TOOLS)
#here we tell CMake to descend into the tools directory. More
#decisions will be made in there
SET(BUILD_DIRS ${BUILD_DIRS} Tools)
ENDIF(BUILD_TOOLS)
############# INSTRUMENTS ? ################
SET( BUILD_INSTRUMENTS OFF CACHE BOOL "Build Instruments ")
IF(BUILD_INSTRUMENTS)
SET(BUILD_DIRS ${BUILD_DIRS} Instruments)
ENDIF(BUILD_INSTRUMENTS)
############# EXAMPLES ? ################
SET( BUILD_EXAMPLES OFF CACHE BOOL "Build Documentation Examples ")
IF(BUILD_EXAMPLES)
SET(BUILD_DIRS ${BUILD_DIRS} Docs/ProgrammingWithMOOS/code Docs/Essentials/Antler/code )
ENDIF(BUILD_EXAMPLES)
############## Thirdparty ?######################
#we'll always descend into thirdparty but don't always build stuff there
SET(BUILD_DIRS ${BUILD_DIRS} Thirdparty)
SET(THIRDPARTY_DIR ${MOOS_SOURCE_DIR}/Thirdparty)
############# UTILITY LIBRARY ? ################
SET( BUILD_UTILITY_LIBRARY ON CACHE BOOL "Build MOOSUtility Library")
IF(BUILD_UTILITY_LIBRARY)
#here we build a goody box that many folk will want to use
SET(BUILD_DIRS ${BUILD_DIRS} Essentials/MOOSUtilityLib)
INCLUDE_DIRECTORIES(${MOOS_SOURCE_DIR}/Essentials )
SET(MOOSLIBS ${MOOSLIBS} MOOSUtility)
ENDIF(BUILD_UTILITY_LIBRARY)
############# OTHER BRANCHES ? ################
SET( ALSO_BUILD CACHE STRING "Specify other directories you want to include in the build (semicolon separated list)")
SET(BUILD_DIRS ${BUILD_DIRS} ${ALSO_BUILD})
#####################################################
# some includes are always needed...
INCLUDE_DIRECTORIES(${MOOS_SOURCE_DIR}/Core )
#####################################################
# some definitions are always needed...
IF(WIN32)
ADD_DEFINITIONS(-DWINDOWS_NT -D_CRT_SECURE_NO_DEPRECATE -D_SCL_SECURE_NO_DEPRECATE)
ENDIF(WIN32)
IF(UNIX)
ADD_DEFINITIONS(-DUNIX)
IF("${CMAKE_SYSTEM_NAME}" MATCHES "Darwin")
ADD_DEFINITIONS( -DPLATFORM_DARWIN )
SET( PLATFORM_DARWIN 1 )
ENDIF("${CMAKE_SYSTEM_NAME}" MATCHES "Darwin")
IF("${CMAKE_SYSTEM_NAME}" MATCHES "Linux")
ADD_DEFINITIONS( -DPLATFORM_LINUX )
SET( PLATFORM_LINUX 1 )
ENDIF("${CMAKE_SYSTEM_NAME}" MATCHES "Linux")
ENDIF(UNIX)
#####################################################
# some platform libs are always required...
IF(WIN32)
SET(PLATFORM_LIBS wsock32 comctl32)
ENDIF(WIN32)
IF(UNIX)
SET(PLATFORM_LIBS m pthread ssl)
IF("${CMAKE_SYSTEM_NAME}" MATCHES "SunOS")
SET(PLATFORM_LIBS ${PLATFORM_LIBS} socket nsl rt)
ENDIF("${CMAKE_SYSTEM_NAME}" MATCHES "SunOS")
ENDIF(UNIX)
#name the MOOSLIBS
SET(MOOSLIBS ${MOOSLIBS} MOOS MOOSGen)
#####################################################
#name OPENGL LIBS (useful for child projects)
IF(WIN32)
SET(OPENGL_LIBS glu32 opengl32 )
ENDIF(WIN32)
IF(UNIX)
SET(OPENGL_LIBS GL GLU)
ENDIF(UNIX)
#####################################################
#OSX Leopard has a cyclic linking issue this is a fix
IF(PLATFORM_DARWIN)
OPTION(OSX_LEOPARD_GL_FIX "Adds linker fix for openGL in Leopard" FALSE)
IF(OSX_LEOPARD_GL_FIX)
SET(CMAKE_EXE_LINKER_FLAGS ${CMAKE_EXE_LINKER_FLAGS} "-dylib_file /System/Library/Frameworks/OpenGL.framework/Versions/A/Libraries/libGL.dylib: /System/Library/Frameworks/OpenGL.framework/Versions/A/Libraries/libGL.dylib")
ENDIF(OSX_LEOPARD_GL_FIX)
ENDIF(PLATFORM_DARWIN)
#####################################################
# Toby Schneiders request for fPIC on amd64
IF("${CMAKE_SYSTEM_PROCESSOR}" STREQUAL "x86_64")
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fPIC" )
ENDIF("${CMAKE_SYSTEM_PROCESSOR}" STREQUAL "x86_64")
# An option to disable names lookup in MOOS server.
SET(DISABLE_NAMES_LOOKUP OFF CACHE BOOL "Disable client names lookup in MOOSDB")
IF(DISABLE_NAMES_LOOKUP)
ADD_DEFINITIONS(-DMOOS_DISABLE_NAMES_LOOKUP)
ENDIF(DISABLE_NAMES_LOOKUP)
#####################################################
#default set up for location of built files
#NB user can change this through UI
SET(MOOSBIN ${MOOS_BINARY_DIR}/MOOSBin)
#dump libs and executables in the same place
SET( LIBRARY_OUTPUT_PATH ${MOOSBIN} CACHE PATH
"Output directory for the MOOS libraries" )
SET( EXECUTABLE_OUTPUT_PATH ${MOOSBIN} CACHE PATH
"Output directory for the MOOS executables" )
###############################################################################
# be helpful and let all projects look for libraries here
LINK_DIRECTORIES(${LIBRARY_OUTPUT_PATH})
###############################################################################
# Create the MOOSConfig.cmake file for the build tree.
SET( MOOS_INCLUDE_DIRS
${MOOS_SOURCE_DIR}/Core
${MOOS_SOURCE_DIR}/Essentials
${MOOS_SOURCE_DIR}/NavigationAndControl
${MOOS_SOURCE_DIR}/Instruments
${MOOS_SOURCE_DIR}/Tools
${MOOS_SOURCE_DIR}/Thirdparty
)
SET( MOOS_LIBRARIES ${MOOSLIBS} )
SET( MOOS_LIBRARY_DIRS ${LIBRARY_OUTPUT_PATH} )
CONFIGURE_FILE( ${MOOS_SOURCE_DIR}/MOOSConfig.cmake.in
${MOOS_BINARY_DIR}/MOOSConfig.cmake @ONLY IMMEDIATE )
###############################################################################
# Tell CMake where to look for find moduleXYZ files
SET( CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake_modules" )
# GO FORTH!
SUBDIRS(${BUILD_DIRS})
# Add MOOS build directory to local CMake Pacakge cache, to help the find scripts
if ("${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION}" GREATER 2.7)
export(PACKAGE MOOS)
endif("${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION}" GREATER 2.7)