From d41da31ac5bd8f5b9205b11e362d8cd0df69574e Mon Sep 17 00:00:00 2001 From: Jiacheng Huang Date: Fri, 3 Jul 2026 16:43:33 +0800 Subject: [PATCH] fix: pass vendor includes to torch object builds --- src/CMakeLists.txt | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 42e0212a3..fb022422c 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -571,6 +571,14 @@ if(WITH_TORCH) list(APPEND _torch_include_flags "-isystem" "${_dir}") endforeach() + set(_torch_vendor_include_flags "") + if(WITH_METAX) + list(APPEND _torch_vendor_include_flags "-I${MACA_PATH}/include") + endif() + if(WITH_MOORE) + list(APPEND _torch_vendor_include_flags "-I${MUSA_ROOT}/include") + endif() + # Vendor-specific defines required by forked `torch` headers. set(_torch_extra_flags "") if(WITH_METAX) @@ -604,6 +612,7 @@ if(WITH_TORCH) "-I${CMAKE_CURRENT_SOURCE_DIR}" "-I${PROJECT_SOURCE_DIR}/generated" ${INFINI_RT_INCLUDE_FLAGS} + ${_torch_vendor_include_flags} ${_torch_include_flags} ${_torch_extra_flags} -c "${_src}" -o "${_obj}"