This repository has been archived on 2024-05-28. You can view files and clone it, but cannot push or open issues or pull requests.
2023-11-14 16:25:09 -05:00

34 lines
926 B
CMake
Executable File

cmake_minimum_required(VERSION 3.23)
#project(sdcard_example C ASM)
set(EXAMPLE_NAME "cam_sdcard")
set(CMAKE_EXPORT_COMPILE_COMMANDS on) # for clangd
### set includes and library
set(Stm32U5Lib_DIR ../../../)
find_package(Stm32U5Lib REQUIRED)
add_definitions(-DSTM32U575xx)
include_directories(./ ../)
add_compile_options(
-g
# -O0
# -Ofast
)
file(GLOB_RECURSE SOURCES
./*.c
./*.cpp
../custom_prephrals.cpp
)
add_executable(${EXAMPLE_NAME}.elf ${SOURCES} ${LINKER_SCRIPT} ${LIB_SOURCES})
set(HEX_FILE ${EXAMPLE_NAME}.hex)
set(BIN_FILE ${EXAMPLE_NAME}.bin)
add_custom_command(TARGET ${EXAMPLE_NAME}.elf POST_BUILD
COMMAND ${CMAKE_OBJCOPY} -Oihex $<TARGET_FILE:${EXAMPLE_NAME}.elf> ${HEX_FILE}
COMMAND ${CMAKE_OBJCOPY} -Obinary $<TARGET_FILE:${EXAMPLE_NAME}.elf> ${BIN_FILE}
COMMENT "Building ${HEX_FILE}
Building ${BIN_FILE}")