From 7110fa003497d7f1cc26d188af145bf5f6d98ef8 Mon Sep 17 00:00:00 2001 From: Reinhold Gschweicher Date: Mon, 4 Apr 2022 21:33:11 +0200 Subject: [PATCH] cmake: create QCBOR target and link to InfiniSim --- CMakeLists.txt | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index c6d4b78..b16b671 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -213,6 +213,31 @@ target_sources(infinisim PUBLIC ) +# QCBOR +add_library(QCBOR STATIC + ${InfiniTime_DIR}/src/libs/QCBOR/src/ieee754.c + ${InfiniTime_DIR}/src/libs/QCBOR/src/qcbor_decode.c + ${InfiniTime_DIR}/src/libs/QCBOR/src/qcbor_encode.c + ${InfiniTime_DIR}/src/libs/QCBOR/src/qcbor_err_to_str.c + ${InfiniTime_DIR}/src/libs/QCBOR/src/UsefulBuf.c) +target_include_directories(QCBOR SYSTEM PUBLIC ${InfiniTime_DIR}/src/libs/QCBOR/inc) +# This is required with the current configuration +target_compile_definitions(QCBOR PUBLIC QCBOR_DISABLE_FLOAT_HW_USE) +# These are for space-saving +target_compile_definitions(QCBOR PUBLIC QCBOR_DISABLE_PREFERRED_FLOAT) +target_compile_definitions(QCBOR PUBLIC QCBOR_DISABLE_EXP_AND_MANTISSA) +target_compile_definitions(QCBOR PUBLIC QCBOR_DISABLE_INDEFINITE_LENGTH_STRINGS) +#target_compile_definitions(QCBOR PUBLIC QCBOR_DISABLE_INDEFINITE_LENGTH_ARRAYS) +target_compile_definitions(QCBOR PUBLIC QCBOR_DISABLE_UNCOMMON_TAGS) +target_compile_definitions(QCBOR PUBLIC USEFULBUF_CONFIG_LITTLE_ENDIAN) +set_target_properties(QCBOR PROPERTIES LINKER_LANGUAGE C) +#target_compile_options(QCBOR PRIVATE +# $<$,$>: ${COMMON_FLAGS} -O0 -g3> +# $<$,$>: ${COMMON_FLAGS} -O3> +# $<$: -MP -MD -x assembler-with-cpp> +# ) +target_link_libraries(infinisim PRIVATE QCBOR) + list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake") # Special case for SDL2 dependency, goal is to find a config that exports SDL2::SDL2 target # libsdl2-dev has a `sdl2-config.cmake` that doesn't export this, but vcpkg does..