mirror of
https://github.com/espressif/esp-idf.git
synced 2024-10-05 20:47:46 -04:00
CMake: Make IDF_PATH available to Kconfiglib when not explicitly set.
When IDF_PATH is not set by the user, cmake infers the same through other means and sets it as an environment variable. However, some sub-invocation of cmake may not see this variable as it is not set in the parent. This change adds a custom command for exporting IDF_PATH just before invoking ldgen so that IDF_PATH can be used in Kconfig without any errors.
This commit is contained in:
parent
d9f0d83466
commit
05220d9cda
@ -236,6 +236,21 @@ function run_tests()
|
||||
mv CMakeLists.txt.bak CMakeLists.txt
|
||||
assert_built ${APP_BINS} ${BOOTLOADER_BINS} ${PARTITION_BIN}
|
||||
|
||||
print_status "Can build with IDF_PATH unset and inferred by cmake when Kconfig needs it to be set"
|
||||
clean_build_dir
|
||||
sed -i.bak 's/ENV{IDF_PATH}/{IDF_PATH}/' CMakeLists.txt
|
||||
export IDF_PATH_BACKUP="$IDF_PATH"
|
||||
mv main/Kconfig.projbuild main/Kconfig.projbuild_bak
|
||||
echo "source \"\$IDF_PATH/examples/wifi/getting_started/station/main/Kconfig.projbuild\"" > main/Kconfig.projbuild
|
||||
(unset IDF_PATH &&
|
||||
cd build &&
|
||||
cmake -G Ninja .. -DIDF_PATH=${IDF_PATH_BACKUP} &&
|
||||
ninja) || failure "Ninja build failed"
|
||||
mv CMakeLists.txt.bak CMakeLists.txt
|
||||
mv main/Kconfig.projbuild_bak main/Kconfig.projbuild
|
||||
assert_built ${APP_BINS} ${BOOTLOADER_BINS} ${PARTITION_BIN}
|
||||
|
||||
|
||||
# Next two tests will use this fake 'esp31b' target
|
||||
export fake_target=esp31b
|
||||
mkdir -p components/$fake_target
|
||||
|
@ -63,6 +63,7 @@ function(ldgen_process_template template output)
|
||||
--env "COMPONENT_KCONFIGS=${COMPONENT_KCONFIGS}"
|
||||
--env "COMPONENT_KCONFIGS_PROJBUILD=${COMPONENT_KCONFIGS_PROJBUILD}"
|
||||
--env "IDF_CMAKE=y"
|
||||
--env "IDF_PATH=${IDF_PATH}"
|
||||
--env "IDF_TARGET=${IDF_TARGET}"
|
||||
DEPENDS ${template} $<TARGET_PROPERTY:ldgen,FRAGMENT_FILES> ${SDKCONFIG} ldgen_section_infos
|
||||
)
|
||||
@ -79,4 +80,4 @@ function(ldgen_add_dependencies)
|
||||
if(IDF_PROJECT_EXECUTABLE)
|
||||
add_dependencies(${IDF_PROJECT_EXECUTABLE} ldgen)
|
||||
endif()
|
||||
endfunction()
|
||||
endfunction()
|
||||
|
Loading…
x
Reference in New Issue
Block a user