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_SERVICE_BIN "Build LayerManagerService Binary" ON)
60 option (WITH_CONTROL_BIN "Build LayerManagerControl Binary" ON)
61 option (WITH_CLIENT_LIB "Build LayerManagement Client Lib" ON)
62 option (WITH_GENERIC_COMMUNICATOR "Build Generic Communicator Plugin" ON)
63 option (WITH_SYSTEMD_HEALTH_MONITOR "Build plugin for systemd health monitoring" OFF)
64 option (WITH_EXAMPLE_SCENE_PROVIDER "Build scene provider plugin for examples" OFF)
65 option (WITH_STATIC_LIBRARIES "Link all libraries statically" OFF)
66 option (WITH_TEXT_RENDERER "Build text renderer (only logging)" OFF)
68 #==============================================================================
69 # Internal global settings not available to user
70 #==============================================================================
71 set (WITH_WAYLAND OFF)
72 set (STATICALLY_LINKED_PLUGINS "" CACHE INTERNAL "list of static plugins" FORCE)
74 #==============================================================================
75 # make sure, only one wayland based renderer was selected
76 #==============================================================================
77 set(NumberOfWaylandRenderers 0)
80 set (WITH_GLESv2_LIB ON)
82 MATH(EXPR NumberOfWaylandRenderers "${NumberOfWaylandRenderers} + 1")
83 endif(WITH_WAYLAND_X11)
85 if (WITH_WAYLAND_FBDEV)
88 MATH(EXPR NumberOfWaylandRenderers "${NumberOfWaylandRenderers} + 1")
89 endif(WITH_WAYLAND_FBDEV)
92 set (WITH_GLESv2_LIB ON)
94 MATH(EXPR NumberOfWaylandRenderers "${NumberOfWaylandRenderers} + 1")
95 endif(WITH_WAYLAND_DRM)
97 if(NumberOfWaylandRenderers GREATER 1)
98 MESSAGE(FATAL_ERROR "More than one Wayland based renderer was selected. This is not supported.")
99 endif(NumberOfWaylandRenderers GREATER 1)
102 #==============================================================================
103 # set default build parameters
104 #==============================================================================
105 add_subdirectory(cmake/optionalFeatures)
107 include_directories ("${PROJECT_SOURCE_DIR}/config")
108 include_directories ("${PROJECT_SOURCE_DIR}/3rdParty/")
109 # ilm_types are used internally to LM, so we can include them by default
110 include_directories ("${PROJECT_SOURCE_DIR}/LayerManagerClient/ilmClient/include")
112 #==============================================================================
113 # enable ctest if building with tests
114 # run 'make test' after build to run all tests
115 # be aware that some tests require a running layermanager
116 #==============================================================================
119 add_subdirectory_once (3rdParty/gtest)
120 add_subdirectory_once (3rdParty/gmock)
123 #==============================================================================
124 # use strict compiler settings for examples and tools
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_once (LayerManagerUtils)
132 add_subdirectory_once (LayerManagerClient/ilmClient)
133 add_subdirectory_once (LayerManagerExamples/EGLX11ApplicationExample)
134 add_subdirectory_once (LayerManagerExamples/EGLX11MockNavigation)
135 endif(WITH_EGL_EXAMPLE)
137 if (WITH_GLX_EXAMPLE)
138 add_subdirectory_once (LayerManagerUtils)
139 add_subdirectory_once (LayerManagerClient/ilmClient)
140 add_subdirectory_once (LayerManagerExamples/GLXApplicationExample)
141 endif(WITH_GLX_EXAMPLE)
143 if (WITH_CLIENTEXAMPLES)
144 add_subdirectory_once (LayerManagerUtils)
145 add_subdirectory_once (LayerManagerClient/ilmClient)
146 add_subdirectory_once (LayerManagerExamples/LayerManagerClientExample)
147 endif(WITH_CLIENTEXAMPLES)
150 add_subdirectory_once (LayerManagerUtils)
151 add_subdirectory_once (LayerManagerClient/ilmClient)
152 add_subdirectory_once (LayerManagerExamples/EGLWLApplicationExample)
153 add_subdirectory_once (LayerManagerExamples/EGLWLMockNavigation)
154 add_subdirectory_once (LayerManagerExamples/WLChromakeyExample)
155 add_subdirectory_once (LayerManagerExamples/EGLWLInputEventExample)
156 endif(WITH_WL_EXAMPLE)
158 if (WITH_CONTROL_BIN)
159 add_subdirectory_once (LayerManagerUtils)
160 add_subdirectory_once (LayerManagerClient/ilmClient)
161 add_subdirectory_once (LayerManagerControl)
162 endif(WITH_CONTROL_BIN)
164 #==============================================================================
165 # use very strict compiler settings for internal components
166 #------------------------------------------------------------------------------
167 set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -pedantic -Wno-long-long")
168 set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-unused-function")
169 #set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Werror")
170 #==============================================================================
172 if (WITH_EXAMPLE_SCENE_PROVIDER)
173 add_subdirectory_once (LayerManagerCommands)
174 add_subdirectory_once (LayerManagerBase)
175 add_subdirectory_once (LayerManagerPlugins/SceneProvider/ExampleSceneProvider)
176 endif(WITH_EXAMPLE_SCENE_PROVIDER)
178 if (WITH_SYSTEMD_HEALTH_MONITOR)
179 add_subdirectory_once (3rdParty/systemd)
180 add_subdirectory_once (LayerManagerUtils)
181 add_subdirectory_once (LayerManagerBase)
182 add_subdirectory_once (LayerManagerPlugins/HealthMonitor/SystemdHealthMonitor)
183 endif(WITH_SYSTEMD_HEALTH_MONITOR)
185 if (WITH_GENERIC_COMMUNICATOR)
186 add_subdirectory_once (LayerManagerPlugins/IpcModules)
187 add_subdirectory_once (LayerManagerCommands)
188 add_subdirectory_once (LayerManagerPlugins/Communicators/GenericCommunicator)
189 endif(WITH_GENERIC_COMMUNICATOR)
192 add_subdirectory_once (LayerManagerPlugins/Renderers/GraphicLib/LayerManagerGraphicGLX)
193 add_subdirectory_once (LayerManagerPlugins/Renderers/Platform/GLXRenderer)
197 add_subdirectory_once (LayerManagerPlugins/Renderers/GraphicLib/LayerManagerGraphicGLX)
201 add_subdirectory_once (LayerManagerPlugins/Renderers/Platform/WaylandGLESRenderer)
204 if (WITH_WAYLAND_X11_LIB)
205 add_subdirectory_once (LayerManagerPlugins/Renderers/GraphicLib/LayerManagerGraphicWaylandX11GLESv2)
206 endif(WITH_WAYLAND_X11_LIB)
209 add_subdirectory_once (LayerManagerPlugins/Renderers/GraphicLib/LayerManagerGraphicGLESv2)
210 add_subdirectory_once (LayerManagerPlugins/Renderers/Platform/X11GLESRenderer)
214 add_subdirectory_once (LayerManagerPlugins/Renderers/GraphicLib/LayerManagerGraphicGLESv2)
215 endif(WITH_GLESv2_LIB)
217 if (WITH_TEXT_RENDERER)
218 add_subdirectory_once (LayerManagerPlugins/Renderers/Platform/TextRenderer)
219 endif(WITH_TEXT_RENDERER)
221 if (WITH_SERVICE_BIN)
222 add_subdirectory_once (LayerManagerUtils)
223 add_subdirectory_once (LayerManagerBase)
224 add_subdirectory_once (LayerManagerService)
225 endif (WITH_SERVICE_BIN)
228 add_subdirectory_once (LayerManagerPlugins/IpcModules)
229 add_subdirectory_once (LayerManagerClient/ilmClient)
230 endif (WITH_CLIENT_LIB)
232 #==============================================================================
233 # store used build configuration
234 #==============================================================================
235 add_subdirectory_once(config)