Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Simplify CMake rules for SPQR_CUDA. #373

Merged
merged 1 commit into from
Sep 1, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
46 changes: 19 additions & 27 deletions SPQR/SPQRGPU/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -20,19 +20,13 @@ message ( STATUS "Building SPQR_CUDA version: v"

include ( SuiteSparsePolicy )

if ( SUITESPARSE_CUDA )
project ( spqr_cuda
VERSION "${SPQR_VERSION_MAJOR}.${SPQR_VERSION_MINOR}.${SPQR_VERSION_SUB}"
LANGUAGES C CXX CUDA )
set ( CMAKE_CUDA_FLAGS "-cudart=static -lineinfo -DSUITESPARSE_CUDA" )
set ( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DSUITESPARSE_CUDA" )
message ( STATUS "C++ flags for CUDA: ${CMAKE_CXX_FLAGS}" )
message ( STATUS "nvcc flags for CUDA: ${CMAKE_CUDA_FLAGS}" )
else ( )
project ( spqr_cuda
VERSION "${SPQR_VERSION_MAJOR}.${SPQR_VERSION_MINOR}.${SPQR_VERSION_SUB}"
LANGUAGES C CXX )
endif ( )
project ( spqr_cuda
VERSION "${SPQR_VERSION_MAJOR}.${SPQR_VERSION_MINOR}.${SPQR_VERSION_SUB}"
LANGUAGES C CXX CUDA )
set ( CMAKE_CUDA_FLAGS "-cudart=static -lineinfo -DSUITESPARSE_CUDA" )
set ( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DSUITESPARSE_CUDA" )
message ( STATUS "C++ flags for CUDA: ${CMAKE_CXX_FLAGS}" )
message ( STATUS "nvcc flags for CUDA: ${CMAKE_CUDA_FLAGS}" )

file ( GLOB SPQR_CUDA_SOURCES "spqrgpu_*.cpp" )

Expand Down Expand Up @@ -91,29 +85,27 @@ set_target_properties ( SPQR_CUDA PROPERTIES POSITION_INDEPENDENT_CODE ON )
set_target_properties ( SPQR_CUDA PROPERTIES CUDA_SEPARABLE_COMPILATION ON )

if ( NOT NSTATIC )
target_include_directories ( SPQR_CUDA_static PRIVATE
target_include_directories ( SPQR_CUDA_static PRIVATE
${CUDAToolkit_INCLUDE_DIRS}
${SPQR_CUDA_INCLUDES}
"$<TARGET_PROPERTY:SuiteSparse::SuiteSparseConfig,INTERFACE_INCLUDE_DIRECTORIES>" )
set_target_properties ( SPQR_CUDA_static PROPERTIES CUDA_SEPARABLE_COMPILATION on )
set_target_properties ( SPQR_CUDA_static PROPERTIES POSITION_INDEPENDENT_CODE on )
set_target_properties ( SPQR_CUDA_static PROPERTIES CUDA_SEPARABLE_COMPILATION on )
set_target_properties ( SPQR_CUDA_static PROPERTIES POSITION_INDEPENDENT_CODE on )

if ( TARGET SuiteSparse::CHOLMOD_static )
target_link_libraries ( SPQR_CUDA_static PUBLIC SuiteSparse::CHOLMOD_static )
else ( )
target_link_libraries ( SPQR_CUDA_static PUBLIC SuiteSparse::CHOLMOD )
endif ( )
if ( TARGET SuiteSparse::CHOLMOD_static )
target_link_libraries ( SPQR_CUDA_static PUBLIC SuiteSparse::CHOLMOD_static )
else ( )
target_link_libraries ( SPQR_CUDA_static PUBLIC SuiteSparse::CHOLMOD )
endif ( )
endif ( )

target_link_libraries ( SPQR_CUDA PRIVATE SuiteSparse::CHOLMOD )

if ( SUITESPARSE_CUDA )
target_link_libraries ( SPQR_CUDA PRIVATE CUDA::nvrtc CUDA::cudart_static
target_link_libraries ( SPQR_CUDA PRIVATE CUDA::nvrtc CUDA::cudart_static
CUDA::nvToolsExt CUDA::cublas )
if ( NOT NSTATIC )
target_link_libraries ( SPQR_CUDA_static PUBLIC CUDA::nvrtc CUDA::cudart_static
CUDA::nvToolsExt CUDA::cublas )
if ( NOT NSTATIC )
target_link_libraries ( SPQR_CUDA_static PUBLIC CUDA::nvrtc CUDA::cudart_static
CUDA::nvToolsExt CUDA::cublas )
endif ( )
endif ( )

#-------------------------------------------------------------------------------
Expand Down