Remove hardcoded path for multiuser support
[platform/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 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(CSP_SUPPORT "Support for csp policy" ON)
42 OPTION(ALLOW_NAVIGATION_SUPPORT "Support for allow-navigation" ON)
43 OPTION(SMACK "Enable smack support" ON)
44 OPTION(DECRYPT_SUPPORT "Enable appmanager capabilities" ON)
45 OPTION(X11_SUPPORT "Enable X11" ON)
46 OPTION(WAYLAND_SUPPORT "Enable Wayland" OFF)
47
48 IF(DECRYPT_SUPPORT)
49     ADD_DEFINITIONS("-DDECRYPT")
50 ENDIF(DECRYPT_SUPPORT)
51 OPTION(SCHEMA_VALIDATION_SUPPORT "Support for XML schema validation" OFF)
52
53 ############################# compiler flags ##################################
54
55 SET(CMAKE_C_FLAGS_PROFILING    "-O2")
56 SET(CMAKE_CXX_FLAGS_PROFILING  "-O2 -std=c++0x")
57 SET(CMAKE_C_FLAGS_DEBUG        "-O0 -g")
58 SET(CMAKE_CXX_FLAGS_DEBUG      "-O0 -std=c++0x -g")
59 SET(CMAKE_C_FLAGS_RELEASE      "-O2 -g")
60 SET(CMAKE_CXX_FLAGS_RELEASE    "-O2 -std=c++0x -g")
61 SET(CMAKE_CXX_FLAGS_CCOV       "-O0 -std=c++0x -g --coverage")
62
63 IF(DPL_LOG AND NOT CMAKE_BUILD_TYPE MATCHES "profiling")
64     MESSAGE(STATUS "Logging enabled for DPL")
65     ADD_DEFINITIONS("-DDPL_LOGS_ENABLED")
66 ELSE(DPL_LOG AND NOT CMAKE_BUILD_TYPE MATCHES "profiling")
67     MESSAGE(STATUS "Logging disabled for DPL")
68 ENDIF(DPL_LOG AND NOT CMAKE_BUILD_TYPE MATCHES "profiling")
69 MESSAGE(STATUS "WITH_TESTS: " ${WITH_TESTS})
70 IF(MULTIPROCESS_SERVICE_SUPPORT)
71     ADD_DEFINITIONS("-DMULTIPROCESS_SERVICE_SUPPORT")
72     IF (MULTIPROCESS_SERVICE_SUPPORT_INLINE)
73         ADD_DEFINITIONS("-DMULTIPROCESS_SERVICE_SUPPORT_INLINE")
74     ENDIF(MULTIPROCESS_SERVICE_SUPPORT_INLINE)
75 ENDIF(MULTIPROCESS_SERVICE_SUPPORT)
76 IF(CSP_SUPPORT)
77     ADD_DEFINITIONS("-DCSP_ENABLED")
78 ENDIF(CSP_SUPPORT)
79 IF(ALLOW_NAVIGATION_SUPPORT)
80     ADD_DEFINITIONS("-DALLOW_NAVIGATION_ENABLED")
81 ENDIF(ALLOW_NAVIGATION_SUPPORT)
82 IF(SCHEMA_VALIDATION_SUPPORT)
83     MESSAGE(STATUS "XML Schema validation of installed app enabled")
84     ADD_DEFINITIONS("-DSCHEMA_VALIDATION_ENABLED")
85 ENDIF(SCHEMA_VALIDATION_SUPPORT)
86
87 # If supported for the target machine, emit position-independent code,suitable
88 # for dynamic linking and avoiding any limit on the size of the global offset
89 # table. This option makes a difference on the m68k, PowerPC and SPARC.
90 # (BJ: our ARM too?)
91 ADD_DEFINITIONS("-fPIC")
92
93 # Set the default ELF image symbol visibility to hidden - all symbols will be
94 # marked with this unless overridden within the code.
95 #ADD_DEFINITIONS("-fvisibility=hidden")
96
97 # Set compiler warning flags
98 #ADD_DEFINITIONS("-Werror")             # Make all warnings into errors.
99 ADD_DEFINITIONS("-Wall")                # Generate all warnings
100 ADD_DEFINITIONS("-Wextra")              # Generate even more extra warnings
101 ADD_DEFINITIONS("-Wno-variadic-macros") # Inhibit variadic macros warnings (needed for ORM)
102 ADD_DEFINITIONS("-Wno-deprecated")      # No warnings about deprecated features
103 ADD_DEFINITIONS("-std=c++0x")           # accept C++11x standard
104 IF(SMACK)
105     ADD_DEFINITIONS("-DWRT_SMACK_ENABLED")  # enable smack
106 ENDIF(SMACK)
107 ADD_DEFINITIONS("-DWRT_INSTALLER_LOG")  # enable installer log
108
109 INSTALL(FILES wrt_preinstall_widgets.sh DESTINATION /usr/bin)
110 INSTALL(FILES wrt-preinstall-widgets.service DESTINATION /usr/lib/systemd/system)
111
112 ############################# Targets names ###################################
113
114 SET(TARGET_INSTALLER_STATIC "wrt-installer_static")
115 SET(TARGET_INSTALLER "wrt-installer")
116 SET(TARGET_BACKEND_LIB "wgt")
117
118 ############################# service file ####################################
119
120 CONFIGURE_FILE(wrt-preinstall-widgets.service.in wrt-preinstall-widgets.service)
121
122 ############################# subdirectories ##################################
123 ADD_SUBDIRECTORY(src)
124 ADD_SUBDIRECTORY(configuration)
125
126 IF(WITH_TESTS)
127     ADD_SUBDIRECTORY(tests)
128 ENDIF(WITH_TESTS)