Skip to content

Commit 6328d0b

Browse files
lgritzscott-wilson
authored andcommitted
build: pybind11 raise min to 2.7 and make self-builder (AcademySoftwareFoundation#4297)
Signed-off-by: Larry Gritz <lg@larrygritz.com> Signed-off-by: Scott Wilson <scott@propersquid.com>
1 parent 15fe22e commit 6328d0b

File tree

5 files changed

+50
-14
lines changed

5 files changed

+50
-14
lines changed

.github/workflows/ci.yml

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ jobs:
5656
cxx_compiler: clang++
5757
cxx_std: 17
5858
openexr_ver: v3.1.13
59-
pybind11_ver: v2.6.2
59+
pybind11_ver: v2.7.0
6060
python_ver: 3.7
6161
simd: "avx2,f16c"
6262
fmt_ver: 8.1.1
@@ -147,17 +147,18 @@ jobs:
147147
python_ver: "3.11"
148148
simd: "avx2,f16c"
149149
fmt_ver: 10.1.1
150-
pybind11_ver: v2.10.0
151-
- desc: oldest gcc9.3/C++17 py3.7 exr-3.1
152-
# Oldest versions of the dependencies that we support.
150+
pybind11_ver: v2.12.0
151+
- desc: oldest/hobbled gcc9.3/C++17 py3.7 exr-3.1 no-sse no-ocio
152+
# Oldest versions of the dependencies that we can muster, and various
153+
# things disabled (no SSE, OCIO, or OpenCV, don't embed plugins).
153154
nametag: linux-oldest
154155
runner: ubuntu-latest
155156
container: aswf/ci-osl:2021
156157
vfxyear: 2021
157158
cxx_std: 17
158159
fmt_ver: 7.0.1
159160
openexr_ver: v3.1.0
160-
pybind11_ver: v2.4.2
161+
pybind11_ver: v2.7.0
161162
python_ver: 3.7
162163
setenvs: export CMAKE_VERSION=3.15.5
163164
PTEX_VERSION=v2.3.2
@@ -174,7 +175,7 @@ jobs:
174175
cxx_std: 17
175176
fmt_ver: 7.0.1
176177
openexr_ver: v3.1.0
177-
pybind11_ver: v2.4.2
178+
pybind11_ver: v2.7.0
178179
python_ver: 3.7
179180
simd: 0
180181
setenvs: export EMBEDPLUGINS=0
@@ -304,7 +305,7 @@ jobs:
304305
cxx_std: 17
305306
fmt_ver: 10.1.1
306307
openexr_ver: v3.2.4
307-
pybind11_ver: v2.11.1
308+
pybind11_ver: v2.12.0
308309
python_ver: "3.10"
309310
simd: avx2,f16c
310311
setenvs: export LIBJPEGTURBO_VERSION=3.0.1
@@ -373,7 +374,7 @@ jobs:
373374
cxx_std: 20
374375
fmt_ver: 10.1.1
375376
openexr_ver: v3.1.13
376-
pybind11_ver: v2.9.2
377+
pybind11_ver: v2.12.0
377378
python_ver: 3.8
378379
simd: avx2,f16c
379380
setenvs: export LLVM_VERSION=14.0.0
@@ -388,7 +389,7 @@ jobs:
388389
python_ver: 3.8
389390
simd: sse4.2
390391
openexr_ver: v3.1.13
391-
pybind11_ver: v2.6.2
392+
pybind11_ver: v2.7.0
392393
setenvs: export CMAKE_BUILD_TYPE=Debug
393394
PUGIXML_VERSION=v1.9
394395
CTEST_TEST_TIMEOUT=1200
@@ -399,7 +400,7 @@ jobs:
399400
cxx_std: 17
400401
openexr_ver: v3.1.13
401402
python_ver: 3.8
402-
pybind11_ver: v2.6.2
403+
pybind11_ver: v2.7.0
403404
setenvs: export BUILD_SHARED_LIBS=OFF
404405
depcmds: |
405406
sudo rm -rf /usr/local/include/OpenEXR

INSTALL.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,7 @@ NEW or CHANGED MINIMUM dependencies since the last major release are **bold**.
3636
* OpenGL
3737
* If you are building the Python bindings or running the testsuite:
3838
* **Python >= 3.7** (tested through 3.12)
39-
* pybind11 >= 2.4.2 (Tested through 2.12. Note that pybind11 v2.10+ does
40-
not support Python < 3.6.)
39+
* **pybind11 >= 2.7** (tested through 2.12)
4140
* NumPy
4241
* If you want support for camera "RAW" formats:
4342
* **LibRaw >= 0.20** (tested though 0.21.2)

src/build-scripts/build_pybind11.bash

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ set -ex
1111

1212
# Repo and branch/tag/commit of pybind11 to download if we don't have it yet
1313
PYBIND11_REPO=${PYBIND11_REPO:=https://github.com/pybind/pybind11.git}
14-
PYBIND11_VERSION=${PYBIND11_VERSION:=v2.8.1}
14+
PYBIND11_VERSION=${PYBIND11_VERSION:=v2.12.0}
1515

1616
# Where to put pybind11 repo source (default to the ext area)
1717
PYBIND11_SRC_DIR=${PYBIND11_SRC_DIR:=${PWD}/ext/pybind11}

src/cmake/build_pybind11.cmake

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
# Copyright Contributors to the OpenImageIO project.
2+
# SPDX-License-Identifier: Apache-2.0
3+
# https://github.com/AcademySoftwareFoundation/OpenImageIO
4+
5+
######################################################################
6+
# pybind11 by hand!
7+
######################################################################
8+
9+
set_cache (pybind11_BUILD_VERSION 2.12.0 "pybind11 version for local builds")
10+
set (pybind11_GIT_REPOSITORY "https://github.com/pybind/pybind11")
11+
set (pybind11_GIT_TAG "v${pybind11_BUILD_VERSION}")
12+
set_cache (pybind11_BUILD_SHARED_LIBS ${LOCAL_BUILD_SHARED_LIBS_DEFAULT}
13+
DOC "Should a local pybind11 build, if necessary, build shared libraries" ADVANCED)
14+
15+
string (MAKE_C_IDENTIFIER ${pybind11_BUILD_VERSION} pybind11_VERSION_IDENT)
16+
17+
build_dependency_with_cmake(pybind11
18+
VERSION ${pybind11_BUILD_VERSION}
19+
GIT_REPOSITORY ${pybind11_GIT_REPOSITORY}
20+
GIT_TAG ${pybind11_GIT_TAG}
21+
CMAKE_ARGS
22+
-D PYBIND11_PYTHON_VERSION=${PYTHON3_VERSION}
23+
# Don't built unnecessary parts of Pybind11
24+
-D BUILD_TESTING=OFF
25+
-D PYBIND11_TEST=OFF
26+
)
27+
28+
29+
# Signal to caller that we need to find again at the installed location
30+
set (pybind11_REFIND TRUE)
31+
set (pybind11_REFIND_ARGS CONFIG)
32+
set (pybind11_REFIND_VERSION ${pybind11_BUILD_VERSION})
33+
34+
if (pybind11_BUILD_SHARED_LIBS)
35+
install_local_dependency_libs (pybind11 pybind11)
36+
endif ()

src/cmake/externalpackages.cmake

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ endif()
106106
# From pythonutils.cmake
107107
find_python()
108108
if (USE_PYTHON)
109-
checked_find_package (pybind11 REQUIRED VERSION_MIN 2.4.2)
109+
checked_find_package (pybind11 REQUIRED VERSION_MIN 2.7)
110110
endif ()
111111

112112

0 commit comments

Comments
 (0)