Skip to content

Commit

Permalink
deps: Make OCIO 2.2+ a required dependency (#4367)
Browse files Browse the repository at this point in the history
Make OCIO a hard dependency, at least version 2.2.

Revise and improve the OCIO "auto-build" scripts.

Remove OCIO 1.x testsuite reference output.

No longer need FindOpenColorIO.cmake module

As part of this, I split the CI "oldest/hobbled" test into two different
tests:

* oldest -- test against the oldest supported versions of all
dependencies.
* hobbled -- test against most optional dependencies missing and
optional features disabled.

---------

Signed-off-by: Larry Gritz <[email protected]>
  • Loading branch information
lgritz authored Aug 12, 2024
1 parent af13eb9 commit fb26ed8
Show file tree
Hide file tree
Showing 41 changed files with 104 additions and 104,520 deletions.
37 changes: 23 additions & 14 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,7 @@ jobs:
container: aswf/ci-osl:2022
vfxyear: 2022
cxx_std: 17
opencolorio_ver: v2.2.1
python_ver: 3.9
# simd: "avx2,f16c"
fmt_ver: 7.1.3
Expand All @@ -104,18 +105,22 @@ jobs:
FREETYPE_VERSION=VER-2-13-0
# For icc, use fp-model precise to eliminate needless LSB errors
# that make test results differ from other platforms.
- desc: icx/C++17 py3.9 exr3.1 ocio2.1 qt5.15
- desc: icx/C++17 py3.9 exr3.1 ocio2.2 qt5.15
nametag: linux-vfx2022-icx
runner: ubuntu-latest
container: aswf/ci-osl:2022
vfxyear: 2022
cc_compiler: icx
cxx_compiler: icpx
cxx_std: 17
opencolorio_ver: v2.3.2
python_ver: 3.9
simd: "avx2,f16c"
pybind11_ver: v2.9.0
simd: "avx2,f16c"
setenvs: export USE_OPENVDB=0
OPENCOLORIO_CXX=g++
# OCIO doesn't build with icx, so we have to force the ocio build
# to use g++.
- desc: sanitizers
nametag: sanitizer
runner: ubuntu-latest
Expand All @@ -124,6 +129,7 @@ jobs:
cc_compiler: clang
cxx_compiler: clang++
cxx_std: 17
opencolorio_ver: v2.3.2
python_ver: 3.9
setenvs: export SANITIZE=address,undefined
OIIO_CMAKE_FLAGS="-DSANITIZE=address,undefined -DUSE_PYTHON=0"
Expand All @@ -150,42 +156,42 @@ jobs:
simd: "avx2,f16c"
fmt_ver: 10.1.1
pybind11_ver: v2.12.0
- desc: oldest 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).
- desc: oldest gcc9.3/C++17 py3.7 exr-3.1
# Oldest versions of the dependencies that we support.
nametag: linux-oldest
runner: ubuntu-latest
container: aswf/ci-osl:2021
vfxyear: 2021
cxx_std: 17
fmt_ver: 7.0.1
opencolorio_ver: v2.2.1
openexr_ver: v3.1.0
pybind11_ver: v2.7.0
python_ver: 3.7
setenvs: export CMAKE_VERSION=3.15.5
PTEX_VERSION=v2.3.2
WEBP_VERSION=v1.1.0
depcmds: sudo rm -rf /usr/local/include/OpenEXR
- desc: hobbled gcc9.3/C++17 py3.7 exr-3.1 no-sse no-ocio
- desc: hobbled gcc9.3/C++17 py3.7 exr-3.1 no-sse
# Use the oldest supported versions of required dependencies, and
# disable most optional dependencies and features (no SSE, OCIO,
# or OpenCV, don't embed plugins).
# disable most optional dependencies and features (no SSE or
# OpenCV, don't embed plugins).
nametag: linux-disabled
runner: ubuntu-latest
container: aswf/ci-osl:2021
vfxyear: 2021
cxx_std: 17
fmt_ver: 7.0.1
opencolorio_ver: v2.2.1
openexr_ver: v3.1.0
pybind11_ver: v2.7.0
pybind11_ver: v2.4.2
python_ver: 3.7
simd: 0
setenvs: export EMBEDPLUGINS=0
CMAKE_VERSION=3.15.5
PTEX_VERSION=v2.3.2
WEBP_VERSION=v1.1.0
USE_JPEGTURBO=0
USE_OPENCOLORIO=0
USE_OPENCV=0
FREETYPE_VERSION=VER-2-10-0
depcmds: sudo rm -rf /usr/local/include/OpenEXR
Expand Down Expand Up @@ -220,6 +226,7 @@ jobs:
CMAKE_CXX_STANDARD: ${{matrix.cxx_std}}
USE_SIMD: ${{matrix.simd}}
FMT_VERSION: ${{matrix.fmt_ver}}
OPENCOLORIO_VERSION: ${{matrix.opencolorio_ver}}
OPENEXR_VERSION: ${{matrix.openexr_ver}}
PYBIND11_VERSION: ${{matrix.pybind11_ver}}
PYTHON_VERSION: ${{matrix.python_ver}}
Expand Down Expand Up @@ -308,14 +315,14 @@ jobs:
cxx_compiler: g++-12
cxx_std: 17
fmt_ver: 10.1.1
opencolorio_ver: v2.3.2
openexr_ver: v3.2.4
pybind11_ver: v2.12.0
python_ver: "3.10"
simd: avx2,f16c
setenvs: export LIBJPEGTURBO_VERSION=3.0.1
LIBRAW_VERSION=0.21.2
LIBTIFF_VERSION=v4.6.0
OPENCOLORIO_VERSION=v2.3.2
OPENJPEG_VERSION=v2.4.0
PTEX_VERSION=v2.4.2
PUGIXML_VERSION=v1.14
Expand All @@ -329,14 +336,14 @@ jobs:
cxx_compiler: g++-14
cxx_std: 20
fmt_ver: master
opencolorio_ver: main
openexr_ver: main
pybind11_ver: master
python_ver: "3.12"
simd: avx2,f16c
setenvs: export LIBJPEGTURBO_VERSION=main
LIBRAW_VERSION=master
LIBTIFF_VERSION=master
OPENCOLORIO_VERSION=main
OPENJPEG_VERSION=master
PTEX_VERSION=main
PUGIXML_VERSION=master
Expand Down Expand Up @@ -376,12 +383,12 @@ jobs:
cc_compiler: clang
cxx_std: 20
fmt_ver: 10.1.1
opencolorio_ver: v2.2.1
openexr_ver: v3.1.13
pybind11_ver: v2.12.0
python_ver: 3.8
simd: avx2,f16c
setenvs: export LLVM_VERSION=14.0.0
OPENCOLORIO_VERSION=v2.1.2
USE_OPENVDB=0
# The installed OpenVDB has a TLS conflict with Python 3.8
- desc: debug gcc9/C++17, sse4.2, exr3.1
Expand Down Expand Up @@ -425,7 +432,8 @@ jobs:
OIIO_CMAKE_FLAGS=-DUSE_PYTHON=0
LLVM_VERSION=17.0.6 LLVM_DISTRO_NAME=ubuntu-22.04
SKIP_SYSTEM_DEPS_INSTALL=1 QT_VERSION=0
OpenImageIO_BUILD_MISSING_DEPS=none
xOpenImageIO_BUILD_MISSING_DEPS=missing
OpenImageIO_OPTIONAL_DEPS=ALL

runs-on: ${{ matrix.runner }}
env:
Expand All @@ -434,6 +442,7 @@ jobs:
CMAKE_CXX_STANDARD: ${{matrix.cxx_std}}
USE_SIMD: ${{matrix.simd}}
FMT_VERSION: ${{matrix.fmt_ver}}
OPENCOLORIO_VERSION: ${{matrix.opencolorio_ver}}
OPENEXR_VERSION: ${{matrix.openexr_ver}}
PYBIND11_VERSION: ${{matrix.pybind11_ver}}
PYTHON_VERSION: ${{matrix.python_ver}}
Expand Down
3 changes: 1 addition & 2 deletions INSTALL.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ NEW or CHANGED MINIMUM dependencies since the last major release are **bold**.
* **Imath >= 3.1** (tested through 3.1.x and main)
* **OpenEXR >= 3.1** (tested through 3.2 and main)
* **libTIFF >= 4.0** (tested through 4.6)
* **OpenColorIO >= 2.2** (tested through 2.3)
* libjpeg >= 8 (tested through jpeg9e), or **libjpeg-turbo >= 2.1** (tested
through 3.0)
* **[fmtlib](https://github.com/fmtlib/fmt) >= 7.0** (tested through 10.2).
Expand Down Expand Up @@ -66,8 +67,6 @@ NEW or CHANGED MINIMUM dependencies since the last major release are **bold**.
* DCMTK >= 3.6.1 (tested through 3.6.8)
* If you want support for WebP images:
* **WebP >= 1.1** (tested through 1.4)
* If you want support for OpenColorIO color transformations:
* OpenColorIO >= 1.1 (tested through 2.3; 2.0+ is recommended)
* If you want support for Ptex:
* Ptex >= 2.3.1 (probably works for older; tested through 2.4.2)
* If you want to be able to do font rendering into images:
Expand Down
4 changes: 3 additions & 1 deletion src/build-scripts/build_opencolorio.bash
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,15 @@ set -ex

# Which OCIO to retrieve, how to build it
OPENCOLORIO_REPO=${OPENCOLORIO_REPO:=https://github.com/AcademySoftwareFoundation/OpenColorIO.git}
OPENCOLORIO_VERSION=${OPENCOLORIO_VERSION:=v2.2.1}
OPENCOLORIO_VERSION=${OPENCOLORIO_VERSION:=v2.3.2}

# Where to install the final results
LOCAL_DEPS_DIR=${LOCAL_DEPS_DIR:=${PWD}/ext}
OPENCOLORIO_SOURCE_DIR=${OPENCOLORIO_SOURCE_DIR:=${LOCAL_DEPS_DIR}/OpenColorIO}
OPENCOLORIO_BUILD_DIR=${OPENCOLORIO_BUILD_DIR:=${LOCAL_DEPS_DIR}/OpenColorIO-build}
OPENCOLORIO_INSTALL_DIR=${OPENCOLORIO_INSTALL_DIR:=${LOCAL_DEPS_DIR}/dist}
OPENCOLORIO_BUILD_TYPE=${OPENCOLORIO_BUILD_TYPE:=Release}
OPENCOLORIO_CXX=${OPENCOLORIO_CXX:=g++}
OPENCOLORIO_CXX_FLAGS=${OPENCOLORIO_CXX_FLAGS:="-Wno-unused-function -Wno-deprecated-declarations -Wno-cast-qual -Wno-write-strings"}
# Just need libs:
OPENCOLORIO_BUILDOPTS="-DOCIO_BUILD_APPS=OFF -DOCIO_BUILD_NUKE=OFF \
Expand Down Expand Up @@ -46,6 +47,7 @@ git checkout ${OPENCOLORIO_VERSION} --force
time cmake -S . -B ${OPENCOLORIO_BUILD_DIR} \
-DCMAKE_BUILD_TYPE=${OPENCOLORIO_BUILD_TYPE} \
-DCMAKE_INSTALL_PREFIX=${OPENCOLORIO_INSTALL_DIR} \
-DCMAKE_CXX_COMPILER=${OPENCOLORIO_CXX} \
-DCMAKE_CXX_FLAGS="${OPENCOLORIO_CXX_FLAGS}" \
${OPENCOLORIO_BUILDOPTS}
time cmake --build ${OPENCOLORIO_BUILD_DIR} --config Release --target install
Expand Down
2 changes: 1 addition & 1 deletion src/build-scripts/ci-build.bash
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ cmake -S $OIIO_SRC_DIR -B $OIIO_BUILD_DIR -G "$CMAKE_GENERATOR" \
$OIIO_CMAKE_FLAGS -DVERBOSE=1

# Save a copy of the generated files for debugging broken CI builds.
mkdir ${OIIO_BUILD_DIR}/cmake-save || /bin/true
mkdir ${OIIO_BUILD_DIR}/cmake-save || true
cp -r ${OIIO_BUILD_DIR}/CMake* ${OIIO_BUILD_DIR}/*.cmake ${OIIO_BUILD_DIR}/cmake-save

: ${BUILDTARGET:=install}
Expand Down
1 change: 0 additions & 1 deletion src/build-scripts/ci-startup.bash
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@ export LD_LIBRARY_PATH=${LOCAL_DEPS_DIR}/dist/lib:$LD_LIBRARY_PATH
export LD_LIBRARY_PATH=${LOCAL_DEPS_DIR}/dist/lib64:$LD_LIBRARY_PATH
export DYLD_LIBRARY_PATH=${LOCAL_DEPS_DIR}/dist/lib:$DYLD_LIBRARY_PATH

# export OCIO="$PWD/testsuite/common/OpenColorIO/nuke-default/config.ocio"
export TESTSUITE_CLEANUP_ON_SUCCESS=${TESTSUITE_CLEANUP_ON_SUCCESS:=1}

# For CI, default to building missing dependencies automatically
Expand Down
1 change: 1 addition & 0 deletions src/cmake/Config.cmake.in
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ if (NOT @BUILD_SHARED_LIBS@)
# INTERFACE_LINK_LIBRARIES. If the project does not know about PNG target, it will cause
# configuration error about unknown targets being linked in.
find_dependency(TIFF)
find_dependency(OpenColorIO)
if (@JPEG_FOUND@)
find_dependency(JPEG)
endif()
Expand Down
17 changes: 13 additions & 4 deletions src/cmake/build_OpenColorIO.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,14 @@ set_cache (OpenColorIO_BUILD_SHARED_LIBS ON
# it all work with the static dependencies, it just makes things complicated
# downstream.

# Clear variables from the failed find_package
unset (OPENCOLORIO_LIBRARY)
unset (OPENCOLORIO_INCLUDE_DIR)
unset (FIND_PACKAGE_MESSAGE_DETAILS_OpenColorIO)
unset (OPENCOLORIO_VERSION_MAJOR)
unset (OPENCOLORIO_VERSION_MINOR)
unset (OpenColorIO_DIR)

string (MAKE_C_IDENTIFIER ${OpenColorIO_BUILD_VERSION} OpenColorIO_VERSION_IDENT)

build_dependency_with_cmake(OpenColorIO
Expand All @@ -35,8 +43,8 @@ build_dependency_with_cmake(OpenColorIO
-D OCIO_INSTALL_EXT_PACKAGES=MISSING
# Give the library a custom name and symbol namespace so it can't
# conflict with any others in the system or linked into the same app.
-D OCIO_NAMESPACE=${PROJ_NAMESPACE_V}_OpenColorIO
-D OCIO_LIBNAME_SUFFIX=_v${OpenColorIO_VERSION_IDENT}_${PROJ_NAMESPACE_V}
# -D OCIO_NAMESPACE=${OpenColorIO_VERSION_IDENT}_${PROJ_NAME}
-D OCIO_LIBNAME_SUFFIX=_v${OpenColorIO_VERSION_IDENT}_${PROJ_NAME}
)

# Set some things up that we'll need for a subsequent find_package to work
Expand All @@ -46,8 +54,9 @@ set (OpenColorIO_ROOT ${OpenColorIO_LOCAL_INSTALL_DIR})
set (OpenColorIO_DIR ${OpenColorIO_LOCAL_INSTALL_DIR})

# Signal to caller that we need to find again at the installed location
set (OpenColorIO_REFIND TRUE)
set (OpenColorIO_REFIND_ARGS CONFIG)
# set (OpenColorIO_REFIND TRUE)
# set (OpenColorIO_REFIND_ARGS CONFIG)
find_package (OpenColorIO ${OpenColorIO_BUILD_VERSION} EXACT CONFIG REQUIRED)

if (OpenColorIO_BUILD_SHARED_LIBS)
install_local_dependency_libs (OpenColorIO OpenColorIO)
Expand Down
22 changes: 6 additions & 16 deletions src/cmake/externalpackages.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -129,23 +129,13 @@ checked_find_package (Freetype
VERSION_MIN 2.10.0
DEFINITIONS USE_FREETYPE=1 )

checked_find_package (OpenColorIO
VERSION_MIN 1.1
checked_find_package (OpenColorIO REQUIRED
VERSION_MIN 2.2
VERSION_MAX 2.9
NO_FP_RANGE_CHECK
DEFINITIONS USE_OCIO=1 USE_OPENCOLORIO=1
)
if (OpenColorIO_FOUND)
option (OIIO_DISABLE_BUILTIN_OCIO_CONFIGS
"For deveoper debugging/testing ONLY! Disable OCIO 2.2 builtin configs." OFF)
if (OIIO_DISABLE_BUILTIN_OCIO_CONFIGS OR "$ENV{OIIO_DISABLE_BUILTIN_OCIO_CONFIGS}")
add_compile_definitions(OIIO_DISABLE_BUILTIN_OCIO_CONFIGS)
endif ()
if (NOT OPENCOLORIO_INCLUDES)
get_target_property(OPENCOLORIO_INCLUDES OpenColorIO::OpenColorIO INTERFACE_INCLUDE_DIRECTORIES)
endif ()
else ()
set (OpenColorIO_FOUND 0)
PREFER_CONFIG
)
if (NOT OPENCOLORIO_INCLUDES)
get_target_property(OPENCOLORIO_INCLUDES OpenColorIO::OpenColorIO INTERFACE_INCLUDE_DIRECTORIES)
endif ()
include_directories(BEFORE ${OPENCOLORIO_INCLUDES})

Expand Down
Loading

0 comments on commit fb26ed8

Please sign in to comment.