2022-10-18 13:01:54 +03:00
|
|
|
# Copyright (c) Microsoft Corporation. All rights reserved.
|
|
|
|
# Licensed under the Apache 2.0 License.
|
|
|
|
|
|
|
|
# Build QCBOR
|
|
|
|
set(QCBOR_DIR "${CMAKE_CURRENT_SOURCE_DIR}/3rdparty/exported/QCBOR")
|
|
|
|
set(QCBOR_SRC "${QCBOR_DIR}/src")
|
|
|
|
set(QCBOR_SRCS
|
|
|
|
"${QCBOR_SRC}/ieee754.c" "${QCBOR_SRC}/qcbor_decode.c"
|
|
|
|
"${QCBOR_SRC}/qcbor_encode.c" "${QCBOR_SRC}/qcbor_err_to_str.c"
|
|
|
|
"${QCBOR_SRC}/UsefulBuf.c"
|
|
|
|
)
|
2022-10-26 12:08:24 +03:00
|
|
|
if(COMPILE_TARGET STREQUAL "sgx")
|
2022-10-18 13:01:54 +03:00
|
|
|
add_enclave_library_c(qcbor.enclave ${QCBOR_SRCS})
|
|
|
|
target_include_directories(
|
|
|
|
qcbor.enclave PUBLIC $<BUILD_INTERFACE:${CCF_3RD_PARTY_EXPORTED_DIR}/QCBOR>
|
|
|
|
$<INSTALL_INTERFACE:include/3rdparty/QCBOR>
|
|
|
|
)
|
|
|
|
|
|
|
|
install(
|
|
|
|
TARGETS qcbor.enclave
|
|
|
|
EXPORT ccf
|
|
|
|
DESTINATION lib
|
|
|
|
)
|
2022-11-18 16:21:14 +03:00
|
|
|
elseif(COMPILE_TARGET STREQUAL "snp")
|
|
|
|
add_library(qcbor.snp STATIC ${QCBOR_SRCS})
|
|
|
|
|
|
|
|
target_include_directories(
|
|
|
|
qcbor.snp PUBLIC $<BUILD_INTERFACE:${CCF_3RD_PARTY_EXPORTED_DIR}/QCBOR>
|
|
|
|
$<INSTALL_INTERFACE:include/3rdparty/QCBOR>
|
|
|
|
)
|
|
|
|
set_property(TARGET qcbor.snp PROPERTY POSITION_INDEPENDENT_CODE ON)
|
|
|
|
add_san(qcbor.snp)
|
|
|
|
|
|
|
|
install(
|
|
|
|
TARGETS qcbor.snp
|
|
|
|
EXPORT ccf
|
|
|
|
DESTINATION lib
|
|
|
|
)
|
2022-10-18 13:01:54 +03:00
|
|
|
endif()
|
|
|
|
|
|
|
|
add_library(qcbor.host STATIC ${QCBOR_SRCS})
|
|
|
|
|
|
|
|
target_include_directories(
|
|
|
|
qcbor.host PUBLIC $<BUILD_INTERFACE:${CCF_3RD_PARTY_EXPORTED_DIR}/QCBOR>
|
|
|
|
$<INSTALL_INTERFACE:include/3rdparty/QCBOR>
|
|
|
|
)
|
|
|
|
set_property(TARGET qcbor.host PROPERTY POSITION_INDEPENDENT_CODE ON)
|
|
|
|
add_san(qcbor.host)
|
|
|
|
|
2022-11-01 15:54:35 +03:00
|
|
|
if(INSTALL_VIRTUAL_LIBRARIES)
|
|
|
|
install(
|
|
|
|
TARGETS qcbor.host
|
|
|
|
EXPORT ccf
|
|
|
|
DESTINATION lib
|
|
|
|
)
|
|
|
|
endif()
|