Skip to content

Commit e6fc4c8

Browse files
committed
bugfix: resolve gtest compilation failures.
1 parent f1a0802 commit e6fc4c8

File tree

3 files changed

+11
-1
lines changed

3 files changed

+11
-1
lines changed

cmake/cc_test.cmake

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,14 @@ function(cc_test)
6969
PRIVATE ${CC_TEST_LINKOPTS}
7070
)
7171

72+
if(USE_NPU)
73+
set(COMMON_LIBS Python::Python torch_npu torch_python)
74+
endif()
75+
76+
if(USE_NPU AND DEFINED COMMON_LIBS)
77+
target_link_libraries(${CC_TEST_NAME} PRIVATE ${COMMON_LIBS})
78+
endif()
79+
7280
add_dependencies(all_tests ${CC_TEST_NAME})
7381

7482
gtest_add_tests(

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
from setuptools.command.bdist_wheel import bdist_wheel
1818
from setuptools.command.build_ext import build_ext
1919

20-
BUILD_TEST_FILE = False
20+
BUILD_TEST_FILE = True
2121
BUILD_EXPORT = True
2222

2323
# get cpu architecture

xllm/core/layers/common/CMakeLists.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ cc_library(
4343
torch
4444
)
4545

46+
if(NOT USE_NPU)
4647
# Add test for DenseMLP
4748
cc_test(
4849
NAME
@@ -76,3 +77,4 @@ cc_test(
7677
torch
7778
GTest::gtest_main
7879
)
80+
endif()

0 commit comments

Comments
 (0)