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.
16 # @file CMakeLists.txt
17 # @author Przemyslaw Dobrowolski (p.dobrowolsk@samsung.com)
18 # @author Pawel Sikorski (p.sikorski@samsung.com)
23 # Check minimum CMake version
24 CMAKE_MINIMUM_REQUIRED(VERSION 2.6)
29 INCLUDE(FindPkgConfig)
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")
37 #############################
39 IF(NOT CMAKE_BUILD_TYPE)
40 SET(CMAKE_BUILD_TYPE "Release")
41 ENDIF(NOT CMAKE_BUILD_TYPE)
43 OPTION(DPL_LOG "DPL logs status" ON)
44 OPTION(WITH_TESTS "Build tests" OFF)
46 # logs can be only enabled in debug mode
47 IF(CMAKE_BUILD_TYPE MATCHES "Profiling" AND DPL_LOG)
48 MESSAGE(STATUS "Logging disabled for DPL")
49 ELSE(CMAKE_BUILD_TYPE MATCHES "Profiling" AND DPL_LOG)
50 ADD_DEFINITIONS("-DDPL_LOGS_ENABLED")
51 MESSAGE(STATUS "Logging enabled for DPL")
52 ENDIF(CMAKE_BUILD_TYPE MATCHES "Profiling" AND DPL_LOG)
54 MESSAGE(STATUS "WITH_TESTS: " ${WITH_TESTS})
55 MESSAGE(STATUS "CMAKE_BUILD_TYPE: ${CMAKE_BUILD_TYPE}")
56 OPTION(PROFILING "Profiling status" OFF)
57 IF(CMAKE_BUILD_TYPE MATCHES "Profiling")
58 MESSAGE(STATUS "PROFILING: ENABLED")
59 ADD_DEFINITIONS("-DPROFILING_ENABLED")
61 ELSE(CMAKE_BUILD_TYPE MATCHES "Profiling")
62 MESSAGE(STATUS "PROFILING: DISABLED")
63 ENDIF(CMAKE_BUILD_TYPE MATCHES "Profiling")
66 SET(CMAKE_C_FLAGS_PROFILING "-O2")
67 SET(CMAKE_CXX_FLAGS_PROFILING "-O2 -std=c++0x")
68 SET(CMAKE_C_FLAGS_DEBUG "-O0 -g")
69 SET(CMAKE_CXX_FLAGS_DEBUG "-O0 -std=c++0x -g")
70 SET(CMAKE_C_FLAGS_RELEASE "-O2 -g")
71 SET(CMAKE_CXX_FLAGS_RELEASE "-O2 -std=c++0x -g")
72 SET(CMAKE_CXX_FLAGS_CCOV "-O0 -std=c++0x -g --coverage")
74 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?)
75 #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.
76 ADD_DEFINITIONS("-fPIE")
78 # Set compiler warning flags
79 #ADD_DEFINITIONS("-Werror") # Make all warnings into errors.
80 ADD_DEFINITIONS("-Wall") # Generate all warnings
81 ADD_DEFINITIONS("-Wextra") # Generate even more extra warnings
82 ADD_DEFINITIONS("-Wno-variadic-macros") # Inhibit variadic macros warnings (needed for ORM)
83 #ADD_DEFINITIONS("-ansi") # Accept only ANSI code
84 #ADD_DEFINITIONS("-pedantic") # Accept only pedantic code
85 #ADD_DEFINITIONS("-Weffc++") # Accept only effective C++ code
86 #ADD_DEFINITIONS("-Wwrite-strings") # Do not accept writing to contant string memory
87 #ADD_DEFINITIONS("-Winit-self") # Do not accept initializing variable with itself
88 #ADD_DEFINITIONS("-Wcast-align") # Do not accept misaligning with casting
89 #ADD_DEFINITIONS("-Wcast-qual") # Do not accept removing qualifiers with casting
90 #ADD_DEFINITIONS("-Wold-style-cast") # Do not accept old style casting
91 #ADD_DEFINITIONS("-Wpointer-arith") # Warn about void pointer arthimetic
92 #ADD_DEFINITIONS("-Wstrict-aliasing") # Ensure strict aliasing
93 #ADD_DEFINITIONS("-Wuninitialized") # Do not accept uninitialized variables
94 #ADD_DEFINITIONS("-Wmissing-declarations") # Warn about global and non-accesible functions
95 #ADD_DEFINITIONS("-Woverloaded-virtual") # Warn about incidental overiding non-virtual base methods
96 #ADD_DEFINITIONS("-Wnon-virtual-dtor") # Warn about non-virtual destructor
97 #ADD_DEFINITIONS("-Wctor-dtor-privacy") # Warn about useless and non-constructible classes
98 #ADD_DEFINITIONS("-Wlong-long") # Do not allow using long long
99 #ADD_DEFINITIONS("-Wunreachable-code") # Warn about unreachable code
100 #ADD_DEFINITIONS("-Wfloat-equal") # Do not accept comparing floating points with equal operator
101 #ADD_DEFINITIONS("-Wabi") # Warn about possible ABI problems
102 #ADD_DEFINITIONS("-Wswitch-enum") # Check switch enumeration
103 #ADD_DEFINITIONS("-Wformat=2") # Check printf formatting
104 #ADD_DEFINITIONS("-Wundef") # Warn if an undefined identifier is evaluated in an @if directive.
105 #ADD_DEFINITIONS("-Wshadow") # Warn whenever a local variable shadows another local variable, parameter or global variable or whenever a built-in function is shadowed
106 #ADD_DEFINITIONS("-Wconversion") # Warn for implicit conversions that may alter a value
107 #ADD_DEFINITIONS("-Wlogical-op") # Warn about suspicious uses of logical operators in expressions
108 #ADD_DEFINITIONS("-Waggregate-return") # Warn if any functions that return structures or unions are defined or called.
109 #ADD_DEFINITIONS("-Wmissing-field-initializers") # Warn if a structure's initializer has some fields missing.
110 #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.
111 #ADD_DEFINITIONS("-Wmissing-include-dirs") # Warn if a user-supplied include directory does not exist.
112 #ADD_DEFINITIONS("-Wswitch-default") # Warn whenever a switch statement does not have a default case.
113 #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.
114 #ADD_DEFINITIONS("-Wunused") # All the above -Wunused options combined.
115 #ADD_DEFINITIONS("-Wstrict-overflow=5") # Also warn about cases where the compiler reduces the magnitude of a constant involved in a comparison.
116 #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.
117 #ADD_DEFINITIONS("-Wmissing-format-attribute") # Warn about function pointers which might be candidates for format attributes.
118 #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.
119 #ADD_DEFINITIONS("-Winline") # Warn if a function can not be inlined and it was declared as inline.
120 #ADD_DEFINITIONS("-Wdisabled-optimization") # Warn if a requested optimization pass is disabled.
121 ADD_DEFINITIONS("-Wno-deprecated") # No warnings about deprecated features
123 #############################
125 SET(TARGET_WRT_ENGINE_STATIC "wrt-engine-static")
126 SET(TARGET_TESTS_COMMON_LIB "wrt-engine-tests-lib") #tests only
127 SET(TARGET_PROFILING_LIB "wrt-profiling")
128 SET(TARGET_PLUGIN_MODULE_LIB "wrt-plugin-module")
129 SET(TARGET_VIEW_MODULE_LIB "wrt-view-module")
130 SET(TARGET_CORE_MODULE_LIB "wrt-core-module")
131 SET(TARGET_BUNDLES_LIB "wrt-wk2-bundle")
135 SET(PROF_LIB ${TARGET_PROFILING_LIB})
139 ${PROJECT_SOURCE_DIR}/wrt_reset_db.sh
140 ${PROJECT_SOURCE_DIR}/wrt_reset_all.sh
141 DESTINATION /usr/bin/
143 INSTALL(FILES ${CMAKE_SOURCE_DIR}/warp_security_error.msg
144 DESTINATION /usr/etc/wrt/
145 PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ GROUP_WRITE
147 INSTALL(FILES ${CMAKE_SOURCE_DIR}/parental.png
148 DESTINATION /usr/etc/wrt/
149 PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ GROUP_WRITE
151 INSTALL(FILES ${CMAKE_SOURCE_DIR}/data/default_icon_tizen.png
152 DESTINATION share/wrt-engine/
154 INSTALL(FILES ${CMAKE_SOURCE_DIR}/data/default_icon_wac.png
155 DESTINATION share/wrt-engine/
157 INSTALL(FILES ${CMAKE_SOURCE_DIR}/data/userAgentProfile.xml
158 DESTINATION share/wrt-engine/
160 INSTALL(FILES ${CMAKE_SOURCE_DIR}/data/WAC2.0TestRootCA.cert
161 DESTINATION share/wrt-engine/
163 INSTALL(FILES ${CMAKE_SOURCE_DIR}/data/AutoSave.js
164 DESTINATION share/wrt-engine/
167 OUTPUT ${PROJECT_SOURCE_DIR}/data/wrt_theme.edj
168 COMMAND edje_cc -id ${PROJECT_SOURCE_DIR}/data/images
169 ARGS ${PROJECT_SOURCE_DIR}/data/wrt_theme.edc
170 ${PROJECT_SOURCE_DIR}/data/wrt_theme.edj
171 DEPENDS ${PROJECT_SOURCE_DIR}/data/wrt_theme.edc
174 OUTPUT ${PROJECT_SOURCE_DIR}/data/Daemon.edj
176 ARGS ${PROJECT_SOURCE_DIR}/data/Daemon.edc
177 ${PROJECT_SOURCE_DIR}/data/Daemon.edj
178 DEPENDS ${PROJECT_SOURCE_DIR}/data/Daemon.edc
181 OUTPUT ${PROJECT_SOURCE_DIR}/data/Platform.edj
183 ARGS ${PROJECT_SOURCE_DIR}/data/Platform.edc
184 ${PROJECT_SOURCE_DIR}/data/Platform.edj
185 DEPENDS ${PROJECT_SOURCE_DIR}/data/Platform.edc
187 ADD_CUSTOM_TARGET( WRT_THEME_EDJES ALL DEPENDS
188 ${PROJECT_SOURCE_DIR}/data/wrt_theme.edj
190 ADD_CUSTOM_TARGET( WRT_EDJES ALL DEPENDS
191 ${PROJECT_SOURCE_DIR}/data/Daemon.edj
193 ADD_CUSTOM_TARGET( WRT_PLATFORM_LAYOUT_EDJES ALL DEPENDS
194 ${PROJECT_SOURCE_DIR}/data/Platform.edj
197 OUTPUT ${PROJECT_SOURCE_DIR}/data/generic_popup.edj
199 ARGS ${PROJECT_SOURCE_DIR}/data/generic_popup.edc
200 ${PROJECT_SOURCE_DIR}/data/generic_popup.edj
201 DEPENDS ${PROJECT_SOURCE_DIR}/data/generic_popup.edc
203 ADD_CUSTOM_TARGET(generic_popup ALL DEPENDS
204 ${PROJECT_SOURCE_DIR}/data/generic_popup.edj
206 INSTALL(FILES ${PROJECT_SOURCE_DIR}/data/generic_popup.edj
207 DESTINATION share/edje/ace/
209 INSTALL(FILES ${PROJECT_SOURCE_DIR}/data/wrt_theme.edj
210 DESTINATION share/edje/wrt/
212 INSTALL(FILES ${PROJECT_SOURCE_DIR}/data/Daemon.edj
213 DESTINATION share/edje/wrt/
215 INSTALL(FILES ${PROJECT_SOURCE_DIR}/data/Platform.edj
216 DESTINATION share/edje/wrt/
219 OUTPUT ${PROJECT_SOURCE_DIR}/data/generic_popup_horizontal.edj
221 ARGS ${PROJECT_SOURCE_DIR}/data/generic_popup_horizontal.edc
222 ${PROJECT_SOURCE_DIR}/data/generic_popup_horizontal.edj
223 DEPENDS ${PROJECT_SOURCE_DIR}/data/generic_popup_horizontal.edc
225 ADD_CUSTOM_TARGET(generic_popup_horizontal ALL DEPENDS
226 ${PROJECT_SOURCE_DIR}/data/generic_popup_horizontal.edj
228 INSTALL(FILES ${PROJECT_SOURCE_DIR}/data/generic_popup_horizontal.edj
229 DESTINATION share/edje/ace/
232 ADD_SUBDIRECTORY(src)
235 SET(WRT_API_NEW_INCLUDES
236 "${PROJECT_SOURCE_DIR}/src/api_new/"
237 "${PROJECT_SOURCE_DIR}/src/domain/")
239 SET(PKGCONFIG_DIR ${PROJECT_SOURCE_DIR}/pkgconfig)
241 CONFIGURE_FILE(${PKGCONFIG_DIR}/wrt-core.pc.in
242 ${PKGCONFIG_DIR}/wrt-core.pc @ONLY)
243 INSTALL(FILES ${PKGCONFIG_DIR}/wrt-core.pc DESTINATION lib/pkgconfig)
246 add_subdirectory(tests)