1 # Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved
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
7 # http://www.apache.org/licenses/LICENSE-2.0
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.
15 # @file CMakeLists.txt
16 # @author Przemyslaw Dobrowolski (p.dobrowolsk@samsung.com)
17 # @author Pawel Sikorski (p.sikorski@samsung.com)
22 # Check minimum CMake version
23 CMAKE_MINIMUM_REQUIRED(VERSION 2.6)
25 SET(CMAKE_EDIT_COMMAND vim)
29 SET(PROJECT_VERSION ${CMAKE_PACKAGE_API_VERSION})
32 # Figure out version from changelog
33 EXECUTE_PROCESS(COMMAND bash -c "head ${PROJECT_SOURCE_DIR}/debian/changelog --lines 1 |grep -o '(.*)' |sed 's/(\\|)//g'"
34 OUTPUT_VARIABLE ${PROJECT_NAME}_version)
35 STRING(STRIP ${${PROJECT_NAME}_version} ${PROJECT_NAME}_version)
36 MESSAGE(STATUS "Version from changelog: ${${PROJECT_NAME}_version}")
37 ADD_DEFINITIONS("-DWRT_ENGINE_VERSION=\"${${PROJECT_NAME}_version}\"")
39 #############################
41 OPTION(OCSP "OCSP validation support" OFF)
43 MESSAGE(STATUS "OCSP validation support: ENABLED")
44 ADD_DEFINITIONS("-DOCSP_VALIDATION")
46 MESSAGE(STATUS "OCSP validation support: DISABLED")
49 OPTION(PROFILING "Profiling enabled" ON)
51 MESSAGE(STATUS "PROFILING: ENABLED")
53 MESSAGE(STATUS "PROFILING: DISABLED")
57 OPTION(WEBKIT_SOUP_CACHE "Turns on/off SOUP cache in WebKit" ON)
59 MESSAGE(STATUS "SOUP cache in Webkit: ENABLED")
60 SET(WEBKIT_SOUP_CACHE_DIR "/opt/apps/widget/user/cache")
61 ADD_DEFINITIONS("-DWEBKIT_SOUP_CACHE")
62 ADD_DEFINITIONS("-DWEBKIT_SOUP_CACHE_DIR=\"${WEBKIT_SOUP_CACHE_DIR}\"")
63 MESSAGE(STATUS "WEBKIT_SOUP_CACHE_DIR = ${WEBKIT_SOUP_CACHE_DIR}")
64 ELSE(WEBKIT_SOUP_CACHE)
65 MESSAGE(STATUS "SOUP cache in Webkit: DISABLED")
66 ENDIF(WEBKIT_SOUP_CACHE)
69 CONFIGURE_FILE(${PROJECT_SOURCE_DIR}/debian/wrt.postinst.in_all
70 ${PROJECT_SOURCE_DIR}/debian/wrt.postinst.in
75 OPTION(SMACK_ENABLED "SMACK status" OFF)
77 MESSAGE(STATUS "Smack is enabled")
78 ADD_DEFINITIONS("-DWRT_SMACK_ENABLED")
80 MESSAGE(STATUS "Smack is disabled")
83 OPTION(WRT_SKIP_ACE_SUPPORT "ACESKIP status" OFF)
84 IF(WRT_SKIP_ACE_SUPPORT)
85 MESSAGE(STATUS "ACE SKIP SUPPORT is enabled")
86 ADD_DEFINITIONS("-DWRT_SKIP_ACE_SUPPORT")
87 ELSE(WRT_SKIP_ACE_SUPPORT)
88 MESSAGE(STATUS "ACE SKIP SUPPORT is disabled")
89 ENDIF(WRT_SKIP_ACE_SUPPORT)
92 OPTION(DPL_LOG "DPL logs status" ON)
94 MESSAGE(STATUS "Logging enabled for DPL")
95 ADD_DEFINITIONS("-DDPL_LOGS_ENABLED")
97 MESSAGE(STATUS "Logging disabled for DPL")
102 # TODO: Probably may be removed
103 SET(BUILD_TYPE "X1" CACHE STRING "Platform build: X1")
106 #When network is not always-on mode
107 OPTION(DNET "DNET : not always on mode" OFF)
109 MESSAGE(STATUS "add -DUSE_DNET")
110 ADD_DEFINITIONS("-DUSE_DNET")
114 # Set build type (Release by default)
115 IF("${CMAKE_BUILD_TYPE}" STREQUAL "")
116 SET(CMAKE_BUILD_TYPE "Release")
117 ENDIF("${CMAKE_BUILD_TYPE}" STREQUAL "")
119 MESSAGE("Build type: ${CMAKE_BUILD_TYPE}")
122 #############################
123 INCLUDE(FindPkgConfig)
124 INCLUDE("CMakeUtils.txt")
126 #############################
128 # TODO: Remove this codes when releasing a product.. This is maintained for test in development....
129 ADD_DEFINITIONS("-DUSE_BROWSER_SETTING")
133 #############################
135 SET(CMAKE_C_FLAGS_PROFILING "-O0 -g -pg")
136 SET(CMAKE_CXX_FLAGS_PROFILING "-O0 -std=c++0x -g -pg")
137 SET(CMAKE_C_FLAGS_DEBUG "-O0 -g")
138 SET(CMAKE_CXX_FLAGS_DEBUG "-O0 -std=c++0x -g")
139 SET(CMAKE_C_FLAGS_RELEASE "-O2 -g")
140 SET(CMAKE_CXX_FLAGS_RELEASE "-O2 -std=c++0x -g")
142 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?)
143 ADD_DEFINITIONS("-DSEPARATED_SINGLETON_IMPLEMENTATION")
144 #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.
146 # Set compiler warning flags
147 #ADD_DEFINITIONS("-Werror") # Make all warnings into errors.
148 ADD_DEFINITIONS("-Wall") # Generate all warnings
149 ADD_DEFINITIONS("-Wextra") # Generate even more extra warnings
150 ADD_DEFINITIONS("-Wno-variadic-macros") # Inhibit variadic macros warnings (needed for ORM)
151 #ADD_DEFINITIONS("-ansi") # Accept only ANSI code
152 #ADD_DEFINITIONS("-pedantic") # Accept only pedantic code
153 #ADD_DEFINITIONS("-Weffc++") # Accept only effective C++ code
154 #ADD_DEFINITIONS("-Wwrite-strings") # Do not accept writing to contant string memory
155 #ADD_DEFINITIONS("-Winit-self") # Do not accept initializing variable with itself
156 #ADD_DEFINITIONS("-Wcast-align") # Do not accept misaligning with casting
157 #ADD_DEFINITIONS("-Wcast-qual") # Do not accept removing qualifiers with casting
158 #ADD_DEFINITIONS("-Wold-style-cast") # Do not accept old style casting
159 #ADD_DEFINITIONS("-Wpointer-arith") # Warn about void pointer arthimetic
160 #ADD_DEFINITIONS("-Wstrict-aliasing") # Ensure strict aliasing
161 #ADD_DEFINITIONS("-Wuninitialized") # Do not accept uninitialized variables
162 #ADD_DEFINITIONS("-Wmissing-declarations") # Warn about global and non-accesible functions
163 #ADD_DEFINITIONS("-Woverloaded-virtual") # Warn about incidental overiding non-virtual base methods
164 #ADD_DEFINITIONS("-Wnon-virtual-dtor") # Warn about non-virtual destructor
165 #ADD_DEFINITIONS("-Wctor-dtor-privacy") # Warn about useless and non-constructible classes
166 #ADD_DEFINITIONS("-Wlong-long") # Do not allow using long long
167 #ADD_DEFINITIONS("-Wunreachable-code") # Warn about unreachable code
168 #ADD_DEFINITIONS("-Wfloat-equal") # Do not accept comparing floating points with equal operator
169 #ADD_DEFINITIONS("-Wabi") # Warn about possible ABI problems
170 #ADD_DEFINITIONS("-Wswitch-enum") # Check switch enumeration
171 #ADD_DEFINITIONS("-Wformat=2") # Check printf formatting
172 #ADD_DEFINITIONS("-Wundef") # Warn if an undefined identifier is evaluated in an @if directive.
173 #ADD_DEFINITIONS("-Wshadow") # Warn whenever a local variable shadows another local variable, parameter or global variable or whenever a built-in function is shadowed
174 #ADD_DEFINITIONS("-Wconversion") # Warn for implicit conversions that may alter a value
175 #ADD_DEFINITIONS("-Wlogical-op") # Warn about suspicious uses of logical operators in expressions
176 #ADD_DEFINITIONS("-Waggregate-return") # Warn if any functions that return structures or unions are defined or called.
177 #ADD_DEFINITIONS("-Wmissing-field-initializers") # Warn if a structure's initializer has some fields missing.
178 #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.
179 #ADD_DEFINITIONS("-Wmissing-include-dirs") # Warn if a user-supplied include directory does not exist.
180 #ADD_DEFINITIONS("-Wswitch-default") # Warn whenever a switch statement does not have a default case.
181 #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.
182 #ADD_DEFINITIONS("-Wunused") # All the above -Wunused options combined.
183 #ADD_DEFINITIONS("-Wstrict-overflow=5") # Also warn about cases where the compiler reduces the magnitude of a constant involved in a comparison.
184 #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.
185 #ADD_DEFINITIONS("-Wmissing-format-attribute") # Warn about function pointers which might be candidates for format attributes.
186 #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.
187 #ADD_DEFINITIONS("-Winline") # Warn if a function can not be inlined and it was declared as inline.
188 #ADD_DEFINITIONS("-Wdisabled-optimization") # Warn if a requested optimization pass is disabled.
189 ADD_DEFINITIONS("-Wno-deprecated") # No warnings about deprecated features
191 #############################
193 SET(TARGET_WRT_ENGINE_STATIC "wrt-engine-static")
194 SET(TARGET_TESTS_COMMON_LIB "wrt-engine-tests-lib") #tests only
195 SET(TARGET_ACE_CLIENT_LIB "wrt-ace-client") #ACE thin client
196 SET(TARGET_PROFILING_LIB "wrt-profiling")
197 SET(TARGET_PLUGIN_LOADING_LIB "wrt-plugin-loading")
199 #############################
203 ADD_DEFINITIONS("-DPROFILING_ENABLED")
204 SET(PROF_LIB ${TARGET_PROFILING_LIB})
209 INSTALL(FILES ${PROJECT_SOURCE_DIR}/wrt_policy_setter.sh
210 DESTINATION /usr/bin/
212 INSTALL(FILES ${CMAKE_SOURCE_DIR}/warp_security_error.msg
213 DESTINATION /usr/etc/wrt/
214 PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ GROUP_WRITE
216 INSTALL(FILES ${CMAKE_SOURCE_DIR}/roaming_error.msg
217 DESTINATION /usr/etc/wrt/
218 PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ GROUP_WRITE
220 INSTALL(FILES ${CMAKE_SOURCE_DIR}/parental.png
221 DESTINATION /usr/etc/wrt/
222 PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ GROUP_WRITE
224 INSTALL(FILES ${CMAKE_SOURCE_DIR}/data/wrt_widget_default_icon.png
225 DESTINATION share/wrt-engine/
227 INSTALL(FILES ${CMAKE_SOURCE_DIR}/data/userAgentProfile.xml
228 DESTINATION share/wrt-engine/
230 INSTALL(FILES ${CMAKE_SOURCE_DIR}/data/WAC2.0TestRootCA.cert
231 DESTINATION share/wrt-engine/
234 OUTPUT ${PROJECT_SOURCE_DIR}/data/communicationBox.edj
236 ARGS ${PROJECT_SOURCE_DIR}/data/communicationBox.edc
237 ${PROJECT_SOURCE_DIR}/data/communicationBox.edj
238 DEPENDS ${PROJECT_SOURCE_DIR}/data/communicationBox.edc
241 OUTPUT ${PROJECT_SOURCE_DIR}/data/wrt_theme.edj
242 COMMAND edje_cc -id ${PROJECT_SOURCE_DIR}/data/images
243 ARGS ${PROJECT_SOURCE_DIR}/data/wrt_theme.edc
244 ${PROJECT_SOURCE_DIR}/data/wrt_theme.edj
245 DEPENDS ${PROJECT_SOURCE_DIR}/data/wrt_theme.edc
248 OUTPUT ${PROJECT_SOURCE_DIR}/data/Daemon.edj
250 ARGS ${PROJECT_SOURCE_DIR}/data/Daemon.edc
251 ${PROJECT_SOURCE_DIR}/data/Daemon.edj
252 DEPENDS ${PROJECT_SOURCE_DIR}/data/Daemon.edc
254 ADD_CUSTOM_TARGET( ACE_EDJES ALL DEPENDS
255 ${PROJECT_SOURCE_DIR}/data/communicationBox.edj
257 ADD_CUSTOM_TARGET( WRT_THEME_EDJES ALL DEPENDS
258 ${PROJECT_SOURCE_DIR}/data/wrt_theme.edj
260 ADD_CUSTOM_TARGET( WRT_EDJES ALL DEPENDS
261 ${PROJECT_SOURCE_DIR}/data/Daemon.edj
264 OUTPUT ${PROJECT_SOURCE_DIR}/data/generic_popup.edj
266 ARGS ${PROJECT_SOURCE_DIR}/data/generic_popup.edc
267 ${PROJECT_SOURCE_DIR}/data/generic_popup.edj
268 DEPENDS ${PROJECT_SOURCE_DIR}/data/generic_popup.edc
270 ADD_CUSTOM_TARGET(generic_popup ALL DEPENDS
271 ${PROJECT_SOURCE_DIR}/data/generic_popup.edj
273 INSTALL(FILES ${PROJECT_SOURCE_DIR}/data/generic_popup.edj
274 DESTINATION share/edje/ace/
276 INSTALL(FILES ${PROJECT_SOURCE_DIR}/data/communicationBox.edj
277 DESTINATION share/edje/ace/
279 INSTALL(FILES ${PROJECT_SOURCE_DIR}/data/wrt_theme.edj
280 DESTINATION share/edje/wrt/
282 INSTALL(FILES ${PROJECT_SOURCE_DIR}/data/Daemon.edj
283 DESTINATION share/edje/wrt/
286 OUTPUT ${PROJECT_SOURCE_DIR}/data/generic_popup_horizontal.edj
288 ARGS ${PROJECT_SOURCE_DIR}/data/generic_popup_horizontal.edc
289 ${PROJECT_SOURCE_DIR}/data/generic_popup_horizontal.edj
290 DEPENDS ${PROJECT_SOURCE_DIR}/data/generic_popup_horizontal.edc
292 ADD_CUSTOM_TARGET(generic_popup_horizontal ALL DEPENDS
293 ${PROJECT_SOURCE_DIR}/data/generic_popup_horizontal.edj
295 INSTALL(FILES ${PROJECT_SOURCE_DIR}/data/generic_popup_horizontal.edj
296 DESTINATION share/edje/ace/
299 ADD_SUBDIRECTORY(src)
301 ADD_SUBDIRECTORY(tests)
302 ADD_SUBDIRECTORY(ace_client)
304 #############################
306 set(PKGCONFIG_DIR ${PROJECT_SOURCE_DIR}/pkgconfigs)
308 macro(configure_and_install_pkg PKG_FILE)
309 CONFIGURE_FILE(${PKGCONFIG_DIR}/${PKG_FILE}.in
310 ${PKGCONFIG_DIR}/${PKG_FILE} @ONLY)
311 INSTALL(FILES ${PKGCONFIG_DIR}/${PKG_FILE} DESTINATION lib/pkgconfig)
312 endmacro(configure_and_install_pkg)
314 configure_and_install_pkg(wrt-plugin-api.pc)
315 configure_and_install_pkg(wrt-engine.pc)
316 configure_and_install_pkg(wrt-ace-client.pc)
317 configure_and_install_pkg(wrt-plugin-loading.pc)