PKGNAME=rocm-rocshmem
PKGDES="GPU-centric networking framework based on an OpenSHMEM-like interface"
PKGSEC=devel
PKGDEP="gcc-runtime rocm-amdsmi rocm-clr"
BUILDDEP="cmake rocm-llvm rocm-cmake"

USECLANG=1
# FIXME: ld.lld: error: undefined symbol: rocshmem::print_build_info(std::ostream&)
# >>> referenced by rocshmem_info.cpp:54 (/var/cache/acbs/build/acbs.wk9s1eje/rocm-systems/projects/rocshmem/tools/rocshmem_info.cpp:54)
# >>>               tools/rocshmem_info.lto.o:(main)
NOLTO=1

# Note: Control Flow Protection is not supported by GPU targets.
#
# https://github.com/llvm/llvm-project/issues/86450
AB_FLAGS_CFP=0

# Note: Keep librocshmem.a, pytorch dependency ...
NOSTATIC=0

ABTYPE=cmakeninja
CMAKE_AFTER=(
    '-DCMAKE_INSTALL_RPATH=/usr/lib/rocm/lib/llvm/lib;/usr/lib/rocm/lib'
    '-DCMAKE_INSTALL_PREFIX=/usr/lib/rocm'
    '-DCMAKE_SKIP_INSTALL_RPATH=OFF'
    '-DCMAKE_LINKER_TYPE=LLD'
    '-DCMAKE_C_COMPILER=/usr/lib/rocm/lib/llvm/bin/clang'
    '-DCMAKE_CXX_COMPILER=/usr/lib/rocm/lib/llvm/bin/clang++'
)

FAIL_ARCH="!(amd64|loongarch64)"
