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