Skip to content

Commit

Permalink
Upgrade platform latest to C++23 and fix Pybind11 asserts
Browse files Browse the repository at this point in the history
Signed-off-by: Rémi Achard <[email protected]>
  • Loading branch information
remia committed Feb 25, 2024
1 parent 5c52eb9 commit 5499733
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 39 deletions.
52 changes: 27 additions & 25 deletions .github/workflows/platform_latest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
build: [1, 2, 3, 4]
build: [1, 2]
include:
# -------------------------------------------------------------------
# GCC
Expand All @@ -46,7 +46,7 @@ jobs:
build-python: ON
build-type: Release
build-shared: ON
cxx-standard: 20
cxx-standard: 23
cxx-compiler: g++
cc-compiler: gcc
compiler-desc: GCC
Expand All @@ -55,32 +55,34 @@ jobs:
build-python: OFF
build-type: Debug
build-shared: ON
cxx-standard: 20
cxx-standard: 23
cxx-compiler: g++
cc-compiler: gcc
compiler-desc: GCC
enable-sanitizer: ON
# -------------------------------------------------------------------
# Clang
# -------------------------------------------------------------------
- build: 3
build-python: ON
build-type: Release
build-shared: ON
cxx-standard: 20
cxx-compiler: clang++
cc-compiler: clang
compiler-desc: Clang
enable-sanitizer: OFF
- build: 4
build-python: OFF
build-type: Debug
build-shared: ON
cxx-standard: 20
cxx-compiler: clang++
cc-compiler: clang
compiler-desc: Clang
enable-sanitizer: ON
# TODO: Re-enable clang when the following issue get fixed:
# https://github.com/actions/runner-images/issues/8659
# - build: 3
# build-python: ON
# build-type: Release
# build-shared: ON
# cxx-standard: 23
# cxx-compiler: clang++
# cc-compiler: clang
# compiler-desc: Clang
# enable-sanitizer: OFF
# - build: 4
# build-python: OFF
# build-type: Debug
# build-shared: ON
# cxx-standard: 23
# cxx-compiler: clang++
# cc-compiler: clang
# compiler-desc: Clang
# enable-sanitizer: ON
env:
CXX: ${{ matrix.cxx-compiler }}
CC: ${{ matrix.cc-compiler }}
Expand Down Expand Up @@ -185,14 +187,14 @@ jobs:
build-python: ON
build-type: Release
build-shared: ON
cxx-standard: 20
cxx-standard: 23
enable-sanitizer: OFF
python-version: '3.11'
- build: 2
build-python: OFF
build-type: Debug
build-shared: ON
cxx-standard: 20
cxx-standard: 23
enable-sanitizer: ON
python-version: '3.11'
steps:
Expand Down Expand Up @@ -298,13 +300,13 @@ jobs:
build-python: ON
build-type: Release
build-shared: ON
cxx-standard: 20
cxx-standard: 23
python-version: '3.11'
- build: 2
build-python: ON
build-type: Debug
build-shared: ON
cxx-standard: 20
cxx-standard: 23
python-version: '3.11'
steps:
- name: Setup Python
Expand Down
3 changes: 1 addition & 2 deletions share/cmake/modules/FindExtPackages.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -179,8 +179,7 @@ if(OCIO_BUILD_PYTHON OR OCIO_BUILD_DOCS)
# pybind11 2.9 fixes issues with MS Visual Studio 2022 (Debug).
ocio_handle_dependency( pybind11 REQUIRED ALLOW_INSTALL
MIN_VERSION 2.9.2
RECOMMENDED_VERSION 2.9.2
RECOMMENDED_VERSION_REASON "Pybind 2.10.0+ does not work with Python 2.7 anymore")
RECOMMENDED_VERSION 2.11.1)
endif()
endif()

Expand Down
12 changes: 0 additions & 12 deletions src/bindings/python/PyPackedImageDesc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,7 @@ void bindPyPackedImageDesc(py::module & m)
.def(py::init([](py::buffer & data, long width, long height, long numChannels)
{
PyPackedImageDesc * p = new PyPackedImageDesc();

py::gil_scoped_release release;
p->m_data[0] = data;
py::gil_scoped_acquire acquire;

py::buffer_info info = p->m_data[0].request();
checkBufferType(info, py::dtype("float32"));
Expand All @@ -39,10 +36,7 @@ void bindPyPackedImageDesc(py::module & m)
ptrdiff_t yStrideBytes)
{
PyPackedImageDesc * p = new PyPackedImageDesc();

py::gil_scoped_release release;
p->m_data[0] = data;
py::gil_scoped_acquire acquire;

py::buffer_info info = p->m_data[0].request();
checkBufferType(info, bitDepth);
Expand All @@ -65,10 +59,7 @@ void bindPyPackedImageDesc(py::module & m)
ChannelOrdering chanOrder)
{
PyPackedImageDesc * p = new PyPackedImageDesc();

py::gil_scoped_release release;
p->m_data[0] = data;
py::gil_scoped_acquire acquire;

py::buffer_info info = p->m_data[0].request();
checkBufferType(info, py::dtype("float32"));
Expand All @@ -89,10 +80,7 @@ void bindPyPackedImageDesc(py::module & m)
ptrdiff_t yStrideBytes)
{
PyPackedImageDesc * p = new PyPackedImageDesc();

py::gil_scoped_release release;
p->m_data[0] = data;
py::gil_scoped_acquire acquire;

py::buffer_info info = p->m_data[0].request();
checkBufferType(info, bitDepth);
Expand Down

0 comments on commit 5499733

Please sign in to comment.