forked from yuichitk/libcsuit
-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathCMakeLists.txt
103 lines (84 loc) · 3.43 KB
/
CMakeLists.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
cmake_minimum_required(VERSION 3.13)
project(libcsuit
DESCRIPTION "SUIT Manifest parser and encoder"
LANGUAGES C
VERSION 1.0.0)
set(CMAKE_C_FLAGS "-Wall -O3 -pedantic")
set(CMAKE_C_FLAGS_DEBUG "-Wall -O0 -g -DDEBUG") # use `-DCMAKE_BUILD_TYPE=Debug'
#set(QCBOR_LIBRARY "qcbor")
set(QCBOR_LIBRARY "/usr/local/lib/libqcbor.a")
add_subdirectory(../t_cose t_cose)
set(T_COSE_LIBRARY "t_cose")
include_directories(/usr/local/include/qcbor)
include_directories(../t_cose/inc)
include_directories(../t_cose/src)
include_directories(examples/inc)
include_directories(inc)
if(MBEDTLS)
set(CRYPTO_LIBRARIES "mbedtls") # "mbedx509" "mbedcrypto"
option(USE_PKCS11_HELPER_LIBRARY "Build mbed TLS with the pkcs11-helper library." OFF)
option(ENABLE_ZLIB_SUPPORT "Build mbed TLS with zlib library." OFF)
option(ENABLE_PROGRAMS "Build mbed TLS programs." OFF)
option(ENABLE_TESTING "Build mbed TLS tests." OFF)
set(CMAKE_INSTALL_NAME_DIR ${CMAKE_INSTALL_FULL_LIBDIR}/lib)
include_directories(../mbedtls/include)
# Use custom config file for Mbed TLS
add_definitions(-DMBEDTLS_CONFIG_FILE="${CMAKE_SOURCE_DIR}/mbedtls_config.h")
option(USE_STATIC_MBEDTLS_LIBRARY "Build mbed TLS static library." off)
option(USE_SHARED_MBEDTLS_LIBRARY "Build mbed TLS shared library." on)
if (CMAKE_SYSTEM MATCHES "OpenBSD")
option(LINK_WITH_PTHREAD "Explicitly link mbed TLS library to pthread." on)
endif()
add_subdirectory(../mbedtls mbedtls)
add_definitions(-DMBEDTLS=1)
# Compile code for use with the PSA Crypto API
add_definitions(-DLIBCSUIT_PSA_CRYPTO_C=1)
else()
set(CRYPTO_LIBRARIES "crypto")
endif()
set(SOURCE_DECODE
src/suit_common.c
src/suit_digest.c
src/suit_cose.c
src/suit_manifest_print.c
src/suit_manifest_encode.c
src/suit_manifest_decode.c
examples/suit_examples_common.c
examples/suit_examples_cose
examples/suit_manifest_parser_main.c
)
add_executable(suit_manifest_parser_main ${SOURCE_DECODE})
target_link_libraries(suit_manifest_parser_main ${CRYPTO_LIBRARIES} ${QCBOR_LIBRARY} ${T_COSE_LIBRARY} -lm)
#set_target_properties(suit_manifest_parser_main PROPERTIES INSTALL_RPATH ${CRYPTO_LIBRARY} t_cose qcbor)
set(SOURCE_ENCODE
src/suit_common.c
src/suit_digest.c
src/suit_cose.c
src/suit_manifest_print.c
src/suit_manifest_encode.c
src/suit_manifest_decode.c
examples/suit_examples_common.c
examples/suit_examples_cose
examples/suit_manifest_encode_main.c
)
add_executable(suit_manifest_encode_main ${SOURCE_ENCODE})
target_link_libraries(suit_manifest_encode_main ${CRYPTO_LIBRARIES} ${QCBOR_LIBRARY} ${T_COSE_LIBRARY} -lm)
#set_target_properties(suit_manifest_encode_main PROPERTIES INSTALL_RPATH ${CRYPTO_LIBRARY} t_cose qcbor)
set(SOURCE_PROCESS
src/suit_common.c
src/suit_digest.c
src/suit_cose.c
src/suit_manifest_print.c
src/suit_manifest_encode.c
src/suit_manifest_decode.c
src/suit_manifest_process.c
examples/suit_examples_common.c
examples/suit_examples_cose
examples/suit_manifest_process_main.c
)
add_executable(suit_manifest_process_main ${SOURCE_PROCESS})
target_link_options(suit_manifest_process_main PRIVATE "LINKER:--wrap=suit_fetch_callback")
target_link_options(suit_manifest_process_main PRIVATE "LINKER:--wrap=suit_store_callback")
target_link_options(suit_manifest_process_main PRIVATE "LINKER:--wrap=suit_invoke_callback")
target_link_options(suit_manifest_process_main PRIVATE "LINKER:--wrap=suit_condition_callback")
target_link_libraries(suit_manifest_process_main ${CRYPTO_LIBRARIES} ${QCBOR_LIBRARY} ${T_COSE_LIBRARY} -lm)