From e665e6f160e23545b441ceb7f9ca3c1cd7b6d1ea Mon Sep 17 00:00:00 2001 From: ptaylor Date: Tue, 4 Oct 2022 11:00:57 -0700 Subject: [PATCH] force CPM to download Legion if legion_dir or legion_src_dir is not explicitly provided --- cmake/thirdparty/get_legion.cmake | 20 +++++++++++--------- install.py | 4 +++- 2 files changed, 14 insertions(+), 10 deletions(-) diff --git a/cmake/thirdparty/get_legion.cmake b/cmake/thirdparty/get_legion.cmake index 344fc2d2c..5faf54023 100644 --- a/cmake/thirdparty/get_legion.cmake +++ b/cmake/thirdparty/get_legion.cmake @@ -37,16 +37,18 @@ function(find_or_configure_legion) BUILD_EXPORT_SET legate-core-exports INSTALL_EXPORT_SET legate-core-exports) - # First try to find Legion via find_package() - # so the `Legion_USE_*` variables are visible - # Use QUIET find by default. - set(_find_mode QUIET) - # If Legion_DIR/Legion_ROOT are defined as something other than empty or NOTFOUND - # use a REQUIRED find so that the build does not silently download Legion. - if(Legion_DIR OR Legion_ROOT) - set(_find_mode REQUIRED) + if((NOT CPM_Legion_SOURCE) AND (NOT CPM_DOWNLOAD_Legion)) + # First try to find Legion via find_package() + # so the `Legion_USE_*` variables are visible + # Use QUIET find by default. + set(_find_mode QUIET) + # If Legion_DIR/Legion_ROOT are defined as something other than empty or NOTFOUND + # use a REQUIRED find so that the build does not silently download Legion. + if(Legion_DIR OR Legion_ROOT) + set(_find_mode REQUIRED) + endif() + rapids_find_package(Legion ${PKG_VERSION} EXACT CONFIG ${_find_mode} ${FIND_PKG_ARGS}) endif() - rapids_find_package(Legion ${PKG_VERSION} EXACT CONFIG ${_find_mode} ${FIND_PKG_ARGS}) if(Legion_FOUND) message(STATUS "CPM: using local package Legion@${PKG_VERSION}") diff --git a/install.py b/install.py index 6566ca68b..6cd0ca3a7 100755 --- a/install.py +++ b/install.py @@ -454,8 +454,10 @@ def validate_path(path): cmake_flags += ["-DThrust_ROOT=%s" % thrust_dir] if legion_dir: cmake_flags += ["-DLegion_ROOT=%s" % legion_dir] - if legion_src_dir: + elif legion_src_dir: cmake_flags += ["-DCPM_Legion_SOURCE=%s" % legion_src_dir] + else: + cmake_flags += ["-DCPM_DOWNLOAD_Legion=ON"] if legion_url: cmake_flags += ["-Dlegate_core_LEGION_REPOSITORY=%s" % legion_url] if legion_branch: