CMake: moved DefaultSettings to separate file
[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}/DefaultSettings.txt)
29 include(${CMAKE_MODULE_PATH}/CMakeVersions.txt)
30 include(${CMAKE_MODULE_PATH}/CustomMacros.txt)
31 add_subdirectory(cmake/optionalFeatures)
32
33 #==============================================================================
34 # Platforms / A set of indiviual options at once
35 #==============================================================================
36 option (WITH_X11_GLES               "Build for X11 with GLES 2.0"                         ON )
37 option (WITH_GLESv2_LIB             "Build development library for GLES2 Based Renderers" OFF)
38 option (WITH_EGL_EXAMPLE            "Build EGL_EXAMPLE / X11"                             ON )
39 option (WITH_WL_EXAMPLE             "Build EGL_EXAMPLE / Wayland"                         OFF)
40 option (WITH_DESKTOP                "Build for Desktop / GLX"                             OFF)
41 option (WITH_GLX_LIB                "Build development library for GLX Based Renderers"   OFF)
42 option (WITH_GLX_EXAMPLE            "Build GLX_EXAMPLE "                                  OFF)
43 option (WITH_FORCE_COPY             "Force Software Copy of Pixmaps"                      OFF)
44 option (WITH_CLIENTEXAMPLES         "Build client examples "                              ON )
45 option (WITH_TESTS                  "Build Available Tests "                              OFF)
46 option (WITH_DLT                    "Build with DLT support "                             OFF)
47 option (WITH_WAYLAND_FBDEV          "Build Wayland with FBDEV backend"                    OFF)
48 option (WITH_WAYLAND_FBDEV_LIB      "Build development library for Wayland FBDEV Based Renderers" OFF)
49 option (WITH_WAYLAND_X11            "Build Wayland with X11 backend"                      OFF)
50 option (WITH_WAYLAND_X11_LIB        "Build development library for Wayland X11 Based Renderers" OFF)
51 option (WITH_WAYLAND_DRM            "Build Wayland with drm backend"                      OFF)
52 option (WITH_WAYLAND_DRM_LIB        "Build development library for Wayland DRM Based Renderers" OFF)
53 option (WITH_SERVICE_BIN            "Build LayerManagerService Binary"                    ON)
54 option (WITH_CONTROL_BIN            "Build LayerManagerControl Binary"                    ON)
55 option (WITH_CLIENT_LIB             "Build LayerManagement Client Lib"                    ON)
56 option (WITH_GENERIC_COMMUNICATOR   "Build Generic Communicator Plugin"                   ON)
57 option (WITH_SYSTEMD_HEALTH_MONITOR "Build plugin for systemd health monitoring"          OFF)
58 option (WITH_EXAMPLE_SCENE_PROVIDER "Build scene provider plugin for examples"            OFF)
59 option (WITH_STATIC_LIBRARIES       "Link all libraries statically"                       OFF)
60 option (WITH_TEXT_RENDERER          "Build text renderer (only logging)"                  OFF)
61
62 #==============================================================================
63 # enable ctest if building with tests
64 # run 'make test' after build to run all tests
65 # be aware that some tests require a running layermanager
66 #==============================================================================
67 if (WITH_TESTS)
68     enable_testing()
69     add_subdirectory_once (3rdParty/gtest)
70     add_subdirectory_once (3rdParty/gmock)
71 endif(WITH_TESTS)
72
73 #==============================================================================
74 # use strict compiler settings for examples and tools
75 #------------------------------------------------------------------------------
76 set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall")
77 set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wextra")
78 #==============================================================================
79
80 if (WITH_EGL_EXAMPLE)
81     add_subdirectory_once (LayerManagerUtils)
82     add_subdirectory_once (LayerManagerClient/ilmClient)
83     add_subdirectory_once (LayerManagerExamples/EGLX11ApplicationExample)
84     add_subdirectory_once (LayerManagerExamples/EGLX11MockNavigation)
85 endif(WITH_EGL_EXAMPLE)
86
87 if (WITH_GLX_EXAMPLE)
88     add_subdirectory_once (LayerManagerUtils)
89     add_subdirectory_once (LayerManagerClient/ilmClient)
90     add_subdirectory_once (LayerManagerExamples/GLXApplicationExample)
91 endif(WITH_GLX_EXAMPLE)
92
93 if (WITH_CLIENTEXAMPLES)
94     add_subdirectory_once (LayerManagerUtils)
95     add_subdirectory_once (LayerManagerClient/ilmClient)
96     add_subdirectory_once (LayerManagerExamples/LayerManagerClientExample)
97 endif(WITH_CLIENTEXAMPLES)
98
99 if (WITH_WL_EXAMPLE)
100     add_subdirectory_once (LayerManagerUtils)
101     add_subdirectory_once (LayerManagerClient/ilmClient)
102     add_subdirectory_once (LayerManagerExamples/EGLWLApplicationExample)
103     add_subdirectory_once (LayerManagerExamples/EGLWLMockNavigation)
104     add_subdirectory_once (LayerManagerExamples/WLChromakeyExample)
105     add_subdirectory_once (LayerManagerExamples/EGLWLInputEventExample)
106 endif(WITH_WL_EXAMPLE)
107
108 if (WITH_CONTROL_BIN)
109     add_subdirectory_once (LayerManagerUtils)
110     add_subdirectory_once (LayerManagerClient/ilmClient)
111     add_subdirectory_once (LayerManagerControl)
112 endif(WITH_CONTROL_BIN)
113
114 #==============================================================================
115 # use very strict compiler settings for internal components
116 #------------------------------------------------------------------------------
117 set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -pedantic -Wno-long-long")
118 set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-unused-function")
119 #set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Werror")
120 #==============================================================================
121
122 if (WITH_EXAMPLE_SCENE_PROVIDER)
123     add_subdirectory_once (LayerManagerCommands)
124     add_subdirectory_once (LayerManagerBase)
125     add_subdirectory_once (LayerManagerPlugins/SceneProvider/ExampleSceneProvider)
126 endif(WITH_EXAMPLE_SCENE_PROVIDER)
127
128 if (WITH_SYSTEMD_HEALTH_MONITOR)
129     add_subdirectory_once (3rdParty/systemd)
130     add_subdirectory_once (LayerManagerUtils)
131     add_subdirectory_once (LayerManagerBase)
132     add_subdirectory_once (LayerManagerPlugins/HealthMonitor/SystemdHealthMonitor)
133 endif(WITH_SYSTEMD_HEALTH_MONITOR)
134
135 if (WITH_GENERIC_COMMUNICATOR)
136     add_subdirectory_once (LayerManagerPlugins/IpcModules)
137     add_subdirectory_once (LayerManagerCommands)
138     add_subdirectory_once (LayerManagerPlugins/Communicators/GenericCommunicator)
139 endif(WITH_GENERIC_COMMUNICATOR)
140
141 if (WITH_DESKTOP)
142     add_subdirectory_once (LayerManagerPlugins/Renderers/GraphicLib/LayerManagerGraphicGLX)
143     add_subdirectory_once (LayerManagerPlugins/Renderers/Platform/GLXRenderer)
144 endif(WITH_DESKTOP)
145
146 if (WITH_GLX_LIB)
147     add_subdirectory_once (LayerManagerPlugins/Renderers/GraphicLib/LayerManagerGraphicGLX)
148 endif(WITH_GLX_LIB)
149
150 if (WITH_WAYLAND_X11)
151     add_subdirectory_once (LayerManagerUtils)
152     add_subdirectory_once (LayerManagerBase)
153     add_subdirectory_once (LayerManagerPlugins/Renderers/GraphicLib/LayerManagerGraphicWaylandX11GLESv2)
154     add_subdirectory_once (LayerManagerPlugins/Renderers/Platform/WaylandGLESRenderer)
155     add_subdirectory_once (LayerManagerPlugins/Renderers/Platform/WaylandX11GLESRenderer)
156 endif(WITH_WAYLAND_X11)
157
158 if (WITH_WAYLAND_X11_LIB)
159     add_subdirectory_once (LayerManagerPlugins/Renderers/GraphicLib/LayerManagerGraphicWaylandX11GLESv2)
160 endif(WITH_WAYLAND_X11_LIB)
161
162 if (WITH_WAYLAND_DRM)
163     add_subdirectory_once (LayerManagerUtils)
164     add_subdirectory_once (LayerManagerBase)
165     add_subdirectory_once (LayerManagerPlugins/Renderers/GraphicLib/LayerManagerGraphicWaylandDrmGLESv2)
166     add_subdirectory_once (LayerManagerPlugins/Renderers/Platform/WaylandGLESRenderer)
167     add_subdirectory_once (LayerManagerPlugins/Renderers/Platform/WaylandDrmGLESRenderer)
168 endif(WITH_WAYLAND_DRM)
169
170 if (WITH_WAYLAND_DRM_LIB)
171     add_subdirectory_once (LayerManagerPlugins/Renderers/GraphicLib/LayerManagerGraphicWaylandDrmGLESv2)
172 endif(WITH_WAYLAND_DRM_LIB)
173
174 if (WITH_WAYLAND_FBDEV)
175     add_subdirectory_once (LayerManagerUtils)
176     add_subdirectory_once (LayerManagerBase)
177     add_subdirectory_once (LayerManagerPlugins/Renderers/GraphicLib/LayerManagerGraphicWaylandFbdevGLESv2)
178     add_subdirectory_once (LayerManagerPlugins/Renderers/Platform/WaylandGLESRenderer)
179     add_subdirectory_once (LayerManagerPlugins/Renderers/Platform/WaylandFbdevGLESRenderer)
180 endif(WITH_WAYLAND_FBDEV)
181
182 if (WITH_WAYLAND_FBDEV_LIB)
183     add_subdirectory_once (LayerManagerPlugins/Renderers/GraphicLib/LayerManagerGraphicWaylandFbdevGLESv2)
184 endif(WITH_WAYLAND_FBDEV_LIB)
185
186 if (WITH_X11_GLES)
187     add_subdirectory_once (LayerManagerPlugins/Renderers/GraphicLib/LayerManagerGraphicGLESv2)
188     add_subdirectory_once (LayerManagerPlugins/Renderers/Platform/X11GLESRenderer)
189 endif(WITH_X11_GLES)
190
191 if (WITH_GLESv2_LIB)
192     add_subdirectory_once (LayerManagerPlugins/Renderers/GraphicLib/LayerManagerGraphicGLESv2)
193 endif(WITH_GLESv2_LIB)
194
195 if (WITH_TEXT_RENDERER)
196     add_subdirectory_once (LayerManagerPlugins/Renderers/Platform/TextRenderer)
197 endif(WITH_TEXT_RENDERER)
198
199 if (WITH_SERVICE_BIN)
200     add_subdirectory_once (LayerManagerUtils)
201     add_subdirectory_once (LayerManagerBase)
202     add_subdirectory_once (LayerManagerService)
203 endif (WITH_SERVICE_BIN)
204
205 if (WITH_CLIENT_LIB)
206     add_subdirectory_once (LayerManagerPlugins/IpcModules)
207     add_subdirectory_once (LayerManagerClient/ilmClient)
208 endif (WITH_CLIENT_LIB)
209
210 #==============================================================================
211 # store used build configuration
212 #==============================================================================
213 add_subdirectory_once(config)