From de3f5f0bcefe87782208030e0c08c7320bfe39b2 Mon Sep 17 00:00:00 2001 From: Pol Henarejos Date: Mon, 6 Nov 2023 11:50:43 +0100 Subject: [PATCH] Update CMake file for standalone build. It should build but not run. Signed-off-by: Pol Henarejos --- CMakeLists.txt | 55 ++++++++++++++++++++++++++++++++++++-------------- 1 file changed, 40 insertions(+), 15 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index fbfefba..a606a99 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -15,33 +15,58 @@ # along with this program. If not, see . # -cmake_minimum_required(VERSION 3.13) + cmake_minimum_required(VERSION 3.13) -project(pico_hsm_sdk C) -set(CMAKE_C_STANDARD 11) -set(CMAKE_CXX_STANDARD 17) + if(ENABLE_EMULATION) + else() + include(pico_sdk_import.cmake) + endif() -if(ENABLE_EMULATION) -else() -include(pico_sdk_import.cmake) -pico_sdk_init() -endif() + project(pico_hsm C CXX ASM) + + set(CMAKE_C_STANDARD 11) + set(CMAKE_CXX_STANDARD 17) + + if(ENABLE_EMULATION) + else() + pico_sdk_init() + endif() + + if (NOT DEFINED __FOR_CI) + set(__FOR_CI 0) + endif() + if (__FOR_CI) + add_definitions(-D__FOR_CI) + endif() + +set(USB_ITF_CCID 1) +set(USB_ITF_HID 1) +include(pico_hsm_sdk_import.cmake) add_executable(pico_hsm_sdk_exe) -set(USB_ITF_HID 1) -set(USB_ITF_CCID 1) - -include(pico_hsm_sdk_import.cmake) - target_compile_options(pico_hsm_sdk_exe PUBLIC -Wall -Werror ) if(ENABLE_EMULATION) +target_compile_options(pico_hsm_sdk_exe PUBLIC + -fdata-sections + -ffunction-sections + ) +if(APPLE) +target_link_options(pico_hsm_sdk_exe PUBLIC + -Wl,-dead_strip + ) +else() +target_link_options(pico_hsm_sdk_exe PUBLIC + -Wl,--gc-sections + ) +endif (APPLE) else() pico_add_extra_outputs(pico_hsm_sdk_exe) -target_link_libraries(pico_hsm_sdk_exe PRIVATE pico_hsm_sdk pico_stdlib pico_multicore hardware_flash hardware_sync hardware_adc pico_unique_id hardware_rtc tinyusb_device tinyusb_board) +target_link_libraries(pico_hsm_sdk_exe PRIVATE pico_hsm_sdk pico_stdlib pico_multicore hardware_flash hardware_sync hardware_adc pico_unique_id hardware_rtc tinyusb_device tinyusb_board) endif() +