diff --git a/python/CMakeLists.txt b/python/CMakeLists.txt index 999efa1de..5a92a8e66 100644 --- a/python/CMakeLists.txt +++ b/python/CMakeLists.txt @@ -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") diff --git a/python/pybind11 b/python/pybind11 index 80dc998ef..3e9dfa286 160000 --- a/python/pybind11 +++ b/python/pybind11 @@ -1 +1 @@ -Subproject commit 80dc998efced8ceb2be59756668a7e90e8bef917 +Subproject commit 3e9dfa2866941655c56877882565e7577de6fc7b diff --git a/python/tests/test_mat.py b/python/tests/test_mat.py index 7019961a5..205053ee5 100644 --- a/python/tests/test_mat.py +++ b/python/tests/test_mat.py @@ -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():