Skip to content

Commit

Permalink
Merge branch 'master' into adsk_contrib/change_cpp_version
Browse files Browse the repository at this point in the history
  • Loading branch information
remia authored Oct 7, 2021
2 parents 53f4322 + ac8290d commit 7367989
Show file tree
Hide file tree
Showing 13 changed files with 132 additions and 56 deletions.
12 changes: 12 additions & 0 deletions .github/workflows/ci_workflow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,10 @@ jobs:
sse=${{ matrix.use-sse }},
cxx=${{ matrix.cxx-standard }},
docs=${{ matrix.build-docs }}>'
# Avoid duplicated checks when a pull_request is opened from a local branch.
if: |
github.event_name == 'push' ||
github.event.pull_request.head.repo.full_name != github.repository
# GH-hosted VM. The build runs in CentOS 7 'container' defined below.
runs-on: ubuntu-latest
container:
Expand Down Expand Up @@ -306,6 +310,10 @@ jobs:
cxx=${{ matrix.cxx-standard }},
python=${{ matrix.python-version }},
docs=${{ matrix.build-docs }}>'
# Avoid duplicated checks when a pull_request is opened from a local branch.
if: |
github.event_name == 'push' ||
github.event.pull_request.head.repo.full_name != github.repository
runs-on: macos-10.15
strategy:
matrix:
Expand Down Expand Up @@ -440,6 +448,10 @@ jobs:
cxx=${{ matrix.cxx-standard }},
python=${{ matrix.python-version }},
docs=${{ matrix.build-docs }}>'
# Avoid duplicated checks when a pull_request is opened from a local branch.
if: |
github.event_name == 'push' ||
github.event.pull_request.head.repo.full_name != github.repository
runs-on: windows-2019
strategy:
matrix:
Expand Down
100 changes: 63 additions & 37 deletions .github/workflows/wheel_workflow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,41 +6,33 @@ name: Wheel

on:
push:
# Versioned branches and tags are ignored for OCIO <= 1.x.x
branches-ignore:
- RB-0.*
- RB-1.*
- gh-pages
tags-ignore:
- v0.*
- v1.*
# Workflow run on tags for v2 only.
tags:
- v2.*
pull_request:
# Workflow run on pull_request only when related files change.
branches-ignore:
- RB-0.*
- RB-1.*
- gh-pages
tags-ignore:
- v0.*
- v1.*
paths:
- .github/workflows/wheel_workflow.yml
- pyproject.toml
schedule:
# Nightly build
- cron: "0 0 * * *"

jobs:
# Linux jobs run in Docker containers (manylinux), so the latest OS version
# is OK. macOS and Windows jobs need to be locked to specific virtual
# environment versions to mitigate issues from OS updates, and will require
# maintenance as OS versions are retired.
#
# Notes:
#
# Documentation fails to build on manylinux2010, maybe too old
# doxygen ? First fail in PyColorSpaceSet for documentation
# referencing PyOpenColorIO (eg. __sub__). Consequence is we don't
# support python 2.7, alternatively build without docstrings, or
# fix the doxygen issue.
#
# When installing doc environment, Python package are not used as the wheel
# is built in it's own isolated environment, hence package are listed again
# in pyproject.toml.
#
# Due to documentation build failing on manylinux2010 (maybe too old doxygen
# version), we build on manylinux2014 image, this requires pip >= 19.3.

# ---------------------------------------------------------------------------
# Linux
Expand All @@ -67,6 +59,9 @@ jobs:
- build: CPython 3.9 32 bits
python: cp39-*
arch: i686
- build: CPython 3.10 32 bits
python: cp310-*
arch: i686
# -------------------------------------------------------------------
# CPython 64 bits
# -------------------------------------------------------------------
Expand All @@ -82,6 +77,27 @@ jobs:
- build: CPython 3.9 64 bits
python: cp39-*
arch: x86_64
- build: CPython 3.10 64 bits
python: cp310-*
arch: x86_64
# -------------------------------------------------------------------
# CPython ARM 64 bits
# -------------------------------------------------------------------
- build: CPython 3.6 ARM 64 bits
python: cp36-*
arch: aarch64
- build: CPython 3.7 ARM 64 bits
python: cp37-*
arch: aarch64
- build: CPython 3.8 ARM 64 bits
python: cp38-*
arch: aarch64
- build: CPython 3.9 ARM 64 bits
python: cp39-*
arch: aarch64
- build: CPython 3.10 ARM 64 bits
python: cp310-*
arch: aarch64

steps:
- uses: actions/checkout@v2
Expand All @@ -91,17 +107,16 @@ jobs:
with:
python-version: '3.8'

- name: Set up QEMU
uses: docker/setup-qemu-action@v1
with:
platforms: all

- name: Build wheels
uses: joerick/cibuildwheel@v1.12.0
uses: joerick/cibuildwheel@v2.1.2
env:
CIBW_MANYLINUX_X86_64_IMAGE: manylinux2014
CIBW_MANYLINUX_I686_IMAGE: manylinux2014
CIBW_BUILD_VERBOSITY: 1
CIBW_BUILD: ${{ matrix.python }}
CIBW_ARCHS: ${{ matrix.arch }}
CIBW_BEFORE_BUILD: share/ci/scripts/linux/yum/install_docs_env.sh
CIBW_TEST_REQUIRES: numpy
CIBW_TEST_COMMAND: python -m PyOpenColorIOTests.OpenColorIOTestSuite

- uses: actions/upload-artifact@v2
with:
Expand All @@ -117,6 +132,13 @@ jobs:
strategy:
matrix:
include:
# Python 3.10 can be enabled when numpy ship the binary wheel (which
# we use during tests). Building it within GH produces the following:
# RuntimeError: Polyfit sanity test emitted a warning, most likely due
# to using a buggy Accelerate backend. If you compiled yourself, see
# site.cfg.example for information. Otherwise report this to the vendor
# that provided NumPy.

# -------------------------------------------------------------------
# CPython 64 bits
# -------------------------------------------------------------------
Expand All @@ -132,6 +154,9 @@ jobs:
- build: CPython 3.9 64 bits
python: cp39-*
arch: x86_64
# - build: CPython 3.10 64 bits
# python: cp310-*
# arch: x86_64
# -------------------------------------------------------------------
# CPython ARM 64 bits
# -------------------------------------------------------------------
Expand All @@ -141,6 +166,9 @@ jobs:
- build: CPython 3.9 ARM 64 bits
python: cp39-*
arch: arm64
# - build: CPython 3.10 ARM 64 bits
# python: cp310-*
# arch: arm64

steps:
- uses: actions/checkout@v2
Expand All @@ -151,14 +179,10 @@ jobs:
python-version: '3.8'

- name: Build wheels
uses: joerick/cibuildwheel@v1.12.0
uses: joerick/cibuildwheel@v2.1.2
env:
CIBW_BUILD_VERBOSITY: 1
CIBW_BUILD: ${{ matrix.python }}
CIBW_ARCHS: ${{ matrix.arch }}
CIBW_BEFORE_BUILD: share/ci/scripts/macos/install_docs_env.sh
CIBW_TEST_REQUIRES: numpy
CIBW_TEST_COMMAND: python -m PyOpenColorIOTests.OpenColorIOTestSuite

- uses: actions/upload-artifact@v2
with:
Expand Down Expand Up @@ -189,6 +213,9 @@ jobs:
- build: CPython 3.9 32 bits
python: cp39-*
arch: x86
- build: CPython 3.10 32 bits
python: cp310-*
arch: x86
# -------------------------------------------------------------------
# CPython 64 bits
# -------------------------------------------------------------------
Expand All @@ -204,6 +231,9 @@ jobs:
- build: CPython 3.9 64 bits
python: cp39-*
arch: AMD64
- build: CPython 3.10 64 bits
python: cp310-*
arch: AMD64

steps:
- uses: actions/checkout@v2
Expand All @@ -214,14 +244,10 @@ jobs:
python-version: '3.8'

- name: Build wheels
uses: joerick/cibuildwheel@v1.12.0
uses: joerick/cibuildwheel@v2.1.2
env:
CIBW_BUILD_VERBOSITY: 1
CIBW_BUILD: ${{ matrix.python }}
CIBW_ARCHS: ${{ matrix.arch }}
CIBW_BEFORE_BUILD: bash -c share/ci/scripts/windows/install_docs_env.sh
CIBW_TEST_REQUIRES: numpy
CIBW_TEST_COMMAND: python -m PyOpenColorIOTests.OpenColorIOTestSuite

- uses: actions/upload-artifact@v2
with:
Expand Down
5 changes: 5 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,11 @@ include (CTest)
enable_testing()


###############################################################################
# Provides install directory variables as defined by the GNU Coding Standards.
include(GNUInstallDirs)


###############################################################################
# Forbid in-source build.

Expand Down
19 changes: 19 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,22 @@ requires = [
"breathe"
]
build-backend = "setuptools.build_meta"

[tool.cibuildwheel]
build-verbosity = "1"

test-command = "python -m PyOpenColorIOTests.OpenColorIOTestSuite"
test-requires = ["numpy"]

manylinux-x86_64-image = "manylinux2014"
manylinux-i686-image = "manylinux2014"
manylinux-aarch64-image = "manylinux2014"

[tool.cibuildwheel.linux]
before-build = "share/ci/scripts/linux/yum/install_docs_env.sh"

[tool.cibuildwheel.macos]
before-build = "share/ci/scripts/macos/install_docs_env.sh"

[tool.cibuildwheel.windows]
before-build = "bash -c share/ci/scripts/windows/install_docs_env.sh"
4 changes: 2 additions & 2 deletions share/cmake/utils/CompilerFlags.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -98,8 +98,8 @@ if (UNIX AND NOT CMAKE_SKIP_RPATH)
# (i.e. a binary loading a dynamic library) and then from the current directory
# (i.e. dynamic library loading another dynamic library).
if (APPLE)
set(CMAKE_INSTALL_RPATH "@loader_path/../lib;@loader_path")
set(CMAKE_INSTALL_RPATH "@loader_path/../${CMAKE_INSTALL_LIBDIR};@loader_path")
else()
set(CMAKE_INSTALL_RPATH "$ORIGIN/../lib;$ORIGIN")
set(CMAKE_INSTALL_RPATH "$ORIGIN/../${CMAKE_INSTALL_LIBDIR};$ORIGIN")
endif()
endif()
2 changes: 0 additions & 2 deletions src/OpenColorIO/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -173,8 +173,6 @@ if(NOT WIN32)

# Install the pkg-config file.

include(GNUInstallDirs)

set(prefix ${CMAKE_INSTALL_PREFIX})
set(exec_prefix "\${prefix}")
set(libdir "\${exec_prefix}/${CMAKE_INSTALL_LIBDIR}")
Expand Down
11 changes: 11 additions & 0 deletions src/apps/ocioconvert/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -625,6 +625,17 @@ int main(int argc, const char **argv)
exit(1);
}

if (useDisplayView)
{
OCIO::ConstConfigRcPtr config = OCIO::GetCurrentConfig();
outputcolorspace = config->getDisplayViewColorSpaceName(display, view);
}

if (outputcolorspace)
{
spec.attribute("oiio:ColorSpace", outputcolorspace);
}

f->open(outputimage, spec);

if(!f->write_image(spec.format, img.getBuffer()))
Expand Down
4 changes: 2 additions & 2 deletions src/bindings/python/PyGpuShaderDesc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ void bindPyGpuShaderDesc(py::module & m)
const py::buffer & values)
{
py::buffer_info info = values.request();
ssize_t numChannels;
py::ssize_t numChannels;

switch (channel)
{
Expand Down Expand Up @@ -252,7 +252,7 @@ void bindPyGpuShaderDesc(py::module & m)
const float * values;
self.m_shaderDesc->getTextureValues(self.m_index, values);

ssize_t numChannels;
py::ssize_t numChannels;
switch (self.m_channel)
{
case GpuShaderDesc::TEXTURE_RED_CHANNEL:
Expand Down
8 changes: 4 additions & 4 deletions src/bindings/python/PyUtils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ const std::vector<std::string> FLOAT_FORMATS = { "e", "f", "d", "g", "Ze", "Zf",

} // namespace

std::string formatCodeToDtypeName(const std::string & format, ssize_t numBits)
std::string formatCodeToDtypeName(const std::string & format, py::ssize_t numBits)
{
std::ostringstream os;

Expand Down Expand Up @@ -85,7 +85,7 @@ py::dtype bitDepthToDtype(BitDepth bitDepth)
return py::dtype(name);
}

ssize_t bitDepthToBytes(BitDepth bitDepth)
py::ssize_t bitDepthToBytes(BitDepth bitDepth)
{
std::string name, err;

Expand Down Expand Up @@ -179,7 +179,7 @@ void checkBufferType(const py::buffer_info & info, BitDepth bitDepth)
checkBufferType(info, bitDepthToDtype(bitDepth));
}

void checkBufferDivisible(const py::buffer_info & info, ssize_t numChannels)
void checkBufferDivisible(const py::buffer_info & info, py::ssize_t numChannels)
{
if (info.size % numChannels != 0)
{
Expand All @@ -190,7 +190,7 @@ void checkBufferDivisible(const py::buffer_info & info, ssize_t numChannels)
}
}

void checkBufferSize(const py::buffer_info & info, ssize_t numEntries)
void checkBufferSize(const py::buffer_info & info, py::ssize_t numEntries)
{
if (info.size != numEntries)
{
Expand Down
8 changes: 4 additions & 4 deletions src/bindings/python/PyUtils.h
Original file line number Diff line number Diff line change
Expand Up @@ -61,11 +61,11 @@ struct PyIterator
};

// Convert Python buffer protocol format code to NumPy dtype name
std::string formatCodeToDtypeName(const std::string & format, ssize_t numBits);
std::string formatCodeToDtypeName(const std::string & format, py::ssize_t numBits);
// Convert OCIO BitDepth to NumPy dtype
py::dtype bitDepthToDtype(BitDepth bitDepth);
// Convert OCIO BitDepth to data type byte count
ssize_t bitDepthToBytes(BitDepth bitDepth);
py::ssize_t bitDepthToBytes(BitDepth bitDepth);
// Convert OCIO ChannelOrdering to channel count
long chanOrderToNumChannels(ChannelOrdering chanOrder);

Expand All @@ -79,9 +79,9 @@ void checkBufferType(const py::buffer_info & info, const py::dtype & dt);
// Throw if Python buffer format is incompatible with an OCIO BitDepth
void checkBufferType(const py::buffer_info & info, BitDepth bitDepth);
// Throw if Python buffer size is not divisible by channel count
void checkBufferDivisible(const py::buffer_info & info, ssize_t numChannels);
void checkBufferDivisible(const py::buffer_info & info, py::ssize_t numChannels);
// Throw if Python buffer does not have an exact count of entries
void checkBufferSize(const py::buffer_info & info, ssize_t numEntries);
void checkBufferSize(const py::buffer_info & info, py::ssize_t numEntries);

// Calculate 3D grid size from a packed 3D LUT buffer
unsigned long getBufferLut3DGridSize(const py::buffer_info & info);
Expand Down
2 changes: 1 addition & 1 deletion src/bindings/python/transforms/PyLut1DTransform.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ void bindPyLut1DTransform(py::module & m)
py::gil_scoped_acquire acquire;

return py::array(py::dtype("float32"),
{ static_cast<ssize_t>(values.size()) },
{ static_cast<py::ssize_t>(values.size()) },
{ sizeof(float) },
values.data());
})
Expand Down
Loading

0 comments on commit 7367989

Please sign in to comment.