mirror of
https://github.com/polhenarejos/pico-hsm.git
synced 2026-04-17 21:58:27 +00:00
Fix link with mbedtls in openssl backend.
Signed-off-by: Pol Henarejos <pol.henarejos@cttc.es>
This commit is contained in:
parent
2d25ed9939
commit
aae66e7db3
1 changed files with 30 additions and 26 deletions
|
|
@ -20,35 +20,35 @@ cmake_minimum_required(VERSION 3.13)
|
||||||
set(USB_VID 0x2E8A)
|
set(USB_VID 0x2E8A)
|
||||||
set(USB_PID 0x10FD)
|
set(USB_PID 0x10FD)
|
||||||
|
|
||||||
if(ESP_PLATFORM)
|
if (ESP_PLATFORM)
|
||||||
set(EXTRA_COMPONENT_DIRS pico-keys-sdk/config/esp32/components src/hsm)
|
set(EXTRA_COMPONENT_DIRS pico-keys-sdk/config/esp32/components src/hsm)
|
||||||
include($ENV{IDF_PATH}/tools/cmake/project.cmake)
|
include($ENV{IDF_PATH}/tools/cmake/project.cmake)
|
||||||
else()
|
else()
|
||||||
if(NOT ENABLE_EMULATION)
|
if (NOT ENABLE_EMULATION)
|
||||||
set(PICO_USE_FASTEST_SUPPORTED_CLOCK 1)
|
set(PICO_USE_FASTEST_SUPPORTED_CLOCK 1)
|
||||||
include(pico_sdk_import.cmake)
|
include(pico_sdk_import.cmake)
|
||||||
endif()
|
endif ()
|
||||||
|
|
||||||
project(pico_hsm C CXX ASM)
|
project(pico_hsm C CXX ASM)
|
||||||
|
|
||||||
set(CMAKE_C_STANDARD 11)
|
set(CMAKE_C_STANDARD 11)
|
||||||
set(CMAKE_CXX_STANDARD 17)
|
set(CMAKE_CXX_STANDARD 17)
|
||||||
|
|
||||||
if(NOT DEFINED __FOR_CI)
|
if (NOT DEFINED __FOR_CI)
|
||||||
set(__FOR_CI 0)
|
set(__FOR_CI 0)
|
||||||
endif()
|
endif ()
|
||||||
if(__FOR_CI)
|
if (__FOR_CI)
|
||||||
add_definitions(-D__FOR_CI)
|
add_compile_definitions(__FOR_CI)
|
||||||
endif()
|
endif ()
|
||||||
|
|
||||||
add_executable(pico_hsm)
|
add_executable(pico_hsm)
|
||||||
endif()
|
endif ()
|
||||||
set(USB_ITF_CCID 1)
|
set(USB_ITF_CCID 1)
|
||||||
set(USB_ITF_WCID 1)
|
set(USB_ITF_WCID 1)
|
||||||
include(pico-keys-sdk/pico_keys_sdk_import.cmake)
|
include(pico-keys-sdk/pico_keys_sdk_import.cmake)
|
||||||
if(NOT ESP_PLATFORM)
|
if (NOT ESP_PLATFORM)
|
||||||
set(SOURCES ${PICO_KEYS_SOURCES})
|
set(SOURCES ${PICO_KEYS_SOURCES})
|
||||||
endif()
|
endif ()
|
||||||
set(SOURCES ${SOURCES}
|
set(SOURCES ${SOURCES}
|
||||||
${CMAKE_CURRENT_LIST_DIR}/src/hsm/sc_hsm.c
|
${CMAKE_CURRENT_LIST_DIR}/src/hsm/sc_hsm.c
|
||||||
${CMAKE_CURRENT_LIST_DIR}/src/hsm/cmd_select.c
|
${CMAKE_CURRENT_LIST_DIR}/src/hsm/cmd_select.c
|
||||||
|
|
@ -83,40 +83,40 @@ set(SOURCES ${SOURCES}
|
||||||
${CMAKE_CURRENT_LIST_DIR}/src/hsm/kek.c
|
${CMAKE_CURRENT_LIST_DIR}/src/hsm/kek.c
|
||||||
)
|
)
|
||||||
|
|
||||||
SET_VERSION(ver_major ver_minor "${CMAKE_CURRENT_LIST_DIR}/src/hsm/version.h" 3)
|
SET_VERSION(ver_major ver_minor "${CMAKE_CURRENT_LIST_DIR}/src/hsm/version.h")
|
||||||
|
|
||||||
if(ESP_PLATFORM)
|
if (ESP_PLATFORM)
|
||||||
project(pico_hsm)
|
project(pico_hsm)
|
||||||
endif()
|
endif ()
|
||||||
|
|
||||||
set(INCLUDES ${INCLUDES}
|
set(INCLUDES ${INCLUDES}
|
||||||
${CMAKE_CURRENT_LIST_DIR}/src/hsm
|
${CMAKE_CURRENT_LIST_DIR}/src/hsm
|
||||||
)
|
)
|
||||||
if(NOT ESP_PLATFORM)
|
if (NOT ESP_PLATFORM)
|
||||||
target_sources(pico_hsm PUBLIC ${SOURCES})
|
target_sources(pico_hsm PUBLIC ${SOURCES})
|
||||||
target_include_directories(pico_hsm PUBLIC ${INCLUDES})
|
target_include_directories(pico_hsm PUBLIC ${INCLUDES})
|
||||||
|
|
||||||
target_compile_options(pico_hsm PUBLIC
|
target_compile_options(pico_hsm PUBLIC
|
||||||
-Wall
|
-Wall
|
||||||
)
|
)
|
||||||
if(NOT MSVC)
|
if (NOT MSVC)
|
||||||
target_compile_options(pico_hsm PUBLIC
|
target_compile_options(pico_hsm PUBLIC
|
||||||
-Werror
|
-Werror
|
||||||
)
|
)
|
||||||
endif()
|
endif ()
|
||||||
|
|
||||||
if(ENABLE_EMULATION)
|
if (ENABLE_EMULATION)
|
||||||
if(NOT MSVC)
|
if (NOT MSVC)
|
||||||
target_compile_options(pico_hsm PUBLIC
|
target_compile_options(pico_hsm PUBLIC
|
||||||
-fdata-sections
|
-fdata-sections
|
||||||
-ffunction-sections
|
-ffunction-sections
|
||||||
)
|
)
|
||||||
endif()
|
endif ()
|
||||||
if(APPLE)
|
if (APPLE)
|
||||||
target_link_options(pico_hsm PUBLIC
|
target_link_options(pico_hsm PUBLIC
|
||||||
-Wl,-dead_strip
|
-Wl,-dead_strip
|
||||||
)
|
)
|
||||||
elseif(MSVC)
|
elseif (MSVC)
|
||||||
target_compile_options(pico_hsm PUBLIC
|
target_compile_options(pico_hsm PUBLIC
|
||||||
-WX
|
-WX
|
||||||
)
|
)
|
||||||
|
|
@ -126,9 +126,13 @@ if(NOT ESP_PLATFORM)
|
||||||
target_link_options(pico_hsm PUBLIC
|
target_link_options(pico_hsm PUBLIC
|
||||||
-Wl,--gc-sections
|
-Wl,--gc-sections
|
||||||
)
|
)
|
||||||
endif(APPLE)
|
endif (APPLE)
|
||||||
target_link_libraries(pico_hsm PRIVATE pico_keys_sdk pthread m mbedtls)
|
set(PICO_HSM_EMU_LIBS pico_keys_sdk pthread m)
|
||||||
|
if (NOT SKIP_MBEDTLS_FOR_OPENSSL_EMULATION)
|
||||||
|
list(APPEND PICO_HSM_EMU_LIBS mbedtls)
|
||||||
|
endif ()
|
||||||
|
target_link_libraries(pico_hsm PRIVATE ${PICO_HSM_EMU_LIBS})
|
||||||
else()
|
else()
|
||||||
pico_add_extra_outputs(${CMAKE_PROJECT_NAME})
|
pico_add_extra_outputs(${CMAKE_PROJECT_NAME})
|
||||||
endif()
|
endif ()
|
||||||
endif()
|
endif ()
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue