Use an ecore workaround directly in WRT.
[platform/framework/web/wrt.git] / CMakeLists.txt
1 # Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved
2 #
3 #    Licensed under the Apache License, Version 2.0 (the "License");
4 #    you may not use this file except in compliance with the License.
5 #    You may obtain a copy of the License at
6 #
7 #        http://www.apache.org/licenses/LICENSE-2.0
8 #
9 #    Unless required by applicable law or agreed to in writing, software
10 #    distributed under the License is distributed on an "AS IS" BASIS,
11 #    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 #    See the License for the specific language governing permissions and
13 #    limitations under the License.
14 #
15 #
16 # @file        CMakeLists.txt
17 # @author      Przemyslaw Dobrowolski (p.dobrowolsk@samsung.com)
18 # @author      Pawel Sikorski (p.sikorski@samsung.com)
19 # @version     1.0
20 # @brief
21 #
22
23 # Check minimum CMake version
24 CMAKE_MINIMUM_REQUIRED(VERSION 2.6)
25
26 # Project name
27 PROJECT(wrt)
28
29 INCLUDE(FindPkgConfig)
30
31 STRING(REGEX MATCH "([^.]*)" PROJECT_API_VERSION "${PROJECT_VERSION}")
32 ADD_DEFINITIONS("-DPROJECT_API_VERSION=\"$(PROJECT_API_VERSION)\"")
33 MESSAGE(STATUS "Version from changelog: ${PROJECT_VERSION}")
34 ADD_DEFINITIONS("-DWRT_ENGINE_VERSION=\"${PROJECT_VERSION}\"") # WRT_ENGINE_VERSION is used by UA
35 #ADD_DEFINITIONS("-DWRT_SMACK_ENABLED")
36 IF(WAYLAND_SUPPORT)
37     ADD_DEFINITIONS("-DHAVE_WAYLAND")
38 ENDIF(WAYLAND_SUPPORT)
39
40 #############################
41 # Build type
42 IF(NOT CMAKE_BUILD_TYPE)
43     SET(CMAKE_BUILD_TYPE "Release")
44 ENDIF(NOT CMAKE_BUILD_TYPE)
45
46 OPTION(DPL_LOG "DPL logs status" ON)
47 OPTION(WITH_TESTS "Build tests" OFF)
48 OPTION(CSP_SUPPORT "Support for csp policy" ON)
49 OPTION(ALLOW_NAVIGATION_SUPPORT "Support for allow-navigation" ON)
50 OPTION(APP_SCHEME_SUPPORT "Support for app:// scheme" OFF)
51 OPTION(CORS_WHITELISTING_SUPPORT "CORS white listing for access positions" OFF)
52 OPTION(DECRYPT_SUPPORT "Enable appmanager capabilities" ON)
53 OPTION(MULTI_USER_SUPPORT "Enable multi-user support" OFF)
54
55 IF(MULTI_USER_SUPPORT)
56     ADD_DEFINITIONS("-DMULTI_USER_SUPPORT")
57 ELSE()
58         ADD_DEFINITIONS("-DDAC_ACTIVATE")
59 ENDIF(MULTI_USER_SUPPORT)
60
61 IF(DECRYPT_SUPPORT)
62     ADD_DEFINITIONS("-DDECRYPT")
63 ENDIF(DECRYPT_SUPPORT)
64 OPTION(X11_SUPPORT "Enable X11" ON)
65 IF(X11_SUPPORT)
66     ADD_DEFINITIONS("-DX11")
67 ENDIF(X11_SUPPORT)
68 IF(CSP_SUPPORT)
69     ADD_DEFINITIONS("-DCSP_ENABLED")
70 ENDIF(CSP_SUPPORT)
71 IF(ALLOW_NAVIGATION_SUPPORT)
72     ADD_DEFINITIONS("-DALLOW_NAVIGATION_ENABLED")
73 ENDIF(ALLOW_NAVIGATION_SUPPORT)
74 IF(APP_SCHEME_SUPPORT)
75     ADD_DEFINITIONS("-DAPP_SCHEME_ENABLED")
76 ENDIF(APP_SCHEME_SUPPORT)
77 IF(CORS_WHITELISTING_SUPPORT)
78     ADD_DEFINITIONS("-DCORS_WHITELISTING_ENABLED")
79 ENDIF(CORS_WHITELISTING_SUPPORT)
80 # logs can be only enabled in debug mode
81 IF(CMAKE_BUILD_TYPE MATCHES "Profiling" AND DPL_LOG)
82     MESSAGE(STATUS "Logging disabled for DPL")
83 ELSE(CMAKE_BUILD_TYPE MATCHES "Profiling" AND DPL_LOG)
84     ADD_DEFINITIONS("-DDPL_LOGS_ENABLED")
85     MESSAGE(STATUS "Logging enabled for DPL")
86 ENDIF(CMAKE_BUILD_TYPE MATCHES "Profiling" AND DPL_LOG)
87
88 MESSAGE(STATUS "WITH_TESTS: " ${WITH_TESTS})
89 MESSAGE(STATUS "CMAKE_BUILD_TYPE: ${CMAKE_BUILD_TYPE}")
90 OPTION(PROFILING "Profiling status" OFF)
91 IF(CMAKE_BUILD_TYPE MATCHES "Profiling")
92     MESSAGE(STATUS "PROFILING: ENABLED")
93     ADD_DEFINITIONS("-DPROFILING_ENABLED")
94     SET(PROFILING ON)
95 ELSE(CMAKE_BUILD_TYPE MATCHES "Profiling")
96     MESSAGE(STATUS "PROFILING: DISABLED")
97 ENDIF(CMAKE_BUILD_TYPE MATCHES "Profiling")
98
99 # Compiler flags
100 SET(CMAKE_C_FLAGS_PROFILING    "-O2")
101 SET(CMAKE_CXX_FLAGS_PROFILING  "-O2 -std=c++0x")
102 SET(CMAKE_C_FLAGS_DEBUG        "-O0 -g")
103 SET(CMAKE_CXX_FLAGS_DEBUG      "-O0 -std=c++0x -g")
104 SET(CMAKE_C_FLAGS_RELEASE      "-O2 -g")
105 SET(CMAKE_CXX_FLAGS_RELEASE    "-O2 -std=c++0x -g")
106 SET(CMAKE_CXX_FLAGS_CCOV       "-O0 -std=c++0x -g --coverage")
107
108 ADD_DEFINITIONS("-fPIC")                        # If supported for the target machine, emit position-independent code, suitable for dynamic linking and avoiding any limit on the size of the global offset table. This option makes a difference on the m68k, PowerPC and SPARC. (BJ: our ARM too?)
109 #ADD_DEFINITIONS("-fvisibility=hidden")          # Set the default ELF image symbol visibility to hidden - all symbols will be marked with this unless overridden within the code.
110
111 # We should be building with position independent code, but something
112 # about the mismatch of various flags ends up breaking the build on
113 # x64_64 architectues.  This issues is being tracked with TZIVI-1185
114 #ADD_DEFINITIONS("-fPIE")
115
116 ADD_DEFINITIONS("-DLIBDIR_PREFIX=\"${LIB_INSTALL_DIR}\"")
117
118 # Set compiler warning flags
119 #ADD_DEFINITIONS("-Werror")                      # Make all warnings into errors.
120 ADD_DEFINITIONS("-Wall")                        # Generate all warnings
121 ADD_DEFINITIONS("-Wextra")                      # Generate even more extra warnings
122 ADD_DEFINITIONS("-Wno-variadic-macros")         # Inhibit variadic macros warnings (needed for ORM)
123 #ADD_DEFINITIONS("-ansi")                        # Accept only ANSI code
124 #ADD_DEFINITIONS("-pedantic")                    # Accept only pedantic code
125 #ADD_DEFINITIONS("-Weffc++")                     # Accept only effective C++ code
126 #ADD_DEFINITIONS("-Wwrite-strings")              # Do not accept writing to contant string memory
127 #ADD_DEFINITIONS("-Winit-self")                  # Do not accept initializing variable with itself
128 #ADD_DEFINITIONS("-Wcast-align")                 # Do not accept misaligning with casting
129 #ADD_DEFINITIONS("-Wcast-qual")                  # Do not accept removing qualifiers with casting
130 #ADD_DEFINITIONS("-Wold-style-cast")             # Do not accept old style casting
131 #ADD_DEFINITIONS("-Wpointer-arith")              # Warn about void pointer arthimetic
132 #ADD_DEFINITIONS("-Wstrict-aliasing")            # Ensure strict aliasing
133 #ADD_DEFINITIONS("-Wuninitialized")              # Do not accept uninitialized variables
134 #ADD_DEFINITIONS("-Wmissing-declarations")       # Warn about global and non-accesible functions
135 #ADD_DEFINITIONS("-Woverloaded-virtual")         # Warn about incidental overiding non-virtual base methods
136 #ADD_DEFINITIONS("-Wnon-virtual-dtor")           # Warn about non-virtual destructor
137 #ADD_DEFINITIONS("-Wctor-dtor-privacy")          # Warn about useless and non-constructible classes
138 #ADD_DEFINITIONS("-Wlong-long")                  # Do not allow using long long
139 #ADD_DEFINITIONS("-Wunreachable-code")           # Warn about unreachable code
140 #ADD_DEFINITIONS("-Wfloat-equal")                # Do not accept comparing floating points with equal operator
141 #ADD_DEFINITIONS("-Wabi")                        # Warn about possible ABI problems
142 #ADD_DEFINITIONS("-Wswitch-enum")                # Check switch enumeration
143 #ADD_DEFINITIONS("-Wformat=2")                   # Check printf formatting
144 #ADD_DEFINITIONS("-Wundef")                      # Warn if an undefined identifier is evaluated in an @if directive.
145 #ADD_DEFINITIONS("-Wshadow")                     # Warn whenever a local variable shadows another local variable, parameter or global variable or whenever a built-in function is shadowed
146 #ADD_DEFINITIONS("-Wconversion")                 # Warn for implicit conversions that may alter a value
147 #ADD_DEFINITIONS("-Wlogical-op")                 # Warn about suspicious uses of logical operators in expressions
148 #ADD_DEFINITIONS("-Waggregate-return")           # Warn if any functions that return structures or unions are defined or called.
149 #ADD_DEFINITIONS("-Wmissing-field-initializers") # Warn if a structure's initializer has some fields missing.
150 #ADD_DEFINITIONS("-Wredundant-decls")            # Warn if anything is declared more than once in the same scope, even in cases where multiple declaration is valid and changes nothing.
151 #ADD_DEFINITIONS("-Wmissing-include-dirs")       # Warn if a user-supplied include directory does not exist.
152 #ADD_DEFINITIONS("-Wswitch-default")             # Warn whenever a switch statement does not have a default case.
153 #ADD_DEFINITIONS("-Wsync-nand")                  # Warn when __sync_fetch_and_nand and __sync_nand_and_fetch built-in functions are used. These functions changed semantics in GCC 4.4.
154 #ADD_DEFINITIONS("-Wunused")                     # All the above -Wunused options combined.
155 #ADD_DEFINITIONS("-Wstrict-overflow=5")          # Also warn about cases where the compiler reduces the magnitude of a constant involved in a comparison.
156 #ADD_DEFINITIONS("-Wunsafe-loop-optimizations")  # Warn if the loop cannot be optimized because the compiler could not assume anything on the bounds of the loop indices. With -funsafe-loop-optimizations warn if the compiler made such assumptions.
157 #ADD_DEFINITIONS("-Wmissing-format-attribute")   # Warn about function pointers which might be candidates for format attributes.
158 #ADD_DEFINITIONS("-Wpadded")                     # Warn if padding is included in a structure, either to align an element of the structure or to align the whole structure.
159 #ADD_DEFINITIONS("-Winline")                     # Warn if a function can not be inlined and it was declared as inline.
160 #ADD_DEFINITIONS("-Wdisabled-optimization")      # Warn if a requested optimization pass is disabled.
161 ADD_DEFINITIONS("-Wno-deprecated")               # No warnings about deprecated features
162
163 #############################
164 # Targets names
165 SET(TARGET_WRT_ENGINE_STATIC  "wrt-engine-static")
166 SET(TARGET_TESTS_COMMON_LIB "wrt-engine-tests-lib") #tests only
167 SET(TARGET_PROFILING_LIB "wrt-profiling")
168 SET(TARGET_PLUGIN_MODULE_LIB "wrt-plugin-module")
169 SET(TARGET_VIEW_MODULE_LIB "wrt-view-module")
170 SET(TARGET_VIEW_COMMON_LIB_STATIC "wrt-view-common")
171 SET(TARGET_CORE_MODULE_LIB "wrt-core-module")
172 SET(TARGET_INJECTED_BUNDLE_LIB "wrt-injected-bundle")
173 SET(PROF_LIB "")
174 IF(PROFILING)
175     SET(PROF_LIB ${TARGET_PROFILING_LIB})
176 ENDIF(PROFILING)
177
178 #############################
179 # definitions
180 ADD_DEFINITIONS("-DWRT_EDJ_PATH=\"/usr/share/edje/wrt/Wrt.edj\"")
181
182 #############################
183 # edc build
184 ADD_CUSTOM_COMMAND(
185     OUTPUT ${PROJECT_SOURCE_DIR}/data/Wrt.edj
186     COMMAND edje_cc
187     ARGS  ${PROJECT_SOURCE_DIR}/data/Wrt.edc
188           ${PROJECT_SOURCE_DIR}/data/Wrt.edj
189     DEPENDS ${PROJECT_SOURCE_DIR}/data/Wrt.edc
190 )
191 ADD_CUSTOM_TARGET(WRT_EDJE ALL
192     DEPENDS ${PROJECT_SOURCE_DIR}/data/Wrt.edj
193 )
194
195 ADD_CUSTOM_COMMAND(
196     OUTPUT ${PROJECT_SOURCE_DIR}/data/generic_popup.edj
197     COMMAND edje_cc
198     ARGS  ${PROJECT_SOURCE_DIR}/data/generic_popup.edc
199           ${PROJECT_SOURCE_DIR}/data/generic_popup.edj
200     DEPENDS ${PROJECT_SOURCE_DIR}/data/generic_popup.edc
201 )
202 ADD_CUSTOM_TARGET(WRT_GENERIC_POPUP_EDJE ALL
203     DEPENDS ${PROJECT_SOURCE_DIR}/data/generic_popup.edj
204 )
205
206 ADD_CUSTOM_COMMAND(
207     OUTPUT ${PROJECT_SOURCE_DIR}/data/generic_popup_horizontal.edj
208     COMMAND edje_cc
209     ARGS  ${PROJECT_SOURCE_DIR}/data/generic_popup_horizontal.edc
210           ${PROJECT_SOURCE_DIR}/data/generic_popup_horizontal.edj
211     DEPENDS ${PROJECT_SOURCE_DIR}/data/generic_popup_horizontal.edc
212 )
213 ADD_CUSTOM_TARGET(WRT_GENERIC_POPUP_HORIZONTAL_EDJE ALL
214     DEPENDS ${PROJECT_SOURCE_DIR}/data/generic_popup_horizontal.edj
215 )
216
217 #############################
218 # install
219 INSTALL(FILES
220     ${PROJECT_SOURCE_DIR}/wrt_reset_db.sh
221     ${PROJECT_SOURCE_DIR}/wrt_reset_all.sh
222     DESTINATION /usr/bin/
223 )
224 INSTALL(FILES
225     ${PROJECT_SOURCE_DIR}/data/Wrt.edj
226     DESTINATION share/edje/wrt/
227 )
228 INSTALL(FILES
229     ${PROJECT_SOURCE_DIR}/data/generic_popup.edj
230     ${PROJECT_SOURCE_DIR}/data/generic_popup_horizontal.edj
231     DESTINATION share/edje/ace/
232 )
233
234 #############################
235 # install launchpad files
236 INSTALL(FILES   ${CMAKE_SOURCE_DIR}/wrt_env.sh
237     DESTINATION /etc/profile.d/
238 )
239 INSTALL(FILES
240     ${CMAKE_CURRENT_SOURCE_DIR}/systemd/wrt_launchpad_daemon@.service
241     ${CMAKE_CURRENT_SOURCE_DIR}/systemd/wrt_launchpad_daemon_1.socket
242     ${CMAKE_CURRENT_SOURCE_DIR}/systemd/wrt_launchpad_daemon_2.socket
243     DESTINATION /usr/lib/systemd/system/
244 )
245
246 ADD_SUBDIRECTORY(src)
247 ADD_SUBDIRECTORY(po)
248
249 SET(WRT_API_NEW_INCLUDES
250     "${PROJECT_SOURCE_DIR}/src/api_new/"
251     "${PROJECT_SOURCE_DIR}/src/domain/"
252     "${PROJECT_SOURCE_DIR}/src/view/")
253
254 SET(PKGCONFIG_DIR ${PROJECT_SOURCE_DIR}/pkgconfig)
255
256 CONFIGURE_FILE(${PKGCONFIG_DIR}/wrt-core.pc.in
257     ${PKGCONFIG_DIR}/wrt-core.pc @ONLY)
258 INSTALL(FILES ${PKGCONFIG_DIR}/wrt-core.pc DESTINATION ${LIB_INSTALL_DIR}/pkgconfig)
259
260 IF(WITH_TESTS)
261     add_subdirectory(tests)
262 ENDIF(WITH_TESTS)