stm32_serDes_protobuf_project/app/CMakeLists.txt

38 lines
947 B
CMake
Raw Normal View History

2024-04-30 13:10:11 +03:00
set(elf_file stm32.elf)
2024-06-10 13:56:17 +03:00
set(CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/nanopb/extra)
find_package(Nanopb REQUIRED)
2024-06-06 14:12:37 +03:00
2024-06-11 19:59:25 +03:00
nanopb_generate_cpp(TARGET proto
simple.proto
quaternion.proto
)
2024-05-13 20:44:16 +03:00
2024-06-10 18:46:02 +03:00
add_executable(${elf_file}
app.c
2024-04-30 13:10:11 +03:00
main.c
syscalls.c
)
target_link_libraries(${elf_file} PUBLIC
bsp
2024-06-10 13:56:17 +03:00
proto
2024-04-30 13:10:11 +03:00
)
target_include_directories(${elf_file} PRIVATE
${CMAKE_CURRENT_SOURCE_DIR}
)
set(EXECUTABLE ${PROJECT_NAME}.elf)
add_custom_command(TARGET ${EXECUTABLE}
POST_BUILD
COMMAND ${CMAKE_SIZE_UTIL} ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/${EXECUTABLE}
)
add_custom_command(TARGET ${EXECUTABLE}
POST_BUILD
COMMAND ${CMAKE_OBJCOPY} -O ihex ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/${EXECUTABLE} ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/${PROJECT_NAME}.hex
COMMAND ${CMAKE_OBJCOPY} -O binary ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/${EXECUTABLE} ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/${PROJECT_NAME}.bin
)