84 lines
2.2 KiB
CMake
84 lines
2.2 KiB
CMake
cmake_minimum_required(VERSION 3.12)
|
|
|
|
# Check if the environment variable PICO_SDK_PATH is set
|
|
if(DEFINED ENV{PICO_SDK_PATH})
|
|
set(PICO_SDK_PATH $ENV{PICO_SDK_PATH})
|
|
else()
|
|
message(FATAL_ERROR "Environment variable PICO_SDK_PATH is not set. Please set it to the path of the pico-sdk.")
|
|
endif()
|
|
|
|
# Include the 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_subdirectory(
|
|
../SOFTWARE/Lib/pico-onewire
|
|
${CMAKE_BINARY_DIR}/pico-onewire
|
|
)
|
|
|
|
|
|
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/common.cpp
|
|
${CMAKE_CURRENT_LIST_DIR}/Source/main.cpp
|
|
${CMAKE_CURRENT_LIST_DIR}/Source/DS18B20.cpp
|
|
${CMAKE_CURRENT_LIST_DIR}/Source/ZC13.cpp
|
|
${CMAKE_CURRENT_LIST_DIR}/Source/ZE07CO.cpp
|
|
${CMAKE_CURRENT_LIST_DIR}/Source/MHZ14B.cpp
|
|
${CMAKE_CURRENT_LIST_DIR}/Source/HC-12.cpp
|
|
)
|
|
|
|
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
|
|
pico_one_wire
|
|
FreeRTOS-Kernel
|
|
FreeRTOS-Kernel-Heap4
|
|
pico_stdlib
|
|
pico_util
|
|
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)
|