4 # Copyright (c) 2021 Samsung Electronics Co., Ltd.
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
10 # http://www.apache.org/licenses/LICENSE-2.0
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.
19 CMAKE_MINIMUM_REQUIRED(VERSION 2.82)
22 INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/src/)
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}")
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")
33 FIND_PROGRAM(UNAME NAMES uname)
34 IF("${ARCH}" STREQUAL "arm")
35 ADD_DEFINITIONS("-DTARGET")
36 MESSAGE("add -DTARGET")
37 ENDIF("${ARCH}" STREQUAL "arm")
39 ADD_DEFINITIONS("-DPREFIX=\"${PREFIX}\"")
41 SET(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,--as-needed -pie")
43 ADD_SUBDIRECTORY(src/dmverity)
44 ADD_SUBDIRECTORY(src/img-verifier)
45 ADD_SUBDIRECTORY(src/upgrade-apply)
46 ADD_SUBDIRECTORY(src/blkid-print)
47 ADD_SUBDIRECTORY(data)
48 ADD_SUBDIRECTORY(scripts/rw-upgrade)