CodeQL / Analyze (actions) (push) Canceled after 0s
CodeQL / Analyze (python) (push) Canceled after 0s
pre-commit / pre-commit (push) Canceled after 0s
Multi-Arch CI / setup (push) Canceled after 0s
Publish build_manylinux_x86_64 images / publish_build_manylinux_x86_64 (push) Canceled after 0s
Setup (Multi-Arch) / setup (push) Canceled after 0s
Multi-Arch CI / Linux::${{ fromJSON(needs.setup.outputs.linux_build_config || '{}').build_variant_label || 'skip' }} (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish no_rocm_image_ubi10 image / publish_no_rocm_image_ubi10 (push) Canceled after 0s
Multi-Arch CI / Windows::${{ fromJSON(needs.setup.outputs.windows_build_config || '{}').build_variant_label || 'skip' }} (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Multi-Arch CI / Manifest Diff (push) Canceled after 0s
TheRock Manifest Diff Report / Generate Manifest Diff Report (push) Canceled after 0s
Multi-Arch CI / CI Summary (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04 (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04_ocl_rt images / publish_no_rocm_image_ubuntu24_04_ocl_rt (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_rocgdb (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04_rocgdb images / publish_no_rocm_image_ubuntu24_04_rocgdb (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_ocl_rt (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Unit Tests / Unit Tests :: ubuntu-24.04 (push) Canceled after 0s
Unit Tests / Unit Tests :: windows-2022 (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_media (push) Canceled after 0s
Unit Tests / Unit Tests Summary (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_openmpi (push) Canceled after 0s
91 lines
2.7 KiB
CMake
91 lines
2.7 KiB
CMake
# Copyright Advanced Micro Devices, Inc., or its affiliates.
|
|
# SPDX-License-Identifier: MIT
|
|
|
|
if(HIPSPARSE_BUILD_SHARED_LIBS OR BUILD_SHARED_LIBS)
|
|
add_library(hipsparse SHARED)
|
|
else()
|
|
add_library(hipsparse STATIC)
|
|
endif()
|
|
add_library(roc::hipsparse ALIAS hipsparse)
|
|
|
|
# Add Windows version resource to library
|
|
if(WIN32 AND BUILD_SHARED_LIBS)
|
|
target_sources(hipsparse PRIVATE "${PROJECT_BINARY_DIR}/version.rc")
|
|
endif()
|
|
|
|
rocm_set_soversion(hipsparse ${hipsparse_SOVERSION})
|
|
set_target_properties(hipsparse PROPERTIES
|
|
CXX_EXTENSIONS OFF
|
|
CXX_VISIBILITY_PRESET "hidden"
|
|
VISIBILITY_INLINES_HIDDEN ON
|
|
RUNTIME_OUTPUT_DIRECTORY "${PROJECT_BINARY_DIR}/staging"
|
|
DEBUG_POSTFIX "-d"
|
|
)
|
|
|
|
target_compile_features(hipsparse PRIVATE cxx_std_17)
|
|
|
|
target_compile_options(hipsparse PRIVATE -Wno-unused-command-line-argument -Wall)
|
|
|
|
if(HIPSPARSE_ENABLE_CUDA)
|
|
target_compile_definitions(hipsparse PRIVATE __HIP_PLATFORM_NVIDIA__)
|
|
target_link_libraries(hipsparse PUBLIC hip::host)
|
|
elseif(HIPSPARSE_ENABLE_HIP)
|
|
target_compile_definitions(hipsparse PRIVATE __HIP_PLATFORM_AMD__)
|
|
target_link_libraries(hipsparse PUBLIC hip::host)
|
|
endif()
|
|
|
|
add_subdirectory(include)
|
|
add_subdirectory(src)
|
|
|
|
if(HIPSPARSE_ENABLE_FORTRAN)
|
|
set(CMAKE_Fortran_MODULE_DIRECTORY "${PROJECT_BINARY_DIR}/include/hipsparse")
|
|
|
|
add_library(hipsparse_fortran OBJECT)
|
|
|
|
target_sources(hipsparse_fortran PRIVATE
|
|
"${CMAKE_CURRENT_SOURCE_DIR}/src/hipsparse.f90"
|
|
"${CMAKE_CURRENT_SOURCE_DIR}/src/hipsparse_enums.f90"
|
|
)
|
|
|
|
target_compile_options(hipsparse_fortran PRIVATE -ffree-form -cpp)
|
|
endif()
|
|
|
|
rocm_install_targets(
|
|
TARGETS hipsparse
|
|
INCLUDE "${CMAKE_BINARY_DIR}/include"
|
|
)
|
|
|
|
|
|
if(HIPSPARSE_ENABLE_HIP)
|
|
rocm_export_targets(
|
|
TARGETS roc::hipsparse
|
|
DEPENDS PACKAGE hip
|
|
STATIC_DEPENDS PACKAGE rocsparse
|
|
NAMESPACE roc::
|
|
)
|
|
elseif(HIPSPARSE_ENABLE_CUDA)
|
|
rocm_export_targets(
|
|
TARGETS roc::hipsparse
|
|
NAMESPACE roc::
|
|
)
|
|
endif()
|
|
|
|
# Windows-specific post-build copy for shared libraries
|
|
if(WIN32 AND (HIPSPARSE_BUILD_SHARED_LIBS OR BUILD_SHARED_LIBS))
|
|
# Copy the DLL to clients/staging
|
|
add_custom_command(
|
|
TARGET hipsparse POST_BUILD
|
|
COMMAND ${CMAKE_COMMAND} -E copy_if_different
|
|
"$<TARGET_FILE:hipsparse>"
|
|
"${PROJECT_BINARY_DIR}/clients/staging/$<TARGET_FILE_NAME:hipsparse>"
|
|
)
|
|
|
|
# Copy PDB file for Debug builds (only when it exists)
|
|
add_custom_command(
|
|
TARGET hipsparse POST_BUILD
|
|
COMMAND ${CMAKE_COMMAND} -E $<IF:$<CONFIG:Debug>,copy_if_different,true>
|
|
"$<$<CONFIG:Debug>:$<TARGET_PDB_FILE:hipsparse>>"
|
|
"$<$<CONFIG:Debug>:${PROJECT_BINARY_DIR}/clients/staging/$<TARGET_PDB_FILE_NAME:hipsparse>>"
|
|
)
|
|
endif()
|