Skip to content

Commit

Permalink
Merge branch 'sh_merge_master' into pybind11k_merge_sh
Browse files Browse the repository at this point in the history
  • Loading branch information
Ralf W. Grosse-Kunstleve committed Aug 13, 2024
2 parents d2b8104 + 28b0163 commit 7525f3f
Show file tree
Hide file tree
Showing 6 changed files with 110 additions and 8 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/emscripten.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ on:
pull_request:
branches:
- master
- stable
- v*

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
Expand All @@ -23,8 +25,6 @@ jobs:
- uses: pypa/[email protected]
env:
PYODIDE_BUILD_EXPORTS: whole_archive
CFLAGS: -fexceptions
LDFLAGS: -fexceptions
with:
package-dir: tests
only: cp312-pyodide_wasm32
71 changes: 71 additions & 0 deletions docs/changelog.rst
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,77 @@ IN DEVELOPMENT

Changes will be summarized here periodically.

New Features:

* Support for Python 3.7 was removed. (Official end-of-life: 2023-06-27).
`#5191 <https://github.com/pybind/pybind11/pull/5191>`_

Support for CMake older than 3.15 and some older compilers will also be removed.

Version 2.13.3 (August 13, 2024)
--------------------------------

Bug fixes:

* Quote paths from pybind11-config
`#5302 <https://github.com/pybind/pybind11/pull/5302>`_


* Fix typo in Emscripten support when in config mode (CMake)
`#5301 <https://github.com/pybind/pybind11/pull/5301>`_


Version 2.13.2 (August 13, 2024)
--------------------------------

New Features:

* A ``pybind11::detail::type_caster_std_function_specializations`` feature was added, to support specializations for
``std::function``'s with return types that require custom to-Python conversion behavior (to primary use case is to catch and
convert exceptions).
`#4597 <https://github.com/pybind/pybind11/pull/4597>`_


Changes:


* Use ``PyMutex`` instead of ``std::mutex`` for internal locking in the free-threaded build.
`#5219 <https://github.com/pybind/pybind11/pull/5219>`_

* Add a special type annotation for C++ empty tuple.
`#5214 <https://github.com/pybind/pybind11/pull/5214>`_

* When compiling for WebAssembly, add the required exception flags (CMake 3.13+).
`#5298 <https://github.com/pybind/pybind11/pull/5298>`_

Bug fixes:

* Make ``gil_safe_call_once_and_store`` thread-safe in free-threaded CPython.
`#5246 <https://github.com/pybind/pybind11/pull/5246>`_

* A missing ``#include <algorithm>`` in pybind11/typing.h was added to fix build errors (in case user code does not already depend
on that include).
`#5208 <https://github.com/pybind/pybind11/pull/5208>`_

* Fix regression introduced in #5201 for GCC<10.3 in C++20 mode.
`#5205 <https://github.com/pybind/pybind11/pull/5205>`_


.. fix(cmake)
* Remove extra = when assigning flto value in the case for Clang in CMake.
`#5207 <https://github.com/pybind/pybind11/pull/5207>`_


Tests:

* Adding WASM testing to our CI (Pyodide / Emscripten via scikit-build-core).
`#4745 <https://github.com/pybind/pybind11/pull/4745>`_

* clang-tidy (in GitHub Actions) was updated from clang 15 to clang 18.
`#5272 <https://github.com/pybind/pybind11/pull/5272>`_


Version 2.13.1 (June 26, 2024)
------------------------------

Expand Down
7 changes: 4 additions & 3 deletions pybind11/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
from __future__ import annotations

import argparse
import shlex
import sys
import sysconfig

Expand All @@ -22,7 +23,7 @@ def print_includes() -> None:
if d and d not in unique_dirs:
unique_dirs.append(d)

print(" ".join("-I" + d for d in unique_dirs))
print(" ".join(shlex.quote(f"-I{d}") for d in unique_dirs))


def main() -> None:
Expand Down Expand Up @@ -54,9 +55,9 @@ def main() -> None:
if args.includes:
print_includes()
if args.cmakedir:
print(get_cmake_dir())
print(shlex.quote(get_cmake_dir()))
if args.pkgconfigdir:
print(get_pkgconfig_dir())
print(shlex.quote(get_pkgconfig_dir()))


if __name__ == "__main__":
Expand Down
4 changes: 4 additions & 0 deletions tests/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@ name = "pybind11_tests"
version = "0.0.1"
dependencies = ["pytest", "pytest-timeout", "numpy", "scipy"]

[tool.scikit-build]
# Hide a warning while we also support CMake < 3.15
cmake.version = ">=3.15"

[tool.scikit-build.cmake.define]
PYBIND11_FINDPYTHON = true

Expand Down
30 changes: 28 additions & 2 deletions tools/pybind11Common.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
Adds the following targets::
pybind11::pybind11 - link to headers and pybind11
pybind11::pybind11 - link to Python headers and pybind11::headers
pybind11::module - Adds module links
pybind11::embed - Adds embed links
pybind11::lto - Link time optimizations (only if CMAKE_INTERPROCEDURAL_OPTIMIZATION is not set)
Expand Down Expand Up @@ -75,6 +75,32 @@ set_property(
APPEND
PROPERTY INTERFACE_LINK_LIBRARIES pybind11::pybind11)

# -------------- emscripten requires exceptions enabled -------------
# _pybind11_no_exceptions is a private mechanism to disable this addition.
# Please open an issue if you need to use it; it will be removed if no one
# needs it.
if(CMAKE_SYSTEM_NAME MATCHES Emscripten AND NOT _pybind11_no_exceptions)
if(CMAKE_VERSION VERSION_LESS 3.13)
message(WARNING "CMake 3.13+ is required to build for Emscripten. Some flags will be missing")
else()
if(is_config)
set(_tmp_config_target pybind11::pybind11_headers)
else()
set(_tmp_config_target pybind11_headers)
endif()

set_property(
TARGET ${_tmp_config_target}
APPEND
PROPERTY INTERFACE_LINK_OPTIONS -fexceptions)
set_property(
TARGET ${_tmp_config_target}
APPEND
PROPERTY INTERFACE_COMPILE_OPTIONS -fexceptions)
unset(_tmp_config_target)
endif()
endif()

# --------------------------- link helper ---------------------------

add_library(pybind11::python_link_helper IMPORTED INTERFACE ${optional_global})
Expand Down Expand Up @@ -329,7 +355,7 @@ function(_pybind11_generate_lto target prefer_thin_lto)

if(CMAKE_SYSTEM_PROCESSOR MATCHES "ppc64le" OR CMAKE_SYSTEM_PROCESSOR MATCHES "mips64")
# Do nothing
elseif(CMAKE_SYSTEM_PROCESSOR MATCHES emscripten)
elseif(CMAKE_SYSTEM_NAME MATCHES Emscripten)
# This compile is very costly when cross-compiling, so set this without checking
set(PYBIND11_LTO_CXX_FLAGS "-flto${thin}${cxx_append}")
set(PYBIND11_LTO_LINKER_FLAGS "-flto${thin}${linker_append}")
Expand Down
2 changes: 1 addition & 1 deletion tools/pybind11Config.cmake.in
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ you can either use the basic targets, or use the FindPython tools:
# Python method:
Python_add_library(MyModule2 src2.cpp)
target_link_libraries(MyModule2 pybind11::headers)
target_link_libraries(MyModule2 PUBLIC pybind11::headers)
set_target_properties(MyModule2 PROPERTIES
INTERPROCEDURAL_OPTIMIZATION ON
CXX_VISIBILITY_PRESET ON
Expand Down

0 comments on commit 7525f3f

Please sign in to comment.