From 5638457a93015e3a8f2d28ce99856fec0a24e68d Mon Sep 17 00:00:00 2001 From: Frantisek Hrbata Date: Sun, 10 Aug 2025 19:46:17 +0200 Subject: [PATCH] feat(cmakev2/build): add __generate_project_info stub Currently, this generates a very basic project_description.json file, allowing idf.py commands that call ensure_build_directory, such as reconfigure, to be used with cmakev2. The ensure_build_directory function sets a global context, which is presently used only for hints, and the project_description.json file is loaded as part of this context. Signed-off-by: Frantisek Hrbata --- tools/cmakev2/build.cmake | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/tools/cmakev2/build.cmake b/tools/cmakev2/build.cmake index 2845c7c8a36..d2a92e233da 100644 --- a/tools/cmakev2/build.cmake +++ b/tools/cmakev2/build.cmake @@ -799,3 +799,31 @@ function(idf_build_library) target_link_libraries("${ARG_INTERFACE}" INTERFACE "${component_interface}") endforeach() endfunction() + +#[[ + __generate_project_info() + + Generate a dummy project_description.json file to enable the use of idf.py + commands that require ensure_build_directory, such as reconfigure. + + FIXME: This needs to generate a complete project_description.json for the + specified executable. +#]] +function(__generate_project_info) + idf_build_get_property(IDF_PATH IDF_PATH) + idf_build_get_property(PROJECT_NAME PROJECT_NAME) + idf_build_get_property(PROJECT_VER PROJECT_VER) + idf_build_get_property(PROJECT_PATH PROJECT_DIR) + idf_build_get_property(BUILD_DIR BUILD_DIR) + idf_build_get_property(SDKCONFIG SDKCONFIG) + idf_build_get_property(SDKCONFIG_DEFAULTS SDKCONFIG_DEFAULTS) + + set(common_component_reqs_json "\"\"") + set(build_components_json "\"\"") + set(build_component_paths_json "\"\"") + set(build_component_info_json "\"\"") + set(all_component_info_json "\"\"") + + configure_file("${IDF_PATH}/tools/cmake/project_description.json.in" + "${BUILD_DIR}/project_description.json") +endfunction()