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 Bartlomiej Grzelewski (b.grzelewski@samsung.com)
20 ############################# Check minimum CMake version #####################
22 CMAKE_MINIMUM_REQUIRED(VERSION 2.6)
23 PROJECT("wrt-installer")
25 ############################# cmake packages ##################################
27 INCLUDE(FindPkgConfig)
29 ############################# build type ######################################
31 IF(NOT CMAKE_BUILD_TYPE)
32 SET(CMAKE_BUILD_TYPE "Release")
33 ENDIF(NOT CMAKE_BUILD_TYPE)
35 ############################# compilation defines #############################
37 OPTION(DPL_LOG "DPL logs status" ON)
38 OPTION(WITH_TESTS "Build tests" OFF)
39 OPTION(MULTIPROCESS_SERVICE_SUPPORT "Process per service" OFF)
40 OPTION(MULTIPROCESS_SERVICE_SUPPORT_INLINE "Process per service - inline mode support" OFF)
41 OPTION(SCHEMA_VALIDATION_SUPPORT "Support for XML schema validation" OFF)
42 OPTION(NFC_APP_CONTROL_EXCEPTION "Enable exception handling for NFC app-control" ON)
44 SET(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/build")
47 ############################# compiler flags ##################################
49 SET(CMAKE_C_FLAGS_PROFILING "-O2")
50 SET(CMAKE_CXX_FLAGS_PROFILING "-O2 -std=c++0x")
51 SET(CMAKE_C_FLAGS_DEBUG "-O0 -g")
52 SET(CMAKE_CXX_FLAGS_DEBUG "-O0 -std=c++0x -g")
53 SET(CMAKE_C_FLAGS_RELEASE "-O2 -g")
54 SET(CMAKE_CXX_FLAGS_RELEASE "-O2 -std=c++0x -g -fvisibility-inlines-hidden")
55 SET(CMAKE_CXX_FLAGS_CCOV "-O0 -std=c++0x -g --coverage")
57 IF(DPL_LOG AND NOT CMAKE_BUILD_TYPE MATCHES "profiling")
58 MESSAGE(STATUS "Logging enabled for DPL")
59 ADD_DEFINITIONS("-DDPL_LOGS_ENABLED")
60 ELSE(DPL_LOG AND NOT CMAKE_BUILD_TYPE MATCHES "profiling")
61 MESSAGE(STATUS "Logging disabled for DPL")
62 ENDIF(DPL_LOG AND NOT CMAKE_BUILD_TYPE MATCHES "profiling")
63 MESSAGE(STATUS "WITH_TESTS: " ${WITH_TESTS})
64 IF(MULTIPROCESS_SERVICE_SUPPORT)
65 ADD_DEFINITIONS("-DMULTIPROCESS_SERVICE_SUPPORT")
66 IF (MULTIPROCESS_SERVICE_SUPPORT_INLINE)
67 ADD_DEFINITIONS("-DMULTIPROCESS_SERVICE_SUPPORT_INLINE")
68 ENDIF(MULTIPROCESS_SERVICE_SUPPORT_INLINE)
69 ENDIF(MULTIPROCESS_SERVICE_SUPPORT)
70 IF(SCHEMA_VALIDATION_SUPPORT)
71 MESSAGE(STATUS "XML Schema validation of installed app enabled")
72 ADD_DEFINITIONS("-DSCHEMA_VALIDATION_ENABLED")
73 ENDIF(SCHEMA_VALIDATION_SUPPORT)
74 IF(NFC_APP_CONTROL_EXCEPTION)
75 MESSAGE(STATUS "Exception handling for NFC app-control is enabled")
76 ADD_DEFINITIONS("-DNFC_EXCEPTION_HANDLING_FOR_TIZEN_2_2_ONLY")
77 ENDIF(NFC_APP_CONTROL_EXCEPTION)
79 IF(DEVICE_PROFILE STREQUAL "wearable")
80 MESSAGE(STATUS "Device Profile: wearable")
81 ADD_DEFINITIONS("-DDEVICE_PROFILE_WEARABLE")
82 ELSE(DEVICE_PROFILE STREQUAL "wearable")
83 MESSAGE(STATUS "Device Profile: mobile")
84 ADD_DEFINITIONS("-DDEVICE_PROFILE_MOBILE")
85 ADD_DEFINITIONS("-DWRT_SMACK_ENABLED") # enable smack
87 OPTION(CSP_SUPPORT "Support for csp policy" ON)
88 OPTION(ALLOW_NAVIGATION_SUPPORT "Support for allow-navigation" ON)
91 ADD_DEFINITIONS("-DCSP_ENABLED")
93 IF(ALLOW_NAVIGATION_SUPPORT)
94 ADD_DEFINITIONS("-DALLOW_NAVIGATION_ENABLED")
95 ENDIF(ALLOW_NAVIGATION_SUPPORT)
96 ENDIF(DEVICE_PROFILE STREQUAL "wearable")
98 # If supported for the target machine, emit position-independent code,suitable
99 # for dynamic linking and avoiding any limit on the size of the global offset
100 # table. This option makes a difference on the m68k, PowerPC and SPARC.
102 ADD_DEFINITIONS("-fPIC")
104 # Set the default ELF image symbol visibility to hidden - all symbols will be
105 # marked with this unless overridden within the code.
106 #ADD_DEFINITIONS("-fvisibility=hidden")
108 # Set compiler warning flags
109 #ADD_DEFINITIONS("-Werror") # Make all warnings into errors.
110 ADD_DEFINITIONS("-Wall") # Generate all warnings
111 ADD_DEFINITIONS("-Wextra") # Generate even more extra warnings
112 ADD_DEFINITIONS("-Wno-variadic-macros") # Inhibit variadic macros warnings (needed for ORM)
113 ADD_DEFINITIONS("-Wno-deprecated") # No warnings about deprecated features
114 ADD_DEFINITIONS("-std=c++0x") # accept C++11x standard
115 ADD_DEFINITIONS("-DWRT_INSTALLER_LOG") # enable installer log
116 ADD_DEFINITIONS("-DDBOX_ENABLED") # enable dynamic box features
117 ADD_DEFINITIONS("-DIME_ENABLED") # enable Ime features
118 ADD_DEFINITIONS("-DSERVICE_ENABLED") # enable Service features
120 ############################# Targets names ###################################
122 SET(TARGET_INSTALLER_STATIC "wrt-installer_static")
123 SET(TARGET_INSTALLER "wrt-installer")
124 SET(TARGET_BACKEND_LIB "wgt")
126 ############################# subdirectories ##################################
127 ADD_SUBDIRECTORY(src)
128 ADD_SUBDIRECTORY(configuration)
131 ADD_SUBDIRECTORY(tests)
134 ########################## smack rule install #################################
135 INSTALL(FILES ${CMAKE_SOURCE_DIR}/wrt-installer.rule
136 DESTINATION /etc/smack/accesses2.d/