Update wrt_0.8.85
[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 # Options
32 OPTION(DPL_LOG "DPL logs status" ON)
33 IF(DPL_LOG)
34     MESSAGE(STATUS "Logging enabled for DPL")
35     ADD_DEFINITIONS("-DDPL_LOGS_ENABLED")
36 ELSE(DPL_LOG)
37     MESSAGE(STATUS "Logging disabled for DPL")
38 ENDIF(DPL_LOG)
39
40 STRING(REGEX MATCH "([^.]*)" PROJECT_API_VERSION "${PROJECT_VERSION}")
41 ADD_DEFINITIONS("-DPROJECT_API_VERSION=\"$(PROJECT_API_VERSION)\"")
42 MESSAGE(STATUS "Version from changelog: ${PROJECT_VERSION}")
43 ADD_DEFINITIONS("-DWRT_ENGINE_VERSION=\"${PROJECT_VERSION}\"") # WRT_ENGINE_VERSION is used by UA
44 #ADD_DEFINITIONS("-DWRT_SMACK_ENABLED")
45
46 #############################
47 # Build type
48 IF(NOT CMAKE_BUILD_TYPE)
49     SET(CMAKE_BUILD_TYPE "Release")
50 ENDIF(NOT CMAKE_BUILD_TYPE)
51
52 # Compiler flags
53 SET(CMAKE_C_FLAGS_PROFILING    "-O0 -g -pg")
54 SET(CMAKE_CXX_FLAGS_PROFILING  "-O0 -std=c++0x -g -pg")
55 SET(CMAKE_C_FLAGS_DEBUG        "-O0 -g")
56 SET(CMAKE_CXX_FLAGS_DEBUG      "-O0 -std=c++0x -g")
57 SET(CMAKE_C_FLAGS_RELEASE      "-O2 -g")
58 SET(CMAKE_CXX_FLAGS_RELEASE    "-O2 -std=c++0x -g")
59 SET(CMAKE_CXX_FLAGS_CCOV       "-O0 -std=c++0x -g --coverage")
60
61 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?)
62 #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.
63 ADD_DEFINITIONS("-fPIE")
64
65 # Set compiler warning flags
66 #ADD_DEFINITIONS("-Werror")                      # Make all warnings into errors.
67 ADD_DEFINITIONS("-Wall")                        # Generate all warnings
68 ADD_DEFINITIONS("-Wextra")                      # Generate even more extra warnings
69 ADD_DEFINITIONS("-Wno-variadic-macros")         # Inhibit variadic macros warnings (needed for ORM)
70 #ADD_DEFINITIONS("-ansi")                        # Accept only ANSI code
71 #ADD_DEFINITIONS("-pedantic")                    # Accept only pedantic code
72 #ADD_DEFINITIONS("-Weffc++")                     # Accept only effective C++ code
73 #ADD_DEFINITIONS("-Wwrite-strings")              # Do not accept writing to contant string memory
74 #ADD_DEFINITIONS("-Winit-self")                  # Do not accept initializing variable with itself
75 #ADD_DEFINITIONS("-Wcast-align")                 # Do not accept misaligning with casting
76 #ADD_DEFINITIONS("-Wcast-qual")                  # Do not accept removing qualifiers with casting
77 #ADD_DEFINITIONS("-Wold-style-cast")             # Do not accept old style casting
78 #ADD_DEFINITIONS("-Wpointer-arith")              # Warn about void pointer arthimetic
79 #ADD_DEFINITIONS("-Wstrict-aliasing")            # Ensure strict aliasing
80 #ADD_DEFINITIONS("-Wuninitialized")              # Do not accept uninitialized variables
81 #ADD_DEFINITIONS("-Wmissing-declarations")       # Warn about global and non-accesible functions
82 #ADD_DEFINITIONS("-Woverloaded-virtual")         # Warn about incidental overiding non-virtual base methods
83 #ADD_DEFINITIONS("-Wnon-virtual-dtor")           # Warn about non-virtual destructor
84 #ADD_DEFINITIONS("-Wctor-dtor-privacy")          # Warn about useless and non-constructible classes
85 #ADD_DEFINITIONS("-Wlong-long")                  # Do not allow using long long
86 #ADD_DEFINITIONS("-Wunreachable-code")           # Warn about unreachable code
87 #ADD_DEFINITIONS("-Wfloat-equal")                # Do not accept comparing floating points with equal operator
88 #ADD_DEFINITIONS("-Wabi")                        # Warn about possible ABI problems
89 #ADD_DEFINITIONS("-Wswitch-enum")                # Check switch enumeration
90 #ADD_DEFINITIONS("-Wformat=2")                   # Check printf formatting
91 #ADD_DEFINITIONS("-Wundef")                      # Warn if an undefined identifier is evaluated in an @if directive.
92 #ADD_DEFINITIONS("-Wshadow")                     # Warn whenever a local variable shadows another local variable, parameter or global variable or whenever a built-in function is shadowed
93 #ADD_DEFINITIONS("-Wconversion")                 # Warn for implicit conversions that may alter a value
94 #ADD_DEFINITIONS("-Wlogical-op")                 # Warn about suspicious uses of logical operators in expressions
95 #ADD_DEFINITIONS("-Waggregate-return")           # Warn if any functions that return structures or unions are defined or called.
96 #ADD_DEFINITIONS("-Wmissing-field-initializers") # Warn if a structure's initializer has some fields missing.
97 #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.
98 #ADD_DEFINITIONS("-Wmissing-include-dirs")       # Warn if a user-supplied include directory does not exist.
99 #ADD_DEFINITIONS("-Wswitch-default")             # Warn whenever a switch statement does not have a default case.
100 #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.
101 #ADD_DEFINITIONS("-Wunused")                     # All the above -Wunused options combined.
102 #ADD_DEFINITIONS("-Wstrict-overflow=5")          # Also warn about cases where the compiler reduces the magnitude of a constant involved in a comparison.
103 #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.
104 #ADD_DEFINITIONS("-Wmissing-format-attribute")   # Warn about function pointers which might be candidates for format attributes.
105 #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.
106 #ADD_DEFINITIONS("-Winline")                     # Warn if a function can not be inlined and it was declared as inline.
107 #ADD_DEFINITIONS("-Wdisabled-optimization")      # Warn if a requested optimization pass is disabled.
108 ADD_DEFINITIONS("-Wno-deprecated")               # No warnings about deprecated features
109
110 #############################
111 # Targets names
112 SET(TARGET_WRT_ENGINE_STATIC  "wrt-engine-static")
113 SET(TARGET_TESTS_COMMON_LIB "wrt-engine-tests-lib") #tests only
114 SET(TARGET_PROFILING_LIB "wrt-profiling")
115 SET(TARGET_PLUGIN_MODULE_LIB "wrt-plugin-module")
116 SET(TARGET_VIEW_MODULE_LIB "wrt-view-module")
117 SET(TARGET_CORE_MODULE_LIB "wrt-core-module")
118 SET(TARGET_BUNDLES_LIB "wrt-wk2-bundle")
119
120 # PROFILING
121 # need to check build with OFF
122 OPTION(PROFILING "Profiling enabled" ON)
123 IF(PROFILING)
124     MESSAGE(STATUS "PROFILING: ENABLED")
125     ADD_DEFINITIONS("-DPROFILING_ENABLED")
126     SET(PROF_LIB ${TARGET_PROFILING_LIB})
127 ELSE(PROFILING)
128     MESSAGE(STATUS "PROFILING: DISABLED")
129     SET(PROF_LIB "")
130 ENDIF(PROFILING)
131
132 INSTALL(FILES
133     ${PROJECT_SOURCE_DIR}/wrt_reset_db.sh
134     ${PROJECT_SOURCE_DIR}/wrt_reset_all.sh
135     DESTINATION /usr/bin/
136     )
137 INSTALL(FILES ${CMAKE_SOURCE_DIR}/warp_security_error.msg
138     DESTINATION /usr/etc/wrt/
139     PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ GROUP_WRITE
140     )
141 INSTALL(FILES ${CMAKE_SOURCE_DIR}/roaming_error.msg
142     DESTINATION /usr/etc/wrt/
143     PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ GROUP_WRITE
144     )
145 INSTALL(FILES ${CMAKE_SOURCE_DIR}/parental.png
146     DESTINATION /usr/etc/wrt/
147     PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ GROUP_WRITE
148     )
149 INSTALL(FILES   ${CMAKE_SOURCE_DIR}/data/wrt_widget_default_icon.png
150     DESTINATION share/wrt-engine/
151     )
152 INSTALL(FILES   ${CMAKE_SOURCE_DIR}/data/userAgentProfile.xml
153     DESTINATION share/wrt-engine/
154     )
155 INSTALL(FILES   ${CMAKE_SOURCE_DIR}/data/WAC2.0TestRootCA.cert
156     DESTINATION share/wrt-engine/
157     )
158 INSTALL(FILES   ${CMAKE_SOURCE_DIR}/data/AutoSave.js
159     DESTINATION share/wrt-engine/
160     )
161 ADD_CUSTOM_COMMAND(
162     OUTPUT ${PROJECT_SOURCE_DIR}/data/communicationBox.edj
163     COMMAND edje_cc
164     ARGS  ${PROJECT_SOURCE_DIR}/data/communicationBox.edc
165           ${PROJECT_SOURCE_DIR}/data/communicationBox.edj
166     DEPENDS ${PROJECT_SOURCE_DIR}/data/communicationBox.edc
167     )
168 ADD_CUSTOM_COMMAND(
169     OUTPUT ${PROJECT_SOURCE_DIR}/data/wrt_theme.edj
170     COMMAND edje_cc -id ${PROJECT_SOURCE_DIR}/data/images
171     ARGS  ${PROJECT_SOURCE_DIR}/data/wrt_theme.edc
172           ${PROJECT_SOURCE_DIR}/data/wrt_theme.edj
173     DEPENDS ${PROJECT_SOURCE_DIR}/data/wrt_theme.edc
174     )
175 ADD_CUSTOM_COMMAND(
176     OUTPUT ${PROJECT_SOURCE_DIR}/data/Daemon.edj
177     COMMAND edje_cc
178     ARGS  ${PROJECT_SOURCE_DIR}/data/Daemon.edc
179           ${PROJECT_SOURCE_DIR}/data/Daemon.edj
180     DEPENDS ${PROJECT_SOURCE_DIR}/data/Daemon.edc
181     )
182 ADD_CUSTOM_TARGET( ACE_EDJES ALL DEPENDS
183     ${PROJECT_SOURCE_DIR}/data/communicationBox.edj
184     )
185 ADD_CUSTOM_TARGET( WRT_THEME_EDJES ALL DEPENDS
186     ${PROJECT_SOURCE_DIR}/data/wrt_theme.edj
187     )
188 ADD_CUSTOM_TARGET( WRT_EDJES ALL DEPENDS
189     ${PROJECT_SOURCE_DIR}/data/Daemon.edj
190     )
191 ADD_CUSTOM_COMMAND(
192     OUTPUT ${PROJECT_SOURCE_DIR}/data/generic_popup.edj
193     COMMAND edje_cc
194     ARGS  ${PROJECT_SOURCE_DIR}/data/generic_popup.edc
195           ${PROJECT_SOURCE_DIR}/data/generic_popup.edj
196     DEPENDS ${PROJECT_SOURCE_DIR}/data/generic_popup.edc
197     )
198 ADD_CUSTOM_TARGET(generic_popup ALL DEPENDS
199     ${PROJECT_SOURCE_DIR}/data/generic_popup.edj
200     )
201 INSTALL(FILES   ${PROJECT_SOURCE_DIR}/data/generic_popup.edj
202     DESTINATION share/edje/ace/
203     )
204 INSTALL(FILES   ${PROJECT_SOURCE_DIR}/data/communicationBox.edj
205     DESTINATION share/edje/ace/
206     )
207 INSTALL(FILES   ${PROJECT_SOURCE_DIR}/data/wrt_theme.edj
208     DESTINATION share/edje/wrt/
209     )
210 INSTALL(FILES   ${PROJECT_SOURCE_DIR}/data/Daemon.edj
211     DESTINATION share/edje/wrt/
212     )
213 ADD_CUSTOM_COMMAND(
214     OUTPUT ${PROJECT_SOURCE_DIR}/data/generic_popup_horizontal.edj
215     COMMAND edje_cc
216     ARGS  ${PROJECT_SOURCE_DIR}/data/generic_popup_horizontal.edc
217           ${PROJECT_SOURCE_DIR}/data/generic_popup_horizontal.edj
218     DEPENDS ${PROJECT_SOURCE_DIR}/data/generic_popup_horizontal.edc
219     )
220 ADD_CUSTOM_TARGET(generic_popup_horizontal ALL DEPENDS
221     ${PROJECT_SOURCE_DIR}/data/generic_popup_horizontal.edj
222     )
223 INSTALL(FILES   ${PROJECT_SOURCE_DIR}/data/generic_popup_horizontal.edj
224     DESTINATION share/edje/ace/
225     )
226
227 ADD_SUBDIRECTORY(src)
228 ADD_SUBDIRECTORY(po)
229
230 set(PKGCONFIG_DIR ${PROJECT_SOURCE_DIR}/pkgconfig)
231
232 CONFIGURE_FILE(${PKGCONFIG_DIR}/wrt-core.pc.in
233     ${PKGCONFIG_DIR}/wrt-core.pc @ONLY)
234 INSTALL(FILES ${PKGCONFIG_DIR}/wrt-core.pc DESTINATION lib/pkgconfig)
235
236