From eabccc961bbcb2685402cf749e1f9c22487b9c5e Mon Sep 17 00:00:00 2001 From: simbit18 <101105604+simbit18@users.noreply.github.com> Date: Thu, 16 Apr 2026 14:47:15 +0200 Subject: [PATCH 1/3] testbuild.sh: CMake Added -DNXTMPDIR - It is now possible to create folder for third-party packages in CMake as well. (Aligned with Make) Signed-off-by: simbit18 --- tools/testbuild.sh | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/tools/testbuild.sh b/tools/testbuild.sh index 420d553a03584..baeed8952e134 100755 --- a/tools/testbuild.sh +++ b/tools/testbuild.sh @@ -35,6 +35,7 @@ MAKE=make unset testfile unset HOPTION unset STORE +unset NXTMPDIR unset JOPTION PRINTLISTONLY=0 GITCLEAN=0 @@ -42,6 +43,7 @@ SAVEARTIFACTS=0 CHECKCLEAN=1 CODECHECKER=0 NINJACMAKE=0 +STORECMAKE=0 RUN=0 case $(uname -s) in @@ -150,6 +152,7 @@ while [ ! -z "$1" ]; do ;; -S ) STORE+=" $1" + STORECMAKE=1 ;; --codechecker ) CODECHECKER=1 @@ -200,6 +203,14 @@ if [ ${NINJACMAKE} -eq 1 ]; then cmakelist=`grep "^[C|c][M|m][A|a][K|k][E|e]" $testfile | cut -d',' -f2 || true` fi +if [ ${STORECMAKE} -eq 1 ]; then + NXTMPDIR="ON" + echo "NXTMPDIR store is enabled" +else + NXTMPDIR="OFF" + echo "NXTMPDIR store is disabled" +fi + cd $nuttx || { echo "ERROR: failed to CD to $nuttx"; exit 1; } function exportandimport { @@ -342,8 +353,8 @@ function configure_default { } function configure_cmake { - if ! cmake -B build -DBOARD_CONFIG=$config -GNinja 1>/dev/null; then - cmake -B build -DBOARD_CONFIG=$config -GNinja + if ! cmake -B build -DBOARD_CONFIG=$config -DNXTMPDIR="$NXTMPDIR" -GNinja 1>/dev/null; then + cmake -B build -DBOARD_CONFIG=$config -DNXTMPDIR="$NXTMPDIR" -GNinja fail=1 fi From 791ec939b69dcdcadf633fda9eaf86c5c9de3471 Mon Sep 17 00:00:00 2001 From: simbit18 <101105604+simbit18@users.noreply.github.com> Date: Thu, 16 Apr 2026 15:03:53 +0200 Subject: [PATCH 2/3] ci/testlist/risc-v-02.dat: Added boards build with CMake - Boards build by CMake esp32c3-xiao esp32-c3-zero Signed-off-by: simbit18 --- tools/ci/testlist/risc-v-02.dat | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/tools/ci/testlist/risc-v-02.dat b/tools/ci/testlist/risc-v-02.dat index 91c1a0456fa12..ac60ce2788fd7 100644 --- a/tools/ci/testlist/risc-v-02.dat +++ b/tools/ci/testlist/risc-v-02.dat @@ -1 +1,11 @@ /risc-v/esp32c[0-5]* + +# Boards build by CMake +CMake,esp32c3-xiao:nimble +CMake,esp32c3-xiao:gpio +CMake,esp32c3-xiao:wifi +CMake,esp32c3-xiao:usbnsh +CMake,esp32-c3-zero:wifi +CMake,esp32-c3-zero:jumbo +CMake,esp32-c3-zero:sta_softap +CMake,esp32-c3-zero:usbnsh From 5945b55d6700e8be0a986a1aa8ed77d87943cee0 Mon Sep 17 00:00:00 2001 From: simbit18 <101105604+simbit18@users.noreply.github.com> Date: Thu, 16 Apr 2026 14:30:03 +0200 Subject: [PATCH 3/3] cmake: Moved the creation of the nxtmpdir folder to the root CMake file - Moved the creation of the `nxtmpdir` folder for third-party packages to the root `CMakeLists.txt` file. cmake/nuttx_3rdparty.cmake - Add the nuttx_remove_nxtmpdir function to remove the third-party cache directory under nuttx/../nxtmpdir Signed-off-by: simbit18 --- CMakeLists.txt | 10 ++++++++++ arch/risc-v/src/common/espressif/CMakeLists.txt | 2 -- cmake/nuttx_3rdparty.cmake | 15 +++++++++++++++ 3 files changed, 25 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 82af32ddb64ad..77755168edf90 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -230,6 +230,16 @@ set(ENV{HOST_OTHER} n) include(nuttx_sethost) +option(NXTMPDIR "Create the nxtmpdir folder for third-party packages." OFF) + +include(nuttx_3rdparty) + +if(NXTMPDIR) + nuttx_make_nxtmpdir() +else() + nuttx_remove_nxtmpdir() +endif() + include(nuttx_parse_function_args) include(nuttx_add_subdirectory) include(nuttx_create_symlink) diff --git a/arch/risc-v/src/common/espressif/CMakeLists.txt b/arch/risc-v/src/common/espressif/CMakeLists.txt index c948bd9b3852a..10e1415e0c913 100644 --- a/arch/risc-v/src/common/espressif/CMakeLists.txt +++ b/arch/risc-v/src/common/espressif/CMakeLists.txt @@ -243,8 +243,6 @@ if(NOT IS_DIRECTORY "${ESP_HAL_3RDPARTY_REPO}") # NXTMPDIR contains a cached version of the esp-hal-3rdparty repository, which # is located on nuttx/../nxtmpdir/esp-hal-3rdparty if it exists. if(NXTMPDIR) - include(${NUTTX_DIR}/cmake/nuttx_3rdparty.cmake) - nuttx_make_nxtmpdir() set(ESP_HAL_NXTMPDIR_CACHE "${NXTMPDIR_PATH}/${ESP_HAL_3RDPARTY_REPO_NAME}") get_filename_component(ESP_HAL_NXTMPDIR_CACHE "${ESP_HAL_NXTMPDIR_CACHE}" REALPATH) diff --git a/cmake/nuttx_3rdparty.cmake b/cmake/nuttx_3rdparty.cmake index 2bd3d0835daf7..593bbcd84b13b 100644 --- a/cmake/nuttx_3rdparty.cmake +++ b/cmake/nuttx_3rdparty.cmake @@ -40,6 +40,21 @@ function(nuttx_make_nxtmpdir) endif() endfunction() +# ~~~ +# nuttx_remove_nxtmpdir +# +# Description: +# Remove the third-party cache directory under nuttx/../nxtmpdir +# +# ~~~ + +function(nuttx_remove_nxtmpdir) + set(_nxtmpdir "${NUTTX_DIR}/../nxtmpdir") + if(EXISTS "${_nxtmpdir}") + file(REMOVE_RECURSE "${_nxtmpdir}") + endif() +endfunction() + # ~~~ # nuttx_check_git_hash #