TensorRT-LLMs/cpp/tensorrt_llm/nanobind/CMakeLists.txt
Martin Marciniszyn Mehringer 425dad01fd
[None][fix] Clean up linking to CUDA stub libraries in build_wheel.py (#6823)
Signed-off-by: Linda-Stadter <57756729+Linda-Stadter@users.noreply.github.com>
Signed-off-by: Martin Marciniszyn Mehringer <11665257+MartinMarciniszyn@users.noreply.github.com>
Co-authored-by: Linda-Stadter <57756729+Linda-Stadter@users.noreply.github.com>
2025-08-18 11:20:51 -04:00

61 lines
1.7 KiB
CMake
Executable File

set(TRTLLM_NB_MODULE bindings)
set(TRTLLM_NB_MODULE
${TRTLLM_NB_MODULE}
PARENT_SCOPE)
set(SRCS
batch_manager/algorithms.cpp
batch_manager/bindings.cpp
batch_manager/cacheTransceiver.cpp
batch_manager/kvCacheManager.cpp
batch_manager/llmRequest.cpp
executor/bindings.cpp
executor/executor.cpp
executor/executorConfig.cpp
executor/request.cpp
runtime/bindings.cpp
testing/modelSpecBinding.cpp
runtime/moeBindings.cpp
userbuffers/bindings.cpp
thop/bindings.cpp
../runtime/ipcNvlsMemory.cu
bindings.cpp)
include_directories(${PROJECT_SOURCE_DIR}/include)
nanobind_add_module(${TRTLLM_NB_MODULE} ${SRCS})
set_property(TARGET ${TRTLLM_NB_MODULE} PROPERTY POSITION_INDEPENDENT_CODE ON)
target_link_directories(${TRTLLM_NB_MODULE} PUBLIC
"${TORCH_INSTALL_PREFIX}/lib")
if(ENABLE_NVSHMEM)
target_link_libraries(${TRTLLM_NB_MODULE} PUBLIC nvshmem::nvshmem_host
nvshmem::nvshmem_device)
endif()
target_link_libraries(
${TRTLLM_NB_MODULE}
PUBLIC ${SHARED_TARGET}
${UNDEFINED_FLAG}
${NO_AS_NEEDED_FLAG}
${Python3_LIBRARIES}
${TORCH_LIBRARIES}
torch_python
CUDA::cuda_driver
${CUDA_NVML_LIB}
th_common)
target_compile_definitions(
${TRTLLM_NB_MODULE} PUBLIC TRTLLM_NB_MODULE=${TRTLLM_NB_MODULE}
PYBIND11_DETAILED_ERROR_MESSAGES=1)
if(NOT WIN32)
set_target_properties(
${TRTLLM_NB_MODULE}
PROPERTIES
LINK_FLAGS
"-Wl,-rpath,'$ORIGIN/libs' -Wl,-rpath,'$ORIGIN/../nvidia/nccl/lib' ${AS_NEEDED_FLAG} ${UNDEFINED_FLAG}"
)
endif()