Skip to content

Commit

Permalink
build: pybind11 raise min to 2.7 and make self-builder (#4297)
Browse files Browse the repository at this point in the history
Signed-off-by: Larry Gritz <lg@larrygritz.com>
  • Loading branch information
lgritz authored Jun 22, 2024
1 parent c45f4d4 commit 9a020e8
Show file tree
Hide file tree
Showing 5 changed files with 50 additions and 14 deletions.
21 changes: 11 additions & 10 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ jobs:
cxx_compiler: clang++
cxx_std: 17
openexr_ver: v3.1.13
pybind11_ver: v2.6.2
pybind11_ver: v2.7.0
python_ver: 3.7
simd: "avx2,f16c"
fmt_ver: 8.1.1
Expand Down Expand Up @@ -147,17 +147,18 @@ jobs:
python_ver: "3.11"
simd: "avx2,f16c"
fmt_ver: 10.1.1
pybind11_ver: v2.10.0
- desc: oldest gcc9.3/C++17 py3.7 exr-3.1
# Oldest versions of the dependencies that we support.
pybind11_ver: v2.12.0
- desc: oldest/hobbled gcc9.3/C++17 py3.7 exr-3.1 no-sse no-ocio
# Oldest versions of the dependencies that we can muster, and various
# things disabled (no SSE, OCIO, or OpenCV, don't embed plugins).
nametag: linux-oldest
runner: ubuntu-latest
container: aswf/ci-osl:2021
vfxyear: 2021
cxx_std: 17
fmt_ver: 7.0.1
openexr_ver: v3.1.0
pybind11_ver: v2.4.2
pybind11_ver: v2.7.0
python_ver: 3.7
setenvs: export CMAKE_VERSION=3.15.5
PTEX_VERSION=v2.3.2
Expand All @@ -174,7 +175,7 @@ jobs:
cxx_std: 17
fmt_ver: 7.0.1
openexr_ver: v3.1.0
pybind11_ver: v2.4.2
pybind11_ver: v2.7.0
python_ver: 3.7
simd: 0
setenvs: export EMBEDPLUGINS=0
Expand Down Expand Up @@ -304,7 +305,7 @@ jobs:
cxx_std: 17
fmt_ver: 10.1.1
openexr_ver: v3.2.4
pybind11_ver: v2.11.1
pybind11_ver: v2.12.0
python_ver: "3.10"
simd: avx2,f16c
setenvs: export LIBJPEGTURBO_VERSION=3.0.1
Expand Down Expand Up @@ -373,7 +374,7 @@ jobs:
cxx_std: 20
fmt_ver: 10.1.1
openexr_ver: v3.1.13
pybind11_ver: v2.9.2
pybind11_ver: v2.12.0
python_ver: 3.8
simd: avx2,f16c
setenvs: export LLVM_VERSION=14.0.0
Expand All @@ -388,7 +389,7 @@ jobs:
python_ver: 3.8
simd: sse4.2
openexr_ver: v3.1.13
pybind11_ver: v2.6.2
pybind11_ver: v2.7.0
setenvs: export CMAKE_BUILD_TYPE=Debug
PUGIXML_VERSION=v1.9
CTEST_TEST_TIMEOUT=1200
Expand All @@ -399,7 +400,7 @@ jobs:
cxx_std: 17
openexr_ver: v3.1.13
python_ver: 3.8
pybind11_ver: v2.6.2
pybind11_ver: v2.7.0
setenvs: export BUILD_SHARED_LIBS=OFF
depcmds: |
sudo rm -rf /usr/local/include/OpenEXR
Expand Down
3 changes: 1 addition & 2 deletions INSTALL.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,7 @@ NEW or CHANGED MINIMUM dependencies since the last major release are **bold**.
* OpenGL
* If you are building the Python bindings or running the testsuite:
* **Python >= 3.7** (tested through 3.12)
* pybind11 >= 2.4.2 (Tested through 2.12. Note that pybind11 v2.10+ does
not support Python < 3.6.)
* **pybind11 >= 2.7** (tested through 2.12)
* NumPy
* If you want support for camera "RAW" formats:
* **LibRaw >= 0.20** (tested though 0.21.2)
Expand Down
2 changes: 1 addition & 1 deletion src/build-scripts/build_pybind11.bash
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ set -ex

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

# Where to put pybind11 repo source (default to the ext area)
PYBIND11_SRC_DIR=${PYBIND11_SRC_DIR:=${PWD}/ext/pybind11}
Expand Down
36 changes: 36 additions & 0 deletions src/cmake/build_pybind11.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
# Copyright Contributors to the OpenImageIO project.
# SPDX-License-Identifier: Apache-2.0
# https://github.com/AcademySoftwareFoundation/OpenImageIO

######################################################################
# pybind11 by hand!
######################################################################

set_cache (pybind11_BUILD_VERSION 2.12.0 "pybind11 version for local builds")
set (pybind11_GIT_REPOSITORY "https://github.com/pybind/pybind11")
set (pybind11_GIT_TAG "v${pybind11_BUILD_VERSION}")
set_cache (pybind11_BUILD_SHARED_LIBS ${LOCAL_BUILD_SHARED_LIBS_DEFAULT}
DOC "Should a local pybind11 build, if necessary, build shared libraries" ADVANCED)

string (MAKE_C_IDENTIFIER ${pybind11_BUILD_VERSION} pybind11_VERSION_IDENT)

build_dependency_with_cmake(pybind11
VERSION ${pybind11_BUILD_VERSION}
GIT_REPOSITORY ${pybind11_GIT_REPOSITORY}
GIT_TAG ${pybind11_GIT_TAG}
CMAKE_ARGS
-D PYBIND11_PYTHON_VERSION=${PYTHON3_VERSION}
# Don't built unnecessary parts of Pybind11
-D BUILD_TESTING=OFF
-D PYBIND11_TEST=OFF
)


# Signal to caller that we need to find again at the installed location
set (pybind11_REFIND TRUE)
set (pybind11_REFIND_ARGS CONFIG)
set (pybind11_REFIND_VERSION ${pybind11_BUILD_VERSION})

if (pybind11_BUILD_SHARED_LIBS)
install_local_dependency_libs (pybind11 pybind11)
endif ()
2 changes: 1 addition & 1 deletion src/cmake/externalpackages.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ endif()
# From pythonutils.cmake
find_python()
if (USE_PYTHON)
checked_find_package (pybind11 REQUIRED VERSION_MIN 2.4.2)
checked_find_package (pybind11 REQUIRED VERSION_MIN 2.7)
endif ()


Expand Down

0 comments on commit 9a020e8

Please sign in to comment.