EBIKE-FreeRTOS/CMakeLists.txt

70 lines
1.8 KiB
CMake
Raw Normal View History

2024-04-14 18:38:39 +08:00
cmake_minimum_required(VERSION 3.12)
# Pull in SDK (must be before project)
set( PICO_SDK_PATH "../pico-sdk" )
include(pico_sdk_import.cmake)
# Pull in FreeRTOS
set( FREERTOS_KERNEL_PATH "../FreeRTOS-Kernel" )
include(FreeRTOS_Kernel_import.cmake)
project(main CXX C ASM)
set(CMAKE_C_STANDARD 11)
set(CMAKE_CXX_STANDARD 17)
pico_sdk_init()
add_executable(
main
)
pico_generate_pio_header(main ${CMAKE_CURRENT_LIST_DIR}/Source/uart_tx.pio)
pico_generate_pio_header(main ${CMAKE_CURRENT_LIST_DIR}/Source/uart_rx.pio)
target_Sources(main PRIVATE
${CMAKE_CURRENT_LIST_DIR}/Source/main.c
${CMAKE_CURRENT_LIST_DIR}/Source/common.c
${CMAKE_CURRENT_LIST_DIR}/Source/PN532.c
${CMAKE_CURRENT_LIST_DIR}/Source/IM1253B.c
${CMAKE_CURRENT_LIST_DIR}/Source/EC800M_GPS.c
${CMAKE_CURRENT_LIST_DIR}/Source/EC800M_4G.c
${CMAKE_CURRENT_LIST_DIR}/Source/HC-04.c
)
target_include_directories(main PRIVATE
${CMAKE_CURRENT_LIST_DIR}
${CMAKE_CURRENT_LIST_DIR}/Source
${CMAKE_CURRENT_LIST_DIR}/Common/include
)
target_compile_options(main PUBLIC
### Gnu/Clang C Options
$<$<COMPILE_LANG_AND_ID:C,GNU>:-fdiagnostics-color=always>
$<$<COMPILE_LANG_AND_ID:C,Clang>:-fcolor-diagnostics>
$<$<COMPILE_LANG_AND_ID:C,Clang,GNU>:-Wall>
$<$<COMPILE_LANG_AND_ID:C,Clang,GNU>:-Wextra>
#$<$<COMPILE_LANG_AND_ID:C,Clang,GNU>:-Werror>
$<$<COMPILE_LANG_AND_ID:C,Clang>:-Weverything>
)
target_link_libraries(
main
FreeRTOS-Kernel
FreeRTOS-Kernel-Heap4
pico_stdlib
pico_runtime
pico_multicore
hardware_rtc
hardware_i2c
hardware_uart
hardware_pwm
hardware_adc
hardware_pio
)
pico_enable_stdio_uart(main 1)
pico_enable_stdio_usb(main 1)
pico_add_extra_outputs(main)