Skip to content
This repository was archived by the owner on Apr 29, 2026. It is now read-only.

Commit fc7b0b7

Browse files
committed
Enable position-independent code for CUDA static library in CMake configuration
- Updated `CMakeLists.txt` to set the `POSITION_INDEPENDENT_CODE` property for the `pe_synth_cuda` static library, ensuring compatibility with shared libraries. - This change enhances the build process for CUDA components, improving flexibility in linking and deployment.
1 parent 4a55fcf commit fc7b0b7

1 file changed

Lines changed: 2 additions & 0 deletions

File tree

src/CMakeLists.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,8 @@ if(PHY_ENGINE_ENABLE_CUDA_PE_SYNTH)
8787
set(_phy_pe_synth_cuda_src "${CMAKE_SOURCE_DIR}/pe_synth_cuda_u64_cones.cu")
8888
set_source_files_properties("${_phy_pe_synth_cuda_src}" PROPERTIES LANGUAGE CXX)
8989
add_library(pe_synth_cuda STATIC "${_phy_pe_synth_cuda_src}")
90+
# This static library is linked into libphyengine.so; ensure its objects are built with -fPIC.
91+
set_property(TARGET pe_synth_cuda PROPERTY POSITION_INDEPENDENT_CODE ON)
9092
target_include_directories(pe_synth_cuda PRIVATE "${CMAKE_SOURCE_DIR}/../include" "${PHY_ENGINE_CUDA_PATH}/include")
9193
target_compile_options(pe_synth_cuda PRIVATE -x cuda "--cuda-path=${PHY_ENGINE_CUDA_PATH}" "--cuda-gpu-arch=${PHY_ENGINE_CUDA_PE_SYNTH_ARCH}")
9294
target_link_options(pe_synth_cuda INTERFACE "--cuda-path=${PHY_ENGINE_CUDA_PATH}" "--cuda-gpu-arch=${PHY_ENGINE_CUDA_PE_SYNTH_ARCH}")

0 commit comments

Comments
 (0)