forked from OctoMap/octomap
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCMakeLists.txt
137 lines (106 loc) · 3.9 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
CMAKE_MINIMUM_REQUIRED(VERSION 2.6)
PROJECT( octomap )
# version (e.g. for packaging)
set(V_MAJOR 1)
set(V_MINOR 0)
set(V_PATCH 0)
# get rid of a useless warning:
if(COMMAND cmake_policy)
cmake_policy(SET CMP0003 NEW)
endif(COMMAND cmake_policy)
# COMPILER SETTINGS (default: Release)
# use "-DCMAKE_BUILD_TYPE=Debug" in cmake for a Debug-build
IF(NOT CMAKE_CONFIGURATION_TYPES AND NOT CMAKE_BUILD_TYPE)
SET(CMAKE_BUILD_TYPE Release)
ENDIF(NOT CMAKE_CONFIGURATION_TYPES AND NOT CMAKE_BUILD_TYPE)
# COMPILER FLAGS
SET (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Wno-error ")
SET (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wno-error ")
SET (CMAKE_CXX_FLAGS_RELEASE "-O3 -funroll-loops -DNDEBUG -O3 -msse3 -mssse3")
SET (CMAKE_CXX_FLAGS_DEBUG "-O0 -g")
# Set output directories for libraries and executables
SET( BASE_DIR ${CMAKE_SOURCE_DIR} )
SET( CMAKE_LIBRARY_OUTPUT_DIRECTORY ${BASE_DIR}/lib )
SET( CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${BASE_DIR}/lib )
SET( CMAKE_RUNTIME_OUTPUT_DIRECTORY ${BASE_DIR}/bin )
SET (CMAKE_MODULE_PATH ${CMAKE_MODULES_PATH} ${BASE_DIR}/CMakeModules)
MESSAGE ("\n")
MESSAGE (STATUS "Building as ${CMAKE_BUILD_TYPE}")
MESSAGE ("\n")
INCLUDE_DIRECTORIES(
${CMAKE_SOURCE_DIR}/include
)
# Installation
# test dir for install
# IF(NOT CMAKE_INSTALL_PREFIX)
# set(CMAKE_INSTALL_PREFIX ${BASE_DIR}/install/)
# ENDIF(NOT CMAKE_INSTALL_PREFIX)
set(INSTALL_TARGETS_DEFAULT_ARGS
RUNTIME DESTINATION bin
LIBRARY DESTINATION lib
ARCHIVE DESTINATION lib
)
ADD_SUBDIRECTORY( src/octomap/math )
ADD_SUBDIRECTORY( src/octomap )
# installation for external targets:
install(PROGRAMS "src/extern/binvox/binvox" DESTINATION bin)
install(PROGRAMS "src/extern/binvox/binvox64" DESTINATION bin)
install(PROGRAMS "src/extern/binvox/viewvox" DESTINATION bin)
install(PROGRAMS "src/extern/binvox/viewvox64" DESTINATION bin)
file(GLOB octomap_HDRS ${CMAKE_SOURCE_DIR}/include/octomap/*.h ${CMAKE_SOURCE_DIR}/include/octomap/*.hxx)
install(FILES ${octomap_HDRS} DESTINATION include/octomap)
file(GLOB octomap_math_HDRS ${CMAKE_SOURCE_DIR}/include/octomap/math/*.h)
install(FILES ${octomap_math_HDRS} DESTINATION include/octomap/math)
# Documentation
FIND_PACKAGE(Doxygen)
IF(DOXYGEN_FOUND)
ADD_CUSTOM_TARGET(docs ${DOXYGEN_EXECUTABLE} ${CMAKE_SOURCE_DIR}/octomap.dox
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
COMMENT "Generating documentation (Doxygen)...")
ENDIF(DOXYGEN_FOUND)
SET( BUILD_VIEWER 0)
FIND_PACKAGE(OpenGL)
IF(NOT OPENGL_FOUND)
MESSAGE ( "\n")
MESSAGE ( "OpenGL not found. \n")
ELSE()
MESSAGE (STATUS "OpenGL found at ${OPENGL_LIBRARY}")
# Look for Qt4
FIND_PACKAGE(Qt4)
IF(QT4_FOUND)
FIND_PACKAGE(QGLViewer)
IF(QGLViewer_FOUND)
SET( BUILD_VIEWER 1)
ELSE()
MESSAGE ( "\n")
MESSAGE ( "libQGLViewer could not be found or generated.")
ENDIF()
ELSE()
MESSAGE ( "\n")
MESSAGE ( "Qt4 development environment could not be found.")
ENDIF()
ENDIF()
IF(BUILD_VIEWER)
MESSAGE(STATUS "\n")
MESSAGE(STATUS "viewer octovis will be built")
ADD_SUBDIRECTORY( src/octovis )
ELSE()
MESSAGE ( "Unfortunately, the viewer (octovis) can not be built because some requirements are missing.")
MESSAGE ( "See README.txt or http://octomap.sf.net for further information.\n")
ENDIF()
# Package building stuff - Experimental!
SET(CPACK_PACKAGE_VERSION_MAJOR "${V_MAJOR}")
SET(CPACK_PACKAGE_VERSION_MINOR "${V_MINOR}")
SET(CPACK_PACKAGE_VERSION_PATCH "${V_PATCH}")
SET(CPACK_PACKAGE_INSTALL_DIRECTORY "CMake ${V_MAJOR}.${V_MINOR}")
SET(CPACK_PACKAGE_CONTACT "K.M. Wurm and A. Hornung")
SET(CPACK_PACKAGE_VENDOR "University of Freiburg")
SET(CPACK_GENERATOR "DEB")
SET(CPACK_SOURCE_GENERATOR "TGZ")
INCLUDE(CPack)
MESSAGE (STATUS "\n")
MESSAGE (STATUS "Compile octomap using: make")
MESSAGE (STATUS "Install octomap using: make install")
MESSAGE ( " (be sure to set the correct CMAKE_INSTALL_PREFIX before)")
MESSAGE (STATUS "Compile API-documentation using: make docs\n")
MESSAGE (STATUS "")