-
Notifications
You must be signed in to change notification settings - Fork 41
/
CMakeLists.txt
106 lines (93 loc) · 3.26 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
PROJECT(glosm)
CMAKE_MINIMUM_REQUIRED(VERSION 2.6)
SET(CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake)
# Global options
IF(UNIX)
SET(BUILD_TILER_DEFAULT ON)
ELSE(UNIX)
SET(BUILD_TILER_DEFAULT OFF)
ENDIF(UNIX)
IF(WIN32)
SET(WITH_GLEW_DEFAULT ON)
ELSE(WIN32)
SET(WITH_GLEW_DEFAULT OFF)
ENDIF(WIN32)
OPTION(BUILD_VIEWER_SDL "Build first-person osm viewer (SDL version)" ON)
OPTION(BUILD_VIEWER_GLUT "Build first-person osm viewer (GLUT version)" OFF)
OPTION(BUILD_TILER "Build tile generator" ${BUILD_TILER_DEFAULT})
OPTION(BUILD_EXAMPLES "Build examples" OFF)
OPTION(BUILD_TESTS "Build tests" ON)
OPTION(WITH_GLEW "Use GLEW (needed when you system uses archaic OpenGL)" ${WITH_GLEW_DEFAULT})
OPTION(WITH_GLES "Use OpenGL ES 1.1" OFF)
# TODO: this requires rewriting some legacy OpenGL code
#OPTION(WITH_GLES2 "Use OpenGL ES 2.0" OFF)
OPTION(WITH_TOUCHPAD "Tune control for touchpad instead of mouse" OFF)
OPTION(DEBUG_TILING "Render tile bounds for debugging" OFF)
OPTION(DEBUG_FPS "Don't limit FPS for profiling" OFF)
# Global variables (still overridable via cmake -D ..)
SET(BINDIR "bin" CACHE STRING "Install subdirectory for binaries")
SET(LIBDIR "lib" CACHE STRING "Install subdirectory for libraries")
# Conditionals
IF(MINGW)
# Leave console till we have better way to display "Loading..." message
SET(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -mconsole")
ENDIF(MINGW)
# TODO: these should be disabled if only server software is built
IF(WITH_GLES)
FIND_PACKAGE(GLES REQUIRED)
ADD_DEFINITIONS(-DWITH_GLES)
SET(GL_INCLUDE_DIRS ${GLES_INCLUDE_DIR})
SET(GL_LIBRARIES ${GLES_LIBRARY})
ELSEIF(WITH_GLES2)
FIND_PACKAGE(GLES2 REQUIRED)
ADD_DEFINITIONS(-DWITH_GLES2)
SET(GL_INCLUDE_DIRS ${GLES2_INCLUDE_DIR})
SET(GL_LIBRARIES ${GLES2_LIBRARY})
ELSE(WITH_GLES)
FIND_PACKAGE(OpenGL REQUIRED)
SET(GL_INCLUDE_DIRS ${OPENGL_INCLUDE_DIR})
SET(GL_LIBRARIES ${OPENGL_gl_LIBRARY})
ENDIF(WITH_GLES)
IF(WITH_GLEW)
FIND_PACKAGE(GLEW REQUIRED)
ADD_DEFINITIONS(-DWITH_GLEW)
SET(GL_INCLUDE_DIRS ${GL_INCLUDE_DIRS} ${GLEW_INCLUDE_DIR})
SET(GL_LIBRARIES ${GL_LIBRARIES} ${GLEW_LIBRARY})
ENDIF(WITH_GLEW)
# Global definitions
ADD_DEFINITIONS(-Wall -Wextra -Wno-unused-parameter)
IF(DEBUG_TILING)
ADD_DEFINITIONS(-DDEBUG_TILING)
ENDIF(DEBUG_TILING)
IF(DEBUG_FPS)
ADD_DEFINITIONS(-DDEBUG_FPS)
ENDIF(DEBUG_FPS)
# Info
MESSAGE(STATUS " Building SDL viewer: ${BUILD_VIEWER_SDL}")
MESSAGE(STATUS " Building GLUT viewer: ${BUILD_VIEWER_GLUT}")
MESSAGE(STATUS " Building tiler: ${BUILD_TILER}")
MESSAGE(STATUS " Building examples: ${BUILD_EXAMPLES}")
MESSAGE(STATUS " Building tests: ${BUILD_TESTS}")
MESSAGE(STATUS "")
MESSAGE(STATUS " GLEW support: ${WITH_GLEW}")
MESSAGE(STATUS "OpenGL ES 1.1 support: ${WITH_GLES}")
#MESSAGE(STATUS "OpenGL ES 2.0 support: ${WITH_GLES2}")
MESSAGE(STATUS " Touchpad support: ${WITH_TOUCHPAD}")
# Framework subdirs
ADD_SUBDIRECTORY(libglosm-server)
ADD_SUBDIRECTORY(libglosm-client)
ADD_SUBDIRECTORY(libglosm-geomgen)
# Application subdirs
IF(BUILD_VIEWER_SDL OR BUILD_VIEWER_GLUT)
ADD_SUBDIRECTORY(viewer)
ENDIF(BUILD_VIEWER_SDL OR BUILD_VIEWER_GLUT)
IF(BUILD_TILER)
ADD_SUBDIRECTORY(tiler)
ENDIF(BUILD_TILER)
IF(BUILD_EXAMPLES)
ADD_SUBDIRECTORY(examples)
ENDIF(BUILD_EXAMPLES)
IF(BUILD_TESTS)
ENABLE_TESTING()
ADD_SUBDIRECTORY(tests)
ENDIF(BUILD_TESTS)