mirror of
https://github.com/espressif/esp-idf.git
synced 2024-10-05 20:47:46 -04:00
build-system: replace ADDITIONAL_MAKE_CLEAN_FILES with ADDITIONAL_CLEAN_FILES
ADDITIONAL_MAKE_CLEAN_FILES is deprecated and only worked with make. Replaced with the new ADDITIONAL_CLEAN_FILES (CMake 3.15) which also works with ninja.
This commit is contained in:
parent
f00c78b020
commit
124a43e9ec
@ -148,5 +148,5 @@ endif()
|
||||
#
|
||||
# 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
|
||||
ADDITIONAL_CLEAN_FILES
|
||||
${bootloader_binary_files})
|
||||
|
@ -150,7 +150,7 @@ if(CONFIG_SECURE_SIGNED_APPS AND (CONFIG_SECURE_BOOT_V1_ENABLED OR CONFIG_SECURE
|
||||
target_add_binary_data(${COMPONENT_LIB} "${secure_boot_verification_key}" "BINARY"
|
||||
RENAME_TO signature_verification_key_bin)
|
||||
set_property(DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}"
|
||||
APPEND PROPERTY ADDITIONAL_MAKE_CLEAN_FILES
|
||||
APPEND PROPERTY ADDITIONAL_CLEAN_FILES
|
||||
"${secure_boot_verification_key}")
|
||||
endif()
|
||||
|
||||
|
@ -137,7 +137,7 @@ if(CONFIG_APP_BUILD_GENERATE_BINARIES)
|
||||
endif()
|
||||
|
||||
set_property(DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}"
|
||||
APPEND PROPERTY ADDITIONAL_MAKE_CLEAN_FILES
|
||||
APPEND PROPERTY ADDITIONAL_CLEAN_FILES
|
||||
"${build_dir}/${unsigned_project_binary}"
|
||||
)
|
||||
|
||||
@ -170,7 +170,7 @@ if(NOT BOOTLOADER_BUILD AND CONFIG_SECURE_SIGNED_APPS)
|
||||
add_dependencies(gen_project_binary gen_signed_project_binary)
|
||||
|
||||
set_property(DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}"
|
||||
APPEND PROPERTY ADDITIONAL_MAKE_CLEAN_FILES
|
||||
APPEND PROPERTY ADDITIONAL_CLEAN_FILES
|
||||
"${build_dir}/${PROJECT_BIN}"
|
||||
)
|
||||
else()
|
||||
|
@ -87,7 +87,7 @@ function(fatfs_create_partition_image partition base_dir)
|
||||
--fat_type "${fatfs_explicit_type}"
|
||||
)
|
||||
set_property(DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}" APPEND PROPERTY
|
||||
ADDITIONAL_MAKE_CLEAN_FILES
|
||||
ADDITIONAL_CLEAN_FILES
|
||||
${image_file})
|
||||
|
||||
idf_component_get_property(main_args esptool_py FLASH_ARGS)
|
||||
|
@ -67,7 +67,7 @@ if(CONFIG_MBEDTLS_CERTIFICATE_BUNDLE)
|
||||
|
||||
target_add_binary_data(${COMPONENT_LIB} ${crt_bundle} BINARY)
|
||||
set_property(DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}"
|
||||
APPEND PROPERTY ADDITIONAL_MAKE_CLEAN_FILES
|
||||
APPEND PROPERTY ADDITIONAL_CLEAN_FILES
|
||||
"${crt_bundle}")
|
||||
endif()
|
||||
|
||||
|
@ -44,7 +44,7 @@ function(spiffs_create_partition_image partition base_dir)
|
||||
)
|
||||
|
||||
set_property(DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}" APPEND PROPERTY
|
||||
ADDITIONAL_MAKE_CLEAN_FILES
|
||||
ADDITIONAL_CLEAN_FILES
|
||||
${image_file})
|
||||
|
||||
idf_component_get_property(main_args esptool_py FLASH_ARGS)
|
||||
|
@ -806,11 +806,11 @@ Some components will have a situation where a source file isn't supplied with th
|
||||
add_dependencies(${COMPONENT_LIB} logo)
|
||||
|
||||
set_property(DIRECTORY "${COMPONENT_DIR}" APPEND PROPERTY
|
||||
ADDITIONAL_MAKE_CLEAN_FILES logo.h)
|
||||
ADDITIONAL_CLEAN_FILES logo.h)
|
||||
|
||||
This answer is adapted from the `CMake FAQ entry <cmake faq generated files_>`_, which contains some other examples that will also work with ESP-IDF builds.
|
||||
|
||||
In this example, logo.h will be generated in the current directory (the build directory) while logo.bmp comes with the component and resides under the component path. Because logo.h is a generated file, it should be cleaned when the project is cleaned. For this reason it is added to the `ADDITIONAL_MAKE_CLEAN_FILES`_ property.
|
||||
In this example, logo.h will be generated in the current directory (the build directory) while logo.bmp comes with the component and resides under the component path. Because logo.h is a generated file, it should be cleaned when the project is cleaned. For this reason it is added to the `ADDITIONAL_CLEAN_FILES`_ property.
|
||||
|
||||
.. note::
|
||||
|
||||
@ -905,7 +905,7 @@ Obviously, there are cases where all these recipes are insufficient for a certai
|
||||
set_target_properties(quirc PROPERTIES INTERFACE_INCLUDE_DIRECTORIES
|
||||
${COMPONENT_DIR}/quirc/lib)
|
||||
|
||||
set_directory_properties( PROPERTIES ADDITIONAL_MAKE_CLEAN_FILES
|
||||
set_directory_properties( PROPERTIES ADDITIONAL_CLEAN_FILES
|
||||
"${COMPONENT_DIR}/quirc/libquirc.a")
|
||||
|
||||
(The above CMakeLists.txt can be used to create a component named ``quirc`` that builds the quirc_ project using its own Makefile.)
|
||||
@ -917,20 +917,20 @@ Obviously, there are cases where all these recipes are insufficient for a certai
|
||||
- Consult the ExternalProject_ documentation for more details about ``externalproject_add()``
|
||||
|
||||
- The second set of commands adds a library target, which points to the "imported" library file built by the external system. Some properties need to be set in order to add include directories and tell CMake where this file is.
|
||||
- Finally, the generated library is added to `ADDITIONAL_MAKE_CLEAN_FILES`_. This means ``make clean`` will delete this library. (Note that the other object files from the build won't be deleted.)
|
||||
- Finally, the generated library is added to `ADDITIONAL_CLEAN_FILES`_. This means ``make clean`` will delete this library. (Note that the other object files from the build won't be deleted.)
|
||||
|
||||
.. only:: esp32
|
||||
|
||||
.. note:: When using an external build process with PSRAM, remember to add ``-mfix-esp32-psram-cache-issue`` to the C compiler arguments. See :ref:`CONFIG_SPIRAM_CACHE_WORKAROUND` for details of this flag.
|
||||
|
||||
.. _ADDITIONAL_MAKE_CLEAN_FILES_note:
|
||||
.. _ADDITIONAL_CLEAN_FILES_note:
|
||||
|
||||
ExternalProject dependencies, clean builds
|
||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
CMake has some unusual behaviour around external project builds:
|
||||
|
||||
- `ADDITIONAL_MAKE_CLEAN_FILES`_ only works when "make" is used as the build system. If Ninja_ or an IDE build system is used, it won't delete these files when cleaning.
|
||||
- `ADDITIONAL_CLEAN_FILES`_ only works when "make" or "ninja" is used as the build system. If an IDE build system is used, it won't delete these files when cleaning.
|
||||
- However, the ExternalProject_ configure & build commands will *always* be re-run after a clean is run.
|
||||
- Therefore, there are two alternative recommended ways to configure the external build command:
|
||||
|
||||
@ -1478,7 +1478,7 @@ Some features are significantly different or removed in the CMake-based system.
|
||||
- ``COMPONENT_EXTRA_INCLUDES``: Used to be an alternative to ``COMPONENT_PRIV_INCLUDEDIRS`` for absolute paths. Use ``PRIV_INCLUDE_DIRS`` argument to ``idf_component_register`` for all cases now (can be relative or absolute).
|
||||
- ``COMPONENT_OBJS``: Previously, component sources could be specified as a list of object files. Now they can be specified as a list of source files via ``SRCS`` argument to `idf_component_register`.
|
||||
- ``COMPONENT_OBJEXCLUDE``: Has been replaced with ``EXCLUDE_SRCS`` argument to ``idf_component_register``. Specify source files (as absolute paths or relative to component directory), instead.
|
||||
- ``COMPONENT_EXTRA_CLEAN``: Set property ``ADDITIONAL_MAKE_CLEAN_FILES`` instead but note :ref:`CMake has some restrictions around this functionality <ADDITIONAL_MAKE_CLEAN_FILES_note>`.
|
||||
- ``COMPONENT_EXTRA_CLEAN``: Set property ``ADDITIONAL_CLEAN_FILES`` instead but note :ref:`CMake has some restrictions around this functionality <ADDITIONAL_CLEAN_FILES_note>`.
|
||||
- ``COMPONENT_OWNBUILDTARGET`` & ``COMPONENT_OWNCLEANTARGET``: Use CMake `ExternalProject`_ instead. See :ref:`component-build-full-override` for full details.
|
||||
- ``COMPONENT_CONFIG_ONLY``: Call ``idf_component_register`` without any arguments instead. See `Configuration-Only Components`_.
|
||||
- ``CFLAGS``, ``CPPFLAGS``, ``CXXFLAGS``: Use equivalent CMake commands instead. See `Controlling Component Compilation`_.
|
||||
@ -1515,7 +1515,7 @@ Flashing from make
|
||||
.. _cmake set: https://cmake.org/cmake/help/v3.16/command/set.html
|
||||
.. _cmake string: https://cmake.org/cmake/help/v3.16/command/string.html
|
||||
.. _cmake faq generated files: https://gitlab.kitware.com/cmake/community/-/wikis/FAQ#how-can-i-generate-a-source-file-during-the-build
|
||||
.. _ADDITIONAL_MAKE_CLEAN_FILES: https://cmake.org/cmake/help/v3.16/prop_dir/ADDITIONAL_MAKE_CLEAN_FILES.html
|
||||
.. _ADDITIONAL_CLEAN_FILES: https://cmake.org/cmake/help/v3.16/prop_dir/ADDITIONAL_CLEAN_FILES.html
|
||||
.. _ExternalProject: https://cmake.org/cmake/help/v3.16/module/ExternalProject.html
|
||||
.. _cmake language variables: https://cmake.org/cmake/help/v3.16/manual/cmake-variables.7.html#variables-for-languages
|
||||
.. _set_source_files_properties: https://cmake.org/cmake/help/v3.16/command/set_source_files_properties.html
|
||||
|
@ -930,7 +930,7 @@ ExternalProject 的依赖与构建清理
|
||||
|
||||
对于外部项目的构建,CMake 会有一些不同寻常的行为:
|
||||
|
||||
- `ADDITIONAL_MAKE_CLEAN_FILES`_ 仅在使用 Make 构建系统时有效。如果使用 Ninja_ 或 IDE 自带的构建系统,执行项目清理时,这些文件不会被删除。
|
||||
- `ADDITIONAL_MAKE_CLEAN_FILES`_ 仅在使用 Make 或 Ninja_ 构建系统时有效。如果使用 IDE 自带的构建系统,执行项目清理时,这些文件不会被删除。
|
||||
- ExternalProject_ 会在 clean 运行后自动重新运行配置和构建命令。
|
||||
- 可以采用以下两种方法来配置外部构建命令:
|
||||
|
||||
|
@ -191,7 +191,7 @@ function(__kconfig_generate_config sdkconfig sdkconfig_defaults)
|
||||
set_property(DIRECTORY APPEND PROPERTY CMAKE_CONFIGURE_DEPENDS "${idf_path}/tools/kconfig_new/confgen.py")
|
||||
|
||||
set_property(DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}" APPEND PROPERTY
|
||||
ADDITIONAL_MAKE_CLEAN_FILES "${sdkconfig_header}" "${sdkconfig_cmake}")
|
||||
ADDITIONAL_CLEAN_FILES "${sdkconfig_header}" "${sdkconfig_cmake}")
|
||||
|
||||
idf_build_set_property(SDKCONFIG_HEADER ${sdkconfig_header})
|
||||
idf_build_set_property(SDKCONFIG_JSON ${sdkconfig_json})
|
||||
|
@ -37,7 +37,7 @@ function(__ldgen_process_template template output)
|
||||
file(GENERATE OUTPUT ${build_dir}/ldgen_libraries INPUT ${build_dir}/ldgen_libraries.in)
|
||||
|
||||
set_property(DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}"
|
||||
APPEND PROPERTY ADDITIONAL_MAKE_CLEAN_FILES
|
||||
APPEND PROPERTY ADDITIONAL_CLEAN_FILES
|
||||
"${build_dir}/ldgen_libraries.in"
|
||||
"${build_dir}/ldgen_libraries")
|
||||
|
||||
|
@ -537,7 +537,7 @@ macro(project project_name)
|
||||
endif()
|
||||
|
||||
set_property(DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}" APPEND PROPERTY
|
||||
ADDITIONAL_MAKE_CLEAN_FILES
|
||||
ADDITIONAL_CLEAN_FILES
|
||||
"${mapfile}" "${project_elf_src}")
|
||||
|
||||
idf_build_get_property(idf_path IDF_PATH)
|
||||
|
@ -103,7 +103,7 @@ function(target_add_binary_data target embed_file embed_type)
|
||||
WORKING_DIRECTORY "${build_dir}"
|
||||
VERBATIM)
|
||||
|
||||
set_property(DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}" APPEND PROPERTY ADDITIONAL_MAKE_CLEAN_FILES "${embed_srcfile}")
|
||||
set_property(DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}" APPEND PROPERTY ADDITIONAL_CLEAN_FILES "${embed_srcfile}")
|
||||
|
||||
target_sources("${target}" PRIVATE "${embed_srcfile}")
|
||||
endfunction()
|
||||
@ -336,7 +336,7 @@ function(file_generate output)
|
||||
endif()
|
||||
|
||||
set_property(DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}"
|
||||
APPEND PROPERTY ADDITIONAL_MAKE_CLEAN_FILES "${output}")
|
||||
APPEND PROPERTY ADDITIONAL_CLEAN_FILES "${output}")
|
||||
endfunction()
|
||||
|
||||
# add_subdirectory_if_exists
|
||||
|
Loading…
Reference in New Issue
Block a user