Merge branch 'pybind:master' into master

This commit is contained in:
Steve R. Sun 2022-12-26 08:31:54 +08:00 committed by GitHub
commit 3bcab95e80
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
15 changed files with 107 additions and 53 deletions

View File

@ -17,6 +17,8 @@ env:
PIP_ONLY_BINARY: numpy PIP_ONLY_BINARY: numpy
FORCE_COLOR: 3 FORCE_COLOR: 3
PYTEST_TIMEOUT: 300 PYTEST_TIMEOUT: 300
# For cmake:
VERBOSE: 1
jobs: jobs:
# This is the "main" test suite, which tests a large number of different # This is the "main" test suite, which tests a large number of different
@ -106,7 +108,6 @@ jobs:
- name: Configure C++11 ${{ matrix.args }} - name: Configure C++11 ${{ matrix.args }}
run: > run: >
cmake -S . -B . cmake -S . -B .
-DCMAKE_VERBOSE_MAKEFILE=ON
-DPYBIND11_WERROR=ON -DPYBIND11_WERROR=ON
-DPYBIND11_SIMPLE_GIL_MANAGEMENT=ON -DPYBIND11_SIMPLE_GIL_MANAGEMENT=ON
-DDOWNLOAD_CATCH=ON -DDOWNLOAD_CATCH=ON
@ -136,7 +137,6 @@ jobs:
- name: Configure C++17 - name: Configure C++17
run: > run: >
cmake -S . -B build2 cmake -S . -B build2
-DCMAKE_VERBOSE_MAKEFILE=ON
-DPYBIND11_WERROR=ON -DPYBIND11_WERROR=ON
-DPYBIND11_SIMPLE_GIL_MANAGEMENT=OFF -DPYBIND11_SIMPLE_GIL_MANAGEMENT=OFF
-DDOWNLOAD_CATCH=ON -DDOWNLOAD_CATCH=ON
@ -159,7 +159,6 @@ jobs:
- name: Configure (unstable ABI) - name: Configure (unstable ABI)
run: > run: >
cmake -S . -B build3 cmake -S . -B build3
-DCMAKE_VERBOSE_MAKEFILE=ON
-DPYBIND11_WERROR=ON -DPYBIND11_WERROR=ON
-DDOWNLOAD_CATCH=ON -DDOWNLOAD_CATCH=ON
-DDOWNLOAD_EIGEN=ON -DDOWNLOAD_EIGEN=ON
@ -246,7 +245,6 @@ jobs:
SETUPTOOLS_USE_DISTUTILS: stdlib SETUPTOOLS_USE_DISTUTILS: stdlib
run: > run: >
cmake -S . -B build cmake -S . -B build
-DCMAKE_VERBOSE_MAKEFILE=ON
-DCMAKE_BUILD_TYPE=Debug -DCMAKE_BUILD_TYPE=Debug
-DPYBIND11_WERROR=ON -DPYBIND11_WERROR=ON
-DDOWNLOAD_CATCH=ON -DDOWNLOAD_CATCH=ON
@ -311,7 +309,6 @@ jobs:
shell: bash shell: bash
run: > run: >
cmake -S . -B build cmake -S . -B build
-DCMAKE_VERBOSE_MAKEFILE=ON
-DPYBIND11_WERROR=ON -DPYBIND11_WERROR=ON
-DDOWNLOAD_CATCH=ON -DDOWNLOAD_CATCH=ON
-DCMAKE_CXX_STANDARD=${{ matrix.std }} -DCMAKE_CXX_STANDARD=${{ matrix.std }}
@ -344,7 +341,7 @@ jobs:
run: apt-get update && DEBIAN_FRONTEND="noninteractive" apt-get install -y cmake git python3-dev python3-pytest python3-numpy run: apt-get update && DEBIAN_FRONTEND="noninteractive" apt-get install -y cmake git python3-dev python3-pytest python3-numpy
- name: Configure - name: Configure
run: cmake -S . -B build -DCMAKE_VERBOSE_MAKEFILE=ON -DPYBIND11_CUDA_TESTS=ON -DPYBIND11_WERROR=ON -DDOWNLOAD_CATCH=ON run: cmake -S . -B build -DPYBIND11_CUDA_TESTS=ON -DPYBIND11_WERROR=ON -DDOWNLOAD_CATCH=ON
- name: Build - name: Build
run: cmake --build build -j2 --verbose run: cmake --build build -j2 --verbose
@ -382,7 +379,7 @@ jobs:
# run: | # run: |
# source /etc/profile.d/modules.sh # source /etc/profile.d/modules.sh
# module load /opt/nvidia/hpc_sdk/modulefiles/nvhpc/20.11 # module load /opt/nvidia/hpc_sdk/modulefiles/nvhpc/20.11
# cmake -S . -B build -DCMAKE_VERBOSE_MAKEFILE=ON -DDOWNLOAD_CATCH=ON -DCMAKE_CXX_STANDARD=14 -DPYTHON_EXECUTABLE=$(python3 -c "import sys; print(sys.executable)") # cmake -S . -B build -DDOWNLOAD_CATCH=ON -DCMAKE_CXX_STANDARD=14 -DPYTHON_EXECUTABLE=$(python3 -c "import sys; print(sys.executable)")
# #
# - name: Build # - name: Build
# run: cmake --build build -j 2 --verbose # run: cmake --build build -j 2 --verbose
@ -480,7 +477,6 @@ jobs:
shell: bash shell: bash
run: > run: >
cmake -S . -B build cmake -S . -B build
-DCMAKE_VERBOSE_MAKEFILE=ON
-DPYBIND11_WERROR=ON -DPYBIND11_WERROR=ON
-DDOWNLOAD_CATCH=ON -DDOWNLOAD_CATCH=ON
-DCMAKE_CXX_STANDARD=${{ matrix.std }} -DCMAKE_CXX_STANDARD=${{ matrix.std }}
@ -535,7 +531,6 @@ jobs:
run: | run: |
set +e; source /opt/intel/oneapi/setvars.sh; set -e set +e; source /opt/intel/oneapi/setvars.sh; set -e
cmake -S . -B build-11 \ cmake -S . -B build-11 \
-DCMAKE_VERBOSE_MAKEFILE=ON \
-DPYBIND11_WERROR=ON \ -DPYBIND11_WERROR=ON \
-DDOWNLOAD_CATCH=ON \ -DDOWNLOAD_CATCH=ON \
-DDOWNLOAD_EIGEN=OFF \ -DDOWNLOAD_EIGEN=OFF \
@ -568,7 +563,6 @@ jobs:
run: | run: |
set +e; source /opt/intel/oneapi/setvars.sh; set -e set +e; source /opt/intel/oneapi/setvars.sh; set -e
cmake -S . -B build-17 \ cmake -S . -B build-17 \
-DCMAKE_VERBOSE_MAKEFILE=ON \
-DPYBIND11_WERROR=ON \ -DPYBIND11_WERROR=ON \
-DDOWNLOAD_CATCH=ON \ -DDOWNLOAD_CATCH=ON \
-DDOWNLOAD_EIGEN=OFF \ -DDOWNLOAD_EIGEN=OFF \
@ -635,7 +629,6 @@ jobs:
shell: bash shell: bash
run: > run: >
cmake -S . -B build cmake -S . -B build
-DCMAKE_VERBOSE_MAKEFILE=ON
-DCMAKE_BUILD_TYPE=MinSizeRel -DCMAKE_BUILD_TYPE=MinSizeRel
-DPYBIND11_WERROR=ON -DPYBIND11_WERROR=ON
-DDOWNLOAD_CATCH=ON -DDOWNLOAD_CATCH=ON
@ -783,7 +776,6 @@ jobs:
run: > run: >
cmake -S . -B build cmake -S . -B build
-G "Visual Studio 16 2019" -A Win32 -G "Visual Studio 16 2019" -A Win32
-DCMAKE_VERBOSE_MAKEFILE=ON
-DPYBIND11_WERROR=ON -DPYBIND11_WERROR=ON
-DDOWNLOAD_CATCH=ON -DDOWNLOAD_CATCH=ON
-DDOWNLOAD_EIGEN=ON -DDOWNLOAD_EIGEN=ON
@ -837,7 +829,6 @@ jobs:
run: > run: >
cmake -S . -B build cmake -S . -B build
-G "Visual Studio 16 2019" -A Win32 -G "Visual Studio 16 2019" -A Win32
-DCMAKE_VERBOSE_MAKEFILE=ON
-DCMAKE_BUILD_TYPE=Debug -DCMAKE_BUILD_TYPE=Debug
-DPYBIND11_WERROR=ON -DPYBIND11_WERROR=ON
-DDOWNLOAD_CATCH=ON -DDOWNLOAD_CATCH=ON
@ -878,7 +869,6 @@ jobs:
- name: Configure C++20 - name: Configure C++20
run: > run: >
cmake -S . -B build cmake -S . -B build
-DCMAKE_VERBOSE_MAKEFILE=ON
-DPYBIND11_WERROR=ON -DPYBIND11_WERROR=ON
-DDOWNLOAD_CATCH=ON -DDOWNLOAD_CATCH=ON
-DDOWNLOAD_EIGEN=ON -DDOWNLOAD_EIGEN=ON
@ -930,7 +920,7 @@ jobs:
- name: Configure C++11 - name: Configure C++11
# LTO leads to many undefined reference like # LTO leads to many undefined reference like
# `pybind11::detail::function_call::function_call(pybind11::detail::function_call&&) # `pybind11::detail::function_call::function_call(pybind11::detail::function_call&&)
run: cmake -G "MinGW Makefiles" -DCMAKE_CXX_STANDARD=11 -DCMAKE_VERBOSE_MAKEFILE=ON -DPYBIND11_WERROR=ON -DDOWNLOAD_CATCH=ON -S . -B build run: cmake -G "MinGW Makefiles" -DCMAKE_CXX_STANDARD=11 -DPYBIND11_WERROR=ON -DDOWNLOAD_CATCH=ON -S . -B build
- name: Build C++11 - name: Build C++11
run: cmake --build build -j 2 run: cmake --build build -j 2
@ -948,7 +938,7 @@ jobs:
run: git clean -fdx run: git clean -fdx
- name: Configure C++14 - name: Configure C++14
run: cmake -G "MinGW Makefiles" -DCMAKE_CXX_STANDARD=14 -DCMAKE_VERBOSE_MAKEFILE=ON -DPYBIND11_WERROR=ON -DDOWNLOAD_CATCH=ON -S . -B build2 run: cmake -G "MinGW Makefiles" -DCMAKE_CXX_STANDARD=14 -DPYBIND11_WERROR=ON -DDOWNLOAD_CATCH=ON -S . -B build2
- name: Build C++14 - name: Build C++14
run: cmake --build build2 -j 2 run: cmake --build build2 -j 2
@ -966,7 +956,7 @@ jobs:
run: git clean -fdx run: git clean -fdx
- name: Configure C++17 - name: Configure C++17
run: cmake -G "MinGW Makefiles" -DCMAKE_CXX_STANDARD=17 -DCMAKE_VERBOSE_MAKEFILE=ON -DPYBIND11_WERROR=ON -DDOWNLOAD_CATCH=ON -S . -B build3 run: cmake -G "MinGW Makefiles" -DCMAKE_CXX_STANDARD=17 -DPYBIND11_WERROR=ON -DDOWNLOAD_CATCH=ON -S . -B build3
- name: Build C++17 - name: Build C++17
run: cmake --build build3 -j 2 run: cmake --build build3 -j 2
@ -1027,7 +1017,6 @@ jobs:
- name: Configure Clang - name: Configure Clang
run: > run: >
cmake -G Ninja -S . -B . cmake -G Ninja -S . -B .
-DCMAKE_VERBOSE_MAKEFILE=ON
-DPYBIND11_WERROR=OFF -DPYBIND11_WERROR=OFF
-DPYBIND11_SIMPLE_GIL_MANAGEMENT=OFF -DPYBIND11_SIMPLE_GIL_MANAGEMENT=OFF
-DDOWNLOAD_CATCH=ON -DDOWNLOAD_CATCH=ON
@ -1093,7 +1082,6 @@ jobs:
- name: CMake Configure - name: CMake Configure
run: > run: >
cmake -S . -B . cmake -S . -B .
-DCMAKE_VERBOSE_MAKEFILE=ON
-DPYBIND11_WERROR=ON -DPYBIND11_WERROR=ON
-DPYBIND11_SIMPLE_GIL_MANAGEMENT=OFF -DPYBIND11_SIMPLE_GIL_MANAGEMENT=OFF
-DDOWNLOAD_CATCH=ON -DDOWNLOAD_CATCH=ON

View File

@ -9,6 +9,10 @@ on:
- stable - stable
- v* - v*
env:
# For cmake:
VERBOSE: 1
jobs: jobs:
# This tests various versions of CMake in various combinations, to make sure # This tests various versions of CMake in various combinations, to make sure
# the configure step passes. # the configure step passes.

View File

@ -14,6 +14,8 @@ on:
env: env:
FORCE_COLOR: 3 FORCE_COLOR: 3
# For cmake:
VERBOSE: 1
jobs: jobs:
pre-commit: pre-commit:

View File

@ -11,6 +11,8 @@ concurrency:
env: env:
PIP_ONLY_BINARY: numpy PIP_ONLY_BINARY: numpy
# For cmake:
VERBOSE: 1
jobs: jobs:
standard: standard:

View File

@ -15,6 +15,60 @@ IN DEVELOPMENT
Changes will be summarized here periodically. Changes will be summarized here periodically.
Version 2.10.2 (Dec 20, 2022)
-----------------------------
Changes:
* ``scoped_interpreter`` constructor taking ``PyConfig``.
`#4330 <https://github.com/pybind/pybind11/pull/4330>`_
* ``pybind11/eigen/tensor.h`` adds converters to and from ``Eigen::Tensor`` and
``Eigen::TensorMap``.
`#4201 <https://github.com/pybind/pybind11/pull/4201>`_
* ``PyGILState_Check()``'s were integrated to ``pybind11::handle``
``inc_ref()`` & ``dec_ref()``. The added GIL checks are guarded by
``PYBIND11_ASSERT_GIL_HELD_INCREF_DECREF``, which is the default only if
``NDEBUG`` is not defined.
`#4246 <https://github.com/pybind/pybind11/pull/4246>`_
* Add option for enable/disable enum members in docstring.
`#2768 <https://github.com/pybind/pybind11/pull/2768>`_
* Fixed typing of ``KeysView``, ``ValuesView`` and ``ItemsView`` in ``bind_map``.
`#4353 <https://github.com/pybind/pybind11/pull/4353>`_
Bug fixes:
* Bug fix affecting only Python 3.6 under very specific, uncommon conditions:
move ``PyEval_InitThreads()`` call to the correct location.
`#4350 <https://github.com/pybind/pybind11/pull/4350>`_
* Fix segfault bug when passing foreign native functions to functional.h.
`#4254 <https://github.com/pybind/pybind11/pull/4254>`_
Build system improvements:
* Support setting PYTHON_LIBRARIES manually for Windows ARM cross-compilation
(classic mode).
`#4406 <https://github.com/pybind/pybind11/pull/4406>`_
* Extend IPO/LTO detection for ICX (a.k.a IntelLLVM) compiler.
`#4402 <https://github.com/pybind/pybind11/pull/4402>`_
* Allow calling ``find_package(pybind11 CONFIG)`` multiple times from separate
directories in the same CMake project and properly link Python (new mode).
`#4401 <https://github.com/pybind/pybind11/pull/4401>`_
* ``multiprocessing_set_spawn`` in pytest fixture for added safety.
`#4377 <https://github.com/pybind/pybind11/pull/4377>`_
* Fixed a bug in two pybind11/tools cmake scripts causing "Unknown arguments specified" errors.
`#4327 <https://github.com/pybind/pybind11/pull/4327>`_
Version 2.10.1 (Oct 31, 2022) Version 2.10.1 (Oct 31, 2022)
----------------------------- -----------------------------
@ -95,7 +149,6 @@ Bug fixes:
finalization. finalization.
`#4192 <https://github.com/pybind/pybind11/pull/4192>`_ `#4192 <https://github.com/pybind/pybind11/pull/4192>`_
Performance and style: Performance and style:
* Reserve space in set and STL map casters if possible. This will prevent * Reserve space in set and STL map casters if possible. This will prevent

View File

@ -10,12 +10,12 @@
#pragma once #pragma once
#define PYBIND11_VERSION_MAJOR 2 #define PYBIND11_VERSION_MAJOR 2
#define PYBIND11_VERSION_MINOR 11 #define PYBIND11_VERSION_MINOR 10
#define PYBIND11_VERSION_PATCH 0.dev1 #define PYBIND11_VERSION_PATCH 2
// Similar to Python's convention: https://docs.python.org/3/c-api/apiabiversion.html // Similar to Python's convention: https://docs.python.org/3/c-api/apiabiversion.html
// Additional convention: 0xD = dev // Additional convention: 0xD = dev
#define PYBIND11_VERSION_HEX 0x020B00D1 #define PYBIND11_VERSION_HEX 0x020A0200
// Define some generic pybind11 helper macros for warning management. // Define some generic pybind11 helper macros for warning management.
// //

View File

@ -8,5 +8,5 @@ def _to_int(s: str) -> Union[int, str]:
return s return s
__version__ = "2.11.0.dev1" __version__ = "2.10.2"
version_info = tuple(_to_int(s) for s in __version__.split(".")) version_info = tuple(_to_int(s) for s in __version__.split("."))

View File

@ -130,7 +130,6 @@ set(PYBIND11_TEST_FILES
test_docstring_options test_docstring_options
test_eigen_matrix test_eigen_matrix
test_eigen_tensor test_eigen_tensor
test_eigen_tensor_avoid_stl_array.cpp
test_enum test_enum
test_eval test_eval
test_exceptions test_exceptions
@ -294,6 +293,11 @@ if(PYBIND11_TEST_FILES_EIGEN_I GREATER -1)
set(EIGEN3_VERSION ${EIGEN3_VERSION_STRING}) set(EIGEN3_VERSION ${EIGEN3_VERSION_STRING})
endif() endif()
message(STATUS "Building tests with Eigen v${EIGEN3_VERSION}") message(STATUS "Building tests with Eigen v${EIGEN3_VERSION}")
if(NOT (CMAKE_CXX_COMPILER_ID STREQUAL "GNU" AND CMAKE_CXX_COMPILER_VERSION VERSION_LESS 5.0))
tests_extra_targets("test_eigen_tensor.py" "eigen_tensor_avoid_stl_array")
endif()
else() else()
list(FIND PYBIND11_TEST_FILES test_eigen_matrix.cpp PYBIND11_TEST_FILES_EIGEN_I) list(FIND PYBIND11_TEST_FILES test_eigen_matrix.cpp PYBIND11_TEST_FILES_EIGEN_I)
if(PYBIND11_TEST_FILES_EIGEN_I GREATER -1) if(PYBIND11_TEST_FILES_EIGEN_I GREATER -1)
@ -304,11 +308,6 @@ if(PYBIND11_TEST_FILES_EIGEN_I GREATER -1)
if(PYBIND11_TEST_FILES_EIGEN_I GREATER -1) if(PYBIND11_TEST_FILES_EIGEN_I GREATER -1)
list(REMOVE_AT PYBIND11_TEST_FILES ${PYBIND11_TEST_FILES_EIGEN_I}) list(REMOVE_AT PYBIND11_TEST_FILES ${PYBIND11_TEST_FILES_EIGEN_I})
endif() endif()
list(FIND PYBIND11_TEST_FILES test_eigen_tensor_avoid_stl_array.cpp
PYBIND11_TEST_FILES_EIGEN_I)
if(PYBIND11_TEST_FILES_EIGEN_I GREATER -1)
list(REMOVE_AT PYBIND11_TEST_FILES ${PYBIND11_TEST_FILES_EIGEN_I})
endif()
message( message(
STATUS "Building tests WITHOUT Eigen, use -DDOWNLOAD_EIGEN=ON on CMake 3.11+ to download") STATUS "Building tests WITHOUT Eigen, use -DDOWNLOAD_EIGEN=ON on CMake 3.11+ to download")
endif() endif()
@ -320,10 +319,6 @@ if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU" AND CMAKE_CXX_COMPILER_VERSION VERSION_L
if(PYBIND11_TEST_FILES_EIGEN_I GREATER -1) if(PYBIND11_TEST_FILES_EIGEN_I GREATER -1)
list(REMOVE_AT PYBIND11_TEST_FILES ${PYBIND11_TEST_FILES_EIGEN_I}) list(REMOVE_AT PYBIND11_TEST_FILES ${PYBIND11_TEST_FILES_EIGEN_I})
endif() endif()
list(FIND PYBIND11_TEST_FILES test_eigen_tensor_avoid_stl_array.cpp PYBIND11_TEST_FILES_EIGEN_I)
if(PYBIND11_TEST_FILES_EIGEN_I GREATER -1)
list(REMOVE_AT PYBIND11_TEST_FILES ${PYBIND11_TEST_FILES_EIGEN_I})
endif()
endif() endif()
# Optional dependency for some tests (boost::variant is only supported with version >= 1.56) # Optional dependency for some tests (boost::variant is only supported with version >= 1.56)

View File

@ -5,12 +5,10 @@
BSD-style license that can be found in the LICENSE file. BSD-style license that can be found in the LICENSE file.
*/ */
constexpr const char *test_eigen_tensor_module_name = "eigen_tensor_avoid_stl_array";
#ifndef EIGEN_AVOID_STL_ARRAY #ifndef EIGEN_AVOID_STL_ARRAY
# define EIGEN_AVOID_STL_ARRAY # define EIGEN_AVOID_STL_ARRAY
#endif #endif
#define PYBIND11_TEST_EIGEN_TENSOR_NAMESPACE eigen_tensor_avoid_stl_array
#include "test_eigen_tensor.inl" #include "test_eigen_tensor.inl"
PYBIND11_MODULE(eigen_tensor_avoid_stl_array, m) { eigen_tensor_test::test_module(m); }

View File

@ -5,8 +5,6 @@
BSD-style license that can be found in the LICENSE file. BSD-style license that can be found in the LICENSE file.
*/ */
constexpr const char *test_eigen_tensor_module_name = "eigen_tensor";
#define PYBIND11_TEST_EIGEN_TENSOR_NAMESPACE eigen_tensor #define PYBIND11_TEST_EIGEN_TENSOR_NAMESPACE eigen_tensor
#ifdef EIGEN_AVOID_STL_ARRAY #ifdef EIGEN_AVOID_STL_ARRAY
@ -14,3 +12,7 @@ constexpr const char *test_eigen_tensor_module_name = "eigen_tensor";
#endif #endif
#include "test_eigen_tensor.inl" #include "test_eigen_tensor.inl"
#include "pybind11_tests.h"
test_initializer egien_tensor("eigen_tensor", eigen_tensor_test::test_module);

View File

@ -7,9 +7,9 @@
#include <pybind11/eigen/tensor.h> #include <pybind11/eigen/tensor.h>
#include "pybind11_tests.h" PYBIND11_NAMESPACE_BEGIN(eigen_tensor_test)
PYBIND11_NAMESPACE_BEGIN(PYBIND11_TEST_EIGEN_TENSOR_NAMESPACE) namespace py = pybind11;
PYBIND11_WARNING_DISABLE_MSVC(4127) PYBIND11_WARNING_DISABLE_MSVC(4127)
@ -108,7 +108,7 @@ void init_tensor_module(pybind11::module &m) {
return check_tensor(get_tensor<Options>()) && check_tensor(get_fixed_tensor<Options>()); return check_tensor(get_tensor<Options>()) && check_tensor(get_fixed_tensor<Options>());
}); });
py::class_<CustomExample<Options>>(m, "CustomExample") py::class_<CustomExample<Options>>(m, "CustomExample", py::module_local())
.def(py::init<>()) .def(py::init<>())
.def_readonly( .def_readonly(
"member", &CustomExample<Options>::member, py::return_value_policy::reference_internal) "member", &CustomExample<Options>::member, py::return_value_policy::reference_internal)
@ -322,8 +322,6 @@ void init_tensor_module(pybind11::module &m) {
py::return_value_policy::reference); py::return_value_policy::reference);
} }
void test_module(py::module_ &);
test_initializer name(test_eigen_tensor_module_name, test_module);
void test_module(py::module_ &m) { void test_module(py::module_ &m) {
auto f_style = m.def_submodule("f_style"); auto f_style = m.def_submodule("f_style");
auto c_style = m.def_submodule("c_style"); auto c_style = m.def_submodule("c_style");
@ -332,4 +330,4 @@ void test_module(py::module_ &m) {
init_tensor_module<Eigen::RowMajor>(c_style); init_tensor_module<Eigen::RowMajor>(c_style);
} }
PYBIND11_NAMESPACE_END(PYBIND11_TEST_EIGEN_TENSOR_NAMESPACE) PYBIND11_NAMESPACE_END(eigen_tensor_test)

View File

@ -6,17 +6,17 @@ np = pytest.importorskip("numpy")
eigen_tensor = pytest.importorskip("pybind11_tests.eigen_tensor") eigen_tensor = pytest.importorskip("pybind11_tests.eigen_tensor")
submodules = [eigen_tensor.c_style, eigen_tensor.f_style] submodules = [eigen_tensor.c_style, eigen_tensor.f_style]
try: try:
from pybind11_tests import eigen_tensor_avoid_stl_array as avoid import eigen_tensor_avoid_stl_array as avoid
submodules += [avoid.c_style, avoid.f_style] submodules += [avoid.c_style, avoid.f_style]
except ImportError as e: except ImportError as e:
# Ensure config, build, toolchain, etc. issues are not masked here: # Ensure config, build, toolchain, etc. issues are not masked here:
raise RuntimeError( raise RuntimeError(
"import pybind11_tests.eigen_tensor_avoid_stl_array FAILED, while " "import eigen_tensor_avoid_stl_array FAILED, while "
"import pybind11_tests.eigen_tensor succeeded. " "import pybind11_tests.eigen_tensor succeeded. "
"Please ensure that " "Please ensure that "
"test_eigen_tensor.cpp & " "test_eigen_tensor.cpp & "
"test_eigen_tensor_avoid_stl_array.cpp " "eigen_tensor_avoid_stl_array.cpp "
"are built together (or both are not built if Eigen is not available)." "are built together (or both are not built if Eigen is not available)."
) from e ) from e
@ -42,7 +42,7 @@ def cleanup():
def test_import_avoid_stl_array(): def test_import_avoid_stl_array():
pytest.importorskip("pybind11_tests.eigen_tensor_avoid_stl_array") pytest.importorskip("eigen_tensor_avoid_stl_array")
assert len(submodules) == 4 assert len(submodules) == 4

View File

@ -208,7 +208,9 @@ string(REGEX REPLACE "\\\\" "/" PYTHON_PREFIX "${PYTHON_PREFIX}")
string(REGEX REPLACE "\\\\" "/" PYTHON_INCLUDE_DIR "${PYTHON_INCLUDE_DIR}") string(REGEX REPLACE "\\\\" "/" PYTHON_INCLUDE_DIR "${PYTHON_INCLUDE_DIR}")
string(REGEX REPLACE "\\\\" "/" PYTHON_SITE_PACKAGES "${PYTHON_SITE_PACKAGES}") string(REGEX REPLACE "\\\\" "/" PYTHON_SITE_PACKAGES "${PYTHON_SITE_PACKAGES}")
if(CMAKE_HOST_WIN32) if(DEFINED PYTHON_LIBRARY)
# Don't write to PYTHON_LIBRARY if it's already set
elseif(CMAKE_HOST_WIN32)
set(PYTHON_LIBRARY "${PYTHON_PREFIX}/libs/python${PYTHON_LIBRARY_SUFFIX}.lib") set(PYTHON_LIBRARY "${PYTHON_PREFIX}/libs/python${PYTHON_LIBRARY_SUFFIX}.lib")
# when run in a venv, PYTHON_PREFIX points to it. But the libraries remain in the # when run in a venv, PYTHON_PREFIX points to it. But the libraries remain in the
@ -274,7 +276,7 @@ if(NOT PYTHON_DEBUG_LIBRARY)
endif() endif()
set(PYTHON_DEBUG_LIBRARIES "${PYTHON_DEBUG_LIBRARY}") set(PYTHON_DEBUG_LIBRARIES "${PYTHON_DEBUG_LIBRARY}")
find_package_message(PYTHON "Found PythonLibs: ${PYTHON_LIBRARY}" find_package_message(PYTHON "Found PythonLibs: ${PYTHON_LIBRARIES}"
"${PYTHON_EXECUTABLE}${PYTHON_VERSION_STRING}") "${PYTHON_EXECUTABLE}${PYTHON_VERSION_STRING}")
set(PYTHONLIBS_FOUND TRUE) set(PYTHONLIBS_FOUND TRUE)

View File

@ -311,6 +311,16 @@ function(_pybind11_generate_lto target prefer_thin_lto)
HAS_FLTO "-flto${cxx_append}" "-flto${linker_append}" PYBIND11_LTO_CXX_FLAGS HAS_FLTO "-flto${cxx_append}" "-flto${linker_append}" PYBIND11_LTO_CXX_FLAGS
PYBIND11_LTO_LINKER_FLAGS) PYBIND11_LTO_LINKER_FLAGS)
endif() endif()
elseif(CMAKE_CXX_COMPILER_ID MATCHES "IntelLLVM")
# IntelLLVM equivalent to LTO is called IPO; also IntelLLVM is WIN32/UNIX
# WARNING/HELP WANTED: This block of code is currently not covered by pybind11 GitHub Actions!
if(WIN32)
_pybind11_return_if_cxx_and_linker_flags_work(
HAS_INTEL_IPO "-Qipo" "-Qipo" PYBIND11_LTO_CXX_FLAGS PYBIND11_LTO_LINKER_FLAGS)
else()
_pybind11_return_if_cxx_and_linker_flags_work(
HAS_INTEL_IPO "-ipo" "-ipo" PYBIND11_LTO_CXX_FLAGS PYBIND11_LTO_LINKER_FLAGS)
endif()
elseif(CMAKE_CXX_COMPILER_ID MATCHES "Intel") elseif(CMAKE_CXX_COMPILER_ID MATCHES "Intel")
# Intel equivalent to LTO is called IPO # Intel equivalent to LTO is called IPO
_pybind11_return_if_cxx_and_linker_flags_work(HAS_INTEL_IPO "-ipo" "-ipo" _pybind11_return_if_cxx_and_linker_flags_work(HAS_INTEL_IPO "-ipo" "-ipo"

View File

@ -9,7 +9,7 @@ if(CMAKE_VERSION VERSION_LESS 3.12)
message(FATAL_ERROR "You cannot use the new FindPython module with CMake < 3.12") message(FATAL_ERROR "You cannot use the new FindPython module with CMake < 3.12")
endif() endif()
include_guard(GLOBAL) include_guard(DIRECTORY)
get_property( get_property(
is_config is_config