Use systemd API to decode unit name
[platform/core/security/ode.git] / server / CMakeLists.txt
1 #
2 # Copyright (c) 2015-2019 Samsung Electronics Co., Ltd All Rights Reserved
3 #
4 # Licensed under the Apache License, Version 2.0 (the "License");
5 # you may not use this file except in compliance with the License.
6 # You may obtain a copy of the License at
7 #
8 #     http://www.apache.org/licenses/LICENSE-2.0
9 #
10 # Unless required by applicable law or agreed to in writing, software
11 # distributed under the License is distributed on an "AS IS" BASIS,
12 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 # See the License for the specific language governing permissions and
14 # limitations under the License.
15 #
16 SET(SERVER_SRCS main.cpp
17                                 server.cpp
18                                 misc.cpp
19                                 ext4-tool.cpp
20                                 file-footer.cpp
21                                 file-sink.cpp
22                                 secure-erase.cpp
23                                 progress-bar.cpp
24                                 kernel-keyring.cpp
25                                 internal-encryption.cpp
26                                 internal-encryption-common.cpp
27                                 external-encryption.cpp
28                                 luks.cpp
29                                 key-server.cpp
30                                 engine/encryption/ext4-engine.cpp
31                                 engine/encryption/dmcrypt-engine.cpp
32                                 engine/encryption/ecryptfs-engine.cpp
33                                 engine/encryption/cryptsetup-engine.cpp
34                                 engine/erase/mmc-engine.cpp
35                                 engine/erase/erase-engine.cpp
36                                 key-manager/key-store.cpp
37                                 key-manager/key-generator.cpp
38                                 key-manager/anti-forensics.cpp
39                                 key-manager/encrypted-key.cpp
40                                 upgrade-support.cpp
41 )
42
43 SET(DEPENDENCY  klay
44                                 vconf
45                                 glib-2.0
46                                 gio-2.0
47                                 libtzplatform-config
48                                 cynara-client
49                                 libcrypto
50                                 libsmack
51                                 capi-system-device
52                                 libsystemd
53 )
54
55 SET(SERVER_NAME ${PROJECT_NAME}d)
56 SET(PROJECT_DATA_DIR ${DATA_DIR}/${PROJECT_NAME})
57
58 ADD_EXECUTABLE(${SERVER_NAME} ${SERVER_SRCS})
59
60 PKG_CHECK_MODULES(SERVER_DEPS REQUIRED ${DEPENDENCY})
61
62 INCLUDE_DIRECTORIES(SYSTEM ${SERVER_DEPS_INCLUDE_DIRS} ${ODE_SERVER} ${PROJECT_SOURCE_DIR})
63
64 TARGET_LINK_LIBRARIES(${SERVER_NAME} ${SERVER_DEPS_LIBRARIES} ${LFS_LDFLAGS} ${LFS_LIBS} pthread dl)
65
66 SET_TARGET_PROPERTIES(${SERVER_NAME} PROPERTIES COMPILE_FLAGS "-fPIE")
67 SET_TARGET_PROPERTIES(${SERVER_NAME} PROPERTIES LINK_FLAGS "-pie -Wl,-z,relro")
68 ADD_DEFINITIONS(-DPROJECT_DATA_DIR="${PROJECT_DATA_DIR}")
69
70 TARGET_COMPILE_DEFINITIONS(${SERVER_NAME} PRIVATE
71         RUN_PATH="${RUN_DIR}"
72         ICON_PATH="${ICON_DIR}"
73 )
74
75 CONFIGURE_FILE(systemd/${PROJECT_NAME}.service.in systemd/${PROJECT_NAME}.service)
76
77 INSTALL(TARGETS ${SERVER_NAME} DESTINATION ${BIN_DIR})
78 INSTALL(FILES systemd/${PROJECT_NAME}.service DESTINATION ${SYSTEMD_UNIT_DIR})
79 INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/engine/encryption/dummy_password DESTINATION ${PROJECT_DATA_DIR})
80 INSTALL(DIRECTORY DESTINATION ${KEY_STORAGE_PLUGIN_DIR})