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 #==============================================================================
26 #==============================================================================
27 set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_CURRENT_SOURCE_DIR}/cmake/modules/")
28 include(${CMAKE_MODULE_PATH}/CMakeVersions.txt)
29 include(${CMAKE_MODULE_PATH}/CustomMacros.txt)
31 #==============================================================================
32 # set default build type, if not defined by user
33 #==============================================================================
34 if (NOT CMAKE_BUILD_TYPE)
35 set(CMAKE_BUILD_TYPE Release CACHE STRING
36 "Choose build type: Debug, Release, RelWithDebInfo, MinSizeRel."
38 message(STATUS "Build type not defined. Using default build type 'Release'.")
39 endif (NOT CMAKE_BUILD_TYPE)
41 #==============================================================================
42 # Platforms / A set of indiviual options at once
43 #==============================================================================
44 option (WITH_X11_GLES "Build for X11 with GLES 2.0" ON )
45 option (WITH_GLESv2_LIB "Build development library for GLES2 Based Renderers" OFF)
46 option (WITH_EGL_EXAMPLE "Build EGL_EXAMPLE / X11" ON )
47 option (WITH_WL_EXAMPLE "Build EGL_EXAMPLE / Wayland" OFF)
48 option (WITH_DESKTOP "Build for Desktop / GLX" OFF)
49 option (WITH_GLX_LIB "Build development library for GLX Based Renderers" OFF)
50 option (WITH_GLX_EXAMPLE "Build GLX_EXAMPLE " OFF)
51 option (WITH_FORCE_COPY "Force Software Copy of Pixmaps" OFF)
52 option (WITH_CLIENTEXAMPLES "Build client examples " ON )
53 option (WITH_TESTS "Build Available Tests " OFF)
54 option (WITH_DLT "Build with DLT support " OFF)
55 option (WITH_WAYLAND_FBDEV "Build Wayland with FBDEV backend" OFF)
56 option (WITH_WAYLAND_FBDEV_LIB "Build development library for Wayland FBDEV Based Renderers" OFF)
57 option (WITH_WAYLAND_X11 "Build Wayland with X11 backend" OFF)
58 option (WITH_WAYLAND_X11_LIB "Build development library for Wayland X11 Based Renderers" OFF)
59 option (WITH_WAYLAND_DRM "Build Wayland with drm backend" OFF)
60 option (WITH_WAYLAND_DRM_LIB "Build development library for Wayland DRM Based Renderers" OFF)
61 option (WITH_SERVICE_BIN "Build LayerManagerService Binary" ON)
62 option (WITH_CONTROL_BIN "Build LayerManagerControl Binary" ON)
63 option (WITH_CLIENT_LIB "Build LayerManagement Client Lib" ON)
64 option (WITH_GENERIC_COMMUNICATOR "Build Generic Communicator Plugin" ON)
65 option (WITH_SYSTEMD_HEALTH_MONITOR "Build plugin for systemd health monitoring" OFF)
66 option (WITH_EXAMPLE_SCENE_PROVIDER "Build scene provider plugin for examples" OFF)
67 option (WITH_STATIC_LIBRARIES "Link all libraries statically" OFF)
68 option (WITH_TEXT_RENDERER "Build text renderer (only logging)" OFF)
70 #==============================================================================
71 # Internal global settings not available to user
72 #==============================================================================
73 set (WITH_WAYLAND OFF)
74 set (STATICALLY_LINKED_PLUGINS "" CACHE INTERNAL "list of static plugins" FORCE)
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)
109 include_directories ("${PROJECT_SOURCE_DIR}/config")
110 include_directories ("${PROJECT_SOURCE_DIR}/3rdParty/")
111 # ilm_types are used internally to LM, so we can include them by default
112 include_directories ("${PROJECT_SOURCE_DIR}/LayerManagerClient/ilmClient/include")
114 #==============================================================================
115 # enable ctest if building with tests
116 # run 'make test' after build to run all tests
117 # be aware that some tests require a running layermanager
118 #==============================================================================
121 add_subdirectory_once (3rdParty/gtest)
122 add_subdirectory_once (3rdParty/gmock)
125 #==============================================================================
126 # use strict compiler settings for examples and tools
127 #------------------------------------------------------------------------------
128 set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall")
129 set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wextra")
130 #==============================================================================
132 if (WITH_EGL_EXAMPLE)
133 add_subdirectory_once (LayerManagerUtils)
134 add_subdirectory_once (LayerManagerClient/ilmClient)
135 add_subdirectory_once (LayerManagerExamples/EGLX11ApplicationExample)
136 add_subdirectory_once (LayerManagerExamples/EGLX11MockNavigation)
137 endif(WITH_EGL_EXAMPLE)
139 if (WITH_GLX_EXAMPLE)
140 add_subdirectory_once (LayerManagerUtils)
141 add_subdirectory_once (LayerManagerClient/ilmClient)
142 add_subdirectory_once (LayerManagerExamples/GLXApplicationExample)
143 endif(WITH_GLX_EXAMPLE)
145 if (WITH_CLIENTEXAMPLES)
146 add_subdirectory_once (LayerManagerUtils)
147 add_subdirectory_once (LayerManagerClient/ilmClient)
148 add_subdirectory_once (LayerManagerExamples/LayerManagerClientExample)
149 endif(WITH_CLIENTEXAMPLES)
152 add_subdirectory_once (LayerManagerUtils)
153 add_subdirectory_once (LayerManagerClient/ilmClient)
154 add_subdirectory_once (LayerManagerExamples/EGLWLApplicationExample)
155 add_subdirectory_once (LayerManagerExamples/EGLWLMockNavigation)
156 add_subdirectory_once (LayerManagerExamples/WLChromakeyExample)
157 add_subdirectory_once (LayerManagerExamples/EGLWLInputEventExample)
158 endif(WITH_WL_EXAMPLE)
160 if (WITH_CONTROL_BIN)
161 add_subdirectory_once (LayerManagerUtils)
162 add_subdirectory_once (LayerManagerClient/ilmClient)
163 add_subdirectory_once (LayerManagerControl)
164 endif(WITH_CONTROL_BIN)
166 #==============================================================================
167 # use very strict compiler settings for internal components
168 #------------------------------------------------------------------------------
169 set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -pedantic -Wno-long-long")
170 set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-unused-function")
171 #set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Werror")
172 #==============================================================================
174 if (WITH_EXAMPLE_SCENE_PROVIDER)
175 add_subdirectory_once (LayerManagerCommands)
176 add_subdirectory_once (LayerManagerBase)
177 add_subdirectory_once (LayerManagerPlugins/SceneProvider/ExampleSceneProvider)
178 endif(WITH_EXAMPLE_SCENE_PROVIDER)
180 if (WITH_SYSTEMD_HEALTH_MONITOR)
181 add_subdirectory_once (3rdParty/systemd)
182 add_subdirectory_once (LayerManagerUtils)
183 add_subdirectory_once (LayerManagerBase)
184 add_subdirectory_once (LayerManagerPlugins/HealthMonitor/SystemdHealthMonitor)
185 endif(WITH_SYSTEMD_HEALTH_MONITOR)
187 if (WITH_GENERIC_COMMUNICATOR)
188 add_subdirectory_once (LayerManagerPlugins/IpcModules)
189 add_subdirectory_once (LayerManagerCommands)
190 add_subdirectory_once (LayerManagerPlugins/Communicators/GenericCommunicator)
191 endif(WITH_GENERIC_COMMUNICATOR)
194 add_subdirectory_once (LayerManagerPlugins/Renderers/GraphicLib/LayerManagerGraphicGLX)
195 add_subdirectory_once (LayerManagerPlugins/Renderers/Platform/GLXRenderer)
199 add_subdirectory_once (LayerManagerPlugins/Renderers/GraphicLib/LayerManagerGraphicGLX)
203 add_subdirectory_once (LayerManagerPlugins/Renderers/Platform/WaylandGLESRenderer)
206 if (WITH_WAYLAND_X11_LIB)
207 add_subdirectory_once (LayerManagerPlugins/Renderers/GraphicLib/LayerManagerGraphicWaylandX11GLESv2)
208 endif(WITH_WAYLAND_X11_LIB)
210 if (WITH_WAYLAND_DRM_LIB)
211 add_subdirectory_once (LayerManagerPlugins/Renderers/GraphicLib/LayerManagerGraphicWaylandDrmGLESv2)
212 endif(WITH_WAYLAND_DRM_LIB)
214 if (WITH_WAYLAND_FBDEV_LIB)
215 add_subdirectory_once (LayerManagerPlugins/Renderers/GraphicLib/LayerManagerGraphicWaylandFbdevGLESv2)
216 endif(WITH_WAYLAND_FBDEV_LIB)
219 add_subdirectory_once (LayerManagerPlugins/Renderers/GraphicLib/LayerManagerGraphicGLESv2)
220 add_subdirectory_once (LayerManagerPlugins/Renderers/Platform/X11GLESRenderer)
224 add_subdirectory_once (LayerManagerPlugins/Renderers/GraphicLib/LayerManagerGraphicGLESv2)
225 endif(WITH_GLESv2_LIB)
227 if (WITH_TEXT_RENDERER)
228 add_subdirectory_once (LayerManagerPlugins/Renderers/Platform/TextRenderer)
229 endif(WITH_TEXT_RENDERER)
231 if (WITH_SERVICE_BIN)
232 add_subdirectory_once (LayerManagerUtils)
233 add_subdirectory_once (LayerManagerBase)
234 add_subdirectory_once (LayerManagerService)
235 endif (WITH_SERVICE_BIN)
238 add_subdirectory_once (LayerManagerPlugins/IpcModules)
239 add_subdirectory_once (LayerManagerClient/ilmClient)
240 endif (WITH_CLIENT_LIB)
242 #==============================================================================
243 # store used build configuration
244 #==============================================================================
245 add_subdirectory_once(config)