Tizen 2.4.0 rev3 SDK Public Release
[framework/web/wrt-installer.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 # @file        CMakeLists.txt
16 # @author      Bartlomiej Grzelewski (b.grzelewski@samsung.com)
17 # @brief
18 #
19
20 ############################# Check minimum CMake version #####################
21
22 CMAKE_MINIMUM_REQUIRED(VERSION 2.6)
23 PROJECT("wrt-installer")
24
25 ############################# cmake packages ##################################
26
27 INCLUDE(FindPkgConfig)
28
29 ############################# build type ######################################
30
31 IF(NOT CMAKE_BUILD_TYPE)
32     SET(CMAKE_BUILD_TYPE "Release")
33 ENDIF(NOT CMAKE_BUILD_TYPE)
34
35 ############################# compilation defines #############################
36
37 OPTION(DPL_LOG "DPL logs status" ON)
38 SET(LOG_TAG "WRT_INSTALLER")
39 OPTION(WITH_TESTS "Build tests" OFF)
40
41 OPTION(MULTIPROCESS_SERVICE_SUPPORT "Process per service" OFF)
42 OPTION(MULTIPROCESS_SERVICE_SUPPORT_INLINE "Process per service - inline mode support" OFF)
43 OPTION(SCHEMA_VALIDATION_SUPPORT "Support for XML schema validation" OFF)
44 OPTION(NFC_APP_CONTROL_EXCEPTION "Enable exception handling for NFC app-control" ON)
45 OPTION(AMBIENT_FEATURE_SUPPORT "Support for ambient" OFF)
46 OPTION(WEB_PROVIDER_SUPPORT "Support for Web Provider" OFF)
47
48 IF(DEVICE_PROFILE STREQUAL "WEARABLE")
49     MESSAGE(STATUS "Device Profile: WEARABLE")
50     ADD_DEFINITIONS("-DDEVICE_PROFILE_WEARABLE")
51     SET(AMBIENT_FEATURE_SUPPORT ON)
52 ELSEIF(DEVICE_PROFILE STREQUAL "MOBILE")
53     MESSAGE(STATUS "Device Profile: MOBILE")
54     ADD_DEFINITIONS("-DDEVICE_PROFILE_MOBILE")
55 ELSEIF(DEVICE_PROFILE STREQUAL "TV")
56     MESSAGE(STATUS "Device Profile: TV")
57     ADD_DEFINITIONS("-DDEVICE_PROFILE_TV")
58 ENDIF()
59
60 SET(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/build")
61 INCLUDE(Options)
62
63 ############################# compiler flags ##################################
64
65 SET(CMAKE_C_FLAGS_PROFILING    "-O2")
66 SET(CMAKE_CXX_FLAGS_PROFILING  "-O2 -std=c++0x")
67 SET(CMAKE_C_FLAGS_DEBUG        "-O0 -g")
68 SET(CMAKE_CXX_FLAGS_DEBUG      "-O0 -std=c++0x -g")
69 SET(CMAKE_C_FLAGS_RELEASE      "-O2 -g")
70 SET(CMAKE_CXX_FLAGS_RELEASE    "-O2 -std=c++0x -g -fvisibility-inlines-hidden")
71 SET(CMAKE_CXX_FLAGS_CCOV       "-O0 -std=c++0x -g --coverage")
72
73 IF(DPL_LOG AND NOT CMAKE_BUILD_TYPE MATCHES "profiling")
74     MESSAGE(STATUS "Logging enabled for DPL")
75     ADD_DEFINITIONS("-DDPL_LOGS_ENABLED")
76 ELSE(DPL_LOG AND NOT CMAKE_BUILD_TYPE MATCHES "profiling")
77     MESSAGE(STATUS "Logging disabled for DPL")
78 ENDIF(DPL_LOG AND NOT CMAKE_BUILD_TYPE MATCHES "profiling")
79 MESSAGE(STATUS "WITH_TESTS: " ${WITH_TESTS})
80 IF(MULTIPROCESS_SERVICE_SUPPORT)
81     ADD_DEFINITIONS("-DMULTIPROCESS_SERVICE_SUPPORT")
82     IF (MULTIPROCESS_SERVICE_SUPPORT_INLINE)
83         ADD_DEFINITIONS("-DMULTIPROCESS_SERVICE_SUPPORT_INLINE")
84     ENDIF(MULTIPROCESS_SERVICE_SUPPORT_INLINE)
85 ENDIF(MULTIPROCESS_SERVICE_SUPPORT)
86 IF(SCHEMA_VALIDATION_SUPPORT)
87     MESSAGE(STATUS "XML Schema validation of installed app enabled")
88     ADD_DEFINITIONS("-DSCHEMA_VALIDATION_ENABLED")
89 ENDIF(SCHEMA_VALIDATION_SUPPORT)
90 IF(NFC_APP_CONTROL_EXCEPTION)
91     MESSAGE(STATUS "Exception handling for NFC app-control is enabled")
92     ADD_DEFINITIONS("-DNFC_EXCEPTION_HANDLING_FOR_TIZEN_2_2_ONLY")
93 ENDIF(NFC_APP_CONTROL_EXCEPTION)
94 IF(AMBIENT_FEATURE_SUPPORT)
95     ADD_DEFINITIONS("-DAMBIENT_ENABLED")
96 ENDIF(AMBIENT_FEATURE_SUPPORT)
97
98 SET(Boost_USE_STATIC_LIBS OFF)
99 SET(Boost_USE_MULTITHREADED ON)
100 SET(Boost_USE_STATIC_RUNTIME OFF)
101
102 FIND_PACKAGE(Boost 1.51.0 REQUIRED filesystem system)
103
104 IF(TIZEN_VERSION)
105     ADD_DEFINITIONS("-DTIZEN_VERSION=\"${TIZEN_VERSION}\"")
106 ELSE(TIZEN_VERSION)
107     message(FATAL_ERROR "TIZEN_VERSION MUST BE declared on build flag.")
108 ENDIF(TIZEN_VERSION)
109
110 # If supported for the target machine, emit position-independent code,suitable
111 # for dynamic linking and avoiding any limit on the size of the global offset
112 # table. This option makes a difference on the m68k, PowerPC and SPARC.
113 # (BJ: our ARM too?)
114 ADD_DEFINITIONS("-fPIC")
115
116 # Set the default ELF image symbol visibility to hidden - all symbols will be
117 # marked with this unless overridden within the code.
118 #ADD_DEFINITIONS("-fvisibility=hidden")
119
120 # Set compiler warning flags
121 #ADD_DEFINITIONS("-Werror")             # Make all warnings into errors.
122 ADD_DEFINITIONS("-Wall")                # Generate all warnings
123 ADD_DEFINITIONS("-Wextra")              # Generate even more extra warnings
124 ADD_DEFINITIONS("-Wno-variadic-macros") # Inhibit variadic macros warnings (needed for ORM)
125 ADD_DEFINITIONS("-Wno-deprecated")      # No warnings about deprecated features
126 ADD_DEFINITIONS("-std=c++0x")           # accept C++11x standard
127 ADD_DEFINITIONS("-DIME_ENABLED")        # enable Ime features
128 ADD_DEFINITIONS("-DSERVICE_ENABLED")    # enable Service features
129
130 ############################# Targets names ###################################
131
132 SET(TARGET_INSTALLER_STATIC "wrt-installer_static")
133 SET(TARGET_INSTALLER "wrt-installer")
134 SET(TARGET_BACKEND_LIB "wgt")
135
136 ############################# subdirectories ##################################
137 ADD_SUBDIRECTORY(src)
138 ADD_SUBDIRECTORY(configuration)
139
140 IF(WITH_TESTS)
141     ADD_SUBDIRECTORY(tests)
142 ENDIF(WITH_TESTS)
143