139
CMakeLists.txt
139
CMakeLists.txt
@@ -1,43 +1,43 @@
|
|||||||
#
|
#
|
||||||
# This file is part of the Pico OpenPGP distribution (https://github.com/polhenarejos/pico-openpgp).
|
# This file is part of the Pico OpenPGP distribution (https://github.com/polhenarejos/pico-openpgp).
|
||||||
# Copyright (c) 2022 Pol Henarejos.
|
# Copyright (c) 2022 Pol Henarejos.
|
||||||
#
|
#
|
||||||
# This program is free software: you can redistribute it and/or modify
|
# This program is free software: you can redistribute it and/or modify
|
||||||
# it under the terms of the GNU General Public License as published by
|
# it under the terms of the GNU General Public License as published by
|
||||||
# the Free Software Foundation, version 3.
|
# the Free Software Foundation, version 3.
|
||||||
#
|
#
|
||||||
# This program is distributed in the hope that it will be useful, but
|
# This program is distributed in the hope that it will be useful, but
|
||||||
# WITHOUT ANY WARRANTY; without even the implied warranty of
|
# WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
# General Public License for more details.
|
# General Public License for more details.
|
||||||
#
|
#
|
||||||
# You should have received a copy of the GNU General Public License
|
# You should have received a copy of the GNU General Public License
|
||||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
#
|
#
|
||||||
|
|
||||||
cmake_minimum_required(VERSION 3.13)
|
cmake_minimum_required(VERSION 3.13)
|
||||||
|
|
||||||
if(ESP_PLATFORM)
|
if(ESP_PLATFORM)
|
||||||
set(EXTRA_COMPONENT_DIRS src pico-keys-sdk/src)
|
set(EXTRA_COMPONENT_DIRS src pico-keys-sdk/src)
|
||||||
include($ENV{IDF_PATH}/tools/cmake/project.cmake)
|
include($ENV{IDF_PATH}/tools/cmake/project.cmake)
|
||||||
else()
|
else()
|
||||||
|
|
||||||
if(ENABLE_EMULATION)
|
if(ENABLE_EMULATION)
|
||||||
else()
|
else()
|
||||||
include(pico_sdk_import.cmake)
|
include(pico_sdk_import.cmake)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
project(pico_openpgp C CXX ASM)
|
project(pico_openpgp C CXX ASM)
|
||||||
|
|
||||||
set(CMAKE_C_STANDARD 11)
|
set(CMAKE_C_STANDARD 11)
|
||||||
set(CMAKE_CXX_STANDARD 17)
|
set(CMAKE_CXX_STANDARD 17)
|
||||||
|
|
||||||
if(ENABLE_EMULATION)
|
if(ENABLE_EMULATION)
|
||||||
else()
|
else()
|
||||||
pico_sdk_init()
|
pico_sdk_init()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
add_executable(pico_openpgp)
|
add_executable(pico_openpgp)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
set(SOURCES ${SOURCES}
|
set(SOURCES ${SOURCES}
|
||||||
@@ -45,49 +45,54 @@ set(SOURCES ${SOURCES}
|
|||||||
${CMAKE_CURRENT_LIST_DIR}/src/openpgp/files.c
|
${CMAKE_CURRENT_LIST_DIR}/src/openpgp/files.c
|
||||||
${CMAKE_CURRENT_LIST_DIR}/src/openpgp/piv.c
|
${CMAKE_CURRENT_LIST_DIR}/src/openpgp/piv.c
|
||||||
${CMAKE_CURRENT_LIST_DIR}/src/openpgp/management.c
|
${CMAKE_CURRENT_LIST_DIR}/src/openpgp/management.c
|
||||||
)
|
)
|
||||||
|
|
||||||
|
set(USB_ITF_CCID 1)
|
||||||
|
set(USB_ITF_WCID 1)
|
||||||
|
include(pico-keys-sdk/pico_keys_sdk_import.cmake)
|
||||||
|
if(ESP_PLATFORM)
|
||||||
|
project(pico_openpgp)
|
||||||
|
endif()
|
||||||
|
|
||||||
set(INCLUDES ${INCLUDES}
|
set(INCLUDES ${INCLUDES}
|
||||||
${CMAKE_CURRENT_LIST_DIR}/src/openpgp
|
${CMAKE_CURRENT_LIST_DIR}/src/openpgp
|
||||||
)
|
|
||||||
|
|
||||||
set(USB_ITF_CCID 1)
|
|
||||||
include(pico-keys-sdk/pico_keys_sdk_import.cmake)
|
|
||||||
if(ESP_PLATFORM)
|
|
||||||
project(pico_fido)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
if(NOT ESP_PLATFORM)
|
|
||||||
target_sources(pico_openpgp PUBLIC ${SOURCES})
|
|
||||||
target_include_directories(pico_openpgp PUBLIC ${INCLUDES})
|
|
||||||
|
|
||||||
target_compile_options(pico_openpgp PUBLIC
|
|
||||||
-Wall
|
|
||||||
-Werror
|
|
||||||
)
|
)
|
||||||
|
if(NOT ESP_PLATFORM)
|
||||||
|
target_sources(pico_openpgp PUBLIC ${SOURCES})
|
||||||
|
target_include_directories(pico_openpgp PUBLIC ${INCLUDES})
|
||||||
|
|
||||||
if(ENABLE_EMULATION)
|
target_compile_options(pico_openpgp PUBLIC
|
||||||
|
-Wall
|
||||||
target_compile_options(pico_openpgp PUBLIC
|
|
||||||
-fdata-sections
|
|
||||||
-ffunction-sections
|
|
||||||
)
|
)
|
||||||
if(APPLE)
|
if(NOT MSVC)
|
||||||
target_link_options(pico_openpgp PUBLIC
|
target_compile_options(pico_openpgp PUBLIC
|
||||||
-Wl,-dead_strip
|
-Werror
|
||||||
)
|
)
|
||||||
else()
|
endif()
|
||||||
target_link_options(pico_openpgp PUBLIC
|
|
||||||
-Wl,--gc-sections
|
|
||||||
)
|
|
||||||
endif (APPLE)
|
|
||||||
target_link_libraries(pico_openpgp PRIVATE pthread m)
|
|
||||||
else()
|
|
||||||
|
|
||||||
pico_add_extra_outputs(pico_openpgp)
|
if(ENABLE_EMULATION)
|
||||||
|
if(NOT MSVC)
|
||||||
|
target_compile_options(pico_openpgp PUBLIC
|
||||||
|
-fdata-sections
|
||||||
|
-ffunction-sections
|
||||||
|
)
|
||||||
|
endif()
|
||||||
|
if(APPLE)
|
||||||
|
target_link_options(pico_openpgp PUBLIC
|
||||||
|
-Wl,-dead_strip
|
||||||
|
)
|
||||||
|
elseif(MSVC)
|
||||||
|
target_compile_options(pico_openpgp PUBLIC
|
||||||
|
-WX
|
||||||
|
)
|
||||||
|
|
||||||
#target_compile_definitions(pico_openpgp PRIVATE MBEDTLS_ECDSA_DETERMINISTIC=1)
|
target_link_libraries(pico_openpgp PUBLIC wsock32 ws2_32 Bcrypt)
|
||||||
|
else()
|
||||||
target_link_libraries(pico_openpgp PRIVATE pico_keys_sdk pico_stdlib tinyusb_device tinyusb_board pico_multicore hardware_flash hardware_sync hardware_adc pico_unique_id pico_aon_timer)
|
target_link_options(pico_openpgp PUBLIC
|
||||||
endif()
|
-Wl,--gc-sections
|
||||||
|
)
|
||||||
|
endif(APPLE)
|
||||||
|
target_link_libraries(pico_openpgp PRIVATE pthread m)
|
||||||
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user