Skip to content
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
15 changes: 11 additions & 4 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -92,15 +92,22 @@ endif()
# Ensure the flag for PIC is added for NVCC
if (CUDA AND CUDA_FOUND)
if (SHARED)
if(${COMPILER} STREQUAL GNU OR ${COMPILER} STREQUAL CLANG)
# For aarch64, -fPIC (uppercase) is required.
if (CMAKE_SYSTEM_PROCESSOR STREQUAL "aarch64")
set(CPPTRAJ_NVCC_PIC_FLAG "--compiler-options -fPIC")
message(STATUS "System is aarch64, forcing -fPIC for CUDA.")
else()
set(CPPTRAJ_NVCC_PIC_FLAG "--compiler-options -fpic")
if(${COMPILER} STREQUAL GNU OR ${COMPILER} STREQUAL CLANG)
set(CPPTRAJ_NVCC_PIC_FLAG "--compiler-options -fpic")
else()
set(CPPTRAJ_NVCC_PIC_FLAG "--compiler-options -fPIC")
endif()
endif()
message(STATUS "Set CUDA PIC flag ${CPPTRAJ_NVCC_PIC_FLAG}")

message(STATUS "Set CUDA PIC flag: ${CPPTRAJ_NVCC_PIC_FLAG}")
list(APPEND CUDA_NVCC_FLAGS ${CPPTRAJ_NVCC_PIC_FLAG})
else()
message(STATUS "Not setting CUDA PIC flag")
message(STATUS "Not a SHARED build, not setting CUDA PIC flag.")
endif()
endif()

Expand Down