From 87b7f0f82cabbfed43ece9fd1fae5d15a7a0862a Mon Sep 17 00:00:00 2001 From: Jason Lowe Date: Tue, 16 Mar 2021 13:43:56 -0500 Subject: [PATCH] Fix specifying GPU architecture in JNI build --- java/src/main/native/CMakeLists.txt | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/java/src/main/native/CMakeLists.txt b/java/src/main/native/CMakeLists.txt index c1239fe69ea..ceafc75f840 100755 --- a/java/src/main/native/CMakeLists.txt +++ b/java/src/main/native/CMakeLists.txt @@ -17,10 +17,7 @@ cmake_minimum_required(VERSION 3.18 FATAL_ERROR) # Use GPU_ARCHS if it is defined if(DEFINED GPU_ARCHS) - unset(CMAKE_CUDA_ARCHITECTURES CACHE) - if(NOT "${GPU_ARCHS}" STREQUAL "ALL") - set(CMAKE_CUDA_ARCHITECTURES "${GPU_ARCHS}") - endif() + set(CMAKE_CUDA_ARCHITECTURES "${GPU_ARCHS}") endif() # If `CMAKE_CUDA_ARCHITECTURES` is not defined, build for all supported architectures. If @@ -29,11 +26,10 @@ endif() # This needs to be run before enabling the CUDA language due to the default initialization behavior # of `CMAKE_CUDA_ARCHITECTURES`, https://gitlab.kitware.com/cmake/cmake/-/issues/21302 -if(NOT DEFINED CMAKE_CUDA_ARCHITECTURES) - set(CUDF_BUILD_FOR_ALL_ARCHS TRUE) +if(NOT DEFINED CMAKE_CUDA_ARCHITECTURES OR CMAKE_CUDA_ARCHITECTURES STREQUAL "ALL") + set(CUDF_JNI_BUILD_FOR_ALL_ARCHS TRUE) elseif(CMAKE_CUDA_ARCHITECTURES STREQUAL "") - unset(CMAKE_CUDA_ARCHITECTURES CACHE) - set(CUDF_BUILD_FOR_DETECTED_ARCHS TRUE) + set(CUDF_JNI_BUILD_FOR_DETECTED_ARCHS TRUE) endif() project(CUDF_JNI VERSION 0.19 LANGUAGES C CXX)