Quadcopter/CMakeLists.txt
2025-10-28 22:24:27 +08:00

114 lines
2.5 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 DveC)
# 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
# User/BarometerDriver sources
User/BarometerDriver/spl06.c
User/BarometerDriver/user_iic.c
# User/bsp sources
User/bsp/gpio.c
User/bsp/i2c.c
User/bsp/mm.c
User/bsp/pwm.c
User/bsp/spi.c
User/bsp/time.c
User/bsp/uart.c
# User/component sources
User/component/AltitudeKalman.c
User/component/ahrs.c
User/component/filter.c
User/component/freertos_cli.c
User/component/limiter.c
User/component/pid.c
User/component/user_math.c
# User/device sources
User/device/at9s_pro.c
User/device/bmi088.c
User/device/buzzer.c
User/device/ist8310.c
User/device/led.c
User/device/vofa.c
# User/module sources
User/module/HeightEstimation.c
User/module/at9s_pro_cmd.c
User/module/config.c
User/module/xm_quadctrl.c
# User/task sources
User/task/atti_esti.c
User/task/blink.c
User/task/cmd.c
User/task/height_cal.c
User/task/init.c
User/task/quad_ctrl.c
User/task/user_task.c
)
# Add include paths
target_include_directories(${CMAKE_PROJECT_NAME} PRIVATE
# Add user defined include paths
User
)
# Add project symbols (macros)
target_compile_definitions(${CMAKE_PROJECT_NAME} PRIVATE
# Add user defined symbols
)
# Remove wrong libob.a library dependency when using cpp files
list(REMOVE_ITEM CMAKE_C_IMPLICIT_LINK_LIBRARIES ob)
# Add linked libraries
target_link_libraries(${CMAKE_PROJECT_NAME}
stm32cubemx
# Add user defined libraries
)