kopia lustrzana https://github.com/espressif/esp-idf
cmake: allow embedding to depend on a target
rodzic
8b67370e65
commit
aed204ce6f
|
@ -830,6 +830,24 @@ Place this line after the ``project()`` line in your project CMakeLists.txt file
|
|||
|
||||
For an example of using this technique, see :example:`protocols/https_request` - the certificate file contents are loaded from the text .pem file at compile time.
|
||||
|
||||
|
||||
.. highlight:: cmake
|
||||
|
||||
It is also possible embed a generated file::
|
||||
|
||||
add_custom_command(OUTPUT my_processed_file.bin
|
||||
COMMAND my_process_file_cmd my_unprocessed_file.bin)
|
||||
target_add_binary_data(my_target "my_processed_file.bin" BINARY)
|
||||
|
||||
In the example above, ``my_processed_file.bin`` is generated from ``my_unprocessed_file.bin`` through some command ``my_process_file_cmd``, then embedded into the target.
|
||||
|
||||
To specify a dependence on a target, use the ``DEPENDS`` argument::
|
||||
|
||||
add_custom_target(my_process COMMAND ...)
|
||||
target_add_binary_data(my_target "my_embed_file.bin" BINARY DEPENDS my_process)
|
||||
|
||||
The ``DEPENDS`` argument to ``target_add_binary_data`` ensures that the target executes first.
|
||||
|
||||
Code and Data Placements
|
||||
------------------------
|
||||
|
||||
|
|
|
@ -77,7 +77,7 @@ endfunction()
|
|||
# by converting it to a generated source file which is then compiled
|
||||
# to a binary object as part of the build
|
||||
function(target_add_binary_data target embed_file embed_type)
|
||||
cmake_parse_arguments(_ "" "RENAME_TO" "" ${ARGN})
|
||||
cmake_parse_arguments(_ "" "RENAME_TO" "DEPENDS" ${ARGN})
|
||||
idf_build_get_property(build_dir BUILD_DIR)
|
||||
idf_build_get_property(idf_path IDF_PATH)
|
||||
|
||||
|
@ -99,7 +99,7 @@ function(target_add_binary_data target embed_file embed_type)
|
|||
-D "FILE_TYPE=${embed_type}"
|
||||
-P "${idf_path}/tools/cmake/scripts/data_file_embed_asm.cmake"
|
||||
MAIN_DEPENDENCY "${embed_file}"
|
||||
DEPENDS "${idf_path}/tools/cmake/scripts/data_file_embed_asm.cmake"
|
||||
DEPENDS "${idf_path}/tools/cmake/scripts/data_file_embed_asm.cmake" ${__DEPENDS}
|
||||
WORKING_DIRECTORY "${build_dir}"
|
||||
VERBATIM)
|
||||
|
||||
|
|
Ładowanie…
Reference in New Issue