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)
57 option (WITH_SERVICE_BIN "Build LayerManagerService Binary" ON)
58 option (WITH_CLIENT_LIB "Build LayerManagement Client Lib" ON)
59 option (WITH_COMMUNICATOR_GEN "Build Generic Communicator Plugin" ON)
61 option (WITH_PLUGIN_SYSTEMD_HEALTH_MONITOR "Build plugin for systemd health monitoring" OFF)
63 option (WITH_TEXT_RENDERER "Build renderer renderer (only logging)" OFF)
65 option (WITH_PLUGIN_EXAMPLE_SCENE_PROVIDER "Build scene provider plugin for example applciations" OFF)
68 #==============================================================================
69 # Internal global settings not available to user
70 #==============================================================================
71 set (WITH_WAYLAND OFF)
72 set (BUILD_UTILS_LIB OFF)
73 set (INSTALL_UTILS_LIB OFF)
76 #==============================================================================
77 # make sure, only one wayland based renderer was selected
78 #==============================================================================
79 set(NumberOfWaylandRenderers 0)
82 set (WITH_GLESv2_LIB ON)
84 MATH(EXPR NumberOfWaylandRenderers "${NumberOfWaylandRenderers} + 1")
85 endif(WITH_WAYLAND_X11)
87 if (WITH_WAYLAND_FBDEV)
90 MATH(EXPR NumberOfWaylandRenderers "${NumberOfWaylandRenderers} + 1")
91 endif(WITH_WAYLAND_FBDEV)
94 set (WITH_GLESv2_LIB ON)
96 MATH(EXPR NumberOfWaylandRenderers "${NumberOfWaylandRenderers} + 1")
97 endif(WITH_WAYLAND_DRM)
99 if(NumberOfWaylandRenderers GREATER 1)
100 MESSAGE(FATAL_ERROR "More than one Wayland based renderer was selected. This is not supported.")
101 endif(NumberOfWaylandRenderers GREATER 1)
104 #==============================================================================
105 # set default build parameters
106 #==============================================================================
107 add_subdirectory(cmake/optionalFeatures)
108 add_subdirectory(config)
110 include_directories ("${PROJECT_SOURCE_DIR}/config")
111 include_directories ("${PROJECT_SOURCE_DIR}/3rdParty/")
112 # ilm_types are used internally to LM, so we can include them by default
113 include_directories ("${PROJECT_SOURCE_DIR}/LayerManagerClient/ilmClient/include")
116 #==============================================================================
117 # default compiler settings for 3rd party components
118 #==============================================================================
120 add_subdirectory (3rdParty)
123 #==============================================================================
124 # use strict compiler settings for examples
125 #------------------------------------------------------------------------------
126 set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall")
127 set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wextra")
128 #==============================================================================
130 if (WITH_EGL_EXAMPLE)
131 add_subdirectory (LayerManagerExamples/EGLX11ApplicationExample)
132 add_subdirectory (LayerManagerExamples/EGLX11MockNavigation)
133 set (BUILD_UTILS_LIB ON)
134 endif(WITH_EGL_EXAMPLE)
136 if (WITH_GLX_EXAMPLE)
137 add_subdirectory (LayerManagerExamples/GLXApplicationExample)
138 set (BUILD_UTILS_LIB ON)
139 endif(WITH_GLX_EXAMPLE)
141 if (WITH_CLIENTEXAMPLES)
142 add_subdirectory (LayerManagerExamples/LayerManagerClientExample)
143 add_subdirectory (LayerManagerExamples/LayerManagerControl)
144 set (BUILD_UTILS_LIB ON)
145 endif(WITH_CLIENTEXAMPLES)
148 add_subdirectory (LayerManagerExamples/EGLWLApplicationExample)
149 add_subdirectory (LayerManagerExamples/EGLWLMockNavigation)
150 add_subdirectory (LayerManagerExamples/WLChromakeyExample)
151 add_subdirectory (LayerManagerExamples/EGLWLInputEventExample)
152 set (BUILD_UTILS_LIB ON)
153 endif(WITH_WL_EXAMPLE)
155 #==============================================================================
156 # use very strict compiler settings for internal components
157 #------------------------------------------------------------------------------
158 set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -pedantic -Wno-long-long")
159 set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-unused-function")
160 #set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Werror")
161 #==============================================================================
163 if (WITH_PLUGIN_EXAMPLE_SCENE_PROVIDER)
164 add_subdirectory (LayerManagerPlugins/SceneProvider/ExampleSceneProvider)
165 endif(WITH_PLUGIN_EXAMPLE_SCENE_PROVIDER)
167 if (WITH_PLUGIN_SYSTEMD_HEALTH_MONITOR)
168 add_subdirectory (LayerManagerPlugins/HealthMonitor/SystemdHealthMonitor)
169 endif(WITH_PLUGIN_SYSTEMD_HEALTH_MONITOR)
171 if (WITH_COMMUNICATOR_GEN)
172 add_subdirectory (LayerManagerCommands)
173 add_subdirectory (LayerManagerPlugins/Communicators/GenericCommunicator)
174 endif(WITH_COMMUNICATOR_GEN)
177 set (WITH_GLX_LIB ON CACHE BOOL "Build X11 GLX development lib" FORCE)
178 add_subdirectory (LayerManagerPlugins/Renderers/Platform/GLXRenderer)
182 if (WITH_WAYLAND_VIVANTE_GAL)
183 add_subdirectory (LayerManagerPlugins/Renderers/Platform/WaylandVivanteRenderer)
184 else (WITH_WAYLAND_VIVANTE_GAL)
185 add_subdirectory (LayerManagerPlugins/Renderers/Platform/WaylandGLESRenderer)
186 endif (WITH_WAYLAND_VIVANTE_GAL)
190 set (WITH_GLESv2_LIB ON CACHE BOOL "Build X11 GLES development lib" FORCE)
191 add_subdirectory (LayerManagerPlugins/Renderers/Platform/X11GLESRenderer)
194 if (WITH_TEXT_RENDERER)
195 add_subdirectory (LayerManagerPlugins/Renderers/Platform/TextRenderer)
196 endif(WITH_TEXT_RENDERER)
198 if (WITH_SERVICE_BIN OR WITH_CLIENT_LIB)
199 add_subdirectory (LayerManagerPlugins/IpcModules)
201 if (WITH_SERVICE_BIN)
202 add_subdirectory (LayerManagerPlugins/Renderers/Graphic)
203 add_subdirectory (LayerManagerService)
204 set (BUILD_UTILS_LIB ON)
205 set (INSTALL_UTILS_LIB ON)
206 endif (WITH_SERVICE_BIN)
209 add_subdirectory (LayerManagerClient/ilmClient)
210 endif (WITH_CLIENT_LIB)
212 endif (WITH_SERVICE_BIN OR WITH_CLIENT_LIB)
214 #==============================================================================
215 # build internal libraries, if required by other components
216 #==============================================================================
218 add_subdirectory (LayerManagerUtils)
219 endif (BUILD_UTILS_LIB)
221 #==============================================================================
222 # enable ctest if building with tests
223 # run 'make test' after build to run all tests
224 # be aware that some tests require a running layermanager
225 #==============================================================================