1 ############################################################################
3 # Copyright 2010-2012 BMW Car IT GmbH
4 # Copyright (C) 2011 DENSO CORPORATION and Robert Bosch Car Multimedia Gmbh
7 # Licensed under the Apache License, Version 2.0 (the "License");
8 # you may not use this file except in compliance with the License.
9 # You may obtain a copy of the License at
11 # http://www.apache.org/licenses/LICENSE-2.0
13 # Unless required by applicable law or agreed to in writing, software
14 # distributed under the License is distributed on an "AS IS" BASIS,
15 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 # See the License for the specific language governing permissions and
17 # limitations under the License.
19 ############################################################################
21 cmake_minimum_required (VERSION 2.6)
22 project (LayerManager)
24 set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_CURRENT_SOURCE_DIR}/cmake/modules/")
26 include(${CMAKE_MODULE_PATH}/CMakeVersions.txt)
28 #==============================================================================
29 # set default build type, if not defined by user
30 #==============================================================================
31 if (NOT CMAKE_BUILD_TYPE)
32 set(CMAKE_BUILD_TYPE Release CACHE STRING
33 "Choose build type: Debug, Release, RelWithDebInfo, MinSizeRel."
35 message(STATUS "Build type not defined. Using default build type 'Release'.")
36 endif (NOT CMAKE_BUILD_TYPE)
39 #==============================================================================
40 # Platforms / A set of indiviual options at once
41 #==============================================================================
42 option (WITH_X11_GLES "Build for X11 with GLES 2.0" ON )
43 option (WITH_GLESv2_LIB "Build development library for GLES2 Based Renderers" OFF)
44 option (WITH_EGL_EXAMPLE "Build EGL_EXAMPLE / X11" ON )
45 option (WITH_WL_EXAMPLE "Build EGL_EXAMPLE / Wayland" OFF)
46 option (WITH_DESKTOP "Build for Desktop / GLX" OFF)
47 option (WITH_GLX_LIB "Build development library for GLX Based Renderers" OFF)
48 option (WITH_GLX_EXAMPLE "Build GLX_EXAMPLE " OFF)
49 option (WITH_FORCE_COPY "Force Software Copy of Pixmaps" OFF)
50 option (WITH_CLIENTEXAMPLES "Build client examples " ON )
51 option (WITH_TESTS "Build Available Tests " OFF)
52 option (WITH_DLT "Build with DLT support " OFF)
53 option (WITH_WAYLAND_FBDEV "Build Wayland with FBDEV backend" OFF)
54 option (WITH_WAYLAND_X11 "Build Wayland with X11 backend" OFF)
55 option (WITH_WAYLAND_DRM "Build Wayland with drm backend" OFF)
56 option (WITH_SERVICE_BIN "Build LayerManagerService Binary" ON)
57 option (WITH_CONTROL_BIN "Build LayerManagerControl Binary" ON)
58 option (WITH_CLIENT_LIB "Build LayerManagement Client Lib" ON)
59 option (WITH_GENERIC_COMMUNICATOR "Build Generic Communicator Plugin" ON)
60 option (WITH_SYSTEMD_HEALTH_MONITOR "Build plugin for systemd health monitoring" OFF)
61 option (WITH_EXAMPLE_SCENE_PROVIDER "Build scene provider plugin for examples" OFF)
62 option (WITH_STATIC_LIBRARIES "Link all libraries statically" OFF)
63 option (WITH_TEXT_RENDERER "Build text renderer (only logging)" OFF)
66 #==============================================================================
67 # Internal global settings not available to user
68 #==============================================================================
69 set (WITH_WAYLAND OFF)
70 set (BUILD_UTILS_LIB OFF)
71 set (INSTALL_UTILS_LIB OFF)
72 set (STATICALLY_LINKED_PLUGINS "" CACHE INTERNAL "list of static plugins" FORCE)
75 #==============================================================================
76 # make sure, only one wayland based renderer was selected
77 #==============================================================================
78 set(NumberOfWaylandRenderers 0)
81 set (WITH_GLESv2_LIB ON)
83 MATH(EXPR NumberOfWaylandRenderers "${NumberOfWaylandRenderers} + 1")
84 endif(WITH_WAYLAND_X11)
86 if (WITH_WAYLAND_FBDEV)
89 MATH(EXPR NumberOfWaylandRenderers "${NumberOfWaylandRenderers} + 1")
90 endif(WITH_WAYLAND_FBDEV)
93 set (WITH_GLESv2_LIB ON)
95 MATH(EXPR NumberOfWaylandRenderers "${NumberOfWaylandRenderers} + 1")
96 endif(WITH_WAYLAND_DRM)
98 if(NumberOfWaylandRenderers GREATER 1)
99 MESSAGE(FATAL_ERROR "More than one Wayland based renderer was selected. This is not supported.")
100 endif(NumberOfWaylandRenderers GREATER 1)
103 #==============================================================================
104 # set default build parameters
105 #==============================================================================
106 add_subdirectory(cmake/optionalFeatures)
108 include_directories ("${PROJECT_SOURCE_DIR}/config")
109 include_directories ("${PROJECT_SOURCE_DIR}/3rdParty/")
110 # ilm_types are used internally to LM, so we can include them by default
111 include_directories ("${PROJECT_SOURCE_DIR}/LayerManagerClient/ilmClient/include")
114 #==============================================================================
115 # default compiler settings for 3rd party components
116 #==============================================================================
118 add_subdirectory (3rdParty)
121 #==============================================================================
122 # use strict compiler settings for examples and tools
123 #------------------------------------------------------------------------------
124 set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall")
125 set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wextra")
126 #==============================================================================
128 if (WITH_EGL_EXAMPLE)
129 add_subdirectory (LayerManagerExamples/EGLX11ApplicationExample)
130 add_subdirectory (LayerManagerExamples/EGLX11MockNavigation)
131 set (BUILD_UTILS_LIB ON)
132 endif(WITH_EGL_EXAMPLE)
134 if (WITH_GLX_EXAMPLE)
135 add_subdirectory (LayerManagerExamples/GLXApplicationExample)
136 set (BUILD_UTILS_LIB ON)
137 endif(WITH_GLX_EXAMPLE)
139 if (WITH_CLIENTEXAMPLES)
140 add_subdirectory (LayerManagerExamples/LayerManagerClientExample)
141 set (BUILD_UTILS_LIB ON)
142 endif(WITH_CLIENTEXAMPLES)
145 add_subdirectory (LayerManagerExamples/EGLWLApplicationExample)
146 add_subdirectory (LayerManagerExamples/EGLWLMockNavigation)
147 add_subdirectory (LayerManagerExamples/WLChromakeyExample)
148 add_subdirectory (LayerManagerExamples/EGLWLInputEventExample)
149 set (BUILD_UTILS_LIB ON)
150 endif(WITH_WL_EXAMPLE)
152 if (WITH_CONTROL_BIN)
153 add_subdirectory (LayerManagerControl)
154 set (BUILD_UTILS_LIB ON)
155 endif(WITH_CONTROL_BIN)
157 #==============================================================================
158 # use very strict compiler settings for internal components
159 #------------------------------------------------------------------------------
160 set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -pedantic -Wno-long-long")
161 set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-unused-function")
162 #set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Werror")
163 #==============================================================================
165 if (WITH_EXAMPLE_SCENE_PROVIDER)
166 add_subdirectory (LayerManagerPlugins/SceneProvider/ExampleSceneProvider)
167 endif(WITH_EXAMPLE_SCENE_PROVIDER)
169 if (WITH_SYSTEMD_HEALTH_MONITOR)
170 add_subdirectory (LayerManagerPlugins/HealthMonitor/SystemdHealthMonitor)
171 endif(WITH_SYSTEMD_HEALTH_MONITOR)
173 if (WITH_GENERIC_COMMUNICATOR)
174 add_subdirectory (LayerManagerCommands)
175 add_subdirectory (LayerManagerPlugins/Communicators/GenericCommunicator)
176 endif(WITH_GENERIC_COMMUNICATOR)
179 set (WITH_GLX_LIB ON CACHE BOOL "Build X11 GLX development lib" FORCE)
180 add_subdirectory (LayerManagerPlugins/Renderers/Platform/GLXRenderer)
184 add_subdirectory (LayerManagerPlugins/Renderers/Platform/WaylandGLESRenderer)
188 set (WITH_GLESv2_LIB ON CACHE BOOL "Build X11 GLES development lib" FORCE)
189 add_subdirectory (LayerManagerPlugins/Renderers/Platform/X11GLESRenderer)
192 if (WITH_TEXT_RENDERER)
193 add_subdirectory (LayerManagerPlugins/Renderers/Platform/TextRenderer)
194 endif(WITH_TEXT_RENDERER)
196 if (WITH_SERVICE_BIN OR WITH_CLIENT_LIB)
197 add_subdirectory (LayerManagerPlugins/IpcModules)
199 if (WITH_SERVICE_BIN)
200 add_subdirectory (LayerManagerPlugins/Renderers/Graphic)
201 add_subdirectory (LayerManagerBase)
202 add_subdirectory (LayerManagerService)
203 set (BUILD_UTILS_LIB ON)
204 set (INSTALL_UTILS_LIB ON)
205 endif (WITH_SERVICE_BIN)
208 add_subdirectory (LayerManagerClient/ilmClient)
209 endif (WITH_CLIENT_LIB)
211 endif (WITH_SERVICE_BIN OR WITH_CLIENT_LIB)
213 #==============================================================================
214 # build internal libraries, if required by other components
215 #==============================================================================
217 add_subdirectory (LayerManagerUtils)
218 endif (BUILD_UTILS_LIB)
220 #==============================================================================
221 # enable ctest if building with tests
222 # run 'make test' after build to run all tests
223 # be aware that some tests require a running layermanager
224 #==============================================================================
229 #==============================================================================
230 # store used build configuration
231 #==============================================================================
232 add_subdirectory(config)