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_X11 "Build Wayland with X11 backend" OFF)
57 option (WITH_WAYLAND_X11_LIB "Build development library for Wayland X11 Based Renderers" OFF)
58 option (WITH_WAYLAND_DRM "Build Wayland with drm backend" OFF)
59 option (WITH_WAYLAND_DRM_LIB "Build development library for Wayland DRM Based Renderers" OFF)
60 option (WITH_SERVICE_BIN "Build LayerManagerService Binary" ON)
61 option (WITH_CONTROL_BIN "Build LayerManagerControl Binary" ON)
62 option (WITH_CLIENT_LIB "Build LayerManagement Client Lib" ON)
63 option (WITH_GENERIC_COMMUNICATOR "Build Generic Communicator Plugin" ON)
64 option (WITH_SYSTEMD_HEALTH_MONITOR "Build plugin for systemd health monitoring" OFF)
65 option (WITH_EXAMPLE_SCENE_PROVIDER "Build scene provider plugin for examples" OFF)
66 option (WITH_STATIC_LIBRARIES "Link all libraries statically" OFF)
67 option (WITH_TEXT_RENDERER "Build text renderer (only logging)" OFF)
69 #==============================================================================
70 # Internal global settings not available to user
71 #==============================================================================
72 set (WITH_WAYLAND OFF)
73 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")
113 #==============================================================================
114 # enable ctest if building with tests
115 # run 'make test' after build to run all tests
116 # be aware that some tests require a running layermanager
117 #==============================================================================
120 add_subdirectory_once (3rdParty/gtest)
121 add_subdirectory_once (3rdParty/gmock)
124 #==============================================================================
125 # use strict compiler settings for examples and tools
126 #------------------------------------------------------------------------------
127 set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall")
128 set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wextra")
129 #==============================================================================
131 if (WITH_EGL_EXAMPLE)
132 add_subdirectory_once (LayerManagerUtils)
133 add_subdirectory_once (LayerManagerClient/ilmClient)
134 add_subdirectory_once (LayerManagerExamples/EGLX11ApplicationExample)
135 add_subdirectory_once (LayerManagerExamples/EGLX11MockNavigation)
136 endif(WITH_EGL_EXAMPLE)
138 if (WITH_GLX_EXAMPLE)
139 add_subdirectory_once (LayerManagerUtils)
140 add_subdirectory_once (LayerManagerClient/ilmClient)
141 add_subdirectory_once (LayerManagerExamples/GLXApplicationExample)
142 endif(WITH_GLX_EXAMPLE)
144 if (WITH_CLIENTEXAMPLES)
145 add_subdirectory_once (LayerManagerUtils)
146 add_subdirectory_once (LayerManagerClient/ilmClient)
147 add_subdirectory_once (LayerManagerExamples/LayerManagerClientExample)
148 endif(WITH_CLIENTEXAMPLES)
151 add_subdirectory_once (LayerManagerUtils)
152 add_subdirectory_once (LayerManagerClient/ilmClient)
153 add_subdirectory_once (LayerManagerExamples/EGLWLApplicationExample)
154 add_subdirectory_once (LayerManagerExamples/EGLWLMockNavigation)
155 add_subdirectory_once (LayerManagerExamples/WLChromakeyExample)
156 add_subdirectory_once (LayerManagerExamples/EGLWLInputEventExample)
157 endif(WITH_WL_EXAMPLE)
159 if (WITH_CONTROL_BIN)
160 add_subdirectory_once (LayerManagerUtils)
161 add_subdirectory_once (LayerManagerClient/ilmClient)
162 add_subdirectory_once (LayerManagerControl)
163 endif(WITH_CONTROL_BIN)
165 #==============================================================================
166 # use very strict compiler settings for internal components
167 #------------------------------------------------------------------------------
168 set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -pedantic -Wno-long-long")
169 set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-unused-function")
170 #set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Werror")
171 #==============================================================================
173 if (WITH_EXAMPLE_SCENE_PROVIDER)
174 add_subdirectory_once (LayerManagerCommands)
175 add_subdirectory_once (LayerManagerBase)
176 add_subdirectory_once (LayerManagerPlugins/SceneProvider/ExampleSceneProvider)
177 endif(WITH_EXAMPLE_SCENE_PROVIDER)
179 if (WITH_SYSTEMD_HEALTH_MONITOR)
180 add_subdirectory_once (3rdParty/systemd)
181 add_subdirectory_once (LayerManagerUtils)
182 add_subdirectory_once (LayerManagerBase)
183 add_subdirectory_once (LayerManagerPlugins/HealthMonitor/SystemdHealthMonitor)
184 endif(WITH_SYSTEMD_HEALTH_MONITOR)
186 if (WITH_GENERIC_COMMUNICATOR)
187 add_subdirectory_once (LayerManagerPlugins/IpcModules)
188 add_subdirectory_once (LayerManagerCommands)
189 add_subdirectory_once (LayerManagerPlugins/Communicators/GenericCommunicator)
190 endif(WITH_GENERIC_COMMUNICATOR)
193 add_subdirectory_once (LayerManagerPlugins/Renderers/GraphicLib/LayerManagerGraphicGLX)
194 add_subdirectory_once (LayerManagerPlugins/Renderers/Platform/GLXRenderer)
198 add_subdirectory_once (LayerManagerPlugins/Renderers/GraphicLib/LayerManagerGraphicGLX)
202 add_subdirectory_once (LayerManagerPlugins/Renderers/Platform/WaylandGLESRenderer)
205 if (WITH_WAYLAND_X11_LIB)
206 add_subdirectory_once (LayerManagerPlugins/Renderers/GraphicLib/LayerManagerGraphicWaylandX11GLESv2)
207 endif(WITH_WAYLAND_X11_LIB)
209 if (WITH_WAYLAND_DRM_LIB)
210 add_subdirectory_once (LayerManagerPlugins/Renderers/GraphicLib/LayerManagerGraphicWaylandDrmGLESv2)
211 endif(WITH_WAYLAND_DRM_LIB)
214 add_subdirectory_once (LayerManagerPlugins/Renderers/GraphicLib/LayerManagerGraphicGLESv2)
215 add_subdirectory_once (LayerManagerPlugins/Renderers/Platform/X11GLESRenderer)
219 add_subdirectory_once (LayerManagerPlugins/Renderers/GraphicLib/LayerManagerGraphicGLESv2)
220 endif(WITH_GLESv2_LIB)
222 if (WITH_TEXT_RENDERER)
223 add_subdirectory_once (LayerManagerPlugins/Renderers/Platform/TextRenderer)
224 endif(WITH_TEXT_RENDERER)
226 if (WITH_SERVICE_BIN)
227 add_subdirectory_once (LayerManagerUtils)
228 add_subdirectory_once (LayerManagerBase)
229 add_subdirectory_once (LayerManagerService)
230 endif (WITH_SERVICE_BIN)
233 add_subdirectory_once (LayerManagerPlugins/IpcModules)
234 add_subdirectory_once (LayerManagerClient/ilmClient)
235 endif (WITH_CLIENT_LIB)
237 #==============================================================================
238 # store used build configuration
239 #==============================================================================
240 add_subdirectory_once(config)