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 (STATICALLY_LINKED_PLUGINS "" CACHE INTERNAL "list of static plugins" FORCE)
75 #==============================================================================
76 # set default build parameters
77 #==============================================================================
78 add_subdirectory(cmake/optionalFeatures)
80 include_directories ("${PROJECT_SOURCE_DIR}/config")
81 include_directories ("${PROJECT_SOURCE_DIR}/3rdParty/")
82 # ilm_types are used internally to LM, so we can include them by default
83 include_directories ("${PROJECT_SOURCE_DIR}/LayerManagerClient/ilmClient/include")
85 #==============================================================================
86 # enable ctest if building with tests
87 # run 'make test' after build to run all tests
88 # be aware that some tests require a running layermanager
89 #==============================================================================
92 add_subdirectory_once (3rdParty/gtest)
93 add_subdirectory_once (3rdParty/gmock)
96 #==============================================================================
97 # use strict compiler settings for examples and tools
98 #------------------------------------------------------------------------------
99 set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall")
100 set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wextra")
101 #==============================================================================
103 if (WITH_EGL_EXAMPLE)
104 add_subdirectory_once (LayerManagerUtils)
105 add_subdirectory_once (LayerManagerClient/ilmClient)
106 add_subdirectory_once (LayerManagerExamples/EGLX11ApplicationExample)
107 add_subdirectory_once (LayerManagerExamples/EGLX11MockNavigation)
108 endif(WITH_EGL_EXAMPLE)
110 if (WITH_GLX_EXAMPLE)
111 add_subdirectory_once (LayerManagerUtils)
112 add_subdirectory_once (LayerManagerClient/ilmClient)
113 add_subdirectory_once (LayerManagerExamples/GLXApplicationExample)
114 endif(WITH_GLX_EXAMPLE)
116 if (WITH_CLIENTEXAMPLES)
117 add_subdirectory_once (LayerManagerUtils)
118 add_subdirectory_once (LayerManagerClient/ilmClient)
119 add_subdirectory_once (LayerManagerExamples/LayerManagerClientExample)
120 endif(WITH_CLIENTEXAMPLES)
123 add_subdirectory_once (LayerManagerUtils)
124 add_subdirectory_once (LayerManagerClient/ilmClient)
125 add_subdirectory_once (LayerManagerExamples/EGLWLApplicationExample)
126 add_subdirectory_once (LayerManagerExamples/EGLWLMockNavigation)
127 add_subdirectory_once (LayerManagerExamples/WLChromakeyExample)
128 add_subdirectory_once (LayerManagerExamples/EGLWLInputEventExample)
129 endif(WITH_WL_EXAMPLE)
131 if (WITH_CONTROL_BIN)
132 add_subdirectory_once (LayerManagerUtils)
133 add_subdirectory_once (LayerManagerClient/ilmClient)
134 add_subdirectory_once (LayerManagerControl)
135 endif(WITH_CONTROL_BIN)
137 #==============================================================================
138 # use very strict compiler settings for internal components
139 #------------------------------------------------------------------------------
140 set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -pedantic -Wno-long-long")
141 set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-unused-function")
142 #set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Werror")
143 #==============================================================================
145 if (WITH_EXAMPLE_SCENE_PROVIDER)
146 add_subdirectory_once (LayerManagerCommands)
147 add_subdirectory_once (LayerManagerBase)
148 add_subdirectory_once (LayerManagerPlugins/SceneProvider/ExampleSceneProvider)
149 endif(WITH_EXAMPLE_SCENE_PROVIDER)
151 if (WITH_SYSTEMD_HEALTH_MONITOR)
152 add_subdirectory_once (3rdParty/systemd)
153 add_subdirectory_once (LayerManagerUtils)
154 add_subdirectory_once (LayerManagerBase)
155 add_subdirectory_once (LayerManagerPlugins/HealthMonitor/SystemdHealthMonitor)
156 endif(WITH_SYSTEMD_HEALTH_MONITOR)
158 if (WITH_GENERIC_COMMUNICATOR)
159 add_subdirectory_once (LayerManagerPlugins/IpcModules)
160 add_subdirectory_once (LayerManagerCommands)
161 add_subdirectory_once (LayerManagerPlugins/Communicators/GenericCommunicator)
162 endif(WITH_GENERIC_COMMUNICATOR)
165 add_subdirectory_once (LayerManagerPlugins/Renderers/GraphicLib/LayerManagerGraphicGLX)
166 add_subdirectory_once (LayerManagerPlugins/Renderers/Platform/GLXRenderer)
170 add_subdirectory_once (LayerManagerPlugins/Renderers/GraphicLib/LayerManagerGraphicGLX)
173 if (WITH_WAYLAND_X11)
174 add_subdirectory_once (LayerManagerUtils)
175 add_subdirectory_once (LayerManagerBase)
176 add_subdirectory_once (LayerManagerPlugins/Renderers/GraphicLib/LayerManagerGraphicWaylandX11GLESv2)
177 add_subdirectory_once (LayerManagerPlugins/Renderers/Platform/WaylandGLESRenderer)
178 add_subdirectory_once (LayerManagerPlugins/Renderers/Platform/WaylandX11GLESRenderer)
179 endif(WITH_WAYLAND_X11)
181 if (WITH_WAYLAND_X11_LIB)
182 add_subdirectory_once (LayerManagerPlugins/Renderers/GraphicLib/LayerManagerGraphicWaylandX11GLESv2)
183 endif(WITH_WAYLAND_X11_LIB)
185 if (WITH_WAYLAND_DRM_LIB)
186 add_subdirectory_once (LayerManagerPlugins/Renderers/GraphicLib/LayerManagerGraphicWaylandDrmGLESv2)
187 endif(WITH_WAYLAND_DRM_LIB)
189 if (WITH_WAYLAND_FBDEV)
190 add_subdirectory_once (LayerManagerUtils)
191 add_subdirectory_once (LayerManagerBase)
192 add_subdirectory_once (LayerManagerPlugins/Renderers/GraphicLib/LayerManagerGraphicWaylandFbdevGLESv2)
193 add_subdirectory_once (LayerManagerPlugins/Renderers/Platform/WaylandGLESRenderer)
194 add_subdirectory_once (LayerManagerPlugins/Renderers/Platform/WaylandFbdevGLESRenderer)
195 endif(WITH_WAYLAND_FBDEV)
197 if (WITH_WAYLAND_FBDEV_LIB)
198 add_subdirectory_once (LayerManagerPlugins/Renderers/GraphicLib/LayerManagerGraphicWaylandFbdevGLESv2)
199 endif(WITH_WAYLAND_FBDEV_LIB)
202 add_subdirectory_once (LayerManagerPlugins/Renderers/GraphicLib/LayerManagerGraphicGLESv2)
203 add_subdirectory_once (LayerManagerPlugins/Renderers/Platform/X11GLESRenderer)
207 add_subdirectory_once (LayerManagerPlugins/Renderers/GraphicLib/LayerManagerGraphicGLESv2)
208 endif(WITH_GLESv2_LIB)
210 if (WITH_TEXT_RENDERER)
211 add_subdirectory_once (LayerManagerPlugins/Renderers/Platform/TextRenderer)
212 endif(WITH_TEXT_RENDERER)
214 if (WITH_SERVICE_BIN)
215 add_subdirectory_once (LayerManagerUtils)
216 add_subdirectory_once (LayerManagerBase)
217 add_subdirectory_once (LayerManagerService)
218 endif (WITH_SERVICE_BIN)
221 add_subdirectory_once (LayerManagerPlugins/IpcModules)
222 add_subdirectory_once (LayerManagerClient/ilmClient)
223 endif (WITH_CLIENT_LIB)
225 #==============================================================================
226 # store used build configuration
227 #==============================================================================
228 add_subdirectory_once(config)