138 lines
4.4 KiB
CMake
138 lines
4.4 KiB
CMake
cmake_minimum_required(VERSION 3.22)
|
|
|
|
#
|
|
# This file is generated only once,
|
|
# and is not re-generated if converter is called multiple times.
|
|
#
|
|
# User is free to modify the file as much as necessary
|
|
#
|
|
|
|
# Setup compiler settings
|
|
set(CMAKE_C_STANDARD 11)
|
|
set(CMAKE_C_STANDARD_REQUIRED ON)
|
|
set(CMAKE_C_EXTENSIONS ON)
|
|
|
|
|
|
# Define the build type
|
|
if(NOT CMAKE_BUILD_TYPE)
|
|
set(CMAKE_BUILD_TYPE "Debug")
|
|
endif()
|
|
|
|
# Set the project name
|
|
set(CMAKE_PROJECT_NAME CloudPlant)
|
|
|
|
|
|
# Enable compile command to ease indexing with e.g. clangd
|
|
set(CMAKE_EXPORT_COMPILE_COMMANDS TRUE)
|
|
|
|
# Core project settings
|
|
project(${CMAKE_PROJECT_NAME})
|
|
message("Build type: " ${CMAKE_BUILD_TYPE})
|
|
|
|
# Enable CMake support for ASM and C languages
|
|
enable_language(C ASM)
|
|
|
|
# Create an executable object type
|
|
add_executable(${CMAKE_PROJECT_NAME})
|
|
|
|
# Add STM32CubeMX generated sources
|
|
add_subdirectory(cmake/stm32cubemx)
|
|
|
|
# Link directories setup
|
|
target_link_directories(${CMAKE_PROJECT_NAME} PRIVATE
|
|
# Add user defined library search paths
|
|
)
|
|
|
|
# Add sources to executable
|
|
target_sources(${CMAKE_PROJECT_NAME} PRIVATE
|
|
# Add user sources here
|
|
3rdparty/jy901p/wit_c_sdk.c
|
|
modules/filter/lowpass/lowpass.c
|
|
modules/filter/moving_average/moving_average.c
|
|
modules/filter/notch/notch.c
|
|
modules/filter/rate_limiter/rate_limiter.c
|
|
modules/filter/dead_zone/dead_zone.c
|
|
modules/device/motor/mf4010v2.c
|
|
modules/device/led/led.c
|
|
modules/device/can/can_device.c
|
|
modules/control/pid/pid.c
|
|
modules/bus/soft_i2c/soft_i2c.c
|
|
modules/bus/i2c/i2c_bus.c
|
|
modules/cmd_parser/cmd_parser.c
|
|
bsp/stm32f4/can/bsp_can.c
|
|
bsp/stm32f4/led/bsp_led.c
|
|
bsp/stm32f4/i2c/bsp_i2c.c
|
|
bsp/stm32f4/gpio/bsp_gpio.c
|
|
bsp/stm32f4/soft_i2c/bsp_soft_i2c.c
|
|
bsp/stm32f4/uart/bsp_uart.c
|
|
hal/stm32f4/can/hal_can.c
|
|
hal/stm32f4/led/hal_led.c
|
|
hal/stm32f4/i2c/hal_i2c.c
|
|
hal/stm32f4/gpio/hal_gpio.c
|
|
hal/stm32f4/soft_i2c/hal_soft_i2c.c
|
|
hal/stm32f4/uart/hal_uart.c
|
|
app/app_init.c
|
|
app/control_task.c
|
|
app/sensor_task.c
|
|
app/callback_task.c
|
|
interfaces/led/led_if.c
|
|
interfaces/can/can_if.c
|
|
interfaces/i2c/i2c_if.c
|
|
interfaces/gpio/gpio_if.c
|
|
interfaces/soft_i2c/soft_i2c_if.c
|
|
interfaces/uart/uart_if.c
|
|
modules/bus/uart/uart.c
|
|
|
|
)
|
|
|
|
# Add include paths
|
|
target_include_directories(${CMAKE_PROJECT_NAME} PRIVATE
|
|
# Add user defined include paths
|
|
${CMAKE_CURRENT_SOURCE_DIR}/3rdparty/jy901p
|
|
${CMAKE_CURRENT_SOURCE_DIR}/modules/device/led
|
|
${CMAKE_CURRENT_SOURCE_DIR}/modules/device/motor
|
|
${CMAKE_CURRENT_SOURCE_DIR}/modules/device/can
|
|
${CMAKE_CURRENT_SOURCE_DIR}/modules/sensor/imu
|
|
${CMAKE_CURRENT_SOURCE_DIR}/modules/filter/lowpass
|
|
${CMAKE_CURRENT_SOURCE_DIR}/modules/filter/moving_average
|
|
${CMAKE_CURRENT_SOURCE_DIR}/modules/filter/notch
|
|
${CMAKE_CURRENT_SOURCE_DIR}/modules/filter/rate_limiter
|
|
${CMAKE_CURRENT_SOURCE_DIR}/modules/filter/dead_zone
|
|
${CMAKE_CURRENT_SOURCE_DIR}/modules/control/pid
|
|
${CMAKE_CURRENT_SOURCE_DIR}/modules/bus/soft_i2c
|
|
${CMAKE_CURRENT_SOURCE_DIR}/modules/bus/i2c
|
|
${CMAKE_CURRENT_SOURCE_DIR}/modules/cmd_parser
|
|
${CMAKE_CURRENT_SOURCE_DIR}/bsp/stm32f4/can
|
|
${CMAKE_CURRENT_SOURCE_DIR}/bsp/stm32f4/led
|
|
${CMAKE_CURRENT_SOURCE_DIR}/bsp/stm32f4/i2c
|
|
${CMAKE_CURRENT_SOURCE_DIR}/bsp/stm32f4/gpio
|
|
${CMAKE_CURRENT_SOURCE_DIR}/bsp/stm32f4/soft_i2c
|
|
${CMAKE_CURRENT_SOURCE_DIR}/bsp/stm32f4/uart
|
|
${CMAKE_CURRENT_SOURCE_DIR}/app
|
|
${CMAKE_CURRENT_SOURCE_DIR}/hal/stm32f4/led
|
|
${CMAKE_CURRENT_SOURCE_DIR}/hal/stm32f4/can
|
|
${CMAKE_CURRENT_SOURCE_DIR}/hal/stm32f4/i2c
|
|
${CMAKE_CURRENT_SOURCE_DIR}/hal/stm32f4/gpio
|
|
${CMAKE_CURRENT_SOURCE_DIR}/hal/stm32f4/soft_i2c
|
|
${CMAKE_CURRENT_SOURCE_DIR}/hal/stm32f4/uart
|
|
${CMAKE_CURRENT_SOURCE_DIR}/interfaces/led
|
|
${CMAKE_CURRENT_SOURCE_DIR}/interfaces/can
|
|
${CMAKE_CURRENT_SOURCE_DIR}/interfaces/i2c
|
|
${CMAKE_CURRENT_SOURCE_DIR}/interfaces/gpio
|
|
${CMAKE_CURRENT_SOURCE_DIR}/interfaces/soft_i2c
|
|
${CMAKE_CURRENT_SOURCE_DIR}/interfaces/uart
|
|
${CMAKE_CURRENT_SOURCE_DIR}/modules/bus/uart
|
|
)
|
|
|
|
# Add project symbols (macros)
|
|
target_compile_definitions(${CMAKE_PROJECT_NAME} PRIVATE
|
|
# Add user defined symbols
|
|
)
|
|
|
|
# Add linked libraries
|
|
target_link_libraries(${CMAKE_PROJECT_NAME}
|
|
stm32cubemx
|
|
|
|
# Add user defined libraries
|
|
)
|