CMake: improved build of LayerManagerGraphicWaylandDrmGLESv2
[profile/ivi/layer-management.git] / CMakeLists.txt
1 ############################################################################
2
3 # Copyright 2010-2012 BMW Car IT GmbH  
4 # Copyright (C) 2011 DENSO CORPORATION and Robert Bosch Car Multimedia Gmbh
5
6
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 
10 #
11 #       http://www.apache.org/licenses/LICENSE-2.0 
12 #
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.
18 #
19 ############################################################################
20
21 cmake_minimum_required (VERSION 2.6)
22 project (LayerManager)
23
24 #==============================================================================
25 # cmake configuration
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)
30
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."
37                          FORCE)
38     message(STATUS "Build type not defined. Using default build type 'Release'.")
39 endif (NOT CMAKE_BUILD_TYPE)
40
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)
68
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)
74
75 #==============================================================================
76 # make sure, only one wayland based renderer was selected
77 #==============================================================================
78 set(NumberOfWaylandRenderers 0)
79
80 if (WITH_WAYLAND_X11)
81     set (WITH_GLESv2_LIB ON)
82     set (WITH_WAYLAND ON)
83     MATH(EXPR NumberOfWaylandRenderers "${NumberOfWaylandRenderers} + 1")
84 endif(WITH_WAYLAND_X11)
85
86 if (WITH_WAYLAND_FBDEV)
87     set (WITH_GLESv2_LIB)
88     set (WITH_WAYLAND ON)
89     MATH(EXPR NumberOfWaylandRenderers "${NumberOfWaylandRenderers} + 1")
90 endif(WITH_WAYLAND_FBDEV)
91
92 if (WITH_WAYLAND_DRM)
93     set (WITH_GLESv2_LIB ON)
94     set (WITH_WAYLAND ON)
95     MATH(EXPR NumberOfWaylandRenderers "${NumberOfWaylandRenderers} + 1")
96 endif(WITH_WAYLAND_DRM)
97
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)
101
102
103 #==============================================================================
104 # set default build parameters
105 #==============================================================================
106 add_subdirectory(cmake/optionalFeatures)
107
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")
112
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 #==============================================================================
118 if (WITH_TESTS)
119     enable_testing()
120     add_subdirectory_once (3rdParty/gtest)
121     add_subdirectory_once (3rdParty/gmock)
122 endif(WITH_TESTS)
123
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 #==============================================================================
130
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)
137
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)
143
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)
149
150 if (WITH_WL_EXAMPLE)
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)
158
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)
164
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 #==============================================================================
172
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)
178
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)
185
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)
191
192 if (WITH_DESKTOP)
193     add_subdirectory_once (LayerManagerPlugins/Renderers/GraphicLib/LayerManagerGraphicGLX)
194     add_subdirectory_once (LayerManagerPlugins/Renderers/Platform/GLXRenderer)
195 endif(WITH_DESKTOP)
196
197 if (WITH_GLX_LIB)
198     add_subdirectory_once (LayerManagerPlugins/Renderers/GraphicLib/LayerManagerGraphicGLX)
199 endif(WITH_GLX_LIB)
200
201 if (WITH_WAYLAND)
202     add_subdirectory_once (LayerManagerPlugins/Renderers/Platform/WaylandGLESRenderer)
203 endif(WITH_WAYLAND)
204
205 if (WITH_WAYLAND_X11_LIB)
206     add_subdirectory_once (LayerManagerPlugins/Renderers/GraphicLib/LayerManagerGraphicWaylandX11GLESv2)
207 endif(WITH_WAYLAND_X11_LIB)
208
209 if (WITH_WAYLAND_DRM_LIB)
210     add_subdirectory_once (LayerManagerPlugins/Renderers/GraphicLib/LayerManagerGraphicWaylandDrmGLESv2)
211 endif(WITH_WAYLAND_DRM_LIB)
212
213 if (WITH_X11_GLES)
214     add_subdirectory_once (LayerManagerPlugins/Renderers/GraphicLib/LayerManagerGraphicGLESv2)
215     add_subdirectory_once (LayerManagerPlugins/Renderers/Platform/X11GLESRenderer)
216 endif(WITH_X11_GLES)
217
218 if (WITH_GLESv2_LIB)
219     add_subdirectory_once (LayerManagerPlugins/Renderers/GraphicLib/LayerManagerGraphicGLESv2)
220 endif(WITH_GLESv2_LIB)
221
222 if (WITH_TEXT_RENDERER)
223     add_subdirectory_once (LayerManagerPlugins/Renderers/Platform/TextRenderer)
224 endif(WITH_TEXT_RENDERER)
225
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)
231
232 if (WITH_CLIENT_LIB)
233     add_subdirectory_once (LayerManagerPlugins/IpcModules)
234     add_subdirectory_once (LayerManagerClient/ilmClient)
235 endif (WITH_CLIENT_LIB)
236
237 #==============================================================================
238 # store used build configuration
239 #==============================================================================
240 add_subdirectory_once(config)