439f01021aeac05ecd43d8aa9ba8a77413b8dd4b
[platform/core/system/upgrade.git] / CMakeLists.txt
1 #
2 # upgrade-engine
3 #
4 # Copyright (c) 2021 Samsung Electronics Co., Ltd.
5 #
6 # Licensed under the Apache License, Version 2.0 (the License);
7 # you may not use this file except in compliance with the License.
8 # You may obtain a copy of the License at
9 #
10 #     http://www.apache.org/licenses/LICENSE-2.0
11 #
12 # Unless required by applicable law or agreed to in writing, software
13 # distributed under the License is distributed on an "AS IS" BASIS,
14 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 # See the License for the specific language governing permissions and
16 # limitations under the License.
17 #
18
19 CMAKE_MINIMUM_REQUIRED(VERSION 2.82)
20 PROJECT(upgrade C)
21
22 INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/src/)
23
24 IF("${CMAKE_BUILD_TYPE}" STREQUAL "")
25         SET(CMAKE_BUILD_TYPE "Release")
26 ENDIF("${CMAKE_BUILD_TYPE}" STREQUAL "")
27 MESSAGE("Build type: ${CMAKE_BUILD_TYPE}")
28
29 SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${EXTRA_CFLAGS} -fPIC -fPIE")
30 SET(CMAKE_C_FLAGS_DEBUG "-O0 -g")
31 SET(CMAKE_C_FLAGS_RELEASE "-O2")
32
33 FIND_PROGRAM(UNAME NAMES uname)
34 IF("${ARCH}" STREQUAL "arm")
35         ADD_DEFINITIONS("-DTARGET")
36         MESSAGE("add -DTARGET")
37 ENDIF("${ARCH}" STREQUAL "arm")
38
39 ADD_DEFINITIONS("-DPREFIX=\"${PREFIX}\"")
40
41 SET(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,--as-needed -pie")
42
43 ADD_SUBDIRECTORY(src/dmverity)
44 ADD_SUBDIRECTORY(src/img-verifier)
45 ADD_SUBDIRECTORY(src/upgrade-apply)
46 ADD_SUBDIRECTORY(src/delta-ua)
47 ADD_SUBDIRECTORY(src/blkid-print)
48 ADD_SUBDIRECTORY(data)
49 ADD_SUBDIRECTORY(scripts/rw-upgrade)