Skip to content

Commit

Permalink
update pybind11 to 2.12, support numpy 2 (#5525)
Browse files Browse the repository at this point in the history
  • Loading branch information
nihui authored Jun 21, 2024
1 parent f56b18a commit f2a34ee
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 2 deletions.
9 changes: 9 additions & 0 deletions python/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,15 @@ if("${CMAKE_LIBRARY_OUTPUT_DIRECTORY}" STREQUAL "")
endif(MSVC OR CMAKE_GENERATOR STREQUAL "Xcode")
endif("${CMAKE_LIBRARY_OUTPUT_DIRECTORY}" STREQUAL "")

# enable global link time optimization
cmake_policy(SET CMP0069 NEW)
set(CMAKE_POLICY_DEFAULT_CMP0069 NEW)
include(CheckIPOSupported)
check_ipo_supported(RESULT ipo_supported OUTPUT ipo_supported_output)
if(ipo_supported)
set(CMAKE_INTERPROCEDURAL_OPTIMIZATION TRUE)
endif()

include_directories(${pybind11_INCLUDE_DIR} ${PYTHON_INCLUDE_DIRS})
pybind11_add_module(pyncnn src/main.cpp)
set_target_properties(pyncnn PROPERTIES OUTPUT_NAME "ncnn")
Expand Down
2 changes: 1 addition & 1 deletion python/pybind11
Submodule pybind11 updated 155 files
2 changes: 1 addition & 1 deletion python/tests/test_mat.py
Original file line number Diff line number Diff line change
Expand Up @@ -298,7 +298,7 @@ def test_fill():
mat = ncnn.Mat(1)
mat.fill(1.0)
array = np.array(mat)
assert np.abs(array[0] - 1.0) < sys.float_info.min
assert np.abs(array[0] - 1.0) < np.finfo(np.float32).eps


def test_clone():
Expand Down

0 comments on commit f2a34ee

Please sign in to comment.