mirror of
https://github.com/espressif/esp-idf.git
synced 2024-10-05 20:47:46 -04:00
cmake: Bootloader subproject & "clean" cleanup
This commit is contained in:
parent
067a19ad88
commit
7f29593a7d
@ -12,11 +12,12 @@ if(NOT ( ${CMAKE_SYSTEM_NAME} STREQUAL "Generic" AND ${CMAKE_C_COMPILER} MATCHES
|
|||||||
"re-running cmake.")
|
"re-running cmake.")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
set(IDF_PATH $ENV{IDF_PATH})
|
set(IDF_PATH "$ENV{IDF_PATH}")
|
||||||
if(NOT IDF_PATH)
|
if(NOT IDF_PATH)
|
||||||
# Documentation says you should set IDF_PATH in your environment, but we
|
# Documentation says you should set IDF_PATH in your environment, but we
|
||||||
# can infer it here if it's not set.
|
# can infer it here if it's not set.
|
||||||
set(IDF_PATH ${CMAKE_CURRENT_LIST_DIR})
|
set(IDF_PATH ${CMAKE_CURRENT_LIST_DIR})
|
||||||
|
set($ENV{IDF_PATH} "${IDF_PATH}")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
# PROJECT_PATH has the path to the IDF project (top-level cmake directory)
|
# PROJECT_PATH has the path to the IDF project (top-level cmake directory)
|
||||||
|
@ -2,12 +2,26 @@
|
|||||||
# cmake project under this one
|
# cmake project under this one
|
||||||
#
|
#
|
||||||
#
|
#
|
||||||
ExternalProject_Add(bootloader_subproject
|
set(bootloader_subproject_build_dir "${CMAKE_BINARY_DIR}/bootloader_subproject")
|
||||||
# TODO: support overriding the bootloader in COMPONENT_PATHS
|
set(bootloader_binary_files
|
||||||
SOURCE_DIR ${IDF_PATH}/components/bootloader/subproject
|
"${bootloader_subproject_build_dir}/bootloader.elf"
|
||||||
BINARY_DIR ${CMAKE_BINARY_DIR}/bootloader_subproject
|
"${bootloader_subproject_build_dir}/bootloader.bin"
|
||||||
CMAKE_ARGS -DSDKCONFIG=${SDKCONFIG} -DIDF_PATH=${IDF_PATH}
|
"${bootloader_subproject_build_dir}/bootloader.map"
|
||||||
INSTALL_COMMAND ""
|
|
||||||
)
|
)
|
||||||
|
|
||||||
|
ExternalProject_Add(bootloader_subproject
|
||||||
|
# TODO: support overriding the bootloader in COMPONENT_PATHS
|
||||||
|
SOURCE_DIR "${IDF_PATH}/components/bootloader/subproject"
|
||||||
|
BINARY_DIR "${bootloader_subproject_build_dir}"
|
||||||
|
CMAKE_ARGS -DSDKCONFIG=${SDKCONFIG} -DIDF_PATH="${IDF_PATH}"
|
||||||
|
INSTALL_COMMAND ""
|
||||||
|
BUILD_ALWAYS 1 # no easy way around this...
|
||||||
|
BUILD_BYPRODUCTS ${bootloader_binary_files}
|
||||||
|
)
|
||||||
|
|
||||||
|
# this is a hack due to an (annoying) shortcoming in cmake, it can't
|
||||||
|
# extend the 'clean' target to the external project
|
||||||
|
# see thread: https://cmake.org/pipermail/cmake/2016-December/064660.html
|
||||||
|
#
|
||||||
|
# So for now we just have the top-level build remove the final build products...
|
||||||
|
set_property(DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}" APPEND PROPERTY ADDITIONAL_MAKE_CLEAN_FILES ${bootloader_binary_files})
|
||||||
|
@ -64,4 +64,6 @@ function(add_executable target)
|
|||||||
_add_executable(${ARGV})
|
_add_executable(${ARGV})
|
||||||
|
|
||||||
target_link_libraries(${target} "-Wl,--gc-sections -Wl,--cref -Wl,--Map=${mapfile} -Wl,--start-group")
|
target_link_libraries(${target} "-Wl,--gc-sections -Wl,--cref -Wl,--Map=${mapfile} -Wl,--start-group")
|
||||||
|
|
||||||
|
set_property(DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}" APPEND PROPERTY ADDITIONAL_MAKE_CLEAN_FILES "${CMAKE_CURRENT_BINARY_DIR}/${mapfile}")
|
||||||
endfunction()
|
endfunction()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user