From 6ff86bc63d42ada0ac3c358bbeb05eede8f48742 Mon Sep 17 00:00:00 2001 From: Shreyas Atre Date: Tue, 21 Jan 2025 21:00:32 -0600 Subject: [PATCH] Avoid building HWLoc more times than initial configuration Signed-off-by: Shreyas Atre --- .github/workflows/macos_debug_fetch_hwloc.yml | 3 ++- cmake/HPX_SetupHwloc.cmake | 20 ++++++++++++++----- 2 files changed, 17 insertions(+), 6 deletions(-) diff --git a/.github/workflows/macos_debug_fetch_hwloc.yml b/.github/workflows/macos_debug_fetch_hwloc.yml index 3b473773463..c1a54b4186e 100644 --- a/.github/workflows/macos_debug_fetch_hwloc.yml +++ b/.github/workflows/macos_debug_fetch_hwloc.yml @@ -18,7 +18,7 @@ jobs: - name: Install dependencies run: | brew install --overwrite python-tk && \ - brew install --overwrite boost gperftools ninja autoconf automake libtool && \ + brew install --overwrite boost gperftools ninja autoconf automake pkgconf libtool && \ brew upgrade cmake - name: Configure shell: bash @@ -36,6 +36,7 @@ jobs: -DHPX_WITH_VERIFY_LOCKS=ON \ -DHPX_WITH_VERIFY_LOCKS_BACKTRACE=ON \ -DHPX_WITH_CHECK_MODULE_DEPENDENCIES=ON + cd build/_deps/hwloc-src/ && autoreconf -f -i - name: Build shell: bash run: | diff --git a/cmake/HPX_SetupHwloc.cmake b/cmake/HPX_SetupHwloc.cmake index 654da5a8e37..587b466e908 100644 --- a/cmake/HPX_SetupHwloc.cmake +++ b/cmake/HPX_SetupHwloc.cmake @@ -44,11 +44,21 @@ else() ) if(NOT HWLoc_POPULATED) fetchcontent_populate(HWLoc) - execute_process( - COMMAND - sh -c - "cd ${FETCHCONTENT_BASE_DIR}/hwloc-src && autoreconf -f -i && ./configure --prefix=${FETCHCONTENT_BASE_DIR}/hwloc-installed && make -j && make install" - ) + if(NOT Hwloc_BUILD_INSTALLED) + execute_process( + COMMAND + sh -c + "cd ${FETCHCONTENT_BASE_DIR}/hwloc-src && ./configure --prefix=${FETCHCONTENT_BASE_DIR}/hwloc-installed && make -j && make install" + ) + set(Hwloc_BUILD_INSTALLED + TRUE + CACHE INTERNAL "" + ) + else() + message( + "HWLoc is installed at ${FETCHCONTENT_BASE_DIR}/hwloc-installed" + ) + endif() endif() set(HWLOC_ROOT "${FETCHCONTENT_BASE_DIR}/hwloc-installed") set(Hwloc_INCLUDE_DIR