diff --git a/src/cmake/ConditionalOption.cmake b/src/cmake/ConditionalOption.cmake index e60bc56262..f2fdadc54b 100644 --- a/src/cmake/ConditionalOption.cmake +++ b/src/cmake/ConditionalOption.cmake @@ -25,6 +25,15 @@ function(av_conditional_option) return() endif() + # A condition given as a single quoted string (e.g. IF "A AND NOT B") arrives + # as one list element, which if() would treat as the name of a variable. + # Split it into separate arguments so that it is evaluated as an expression. + # Multi-element conditions are left untouched, so quoted values inside them + # (e.g. IF X STREQUAL "a b") keep their spaces. + list(LENGTH _co_IF _co_IF_LEN) + if(_co_IF_LEN EQUAL 1) + separate_arguments(_co_IF) + endif() if(${_co_IF}) option(${_co_OPT_NAME} ${_opt_DESCRIPTION} ${_co_THEN}) else() diff --git a/src/cmake/DependenciesVersions.cmake b/src/cmake/DependenciesVersions.cmake index ded88faec7..4e27cf3f5a 100644 --- a/src/cmake/DependenciesVersions.cmake +++ b/src/cmake/DependenciesVersions.cmake @@ -114,7 +114,7 @@ set(DEP_LAPACK_URL "https://github.com/Reference-LAPACK/lapack/archive/v${DE set(DEP_LAPACK_HASH "MD5=595b064fd448b161cd711fe346f498a7") set(DEP_GMP_VERSION "6.2.1") -set(DEP_GMP_URL "https://gmplib.org/download/gmp/gmp-${DEP_GMP_VERSION}.tar.xz") +set(DEP_GMP_URL "https://ftp.gnu.org/gnu/gmp/gmp-${DEP_GMP_VERSION}.tar.xz") set(DEP_GMP_HASH "MD5=0b82665c4a92fd2ade7440c13fcaa42b") set(DEP_MPFR_VERSION "4.2.0") diff --git a/src/cmake/deps/lapack.cmake b/src/cmake/deps/lapack.cmake index e2baed7aae..734d026f5b 100644 --- a/src/cmake/deps/lapack.cmake +++ b/src/cmake/deps/lapack.cmake @@ -24,7 +24,8 @@ if(AV_BUILD_LAPACK) ${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}/liblapack${CMAKE_SHARED_LIBRARY_SUFFIX} ) set(LAPACK_CMAKE_FLAGS - "-DBLAS_LIBRARIES=${BLAS_LIBRARIES} -DLAPACK_LIBRARIES=${LAPACK_LIBRARIES}" + -DBLAS_LIBRARIES=${BLAS_LIBRARIES} + -DLAPACK_LIBRARIES=${LAPACK_LIBRARIES} ) endif() diff --git a/src/cmake/deps/suitesparse.cmake b/src/cmake/deps/suitesparse.cmake index 3ddb8ebcc5..b0e9d6d3a8 100644 --- a/src/cmake/deps/suitesparse.cmake +++ b/src/cmake/deps/suitesparse.cmake @@ -1,6 +1,6 @@ # ============================================================================= # deps/suitesparse.cmake -# Dependencies: lapack (BLAS_LIBRARIES, LAPACK_LIBRARIES), cuda (optionnel) +# Dependencies: lapack (BLAS_LIBRARIES, LAPACK_LIBRARIES) # Provides: SUITESPARSE_TARGET, SUITESPARSE_CMAKE_FLAGS # # NOTE: Requires gmp and mpfr as prerequisites, built inline here since they @@ -85,9 +85,13 @@ if(AV_BUILD_SUITESPARSE) # ) #endif() - if(AV_USE_CUDA) - set(_cuda_cmake_flags "-DENABLE_CUDA=ON\ -DCMAKE_CXX_FLAGS=-I${CUDA_TOOLKIT_ROOT_DIR}/include\ -DCMAKE_C_FLAGS=-I${CUDA_TOOLKIT_ROOT_DIR}/include") + set(_ss_lapack_flags ${LAPACK_CMAKE_FLAGS}) + if(_ss_lapack_flags) + # SuiteSparse requires BLA_VENDOR along with BLAS_LIBRARIES; the reference BLAS is "Generic" + list(APPEND _ss_lapack_flags -DBLA_VENDOR=Generic) endif() + # SuiteSparse's Makefile takes all CMake options in one space-separated variable + list(JOIN _ss_lapack_flags " " _ss_lapack_flags) ExternalProject_Add(${SUITESPARSE_TARGET} URL ${DEP_SUITESPARSE_URL} @@ -104,7 +108,7 @@ if(AV_BUILD_SUITESPARSE) CONFIGURE_COMMAND "" BUILD_COMMAND $(MAKE) -j${AV_BUILD_DEPENDENCIES_PARALLEL} - CMAKE_OPTIONS=${LAPACK_CMAKE_FLAGS}\ -DCMAKE_INSTALL_PREFIX=${CMAKE_INSTALL_PREFIX}\ -DCMAKE_INSTALL_LIBDIR=lib\ ${_cuda_cmake_flags} + CMAKE_OPTIONS=${_ss_lapack_flags}\ -DCMAKE_INSTALL_PREFIX=${CMAKE_INSTALL_PREFIX}\ -DCMAKE_INSTALL_LIBDIR=lib\ -DSUITESPARSE_USE_CUDA=OFF INSTALL_COMMAND $(MAKE) install DEPENDS ${LAPACK_TARGET} mpfr @@ -118,7 +122,7 @@ if(AV_BUILD_SUITESPARSE) av_register_dep(${SUITESPARSE_TARGET}) - unset(_cuda_cmake_flags) + unset(_ss_lapack_flags) #unset(_ss_env) #unset(_ss_blas) #unset(_ss_cmake_opts)