44 lines
1.0 KiB
CMake
44 lines
1.0 KiB
CMake
cmake_minimum_required(VERSION 3.7.1)
|
|
project(umcumgr C)
|
|
|
|
set(CMAKE_C_STANDARD 99)
|
|
|
|
OPTION(DO_UPLOAD_SHA "Send data SHA with update packets" OFF)
|
|
OPTION(SANITIZE "ASAN" OFF)
|
|
|
|
find_package(PkgConfig)
|
|
|
|
PKG_CHECK_MODULES(CBOR REQUIRED tinycbor)
|
|
|
|
set(CMAKE_C_FLAGS
|
|
"${CMAKE_C_FLAGS} -Wno-attributes")
|
|
|
|
add_library(umcumgr_serial
|
|
src/serial_util.c
|
|
src/timer.c)
|
|
|
|
add_executable(umcumgr
|
|
src/base64.c
|
|
src/image.c
|
|
src/main.c
|
|
src/crc16_sw.c
|
|
src/gpio.c
|
|
src/error.c
|
|
src/dump.c)
|
|
|
|
if(SANITIZE)
|
|
message(STATUS "SANITIZE Enabled")
|
|
set(CMAKE_C_FLAGS
|
|
"${CMAKE_C_FLAGS} -fsanitize=address -fsanitize=undefined")
|
|
endif(SANITIZE)
|
|
|
|
if (DO_UPLOAD_SHA)
|
|
message(STATUS "Enabled data SHA on update packets")
|
|
add_definitions(-DDO_UPLOAD_SHA)
|
|
target_sources(umcumgr PRIVATE src/sha256.c)
|
|
endif ()
|
|
|
|
target_include_directories(umcumgr PRIVATE ${CBOR_INCLUDE_DIRS})
|
|
target_link_libraries(umcumgr PRIVATE ${CBOR_LIBRARIES} m umcumgr_serial)
|
|
|
|
install(TARGETS umcumgr DESTINATION bin) |