Files
Card_Reader_Software/CMakeLists.txt
Martijn Scheepers 18b13291cd Add debug command
2025-04-30 11:46:37 +02:00

115 lines
3.2 KiB
CMake

# Generated Cmake Pico project file
cmake_minimum_required(VERSION 3.13)
# Set CMake build type. Debug, Release, MinSizeRel, RelWithDebInfo
#set(CMAKE_BUILD_TYPE Release)
set(CMAKE_C_STANDARD 11)
set(CMAKE_CXX_STANDARD 23)
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
# Initialise pico_sdk from installed location
# (note this can come from environment, CMake cache etc)
# == DO NOT EDIT THE FOLLOWING LINES for the Raspberry Pi Pico VS Code Extension to work ==
if(WIN32)
set(USERHOME $ENV{USERPROFILE})
else()
set(USERHOME $ENV{HOME})
endif()
set(sdkVersion 2.1.1)
set(toolchainVersion 14_2_Rel1)
set(picotoolVersion 2.1.1)
set(picoVscode ${USERHOME}/.pico-sdk/cmake/pico-vscode.cmake)
if (EXISTS ${picoVscode})
include(${picoVscode})
endif()
# ====================================================================================
set(PICO_BOARD pico CACHE STRING "Board type")
# Pull in Raspberry Pi Pico SDK (must be before project)
include(pico_sdk_import.cmake)
# Pull in FreeRTOS
#set(FREERTOS_PORT GCC_RP2040 CACHE STRING "")
set(FREERTOS_KERNEL_PATH ${CMAKE_SOURCE_DIR}/FreeRTOS-Kernel)
include(FreeRTOS_Kernel_import.cmake)
project(ACS_Card_Reader C CXX ASM)
add_compile_options(
-Wall # Enable most warning messages
-Wextra
#-Wpedantic
#-fanalyzer
-Wdouble-promotion
#-Wnon-virtual-dtor
-Wcast-align
-Wunused
#-Wno-format # int != int32_t as far as the compiler is concerned because gcc has int32_t as long int
#-Wno-unused-function # we have some for the docs that aren't called
)
# Initialise the Raspberry Pi Pico SDK
pico_sdk_init()
# Add executable. Default name is the project name, version 0.1
add_executable(ACS_Card_Reader
src/ACS_Card_Reader.cpp
src/UserFeedback.cpp
src/BusReader.cpp
src/CardReader.cpp
src/Global.cpp
src/RS485.cpp
src/PWMTone.cpp
src/Debug.cpp
src/rc522/MFRC522.cpp
src/rc522/Desfire.cpp
src/rc522/Mifare.cpp
src/rc522/ISO.cpp
src/rc522/Helpers.cpp
)
pico_set_program_name(ACS_Card_Reader "ACS_Card_Reader")
pico_set_program_version(ACS_Card_Reader "0.1")
# Modify the below lines to enable/disable output over UART/USB
pico_enable_stdio_uart(ACS_Card_Reader 1)
pico_enable_stdio_usb(ACS_Card_Reader 0)
include(FetchContent)
FetchContent_Declare(cmake_git_version_tracking
GIT_REPOSITORY https://github.com/andrew-hardin/cmake-git-version-tracking.git
# GIT_TAG 904dbda1336ba4b9a1415a68d5f203f576b696bb
)
FetchContent_MakeAvailable(cmake_git_version_tracking)
# Add the standard library to the build
target_link_libraries(ACS_Card_Reader
cmake_git_version_tracking
pico_stdlib
pico_unique_id
#pico_multicore
#pico_async_context_freertos
FreeRTOS-Kernel
FreeRTOS-Kernel-Heap1
#FreeRTOS-Kernel-Heap4
hardware_spi
hardware_pwm
)
# Add the standard include files to the build
target_include_directories(ACS_Card_Reader PRIVATE
${CMAKE_CURRENT_LIST_DIR}
${CMAKE_CURRENT_LIST_DIR}/include
${CMAKE_CURRENT_LIST_DIR}/include/readerProtocol
${CMAKE_CURRENT_LIST_DIR}/include/rc522
)
pico_add_extra_outputs(ACS_Card_Reader)
add_test(NAME test/test_hello_world.cpp COMMAND ExecutableToRun arg1 arg2 ...)