Update CMake file for standalone build.

It should build but not run.

Signed-off-by: Pol Henarejos <pol.henarejos@cttc.es>
This commit is contained in:
Pol Henarejos 2023-11-06 11:50:43 +01:00
parent 899a7ed609
commit de3f5f0bce
No known key found for this signature in database
GPG key ID: C0095B7870A4CCD3

View file

@ -15,33 +15,58 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
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()