EGLWLApplicationExample: Update for wayland version 1.0.0
[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
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)
60
61 option (WITH_SYSTEMD        "Build with native systemd integration"               OFF)
62
63
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)
70
71
72 #==============================================================================
73 # make sure, only one wayland based renderer was selected
74 #==============================================================================
75 set(NumberOfWaylandRenderers 0)
76
77 if (WITH_WAYLAND_X11)
78     set (WITH_GLESv2_LIB ON)
79     set (WITH_WAYLAND ON)
80     MATH(EXPR NumberOfWaylandRenderers "${NumberOfWaylandRenderers} + 1")
81 endif(WITH_WAYLAND_X11)
82
83 if (WITH_WAYLAND_FBDEV)
84     set (WITH_GLESv2_LIB)
85     set (WITH_WAYLAND ON)
86     MATH(EXPR NumberOfWaylandRenderers "${NumberOfWaylandRenderers} + 1")
87 endif(WITH_WAYLAND_FBDEV)
88
89 if (WITH_WAYLAND_DRM)
90     set (WITH_GLESv2_LIB ON)
91     set (WITH_WAYLAND ON)
92     MATH(EXPR NumberOfWaylandRenderers "${NumberOfWaylandRenderers} + 1")
93 endif(WITH_WAYLAND_DRM)
94
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)
98
99
100 #==============================================================================
101 # set default build parameters
102 #==============================================================================
103 add_subdirectory(cmake/optionalFeatures)
104 add_subdirectory(config)
105
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")
110
111
112 #==============================================================================
113 # default compiler settings for 3rd party components
114 #==============================================================================
115
116 add_subdirectory (3rdParty)
117
118
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 #==============================================================================
125
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)
131
132 if (WITH_GLX_EXAMPLE)
133     add_subdirectory (LayerManagerExamples/GLXApplicationExample)
134     set (BUILD_UTILS_LIB ON)
135 endif(WITH_GLX_EXAMPLE)
136
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)
144
145 if (WITH_WL_EXAMPLE)
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)
152
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 #==============================================================================
160
161 if (WITH_COMMUNICATOR_GEN)
162     add_subdirectory (LayerManagerCommands)
163     add_subdirectory (LayerManagerPlugins/Communicators/GenericCommunicator)
164 endif(WITH_COMMUNICATOR_GEN)
165
166 if (WITH_DESKTOP)
167     set (WITH_GLX_LIB ON CACHE BOOL "Build X11 GLX development lib" FORCE)
168     add_subdirectory (LayerManagerPlugins/Renderers/Platform/GLXRenderer)
169 endif(WITH_DESKTOP)     
170
171 if (WITH_WAYLAND)
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)
177 endif(WITH_WAYLAND)
178
179 if (WITH_X11_GLES)
180     set (WITH_GLESv2_LIB ON CACHE BOOL "Build X11 GLES development lib" FORCE)
181     add_subdirectory (LayerManagerPlugins/Renderers/Platform/X11GLESRenderer)
182 endif(WITH_X11_GLES)
183
184 if (WITH_SERVICE_BIN OR WITH_CLIENT_LIB)
185     add_subdirectory (LayerManagerPlugins/IpcModules)
186
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)
193
194     if (WITH_CLIENT_LIB)
195         add_subdirectory (LayerManagerClient/ilmClient)
196     endif (WITH_CLIENT_LIB)
197
198 endif (WITH_SERVICE_BIN OR WITH_CLIENT_LIB)
199
200 #==============================================================================
201 # build internal libraries, if required by other components
202 #==============================================================================
203 if (BUILD_UTILS_LIB)
204     add_subdirectory (LayerManagerUtils)
205 endif (BUILD_UTILS_LIB)
206
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 #==============================================================================
212 if (WITH_TESTS)
213     enable_testing()
214 endif(WITH_TESTS)
215
216