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 # 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 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