Skip to content

Commit cb2b21e

Browse files
committed
numpy: fix compatibility issue with old versions < 1.16.0
1 parent 61be273 commit cb2b21e

File tree

2 files changed

+13
-3
lines changed

2 files changed

+13
-3
lines changed

CMakeLists.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,10 @@ endif()
8282
set(PYTHON_EXPORT_DEPENDENCY ON)
8383
findpython(REQUIRED)
8484

85+
if(NUMPY_VERSION VERSION_LESS "1.16.0")
86+
set(NUMPY_WITH_BROKEN_UFUNC_SUPPORT)
87+
endif()
88+
8589
if(WIN32)
8690
link_directories(${PYTHON_LIBRARY_DIRS})
8791
# # Set default Windows build paths SET(CMAKE_LIBRARY_OUTPUT_DIRECTORY

unittest/CMakeLists.txt

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,10 @@ add_lib_unit_test(include)
3232
if(NOT ${EIGEN3_VERSION} VERSION_LESS "3.2.0")
3333
add_lib_unit_test(eigen_ref)
3434
endif()
35-
add_lib_unit_test(user_type)
35+
36+
if(NOT NUMPY_WITH_BROKEN_UFUNC_SUPPORT)
37+
add_lib_unit_test(user_type)
38+
endif()
3639
add_lib_unit_test(std_vector)
3740

3841
add_python_unit_test("py-matrix" "unittest/python/test_matrix.py" "unittest")
@@ -43,8 +46,11 @@ add_python_unit_test("py-return-by-ref" "unittest/python/test_return_by_ref.py"
4346
"unittest")
4447
add_python_unit_test("py-eigen-ref" "unittest/python/test_eigen_ref.py"
4548
"unittest")
46-
add_python_unit_test("py-user-type" "unittest/python/test_user_type.py"
47-
"unittest")
49+
50+
if(NOT NUMPY_WITH_BROKEN_UFUNC_SUPPORT)
51+
add_python_unit_test("py-user-type" "unittest/python/test_user_type.py"
52+
"unittest")
53+
endif()
4854

4955
add_python_unit_test("py-switch" "unittest/python/test_switch.py"
5056
"python;unittest")

0 commit comments

Comments
 (0)