ilmClient: fixed memory leak in notification delivery
[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 set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_CURRENT_SOURCE_DIR}/cmake/modules/")
25
26 include(${CMAKE_MODULE_PATH}/CMakeVersions.txt)
27
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."
34                          FORCE)
35     message(STATUS "Build type not defined. Using default build type 'Release'.")
36 endif (NOT CMAKE_BUILD_TYPE)
37
38
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)
56 option (WITH_SERVICE_BIN            "Build LayerManagerService Binary"                    ON)
57 option (WITH_CONTROL_BIN            "Build LayerManagerControl Binary"                    ON)
58 option (WITH_CLIENT_LIB             "Build LayerManagement Client Lib"                    ON)
59 option (WITH_GENERIC_COMMUNICATOR   "Build Generic Communicator Plugin"                   ON)
60 option (WITH_SYSTEMD_HEALTH_MONITOR "Build plugin for systemd health monitoring"          OFF)
61 option (WITH_EXAMPLE_SCENE_PROVIDER "Build scene provider plugin for examples"            OFF)
62 option (WITH_STATIC_LIBRARIES       "Link all libraries statically"                       OFF)
63 option (WITH_TEXT_RENDERER          "Build text renderer (only logging)"                  OFF)
64
65
66 #==============================================================================
67 # Internal global settings not available to user
68 #==============================================================================
69 set (WITH_WAYLAND    OFF)
70 set (BUILD_UTILS_LIB  OFF)
71 set (INSTALL_UTILS_LIB  OFF)
72 set (STATICALLY_LINKED_PLUGINS "" CACHE INTERNAL "list of static plugins" FORCE)
73
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 #==============================================================================
115 # default compiler settings for 3rd party components
116 #==============================================================================
117
118 add_subdirectory (3rdParty)
119
120
121 #==============================================================================
122 # use strict compiler settings for examples and tools
123 #------------------------------------------------------------------------------
124 set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall")
125 set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wextra")
126 #==============================================================================
127
128 if (WITH_EGL_EXAMPLE)
129     add_subdirectory (LayerManagerExamples/EGLX11ApplicationExample)
130     add_subdirectory (LayerManagerExamples/EGLX11MockNavigation)
131     set (BUILD_UTILS_LIB ON)
132 endif(WITH_EGL_EXAMPLE)
133
134 if (WITH_GLX_EXAMPLE)
135     add_subdirectory (LayerManagerExamples/GLXApplicationExample)
136     set (BUILD_UTILS_LIB ON)
137 endif(WITH_GLX_EXAMPLE)
138
139 if (WITH_CLIENTEXAMPLES)
140     add_subdirectory (LayerManagerExamples/LayerManagerClientExample)
141     set (BUILD_UTILS_LIB ON)
142 endif(WITH_CLIENTEXAMPLES)
143
144 if (WITH_WL_EXAMPLE)
145     add_subdirectory (LayerManagerExamples/EGLWLApplicationExample)
146     add_subdirectory (LayerManagerExamples/EGLWLMockNavigation)
147     add_subdirectory (LayerManagerExamples/WLChromakeyExample)
148     add_subdirectory (LayerManagerExamples/EGLWLInputEventExample)
149     set (BUILD_UTILS_LIB ON)
150 endif(WITH_WL_EXAMPLE)
151
152 if (WITH_CONTROL_BIN)
153     add_subdirectory (LayerManagerControl)
154     set (BUILD_UTILS_LIB ON)
155 endif(WITH_CONTROL_BIN)
156
157 #==============================================================================
158 # use very strict compiler settings for internal components
159 #------------------------------------------------------------------------------
160 set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -pedantic -Wno-long-long")
161 set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-unused-function")
162 #set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Werror")
163 #==============================================================================
164
165 if (WITH_EXAMPLE_SCENE_PROVIDER)
166     add_subdirectory (LayerManagerPlugins/SceneProvider/ExampleSceneProvider)
167 endif(WITH_EXAMPLE_SCENE_PROVIDER)
168
169 if (WITH_SYSTEMD_HEALTH_MONITOR)
170     add_subdirectory (LayerManagerPlugins/HealthMonitor/SystemdHealthMonitor)
171 endif(WITH_SYSTEMD_HEALTH_MONITOR)
172
173 if (WITH_GENERIC_COMMUNICATOR)
174     add_subdirectory (LayerManagerCommands)
175     add_subdirectory (LayerManagerPlugins/Communicators/GenericCommunicator)
176 endif(WITH_GENERIC_COMMUNICATOR)
177
178 if (WITH_DESKTOP)
179     set (WITH_GLX_LIB ON CACHE BOOL "Build X11 GLX development lib" FORCE)
180     add_subdirectory (LayerManagerPlugins/Renderers/Platform/GLXRenderer)
181 endif(WITH_DESKTOP)     
182
183 if (WITH_WAYLAND)
184     if (WITH_WAYLAND_VIVANTE_GAL)
185         add_subdirectory (LayerManagerPlugins/Renderers/Platform/WaylandVivanteRenderer)
186     else (WITH_WAYLAND_VIVANTE_GAL)
187         add_subdirectory (LayerManagerPlugins/Renderers/Platform/WaylandGLESRenderer)
188     endif (WITH_WAYLAND_VIVANTE_GAL)
189 endif(WITH_WAYLAND)
190
191 if (WITH_X11_GLES)
192     set (WITH_GLESv2_LIB ON CACHE BOOL "Build X11 GLES development lib" FORCE)
193     add_subdirectory (LayerManagerPlugins/Renderers/Platform/X11GLESRenderer)
194 endif(WITH_X11_GLES)
195
196 if (WITH_TEXT_RENDERER)
197     add_subdirectory (LayerManagerPlugins/Renderers/Platform/TextRenderer)
198 endif(WITH_TEXT_RENDERER)
199
200 if (WITH_SERVICE_BIN OR WITH_CLIENT_LIB)
201     add_subdirectory (LayerManagerPlugins/IpcModules)
202
203     if (WITH_SERVICE_BIN)
204         add_subdirectory (LayerManagerPlugins/Renderers/Graphic)
205         add_subdirectory (LayerManagerBase)
206         add_subdirectory (LayerManagerService)
207         set (BUILD_UTILS_LIB ON)
208         set (INSTALL_UTILS_LIB ON)
209     endif (WITH_SERVICE_BIN)
210
211     if (WITH_CLIENT_LIB)
212         add_subdirectory (LayerManagerClient/ilmClient)
213     endif (WITH_CLIENT_LIB)
214
215 endif (WITH_SERVICE_BIN OR WITH_CLIENT_LIB)
216
217 #==============================================================================
218 # build internal libraries, if required by other components
219 #==============================================================================
220 if (BUILD_UTILS_LIB)
221     add_subdirectory (LayerManagerUtils)
222 endif (BUILD_UTILS_LIB)
223
224 #==============================================================================
225 # enable ctest if building with tests
226 # run 'make test' after build to run all tests
227 # be aware that some tests require a running layermanager
228 #==============================================================================
229 if (WITH_TESTS)
230     enable_testing()
231 endif(WITH_TESTS)
232
233 #==============================================================================
234 # store used build configuration
235 #==============================================================================
236 add_subdirectory(config)