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_SYSTEMD "Build with native systemd integration" OFF)
64 #==============================================================================
65 # Internal global settings not available to user
66 #==============================================================================
67 set (WITH_WAYLAND OFF)
68 set (BUILD_UTILS_LIB OFF)
69 set (INSTALL_UTILS_LIB OFF)
72 #==============================================================================
73 # make sure, only one wayland based renderer was selected
74 #==============================================================================
75 set(NumberOfWaylandRenderers 0)
78 set (WITH_GLESv2_LIB ON)
80 MATH(EXPR NumberOfWaylandRenderers "${NumberOfWaylandRenderers} + 1")
81 endif(WITH_WAYLAND_X11)
83 if (WITH_WAYLAND_FBDEV)
86 MATH(EXPR NumberOfWaylandRenderers "${NumberOfWaylandRenderers} + 1")
87 endif(WITH_WAYLAND_FBDEV)
90 set (WITH_GLESv2_LIB ON)
92 MATH(EXPR NumberOfWaylandRenderers "${NumberOfWaylandRenderers} + 1")
93 endif(WITH_WAYLAND_DRM)
95 if(NumberOfWaylandRenderers GREATER 1)
96 MESSAGE(FATAL_ERROR "More than one Wayland based renderer was selected. This is not supported.")
97 endif(NumberOfWaylandRenderers GREATER 1)
100 #==============================================================================
101 # set default build parameters
102 #==============================================================================
103 add_subdirectory(cmake/optionalFeatures)
104 add_subdirectory(config)
106 include_directories ("${PROJECT_SOURCE_DIR}/config")
107 include_directories ("${PROJECT_SOURCE_DIR}/3rdParty/")
108 # ilm_types are used internally to LM, so we can include them by default
109 include_directories ("${PROJECT_SOURCE_DIR}/LayerManagerClient/ilmClient/include")
112 #==============================================================================
113 # default compiler settings for 3rd party components
114 #==============================================================================
116 add_subdirectory (3rdParty)
119 #==============================================================================
120 # use strict compiler settings for examples
121 #------------------------------------------------------------------------------
122 set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall")
123 set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wextra")
124 #==============================================================================
126 if (WITH_EGL_EXAMPLE)
127 add_subdirectory (LayerManagerExamples/EGLX11ApplicationExample)
128 add_subdirectory (LayerManagerExamples/EGLX11MockNavigation)
129 set (BUILD_UTILS_LIB ON)
130 endif(WITH_EGL_EXAMPLE)
132 if (WITH_GLX_EXAMPLE)
133 add_subdirectory (LayerManagerExamples/GLXApplicationExample)
134 set (BUILD_UTILS_LIB ON)
135 endif(WITH_GLX_EXAMPLE)
137 if (WITH_CLIENTEXAMPLES)
138 add_subdirectory (LayerManagerExamples/LayerManagerClientExample)
139 add_subdirectory (LayerManagerExamples/LayerManagerToolBox)
140 add_subdirectory (LayerManagerExamples/LayerManagerControl)
141 add_subdirectory (LayerManagerExamples/LayerSceneDescriptionExample)
142 set (BUILD_UTILS_LIB ON)
143 endif(WITH_CLIENTEXAMPLES)
146 add_subdirectory (LayerManagerExamples/EGLWLApplicationExample)
147 add_subdirectory (LayerManagerExamples/EGLWLMockNavigation)
148 add_subdirectory (LayerManagerExamples/WLChromakeyExample)
149 add_subdirectory (LayerManagerExamples/EGLWLInputEventExample)
150 set (BUILD_UTILS_LIB ON)
151 endif(WITH_WL_EXAMPLE)
153 #==============================================================================
154 # use very strict compiler settings for internal components
155 #------------------------------------------------------------------------------
156 set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -pedantic -Wno-long-long")
157 set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-unused-function")
158 #set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Werror")
159 #==============================================================================
161 if (WITH_COMMUNICATOR_GEN)
162 add_subdirectory (LayerManagerCommands)
163 add_subdirectory (LayerManagerPlugins/Communicators/GenericCommunicator)
164 endif(WITH_COMMUNICATOR_GEN)
167 set (WITH_GLX_LIB ON CACHE BOOL "Build X11 GLX development lib" FORCE)
168 add_subdirectory (LayerManagerPlugins/Renderers/Platform/GLXRenderer)
172 if (WITH_WAYLAND_VIVANTE_GAL)
173 add_subdirectory (LayerManagerPlugins/Renderers/Platform/WaylandVivanteRenderer)
174 else (WITH_WAYLAND_VIVANTE_GAL)
175 add_subdirectory (LayerManagerPlugins/Renderers/Platform/WaylandGLESRenderer)
176 endif (WITH_WAYLAND_VIVANTE_GAL)
180 set (WITH_GLESv2_LIB ON CACHE BOOL "Build X11 GLES development lib" FORCE)
181 add_subdirectory (LayerManagerPlugins/Renderers/Platform/X11GLESRenderer)
184 if (WITH_SERVICE_BIN OR WITH_CLIENT_LIB)
185 add_subdirectory (LayerManagerPlugins/IpcModules)
187 if (WITH_SERVICE_BIN)
188 add_subdirectory (LayerManagerPlugins/Renderers/Graphic)
189 add_subdirectory (LayerManagerService)
190 set (BUILD_UTILS_LIB ON)
191 set (INSTALL_UTILS_LIB ON)
192 endif (WITH_SERVICE_BIN)
195 add_subdirectory (LayerManagerClient/ilmClient)
196 endif (WITH_CLIENT_LIB)
198 endif (WITH_SERVICE_BIN OR WITH_CLIENT_LIB)
200 #==============================================================================
201 # build internal libraries, if required by other components
202 #==============================================================================
204 add_subdirectory (LayerManagerUtils)
205 endif (BUILD_UTILS_LIB)
207 #==============================================================================
208 # enable ctest if building with tests
209 # run 'make test' after build to run all tests
210 # be aware that some tests require a running layermanager
211 #==============================================================================