Compare commits

..
3 Commits
Author SHA1 Message Date
d1ef24cbf8 Integration - Fixes from main into RB-2.2 - Adsk Contrib (#1750)
* Changing version release type for 2.2.1 official release.

Signed-off-by: Cédrik Fuoco <cedrik.fuoco@autodesk.com>

* replace texture2D function with texture for GLSL 1.3 (#1723)

Signed-off-by: Bart Styczen <bart.styczen@cine.dev>

Signed-off-by: Bart Styczen <bart.styczen@cine.dev>
Co-authored-by: Doug Walker <doug.walker@autodesk.com>
(cherry picked from commit d5cedbf551)
Signed-off-by: Cédrik Fuoco <cedrik.fuoco@autodesk.com>

* CheckSupportSSE2: Fix sse flags unexpected propagation (#1721)

Set function will affects all variables in current directory. If sse
flags are added in CheckSupportSSE2.cmake, they will remain in
Findminizip-ng.cmake which will cause liblzma cannot be detected. This
patch keep CMAKE_REQUIRED_FLAGS being changed only in current file
scope. This patch has been tested on riscv64.

Signed-off-by: Letu Ren <fantasquex@gmail.com>

Signed-off-by: Letu Ren <fantasquex@gmail.com>
Co-authored-by: Doug Walker <doug.walker@autodesk.com>
(cherry picked from commit b6e40f4fca)
Signed-off-by: Cédrik Fuoco <cedrik.fuoco@autodesk.com>

* Adsk contrib - Fix issue with minizip build (#1725)

* - Refactoring how OCIO search for minizip-ng. The first step is to search for an external minizip-ng. If not found, search for minizip-ng with MZ_COMPAT=ON (libminizip). If it is not found either, download and install minizip-ng with MZ_COMPAT=OFF.
- Removing the minizip-ng part for the includes for minizip-ng headers.

Signed-off-by: Cédrik Fuoco <cedrik.fuoco@autodesk.com>

* Update comments

Signed-off-by: Cédrik Fuoco <cedrik.fuoco@autodesk.com>

* Improved find_package in Config mode (adding it back)
Added missing scripts to install minizip-ng and zlib for the analysis workflow

Signed-off-by: Cédrik Fuoco <cedrik.fuoco@autodesk.com>

* Adding +x permissions for install_minizip_ng and zlib
Fixing path to find zlib in install_minizip-ng.sh

Signed-off-by: Cédrik Fuoco <cedrik.fuoco@autodesk.com>

* Changing target name to match the one used by minizip-ng library (+ using the imported target instead of creating a new one when minizip-ng is found)

Signed-off-by: Cédrik Fuoco <cedrik.fuoco@autodesk.com>

Signed-off-by: Cédrik Fuoco <cedrik.fuoco@autodesk.com>
Co-authored-by: Doug Walker <doug.walker@autodesk.com>
(cherry picked from commit 811902b37d)
Signed-off-by: Cédrik Fuoco <cedrik.fuoco@autodesk.com>

* Adsk contrib - Processor cache does not detect changes in cccid (#1726)

* For Looks that has a FileTransform and for Colorspace with FileTransfrom, add the CCCID to the processor's cache key for that transform.

Signed-off-by: Cédrik Fuoco <cedrik.fuoco@autodesk.com>

* Removing the workaround in the related unit tests and fixing the issue by adding the environment variable to the context using setStringVar. The processor's cache key is using the context cache ID which has all the context variables taken into account.

Signed-off-by: Cédrik Fuoco <cedrik.fuoco@autodesk.com>

* Now using addStringVars and creating a new context instead of reusing the one used for the filename.

Signed-off-by: Cédrik Fuoco <cedrik.fuoco@autodesk.com>

* Adding cccid to the context when there are no context variable.

Signed-off-by: Cédrik Fuoco <cedrik.fuoco@autodesk.com>

* Adding a few unit tests to test that the processor is different when changing the FileTransform's CCCID.

Signed-off-by: Cédrik Fuoco <cedrik.fuoco@autodesk.com>

* Using setStringVar to set CCNUM context variable in unit test.

Signed-off-by: Cédrik Fuoco <cedrik.fuoco@autodesk.com>

* Adding a test in FileTransform to test CollectContextVariables directly.

Signed-off-by: Cédrik Fuoco <cedrik.fuoco@autodesk.com>

* Minor tweaks for the unit test

Signed-off-by: Cédrik Fuoco <cedrik.fuoco@autodesk.com>

Signed-off-by: Cédrik Fuoco <cedrik.fuoco@autodesk.com>
Co-authored-by: Doug Walker <doug.walker@autodesk.com>
(cherry picked from commit 4fa775030a)
Signed-off-by: Cédrik Fuoco <cedrik.fuoco@autodesk.com>

* Adsk contrib - Configure the OpenColorIO.pc file on Windows (#1720)

* Configure the OpenColorIO.pc file on Windows and fix an issue where CMAKE_INSTALL_PREFIX wasn't included in the cmake build command in ocio.bat.

Signed-off-by: Cédrik Fuoco <cedrik.fuoco@autodesk.com>

* Removing pkconfig folder since that PC file is not used.

Signed-off-by: Cédrik Fuoco <cedrik.fuoco@autodesk.com>

* Small tweak in the configuration of OpenColorIO.cmake.in to handle absolute path with CMAKE_INSTALL_LIBDIR or CMAKE_INSTALL_INCLUDEDIR.
Keeping exec_prefix for CMAKE_INSTALL_INCLUDE_DIR since it was changed for a specific issue on Mac (see PR #1120).

Signed-off-by: Cédrik Fuoco <cedrik.fuoco@autodesk.com>

* Using ${prefix} for includedir

Signed-off-by: Cédrik Fuoco <cedrik.fuoco@autodesk.com>

Signed-off-by: Cédrik Fuoco <cedrik.fuoco@autodesk.com>
Co-authored-by: Doug Walker <doug.walker@autodesk.com>
(cherry picked from commit 332462e7f5)
Signed-off-by: Cédrik Fuoco <cedrik.fuoco@autodesk.com>

* Adsk contrib - Hiding minizip-ng symbols on Mac (#1729)

* Hiding minizip-ng symbols on Mac

Signed-off-by: Cédrik Fuoco <cedrik.fuoco@autodesk.com>

* Fixing a linking issue related to the code that tries to hide expat symbols and small refactor to add robustness.

Signed-off-by: Cédrik Fuoco <cedrik.fuoco@autodesk.com>

Signed-off-by: Cédrik Fuoco <cedrik.fuoco@autodesk.com>
Co-authored-by: Doug Walker <doug.walker@autodesk.com>
(cherry picked from commit 907ed3be17)
Signed-off-by: Cédrik Fuoco <cedrik.fuoco@autodesk.com>

* Adsk contrib - Fix issue with is colorspace linear (#1734)

* Throw when the colorspace is undefined for isColorSpaceLinear method. (+ unit test)

Signed-off-by: Cédrik Fuoco <cedrik.fuoco@autodesk.com>

* Typo

Signed-off-by: Cédrik Fuoco <cedrik.fuoco@autodesk.com>

Signed-off-by: Cédrik Fuoco <cedrik.fuoco@autodesk.com>
Co-authored-by: Doug Walker <doug.walker@autodesk.com>
(cherry picked from commit 6d7c4791f1)
Signed-off-by: Cédrik Fuoco <cedrik.fuoco@autodesk.com>

* Adsk Contrib - Improve naming of ICC-based displays on Windows (#1742)

* Adding a method to get the Monitor's userFriendlyName if available

Signed-off-by: Cédrik Fuoco <cedrik.fuoco@autodesk.com>

* Removing the slashes at the start of the display name

Signed-off-by: Cédrik Fuoco <cedrik.fuoco@autodesk.com>

* Adding descriptions and comments.
Adding troubleshooting script that print the monitor display name and ICC profile path.

Signed-off-by: Cédrik Fuoco <cedrik.fuoco@autodesk.com>

* no message

Signed-off-by: Cédrik Fuoco <cedrik.fuoco@autodesk.com>

* Comments

Signed-off-by: Cédrik Fuoco <cedrik.fuoco@autodesk.com>

Signed-off-by: Cédrik Fuoco <cedrik.fuoco@autodesk.com>
Co-authored-by: Doug Walker <doug.walker@autodesk.com>
(cherry picked from commit 1d126b56e9)
Signed-off-by: Cédrik Fuoco <cedrik.fuoco@autodesk.com>

* Fix minizip-ng CMake args passing (#1741)

Signed-off-by: Rémi Achard <remiachard@gmail.com>

Signed-off-by: Rémi Achard <remiachard@gmail.com>
Co-authored-by: Doug Walker <doug.walker@autodesk.com>
(cherry picked from commit 051241c9f1)
Signed-off-by: Cédrik Fuoco <cedrik.fuoco@autodesk.com>

* Fix inverse Lut1D optimization bug (#1743)

Signed-off-by: Doug Walker <doug.walker@autodesk.com>

Signed-off-by: Doug Walker <doug.walker@autodesk.com>
(cherry picked from commit 5152635a18)
Signed-off-by: Cédrik Fuoco <cedrik.fuoco@autodesk.com>

* Update documentation for 2.2 release (#1738)

* Update documentation for 2.2 release

Signed-off-by: Doug Walker <doug.walker@autodesk.com>

* Fix typos

Signed-off-by: Doug Walker <doug.walker@autodesk.com>

* Remove V2_DOC_README.md

Signed-off-by: Doug Walker <doug.walker@autodesk.com>

* Tweaks to 2.2

Signed-off-by: Doug Walker <doug.walker@autodesk.com>

* Improve installation section

Signed-off-by: Doug Walker <doug.walker@autodesk.com>

* Add link to demo config

Signed-off-by: Doug Walker <doug.walker@autodesk.com>

* Fix typos

Signed-off-by: Doug Walker <doug.walker@autodesk.com>

* Improve file_rules section

Signed-off-by: Doug Walker <doug.walker@autodesk.com>

Signed-off-by: Doug Walker <doug.walker@autodesk.com>
(cherry picked from commit 17f5c98f9b)
Signed-off-by: Cédrik Fuoco <cedrik.fuoco@autodesk.com>

* Adsk Contrib - OCIO cmake improvements (#1736)

* - Refactoring how OCIO search for minizip-ng. The first step is to search for an external minizip-ng. If not found, search for minizip-ng with MZ_COMPAT=ON (libminizip). If it is not found either, download and install minizip-ng with MZ_COMPAT=OFF.
- Removing the minizip-ng part for the includes for minizip-ng headers.

Signed-off-by: Cédrik Fuoco <cedrik.fuoco@autodesk.com>

* Update comments

Signed-off-by: Cédrik Fuoco <cedrik.fuoco@autodesk.com>

* Improved find_package in Config mode (adding it back)
Added missing scripts to install minizip-ng and zlib for the analysis workflow

Signed-off-by: Cédrik Fuoco <cedrik.fuoco@autodesk.com>

* Adding +x permissions for install_minizip_ng and zlib
Fixing path to find zlib in install_minizip-ng.sh

Signed-off-by: Cédrik Fuoco <cedrik.fuoco@autodesk.com>

* Changing target name to match the one used by minizip-ng library (+ using the imported target instead of creating a new one when minizip-ng is found)

Signed-off-by: Cédrik Fuoco <cedrik.fuoco@autodesk.com>

* First pass for the OpenColorIOConfig.cmake file with the required dependencies only.
A few extra fixes for OpenEXR, ZLIB and Minizip-ng.

Signed-off-by: Cédrik Fuoco <cedrik.fuoco@autodesk.com>

* Adding a informative message when building static ocio instead of per module.

Signed-off-by: Cédrik Fuoco <cedrik.fuoco@autodesk.com>

* Adding an extra step to test the consumer app with static OpenColorIO for Windows, Linux and MacOS.

Signed-off-by: Cédrik Fuoco <cedrik.fuoco@autodesk.com>

* Re-using the same test instead of creating a new one by removing the condition on build-shared.

Signed-off-by: Cédrik Fuoco <cedrik.fuoco@autodesk.com>

* Fixing spacing, typo and adding back the NOT in the condition. (it was removed for debugging purpose)

Signed-off-by: Cédrik Fuoco <cedrik.fuoco@autodesk.com>

* Changing directory where we share OCIO custom find modules (now in <install dir>/share/cmake/modules).
Adding a cmake macro when installing OCIO since it is needed by some custom find modules.
The find modules are only installed when building OCIO as a static library.
The config.cmake.in files now only looks for the dependency when OCIO was built as a static library.
Tentative (ci-workflow): Adding cmake-consumer test for static builds.
Overhaul of the Findzlib module to be more inline with the FindZLIB from cmake and to be more robust.

Signed-off-by: Cédrik Fuoco <cedrik.fuoco@autodesk.com>

* Adding missing backward slashes and saving the build path in an existing step instead of creating a new step.
Adding a check for CMake version for a section in Findzlib.cmake.
Re-phrasing some comments.

Signed-off-by: Cédrik Fuoco <cedrik.fuoco@autodesk.com>

* Prevent the download of the dependencies in the scenario where static OCIO is linked to a consumer project. Since OCIO_INSTALL_EXT_PACKAGES is not defined, our find module tries to download the dependencies, but we don't want that mecanism for consumer project.

Signed-off-by: Cédrik Fuoco <cedrik.fuoco@autodesk.com>

* Changing path where OCIO install its own custom find module.
Removing custom Findzlib and making modifications to use CMake FindZLIB.
Created a InstallZLIB module which does the download and install part if OCIO_INSTALL_EXT_PACAKGES is ALL or MISSING.
Tweaked config.cmake.in to use CMake FindZLIB.

Signed-off-by: Cédrik Fuoco <cedrik.fuoco@autodesk.com>

* Adding more details in comments

Signed-off-by: Cédrik Fuoco <cedrik.fuoco@autodesk.com>

* Removing an extra "shell" property in CI workflow.

Signed-off-by: Cédrik Fuoco <cedrik.fuoco@autodesk.com>

* Fix issues discovered with the failing CI workflow:

Cmake-consumer test now prefer the static version of the dependencies.
Fix an issue where yaml-cpp is not found by a consumer app (variable spelled incorectly in Findyaml-cpp).
Fix an issue expat library is not found by a consumer app on Windows.
Adding support for OCIO's  <pkg_name>_STATIC_LIBRARY for ZLIB while supporting ZLIB_USE_STATIC_LIBS (CMake 3.24+) from CMake's FindZLIB.

Signed-off-by: Cédrik Fuoco <cedrik.fuoco@autodesk.com>

* Removing pystring_STATIC_LIBRARY does not exists in CI workflow.
Detecting if the build is Debug in the find module that OCIO installs since they can't rely on variables set by OCIO CMakefiles.
Fix issue with yaml-cpp library naming in debug.

Signed-off-by: Cédrik Fuoco <cedrik.fuoco@autodesk.com>

* Fix issues on Windows with expat and minizip-ng library naming when building static OCIO.

Signed-off-by: Cédrik Fuoco <cedrik.fuoco@autodesk.com>

* Added option for macOS CI job in order to get more info on a failed job. Will be reverted once the issue is found.

Signed-off-by: Cédrik Fuoco <cedrik.fuoco@autodesk.com>

* Fixing a issue on macOS.
Improving ZLIB usage comments.
Bumping minizip-ng to the latest version - 3.0.7.
Bumping ZLIB to the latest version 2.1.13 to fix a vulnerability (CVE-2022-37434)

Signed-off-by: Cédrik Fuoco <cedrik.fuoco@autodesk.com>

* Proposing to remove Findminizip module since external minizip-ng build need to be done with the same option as the internal build.
Otherwise, linking and symbols issues are going to happend if the other libraries are not linked in correctly.
It is going to simplify the maintainability of OCIO.

Signed-off-by: Cédrik Fuoco <cedrik.fuoco@autodesk.com>

* Removing findminizip.cmake from the install since it does not exist anymore.

Signed-off-by: Cédrik Fuoco <cedrik.fuoco@autodesk.com>

Signed-off-by: Cédrik Fuoco <cedrik.fuoco@autodesk.com>
Signed-off-by: Cédrik Fuoco <105517825+cedrik-fuoco-adsk@users.noreply.github.com>
(cherry picked from commit 91761f256b)
Signed-off-by: Cédrik Fuoco <cedrik.fuoco@autodesk.com>

Signed-off-by: Cédrik Fuoco <cedrik.fuoco@autodesk.com>
Signed-off-by: Bart Styczen <bart.styczen@cine.dev>
Signed-off-by: Letu Ren <fantasquex@gmail.com>
Signed-off-by: Rémi Achard <remiachard@gmail.com>
Signed-off-by: Doug Walker <doug.walker@autodesk.com>
Signed-off-by: Cédrik Fuoco <105517825+cedrik-fuoco-adsk@users.noreply.github.com>
Co-authored-by: bartstyczen <93516126+bartstyczen@users.noreply.github.com>
Co-authored-by: Doug Walker <doug.walker@autodesk.com>
Co-authored-by: FantasqueX <voidren@outlook.com>
Co-authored-by: Rémi Achard <remiachard@gmail.com>
2023-01-05 21:05:59 -05:00
Cédrik Fuoco 5185626f9b Prepare for 2.2.1 bug fixes (#1727)
Signed-off-by: Cédrik Fuoco <cedrik.fuoco@autodesk.com>

Signed-off-by: Cédrik Fuoco <cedrik.fuoco@autodesk.com>
2022-12-02 14:27:02 -05:00
Cédrik Fuoco fb9390ece9 Removing dev for official release (#1716)
Signed-off-by: Cédrik Fuoco <cedrik.fuoco@autodesk.com>

Signed-off-by: Cédrik Fuoco <cedrik.fuoco@autodesk.com>
2022-10-31 18:27:35 -04:00
332 changed files with 4498 additions and 33068 deletions
+379 -2
View File
@@ -22,6 +22,381 @@ on:
- cron: "0 0 * * *"
jobs:
# ---------------------------------------------------------------------------
# Linux latest ext packages
# ---------------------------------------------------------------------------
linux_latest:
name: 'Linux CentOS 7 VFX CY${{ matrix.vfx-cy }} latest
<${{ matrix.compiler-desc }}
cxx=${{ matrix.cxx-standard }},
docs=${{ matrix.build-docs }}>'
# Don't run on OCIO forks
if: github.repository == 'AcademySoftwareFoundation/OpenColorIO'
# GH-hosted VM. The build runs in CentOS 7 'container' defined below.
runs-on: ubuntu-latest
container:
# DockerHub: https://hub.docker.com/u/aswf
# Source: https://github.com/AcademySoftwareFoundation/aswf-docker
image: aswf/ci-base:${{ matrix.vfx-cy }}
strategy:
matrix:
build: [1, 2, 3, 4]
include:
# -------------------------------------------------------------------
# GCC
# -------------------------------------------------------------------
# VFX CY2022, C++17, docs, OpenFX
- build: 1
build-docs: 'ON'
build-openfx: 'ON'
cxx-standard: 17
cxx-compiler: g++
cc-compiler: gcc
compiler-desc: GCC 9.3.1
vfx-cy: 2022
# VFX CY2021, C++14
- build: 2
build-docs: 'OFF'
build-openfx: 'OFF'
cxx-standard: 14
cxx-compiler: g++
cc-compiler: gcc
compiler-desc: GCC 9.3.1
vfx-cy: 2021
# -------------------------------------------------------------------
# Clang
# -------------------------------------------------------------------
# VFX CY2022, C++17
- build: 3
build-docs: 'OFF'
build-openfx: 'OFF'
cxx-standard: 17
cxx-compiler: clang++
cc-compiler: clang
compiler-desc: Clang 9
vfx-cy: 2022
# VFX CY2021, C++14, docs, OpenFX
- build: 4
build-docs: 'ON'
build-openfx: 'ON'
cxx-standard: 14
cxx-compiler: clang++
cc-compiler: clang
compiler-desc: Clang 9
vfx-cy: 2021
env:
CXX: ${{ matrix.cxx-compiler }}
CC: ${{ matrix.cc-compiler }}
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Install docs env
run: share/ci/scripts/linux/yum/install_docs_env.sh
if: matrix.build-docs == 'ON'
- name: Install tests env
run: share/ci/scripts/linux/yum/install_tests_env.sh
- name: Setup ext environment
run: |
EXT_PATH=/usr/local
echo "EXT_PATH=$EXT_PATH" >> $GITHUB_ENV
- name: Install indirect dependencies
run: |
share/ci/scripts/multi/install_pugixml.sh latest
- name: Install fixed ext package versions
# Minizip-ng depends on ZLIB. ZLIB must be installed first.
run: |
share/ci/scripts/multi/install_expat.sh 2.4.1 $EXT_PATH
share/ci/scripts/multi/install_lcms2.sh 2.2 $EXT_PATH
share/ci/scripts/multi/install_yaml-cpp.sh 0.7.0 $EXT_PATH
share/ci/scripts/multi/install_pystring.sh 1.1.3 $EXT_PATH
share/ci/scripts/multi/install_pybind11.sh 2.9.2 $EXT_PATH
share/ci/scripts/multi/install_zlib.sh 1.2.12 $EXT_PATH
share/ci/scripts/multi/install_minizip-ng.sh 3.0.6 $EXT_PATH
- name: Install latest ext package versions
run: |
share/ci/scripts/multi/install_imath.sh latest $EXT_PATH
share/ci/scripts/multi/install_openexr.sh latest $EXT_PATH
share/ci/scripts/multi/install_oiio.sh latest $EXT_PATH
share/ci/scripts/multi/install_osl.sh latest $EXT_PATH
share/ci/scripts/multi/install_openfx.sh latest $EXT_PATH
- name: Create build directories
run: |
mkdir _install
mkdir _build
- name: Configure
run: |
cmake ../. \
-DCMAKE_INSTALL_PREFIX=../_install \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_CXX_STANDARD=${{ matrix.cxx-standard }} \
-DOCIO_BUILD_DOCS=${{ matrix.build-docs }} \
-DOCIO_BUILD_OPENFX=${{ matrix.build-openfx }} \
-DOCIO_BUILD_GPU_TESTS=OFF \
-DOCIO_INSTALL_EXT_PACKAGES=NONE \
-DOCIO_WARNING_AS_ERROR=OFF \
-DPython_EXECUTABLE=$(which python) \
-DOCIO_USE_OIIO_CMAKE_CONFIG=ON
working-directory: _build
- name: Build
run: |
cmake --build . \
--target install \
--config Release \
-- -j$(nproc)
working-directory: _build
- name: Test
run: ctest -V -C Release
working-directory: _build
- name: Test CMake Consumer
run: |
cmake . \
-DCMAKE_PREFIX_PATH=../../../_install \
-DCMAKE_BUILD_TYPE=Release
cmake --build . \
--config Release
./consumer
working-directory: _build/tests/cmake-consumer-dist
# ---------------------------------------------------------------------------
# MacOS latest ext packages
# ---------------------------------------------------------------------------
macos-latest:
name: 'macOS latest
<AppleClang 12.0
cxx=${{ matrix.cxx-standard }},
docs=${{ matrix.build-docs }},
python=${{ matrix.python-version }}>'
# Don't run on OCIO forks
if: github.repository == 'AcademySoftwareFoundation/OpenColorIO'
runs-on: macos-latest
strategy:
matrix:
build: [1, 2]
include:
# C++17
- build: 1
build-docs: 'ON'
build-openfx: 'ON'
cxx-standard: 17
python-version: 3.9
# C++14
- build: 2
build-docs: 'ON'
build-openfx: 'ON'
cxx-standard: 14
python-version: 3.9
steps:
- name: Setup Python
uses: actions/setup-python@v1
with:
python-version: ${{ matrix.python-version }}
- name: Checkout
uses: actions/checkout@v2
- name: Install docs env
run: share/ci/scripts/macos/install_docs_env.sh
if: matrix.build-docs == 'ON'
- name: Install tests env
run: share/ci/scripts/macos/install_tests_env.sh
- name: Setup ext environment
run: |
EXT_PATH=/usr/local
echo "EXT_PATH=$EXT_PATH" >> $GITHUB_ENV
- name: Install indirect dependencies
run: |
share/ci/scripts/macos/install_bison.sh latest
share/ci/scripts/macos/install_boost.sh latest
share/ci/scripts/multi/install_pugixml.sh latest $EXT_PATH
- name: Install fixed ext package versions
# Minizip-ng depends on ZLIB. ZLIB must be installed first.
run: |
share/ci/scripts/multi/install_expat.sh 2.4.1 $EXT_PATH
share/ci/scripts/multi/install_lcms2.sh 2.2 $EXT_PATH
share/ci/scripts/multi/install_yaml-cpp.sh 0.7.0 $EXT_PATH
share/ci/scripts/multi/install_pystring.sh 1.1.3 $EXT_PATH
share/ci/scripts/multi/install_pybind11.sh 2.9.2 $EXT_PATH
share/ci/scripts/multi/install_zlib.sh 1.2.12 $EXT_PATH
share/ci/scripts/multi/install_minizip-ng.sh 3.0.6 $EXT_PATH
- name: Install latest ext package versions
run: |
share/ci/scripts/multi/install_imath.sh latest $EXT_PATH
share/ci/scripts/multi/install_openexr.sh latest $EXT_PATH
share/ci/scripts/multi/install_oiio.sh latest $EXT_PATH
share/ci/scripts/multi/install_osl.sh latest $EXT_PATH
share/ci/scripts/multi/install_openfx.sh latest $EXT_PATH
- name: Create build directories
run: |
mkdir _install
mkdir _build
- name: Configure
run: |
cmake ../. \
-DCMAKE_INSTALL_PREFIX=../_install \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_CXX_STANDARD=${{ matrix.cxx-standard }} \
-DOCIO_BUILD_DOCS=${{ matrix.build-docs }} \
-DOCIO_BUILD_OPENFX=${{ matrix.build-openfx }} \
-DOCIO_BUILD_GPU_TESTS=OFF \
-DOCIO_INSTALL_EXT_PACKAGES=NONE \
-DOCIO_WARNING_AS_ERROR=OFF \
-DPython_EXECUTABLE=$(which python) \
-DOCIO_USE_OIIO_CMAKE_CONFIG=ON
working-directory: _build
- name: Build
run: |
cmake --build . \
--target install \
--config Release \
-- -j$(sysctl -n hw.ncpu)
working-directory: _build
- name: Test
run: ctest -V -C Release
working-directory: _build
- name: Test CMake Consumer
run: |
cmake . \
-DCMAKE_PREFIX_PATH=../../../_install \
-DCMAKE_BUILD_TYPE=Release
cmake --build . \
--config Release
./consumer
working-directory: _build/tests/cmake-consumer-dist
# ---------------------------------------------------------------------------
# Windows latest ext packages
# ---------------------------------------------------------------------------
windows-latest:
name: 'Windows latest
<MSVC
cxx=${{ matrix.cxx-standard }},
docs=${{ matrix.build-docs }},
python=${{ matrix.python-version }}>'
# Don't run on OCIO forks
if: github.repository == 'AcademySoftwareFoundation/OpenColorIO'
runs-on: windows-latest
strategy:
matrix:
build: [1, 2]
include:
# C++17
- build: 1
build-docs: 'ON'
build-openfx: 'ON'
cxx-standard: 17
python-version: 3.9
# C++14
- build: 2
build-docs: 'ON'
build-openfx: 'ON'
cxx-standard: 14
python-version: 3.9
steps:
- name: Setup Python
uses: actions/setup-python@v1
with:
python-version: ${{ matrix.python-version }}
- name: Checkout
uses: actions/checkout@v2
- name: Install docs env
run: share/ci/scripts/windows/install_docs_env.sh
shell: bash
if: matrix.build-docs == 'ON'
- name: Install tests env
run: share/ci/scripts/windows/install_tests_env.sh
shell: bash
- name: Setup ext environment
run: |
EXT_PATH=$GITHUB_WORKSPACE/_ext
VCPKG_ROOT=$VCPKG_INSTALLATION_ROOT/installed/x64-windows
echo "EXT_PATH=$EXT_PATH" >> $GITHUB_ENV
echo "CMAKE_PREFIX_PATH=$VCPKG_ROOT;$EXT_PATH" >> $GITHUB_ENV
echo "$VCPKG_ROOT/bin" >> $GITHUB_PATH
echo "$EXT_PATH/bin" >> $GITHUB_PATH
mkdir $EXT_PATH
shell: bash
- name: Install indirect dependencies
run: |
vcpkg install zlib:x64-windows
vcpkg install tiff:x64-windows
vcpkg install boost-asio:x64-windows
vcpkg install boost-container:x64-windows
vcpkg install boost-filesystem:x64-windows
vcpkg install boost-math:x64-windows
vcpkg install boost-stacktrace:x64-windows
vcpkg install boost-system:x64-windows
vcpkg install boost-thread:x64-windows
share/ci/scripts/multi/install_pugixml.sh latest $EXT_PATH
shell: bash
- name: Install fixed ext package versions
# Minizip-ng depends on ZLIB. ZLIB must be installed first.
run: |
share/ci/scripts/multi/install_lcms2.sh 2.2 $EXT_PATH
share/ci/scripts/multi/install_yaml-cpp.sh 0.7.0 $EXT_PATH
share/ci/scripts/multi/install_pystring.sh 1.1.3 $EXT_PATH
share/ci/scripts/multi/install_pybind11.sh 2.9.2 $EXT_PATH
share/ci/scripts/multi/install_expat.sh 2.4.1 $EXT_PATH
share/ci/scripts/multi/install_zlib.sh 1.2.12 $EXT_PATH
share/ci/scripts/multi/install_minizip-ng.sh 3.0.6 $EXT_PATH
shell: bash
# OSL not installed due to LLVM compilation time.
- name: Install latest ext package versions
run: |
share/ci/scripts/multi/install_imath.sh latest $EXT_PATH
share/ci/scripts/multi/install_openexr.sh latest $EXT_PATH
share/ci/scripts/multi/install_oiio.sh latest $EXT_PATH
share/ci/scripts/multi/install_openfx.sh latest $EXT_PATH
shell: bash
- name: Create build directories
run: |
mkdir _install
mkdir _build
shell: bash
- name: Configure
run: |
cmake ../. \
-DCMAKE_INSTALL_PREFIX=../_install \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_CXX_STANDARD=${{ matrix.cxx-standard }} \
-DCMAKE_GENERATOR_PLATFORM=x64 \
-DOCIO_BUILD_DOCS=OFF \
-DOCIO_BUILD_OPENFX=${{ matrix.build-openfx }} \
-DOCIO_BUILD_GPU_TESTS=OFF \
-DOCIO_INSTALL_EXT_PACKAGES=NONE \
-DOCIO_WARNING_AS_ERROR=OFF \
-DPython_EXECUTABLE=$(which python) \
-DOCIO_BUILD_PYTHON=OFF \
-DOCIO_USE_OIIO_CMAKE_CONFIG=ON
shell: bash
working-directory: _build
- name: Build
run: |
cmake --build . \
--target install \
--config Release \
--parallel
shell: bash
working-directory: _build
- name: Test
run: |
ctest -V -C Release
shell: bash
working-directory: _build
- name: Test CMake Consumer
run: |
cmake . \
-DCMAKE_PREFIX_PATH=../../../_install \
-DCMAKE_BUILD_TYPE=Release
cmake --build . \
--config Release
export PATH=../../../_install/bin:$PATH
./Release/consumer
shell: bash
working-directory: _build/tests/cmake-consumer-dist
# ---------------------------------------------------------------------------
# SonarCloud static analysis
# ---------------------------------------------------------------------------
@@ -29,7 +404,9 @@ jobs:
linux_sonarcloud:
name: 'Linux CentOS 7 VFX CY2022 SonarCloud <GCC 9.3.1>'
# Don't run on OCIO forks
if: github.repository == 'AcademySoftwareFoundation/OpenColorIO'
if: |
github.repository == 'AcademySoftwareFoundation/OpenColorIO' &&
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:
@@ -41,7 +418,7 @@ jobs:
CC: gcc
steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v2
with:
fetch-depth: 50
- name: Install docs env
+196 -132
View File
@@ -44,7 +44,7 @@ jobs:
<${{ matrix.compiler-desc }}
config=${{ matrix.build-type }},
shared=${{ matrix.build-shared }},
simd=${{ matrix.use-simd }},
sse=${{ matrix.use-sse }},
cxx=${{ matrix.cxx-standard }},
docs=${{ matrix.build-docs }},
oiio=${{ matrix.use-oiio }}>'
@@ -60,170 +60,202 @@ jobs:
image: aswf/ci-ocio:${{ matrix.vfx-cy }}
strategy:
matrix:
build: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12]
build: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13]
include:
# -------------------------------------------------------------------
# VFX CY2023 (Python 3.10)
# VFX CY2022 (Python 3.9)
# -------------------------------------------------------------------
- build: 12
# C++17, Clang, Debug, OpenFX
- build: 13
build-type: Debug
build-shared: 'ON'
build-docs: 'OFF'
build-openfx: 'ON'
use-simd: 'ON'
use-sse: 'ON'
use-oiio: 'ON'
cxx-standard: 17
cxx-compiler: clang++
cc-compiler: clang
compiler-desc: Clang
vfx-cy: 2023
- build: 11
compiler-desc: Clang 9
vfx-cy: 2022
# C++17, GCC, no SSE, OpenFX
- build: 12
build-type: Release
build-shared: 'ON'
build-docs: 'ON'
build-docs: 'OFF'
build-openfx: 'ON'
use-simd: 'OFF'
use-sse: 'OFF'
use-oiio: 'OFF'
cxx-standard: 17
cxx-compiler: g++
cc-compiler: gcc
compiler-desc: GCC
vfx-cy: 2023
compiler-desc: GCC 9.3.1
vfx-cy: 2022
# C++14, GCC, static, docs
- build: 11
build-type: Release
build-shared: 'OFF'
build-docs: 'ON'
build-openfx: 'OFF'
use-sse: 'ON'
use-oiio: 'OFF'
cxx-standard: 14
cxx-compiler: g++
cc-compiler: gcc
compiler-desc: GCC 9.3.1
vfx-cy: 2022
# C++11, GCC, static
- build: 10
build-type: Release
build-shared: 'OFF'
build-docs: 'OFF'
build-openfx: 'OFF'
use-simd: 'ON'
use-sse: 'ON'
use-oiio: 'OFF'
cxx-standard: 11
cxx-compiler: g++
cc-compiler: gcc
compiler-desc: GCC
vfx-cy: 2023
# -------------------------------------------------------------------
# VFX CY2022 (Python 3.9)
# -------------------------------------------------------------------
- build: 9
build-type: Debug
build-shared: 'ON'
build-docs: 'OFF'
build-openfx: 'ON'
use-simd: 'ON'
use-oiio: 'ON'
cxx-standard: 17
cxx-compiler: clang++
cc-compiler: clang
compiler-desc: Clang
vfx-cy: 2022
- build: 8
build-type: Release
build-shared: 'ON'
build-docs: 'ON'
build-openfx: 'ON'
use-simd: 'OFF'
use-oiio: 'OFF'
cxx-standard: 17
cxx-compiler: g++
cc-compiler: gcc
compiler-desc: GCC
vfx-cy: 2022
- build: 7
build-type: Release
build-shared: 'OFF'
build-docs: 'OFF'
build-openfx: 'OFF'
use-simd: 'ON'
use-oiio: 'OFF'
cxx-standard: 11
cxx-compiler: g++
cc-compiler: gcc
compiler-desc: GCC
compiler-desc: GCC 9.3.1
vfx-cy: 2022
# -------------------------------------------------------------------
# VFX CY2021 (Python 3.7)
# -------------------------------------------------------------------
- build: 6
# C++17, Clang
- build: 9
build-type: Release
build-shared: 'ON'
build-docs: 'OFF'
build-openfx: 'OFF'
use-simd: 'ON'
use-sse: 'ON'
use-oiio: 'ON'
cxx-standard: 17
cxx-compiler: clang++
cc-compiler: clang
compiler-desc: Clang
compiler-desc: Clang 9
vfx-cy: 2021
- build: 5
# C++14, Clang, static, no SSE, OpenFX
- build: 8
build-type: Release
build-shared: 'OFF'
build-docs: 'OFF'
build-openfx: 'ON'
use-simd: 'OFF'
use-sse: 'OFF'
use-oiio: 'OFF'
cxx-standard: 14
cxx-compiler: clang++
cc-compiler: clang
compiler-desc: Clang
compiler-desc: Clang 9
vfx-cy: 2021
- build: 4
# C++11, GCC, Debug
- build: 7
build-type: Debug
build-shared: 'ON'
build-docs: 'OFF'
build-openfx: 'OFF'
use-simd: 'ON'
use-sse: 'ON'
use-oiio: 'OFF'
cxx-standard: 11
cxx-compiler: g++
cc-compiler: gcc
compiler-desc: GCC
compiler-desc: GCC 9.3.1
vfx-cy: 2021
# -------------------------------------------------------------------
# VFX CY2020 (Python 3.7)
# -------------------------------------------------------------------
- build: 3
# C++14, Clang, OpenFX
- build: 6
build-type: Release
build-shared: 'ON'
build-docs: 'OFF'
build-openfx: 'ON'
use-simd: 'OFF'
use-sse: 'OFF'
use-oiio: 'OFF'
cxx-standard: 14
cxx-compiler: clang++
cc-compiler: clang
compiler-desc: Clang
compiler-desc: Clang 7
vfx-cy: 2020
- build: 2
# C++14, GCC, static, Debug, OpenFX
- build: 5
build-type: Debug
build-shared: 'OFF'
build-docs: 'OFF'
build-openfx: 'ON'
use-simd: 'ON'
use-sse: 'ON'
use-oiio: 'ON'
cxx-standard: 14
cxx-compiler: g++
cc-compiler: gcc
compiler-desc: GCC
compiler-desc: GCC 6.3.1
vfx-cy: 2020
- build: 1
# C++11, GCC, no SSE
- build: 4
build-type: Release
build-shared: 'ON'
build-docs: 'OFF'
build-openfx: 'OFF'
use-simd: 'ON'
use-sse: 'ON'
use-oiio: 'OFF'
cxx-standard: 11
cxx-compiler: g++
cc-compiler: gcc
compiler-desc: GCC
compiler-desc: GCC 6.3.1
vfx-cy: 2020
# -------------------------------------------------------------------
# VFX CY2019 (Python 2.7)
# -------------------------------------------------------------------
# C++11, Clang, static
- build: 3
build-type: Release
build-shared: 'OFF'
# Doc build requires Python 3
build-docs: 'OFF'
build-openfx: 'OFF'
use-sse: 'ON'
use-oiio: 'ON'
cxx-standard: 11
cxx-compiler: clang++
cc-compiler: clang
compiler-desc: Clang 7
vfx-cy: 2019
# C++11, Clang, Debug, no SSE
- build: 2
build-type: Debug
build-shared: 'ON'
# Doc build requires Python 3
build-docs: 'OFF'
build-openfx: 'OFF'
use-sse: 'OFF'
use-oiio: 'OFF'
cxx-standard: 11
cxx-compiler: clang++
cc-compiler: clang
compiler-desc: Clang 7
vfx-cy: 2019
# C++11, GCC, OpenFX
- build: 1
build-type: Release
build-shared: 'ON'
# Doc build requires Python 3
build-docs: 'OFF'
build-openfx: 'ON'
use-sse: 'ON'
use-oiio: 'OFF'
cxx-standard: 11
cxx-compiler: g++
cc-compiler: gcc
compiler-desc: GCC 6.3.1
vfx-cy: 2019
env:
CXX: ${{ matrix.cxx-compiler }}
CC: ${{ matrix.cc-compiler }}
steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v2
# minizip-ng requires CMake 3.13+ but VFX2019 image ships with 3.12
- name: Upgrade VFX2019 CMake
run: pip install cmake==3.13.3
if: matrix.vfx-cy == '2019'
- name: Install docs env
run: share/ci/scripts/linux/yum/install_docs_env.sh
if: matrix.build-docs == 'ON'
@@ -243,7 +275,7 @@ jobs:
-DOCIO_BUILD_DOCS=${{ matrix.build-docs }} \
-DOCIO_BUILD_OPENFX=${{ matrix.build-openfx }} \
-DOCIO_BUILD_GPU_TESTS=OFF \
-DOCIO_USE_SIMD=${{ matrix.use-simd }} \
-DOCIO_USE_SSE=${{ matrix.use-sse }} \
-DOCIO_USE_OIIO_FOR_APPS=${{ matrix.use-oiio }} \
-DOCIO_INSTALL_EXT_PACKAGES=ALL \
-DOCIO_WARNING_AS_ERROR=ON \
@@ -304,12 +336,11 @@ jobs:
# ---------------------------------------------------------------------------
macos:
name: 'macOS 11
<AppleClang
arch=${{ matrix.arch-type }},
name: 'macOS 10.15
<AppleClang 11.0
config=${{ matrix.build-type }},
shared=${{ matrix.build-shared }},
simd=${{ matrix.use-simd }},
sse=${{ matrix.use-sse }},
cxx=${{ matrix.cxx-standard }},
python=${{ matrix.python-version }},
docs=${{ matrix.build-docs }},
@@ -318,69 +349,79 @@ jobs:
if: |
github.event_name == 'push' ||
github.event.pull_request.head.repo.full_name != github.repository
runs-on: macos-11
runs-on: macos-10.15
strategy:
matrix:
build: [1, 2, 3, 4]
build: [1, 2, 3, 4, 5, 6]
include:
- build: 5
arch-type: "x86_64"
# C++17, OpenFX
- build: 6
build-type: Release
build-shared: 'ON'
build-docs: 'OFF'
build-openfx: 'ON'
use-simd: 'ON'
use-sse: 'ON'
use-oiio: 'ON'
cxx-standard: 17
python-version: '3.11'
# Keeping one universal build
- build: 4
arch-type: "x86_64;arm64"
build-type: Release
build-shared: 'ON'
build-docs: 'OFF'
build-openfx: 'OFF'
use-simd: 'ON'
use-oiio: 'OFF'
cxx-standard: 11
python-version: '3.10'
- build: 3
arch-type: "x86_64"
python-version: 3.9
# C++11, Python 3.7
- build: 5
build-type: Release
build-shared: 'ON'
build-docs: 'ON'
build-openfx: 'OFF'
use-simd: 'OFF'
use-sse: 'ON'
use-oiio: 'OFF'
cxx-standard: 11
python-version: '3.10'
- build: 2
arch-type: "x86_64"
python-version: 3.7
# Debug, OpenFX
- build: 4
build-type: Debug
build-shared: 'ON'
build-docs: 'OFF'
build-openfx: 'ON'
use-simd: 'ON'
use-sse: 'ON'
use-oiio: 'OFF'
cxx-standard: 11
python-version: '3.9'
- build: 1
arch-type: "x86_64"
python-version: 3.7
# C++14, OpenEXR, OpenFX
- build: 3
build-type: Release
build-shared: 'ON'
build-docs: 'OFF'
build-openfx: 'ON'
use-sse: 'ON'
use-oiio: 'OFF'
cxx-standard: 14
python-version: 3.7
# Static, no SSE
- build: 2
build-type: Release
build-shared: 'OFF'
build-docs: 'OFF'
build-openfx: 'ON'
use-simd: 'ON'
build-openfx: 'OFF'
use-sse: 'OFF'
use-oiio: 'OFF'
cxx-standard: 14
python-version: '3.7'
cxx-standard: 11
python-version: 3.7
# Python 2.7
- build: 1
build-type: Release
build-shared: 'ON'
# Doc build requires Python 3
build-docs: 'OFF'
build-openfx: 'OFF'
use-sse: 'ON'
use-oiio: 'ON'
cxx-standard: 11
python-version: 2.7
steps:
- name: Setup Python
uses: actions/setup-python@v4
uses: actions/setup-python@v1
with:
python-version: ${{ matrix.python-version }}
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v2
- name: Install docs env
run: share/ci/scripts/macos/install_docs_env.sh
if: matrix.build-docs == 'ON'
@@ -400,12 +441,11 @@ jobs:
-DOCIO_BUILD_DOCS=${{ matrix.build-docs }} \
-DOCIO_BUILD_OPENFX=${{ matrix.build-openfx }} \
-DOCIO_BUILD_GPU_TESTS=OFF \
-DOCIO_USE_SIMD=${{ matrix.use-simd }} \
-DOCIO_USE_SSE=${{ matrix.use-sse }} \
-DOCIO_USE_OIIO_FOR_APPS=${{ matrix.use-oiio }} \
-DOCIO_INSTALL_EXT_PACKAGES=ALL \
-DOCIO_WARNING_AS_ERROR=ON \
-DPython_EXECUTABLE=$(which python) \
-DCMAKE_OSX_ARCHITECTURES="${{ matrix.arch-type }}"
-DPython_EXECUTABLE=$(which python)
working-directory: _build
- name: Build
run: |
@@ -465,10 +505,10 @@ jobs:
windows:
name: 'Windows 2019
<MSVC
<MSVC 16.4
config=${{ matrix.build-type }},
shared=${{ matrix.build-shared }},
simd=${{ matrix.use-simd }},
sse=${{ matrix.use-sse }},
cxx=${{ matrix.cxx-standard }},
python=${{ matrix.python-version }},
docs=${{ matrix.build-docs }},
@@ -480,52 +520,76 @@ jobs:
runs-on: windows-2019
strategy:
matrix:
build: [1, 2, 3, 4]
build: [1, 2, 3, 4, 5, 6]
include:
- build: 4
# C++17, OpenFX
- build: 6
build-type: Release
build-shared: 'ON'
build-docs: 'OFF'
build-openfx: 'ON'
use-simd: 'OFF'
use-sse: 'ON'
use-oiio: 'ON'
cxx-standard: 17
python-version: '3.11'
- build: 3
python-version: 3.9
# C++11, Python 3.7
- build: 5
build-type: Release
build-shared: 'OFF'
build-shared: 'ON'
build-docs: 'OFF'
build-openfx: 'OFF'
use-simd: 'ON'
use-sse: 'ON'
use-oiio: 'OFF'
cxx-standard: 11
python-version: '3.9'
- build: 2
python-version: 3.7
# Debug
- build: 4
build-type: Debug
build-shared: 'ON'
build-docs: 'OFF'
build-openfx: 'OFF'
use-simd: 'ON'
use-sse: 'ON'
use-oiio: 'OFF'
cxx-standard: 11
python-version: '3.8'
python-version: 3.7
# C++14, OpenEXR, OpenFX
- build: 1
- build: 3
build-type: Release
build-shared: 'ON'
build-docs: 'OFF'
build-openfx: 'ON'
use-simd: 'ON'
use-sse: 'ON'
use-oiio: 'OFF'
cxx-standard: 14
python-version: '3.7'
python-version: 3.7
# Static, no SSE, OpenFX
- build: 2
build-type: Release
build-shared: 'OFF'
build-docs: 'OFF'
build-openfx: 'ON'
use-sse: 'OFF'
use-oiio: 'OFF'
cxx-standard: 11
python-version: 3.7
# Python 2.7
- build: 1
build-type: Release
build-shared: 'ON'
# Doc build requires Python 3
build-docs: 'OFF'
build-openfx: 'OFF'
use-sse: 'ON'
use-oiio: 'ON'
cxx-standard: 11
python-version: 2.7
steps:
- name: Setup Python
uses: actions/setup-python@v4
uses: actions/setup-python@v1
with:
python-version: ${{ matrix.python-version }}
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v2
- name: Install docs env
run: share/ci/scripts/windows/install_docs_env.sh
shell: bash
@@ -549,7 +613,7 @@ jobs:
-DOCIO_BUILD_DOCS=${{ matrix.build-docs }} \
-DOCIO_BUILD_OPENFX=${{ matrix.build-openfx }} \
-DOCIO_BUILD_GPU_TESTS=OFF \
-DOCIO_USE_SIMD=${{ matrix.use-simd }} \
-DOCIO_USE_SSE=${{ matrix.use-sse }} \
-DOCIO_USE_OIIO_FOR_APPS=${{ matrix.use-oiio }} \
-DOCIO_INSTALL_EXT_PACKAGES=ALL \
-DOCIO_WARNING_AS_ERROR=ON \
-388
View File
@@ -1,388 +0,0 @@
# SPDX-License-Identifier: BSD-3-Clause
# Copyright Contributors to the OpenColorIO Project.
#
# GitHub Actions workflow file
# https://help.github.com/en/actions/reference/workflow-syntax-for-github-actions
name: Dependencies latest
on:
pull_request:
branches-ignore:
- RB-0.*
- RB-1.*
- gh-pages
tags-ignore:
- v0.*
- v1.*
paths:
- .github/workflows/dependencies_latest.yml
schedule:
# Nightly build
- cron: "0 0 * * *"
jobs:
# ---------------------------------------------------------------------------
# Linux latest ext packages
# ---------------------------------------------------------------------------
linux_latest:
name: 'Linux CentOS 7 VFX CY${{ matrix.vfx-cy }} latest
<${{ matrix.compiler-desc }}
cxx=${{ matrix.cxx-standard }},
docs=${{ matrix.build-docs }}>'
# Don't run on OCIO forks
if: github.repository == 'AcademySoftwareFoundation/OpenColorIO'
# GH-hosted VM. The build runs in CentOS 7 'container' defined below.
runs-on: ubuntu-latest
container:
# DockerHub: https://hub.docker.com/u/aswf
# Source: https://github.com/AcademySoftwareFoundation/aswf-docker
image: aswf/ci-base:${{ matrix.vfx-cy }}
strategy:
matrix:
build: [1, 2, 3, 4]
include:
# -------------------------------------------------------------------
# GCC
# -------------------------------------------------------------------
- build: 1
build-docs: 'ON'
build-openfx: 'ON'
cxx-standard: 17
cxx-compiler: g++
cc-compiler: gcc
compiler-desc: GCC
vfx-cy: 2022
- build: 2
build-docs: 'OFF'
build-openfx: 'OFF'
cxx-standard: 14
cxx-compiler: g++
cc-compiler: gcc
compiler-desc: GCC
vfx-cy: 2021
# -------------------------------------------------------------------
# Clang
# -------------------------------------------------------------------
- build: 3
build-docs: 'OFF'
build-openfx: 'OFF'
cxx-standard: 17
cxx-compiler: clang++
cc-compiler: clang
compiler-desc: Clang
vfx-cy: 2022
- build: 4
build-docs: 'ON'
build-openfx: 'ON'
cxx-standard: 14
cxx-compiler: clang++
cc-compiler: clang
compiler-desc: Clang
vfx-cy: 2021
env:
CXX: ${{ matrix.cxx-compiler }}
CC: ${{ matrix.cc-compiler }}
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Install docs env
run: share/ci/scripts/linux/yum/install_docs_env.sh
if: matrix.build-docs == 'ON'
- name: Install tests env
run: share/ci/scripts/linux/yum/install_tests_env.sh
- name: Setup ext environment
run: |
EXT_PATH=/usr/local
echo "EXT_PATH=$EXT_PATH" >> $GITHUB_ENV
- name: Install indirect dependencies
run: |
share/ci/scripts/multi/install_pugixml.sh latest
- name: Install fixed ext package versions
# Minizip-ng depends on ZLIB. ZLIB must be installed first.
run: |
share/ci/scripts/multi/install_expat.sh 2.4.1 $EXT_PATH
share/ci/scripts/multi/install_lcms2.sh 2.2 $EXT_PATH
share/ci/scripts/multi/install_yaml-cpp.sh 0.7.0 $EXT_PATH
share/ci/scripts/multi/install_pystring.sh 1.1.3 $EXT_PATH
share/ci/scripts/multi/install_pybind11.sh 2.9.2 $EXT_PATH
share/ci/scripts/multi/install_zlib.sh 1.2.12 $EXT_PATH
share/ci/scripts/multi/install_minizip-ng.sh 3.0.6 $EXT_PATH
- name: Install latest ext package versions
run: |
share/ci/scripts/multi/install_imath.sh latest $EXT_PATH
share/ci/scripts/multi/install_openexr.sh latest $EXT_PATH
share/ci/scripts/multi/install_oiio.sh latest $EXT_PATH
share/ci/scripts/multi/install_osl.sh latest $EXT_PATH
share/ci/scripts/multi/install_openfx.sh latest $EXT_PATH
- name: Create build directories
run: |
mkdir _install
mkdir _build
- name: Configure
run: |
cmake ../. \
-DCMAKE_INSTALL_PREFIX=../_install \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_CXX_STANDARD=${{ matrix.cxx-standard }} \
-DOCIO_BUILD_DOCS=${{ matrix.build-docs }} \
-DOCIO_BUILD_OPENFX=${{ matrix.build-openfx }} \
-DOCIO_BUILD_GPU_TESTS=OFF \
-DOCIO_INSTALL_EXT_PACKAGES=NONE \
-DOCIO_WARNING_AS_ERROR=OFF \
-DPython_EXECUTABLE=$(which python) \
-DOCIO_USE_OIIO_CMAKE_CONFIG=ON
working-directory: _build
- name: Build
run: |
cmake --build . \
--target install \
--config Release \
-- -j$(nproc)
working-directory: _build
- name: Test
run: ctest -V -C Release
working-directory: _build
- name: Test CMake Consumer
run: |
cmake . \
-DCMAKE_PREFIX_PATH=../../../_install \
-DCMAKE_BUILD_TYPE=Release
cmake --build . \
--config Release
./consumer
working-directory: _build/tests/cmake-consumer-dist
# ---------------------------------------------------------------------------
# MacOS latest ext packages
# ---------------------------------------------------------------------------
macos-latest:
name: 'macOS latest
<AppleClang
cxx=${{ matrix.cxx-standard }},
docs=${{ matrix.build-docs }},
python=${{ matrix.python-version }}>'
# Don't run on OCIO forks
if: github.repository == 'AcademySoftwareFoundation/OpenColorIO'
runs-on: macos-latest
strategy:
matrix:
build: [1, 2]
include:
- build: 1
build-docs: 'ON'
build-openfx: 'ON'
cxx-standard: 17
python-version: '3.11'
- build: 2
build-docs: 'ON'
build-openfx: 'ON'
cxx-standard: 14
python-version: '3.9'
steps:
- name: Setup Python
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Checkout
uses: actions/checkout@v3
- name: Install docs env
run: share/ci/scripts/macos/install_docs_env.sh
if: matrix.build-docs == 'ON'
- name: Install tests env
run: share/ci/scripts/macos/install_tests_env.sh
- name: Setup ext environment
run: |
EXT_PATH=/usr/local
echo "EXT_PATH=$EXT_PATH" >> $GITHUB_ENV
- name: Install indirect dependencies
run: |
share/ci/scripts/macos/install_bison.sh latest
share/ci/scripts/macos/install_boost.sh latest
share/ci/scripts/multi/install_pugixml.sh latest $EXT_PATH
- name: Install fixed ext package versions
# Minizip-ng depends on ZLIB. ZLIB must be installed first.
run: |
share/ci/scripts/multi/install_expat.sh 2.4.1 $EXT_PATH
share/ci/scripts/multi/install_lcms2.sh 2.2 $EXT_PATH
share/ci/scripts/multi/install_yaml-cpp.sh 0.7.0 $EXT_PATH
share/ci/scripts/multi/install_pystring.sh 1.1.3 $EXT_PATH
share/ci/scripts/multi/install_pybind11.sh 2.9.2 $EXT_PATH
share/ci/scripts/multi/install_zlib.sh 1.2.12 $EXT_PATH
share/ci/scripts/multi/install_minizip-ng.sh 3.0.6 $EXT_PATH
- name: Install latest ext package versions
run: |
share/ci/scripts/multi/install_imath.sh latest $EXT_PATH
share/ci/scripts/multi/install_openexr.sh latest $EXT_PATH
share/ci/scripts/multi/install_oiio.sh latest $EXT_PATH
share/ci/scripts/multi/install_osl.sh latest $EXT_PATH
share/ci/scripts/multi/install_openfx.sh latest $EXT_PATH
- name: Create build directories
run: |
mkdir _install
mkdir _build
- name: Configure
run: |
cmake ../. \
-DCMAKE_INSTALL_PREFIX=../_install \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_CXX_STANDARD=${{ matrix.cxx-standard }} \
-DOCIO_BUILD_DOCS=${{ matrix.build-docs }} \
-DOCIO_BUILD_OPENFX=${{ matrix.build-openfx }} \
-DOCIO_BUILD_GPU_TESTS=OFF \
-DOCIO_INSTALL_EXT_PACKAGES=NONE \
-DOCIO_WARNING_AS_ERROR=OFF \
-DPython_EXECUTABLE=$(which python) \
-DOCIO_USE_OIIO_CMAKE_CONFIG=ON
working-directory: _build
- name: Build
run: |
cmake --build . \
--target install \
--config Release \
-- -j$(sysctl -n hw.ncpu)
working-directory: _build
- name: Test
run: ctest -V -C Release
working-directory: _build
- name: Test CMake Consumer
run: |
cmake . \
-DCMAKE_PREFIX_PATH=../../../_install \
-DCMAKE_BUILD_TYPE=Release
cmake --build . \
--config Release
./consumer
working-directory: _build/tests/cmake-consumer-dist
# ---------------------------------------------------------------------------
# Windows latest ext packages
# ---------------------------------------------------------------------------
windows-latest:
name: 'Windows latest
<MSVC
cxx=${{ matrix.cxx-standard }},
docs=${{ matrix.build-docs }},
python=${{ matrix.python-version }}>'
# Don't run on OCIO forks
if: github.repository == 'AcademySoftwareFoundation/OpenColorIO'
runs-on: windows-latest
strategy:
matrix:
build: [1, 2]
include:
- build: 1
build-docs: 'ON'
build-openfx: 'ON'
cxx-standard: 17
python-version: '3.11'
- build: 2
build-docs: 'ON'
build-openfx: 'ON'
cxx-standard: 14
python-version: '3.9'
steps:
- name: Setup Python
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Checkout
uses: actions/checkout@v3
- name: Install docs env
run: share/ci/scripts/windows/install_docs_env.sh
shell: bash
if: matrix.build-docs == 'ON'
- name: Install tests env
run: share/ci/scripts/windows/install_tests_env.sh
shell: bash
- name: Setup ext environment
run: |
EXT_PATH=$GITHUB_WORKSPACE/_ext
VCPKG_ROOT=$VCPKG_INSTALLATION_ROOT/installed/x64-windows
echo "EXT_PATH=$EXT_PATH" >> $GITHUB_ENV
echo "CMAKE_PREFIX_PATH=$VCPKG_ROOT;$EXT_PATH" >> $GITHUB_ENV
echo "$VCPKG_ROOT/bin" >> $GITHUB_PATH
echo "$EXT_PATH/bin" >> $GITHUB_PATH
mkdir $EXT_PATH
shell: bash
- name: Install indirect dependencies
run: |
vcpkg install zlib:x64-windows
vcpkg install tiff:x64-windows
vcpkg install boost-asio:x64-windows
vcpkg install boost-container:x64-windows
vcpkg install boost-filesystem:x64-windows
vcpkg install boost-math:x64-windows
vcpkg install boost-stacktrace:x64-windows
vcpkg install boost-system:x64-windows
vcpkg install boost-thread:x64-windows
share/ci/scripts/multi/install_pugixml.sh latest $EXT_PATH
shell: bash
- name: Install fixed ext package versions
# Minizip-ng depends on ZLIB. ZLIB must be installed first.
run: |
share/ci/scripts/multi/install_lcms2.sh 2.2 $EXT_PATH
share/ci/scripts/multi/install_yaml-cpp.sh 0.7.0 $EXT_PATH
share/ci/scripts/multi/install_pystring.sh 1.1.3 $EXT_PATH
share/ci/scripts/multi/install_pybind11.sh 2.9.2 $EXT_PATH
share/ci/scripts/multi/install_expat.sh 2.4.1 $EXT_PATH
share/ci/scripts/multi/install_zlib.sh 1.2.12 $EXT_PATH
share/ci/scripts/multi/install_minizip-ng.sh 3.0.6 $EXT_PATH
shell: bash
# OSL not installed due to LLVM compilation time.
- name: Install latest ext package versions
run: |
share/ci/scripts/multi/install_imath.sh latest $EXT_PATH
share/ci/scripts/multi/install_openexr.sh latest $EXT_PATH
share/ci/scripts/multi/install_oiio.sh latest $EXT_PATH
share/ci/scripts/multi/install_openfx.sh latest $EXT_PATH
shell: bash
- name: Create build directories
run: |
mkdir _install
mkdir _build
shell: bash
- name: Configure
run: |
cmake ../. \
-DCMAKE_INSTALL_PREFIX=../_install \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_CXX_STANDARD=${{ matrix.cxx-standard }} \
-DCMAKE_GENERATOR_PLATFORM=x64 \
-DOCIO_BUILD_DOCS=OFF \
-DOCIO_BUILD_OPENFX=${{ matrix.build-openfx }} \
-DOCIO_BUILD_GPU_TESTS=OFF \
-DOCIO_INSTALL_EXT_PACKAGES=NONE \
-DOCIO_WARNING_AS_ERROR=OFF \
-DPython_EXECUTABLE=$(which python) \
-DOCIO_BUILD_PYTHON=OFF \
-DOCIO_USE_OIIO_CMAKE_CONFIG=ON
shell: bash
working-directory: _build
- name: Build
run: |
cmake --build . \
--target install \
--config Release \
--parallel
shell: bash
working-directory: _build
- name: Test
run: |
ctest -V -C Release
shell: bash
working-directory: _build
- name: Test CMake Consumer
run: |
cmake . \
-DCMAKE_PREFIX_PATH=../../../_install \
-DCMAKE_BUILD_TYPE=Release
cmake --build . \
--config Release
export PATH=../../../_install/bin:$PATH
./Release/consumer
shell: bash
working-directory: _build/tests/cmake-consumer-dist
+2 -4
View File
@@ -16,8 +16,6 @@ on:
tags-ignore:
- v0.*
- v1.*
paths:
- .github/workflows/gpu_workflow.yml
jobs:
# ---------------------------------------------------------------------------
@@ -35,13 +33,13 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Configure AWS Credentials
uses: aws-actions/configure-aws-credentials@v2
uses: aws-actions/configure-aws-credentials@v1
with:
aws-access-key-id: ${{ secrets.CODEBUILD_ID }}
aws-secret-access-key: ${{ secrets.CODEBUILD_SECRET }}
aws-region: us-west-2
- name: Run CodeBuild
uses: aws-actions/aws-codebuild-run-build@v1
uses: aws-actions/aws-codebuild-run-project@v1.0.0
with:
project-name: OpenColorIO
buildspec-override: buildspec.yml
-396
View File
@@ -1,396 +0,0 @@
# SPDX-License-Identifier: BSD-3-Clause
# Copyright Contributors to the OpenColorIO Project.
#
# GitHub Actions workflow file
# https://help.github.com/en/actions/reference/workflow-syntax-for-github-actions
name: Platform latest
on:
pull_request:
branches-ignore:
- RB-0.*
- RB-1.*
- gh-pages
tags-ignore:
- v0.*
- v1.*
paths:
- .github/workflows/platform_latest.yml
schedule:
# Nightly build
- cron: "0 0 * * *"
jobs:
# ---------------------------------------------------------------------------
# Linux latest ext packages
# ---------------------------------------------------------------------------
linux_latest:
name: 'Linux Ubuntu latest
<${{ matrix.compiler-desc }}
config=${{ matrix.build-type }},
shared=${{ matrix.build-shared }},
cxx=${{ matrix.cxx-standard }}>'
# Don't run on OCIO forks
if: github.repository == 'AcademySoftwareFoundation/OpenColorIO'
runs-on: ubuntu-latest
strategy:
matrix:
build: [1, 2, 3, 4]
include:
# -------------------------------------------------------------------
# GCC
# -------------------------------------------------------------------
- build: 1
build-python: ON
build-type: Release
build-shared: ON
cxx-standard: 20
cxx-compiler: g++
cc-compiler: gcc
compiler-desc: GCC
enable-sanitizer: OFF
- build: 2
build-python: OFF
build-type: Debug
build-shared: ON
cxx-standard: 20
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
env:
CXX: ${{ matrix.cxx-compiler }}
CC: ${{ matrix.cc-compiler }}
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Install tests env
run: share/ci/scripts/linux/yum/install_tests_env.sh
- name: Create build directories
run: |
mkdir _install
mkdir _build
- name: Configure
run: |
cmake ../. \
-DCMAKE_INSTALL_PREFIX=../_install \
-DCMAKE_BUILD_TYPE=${{ matrix.build-type }} \
-DCMAKE_CXX_STANDARD=${{ matrix.cxx-standard }} \
-DBUILD_SHARED_LIBS=${{ matrix.build-shared }} \
-DOCIO_BUILD_DOCS=OFF \
-DOCIO_BUILD_OPENFX=ON \
-DOCIO_BUILD_GPU_TESTS=OFF \
-DOCIO_BUILD_PYTHON=${{ matrix.build-python}} \
-DOCIO_USE_SSE=ON \
-DOCIO_USE_OIIO_FOR_APPS=OFF \
-DOCIO_INSTALL_EXT_PACKAGES=ALL \
-DOCIO_WARNING_AS_ERROR=ON \
-DOCIO_ENABLE_SANITIZER=${{ matrix.enable-sanitizer }} \
-DPython_EXECUTABLE=$(which python)
working-directory: _build
- name: Build
run: |
cmake --build . \
--target install \
--config ${{ matrix.build-type }} \
-v \
-- -j$(nproc)
echo "ocio_build_path=$(pwd)" >> $GITHUB_ENV
working-directory: _build
- name: Test
run: ctest -V -C ${{ matrix.build-type }}
working-directory: _build
- name: Test CMake Consumer with shared OCIO
if: matrix.build-shared == 'ON'
run: |
cmake . \
-DCMAKE_PREFIX_PATH=../../../_install \
-DCMAKE_BUILD_TYPE=${{ matrix.build-type }} \
-DOCIO_ENABLE_SANITIZER=${{ matrix.enable-sanitizer }}
cmake --build . \
--config ${{ matrix.build-type }}
./consumer
working-directory: _build/tests/cmake-consumer-dist
- name: Test CMake Consumer with static OCIO
if: matrix.build-shared == 'OFF'
# The yaml-cpp_VERSION is set below because Findyaml-cpp.cmake needs it but is unable to
# extract it from the headers, like the other modules.
#
# Prefer the static version of each dependencies by using <pkg>_STATIC_LIBRARY.
# Alternatively, this can be done by setting <pkg>_LIBRARY and <pkg>_INCLUDE_DIR to
# the static version of the package.
run: |
cmake . \
-DCMAKE_PREFIX_PATH=../../../_install \
-DCMAKE_BUILD_TYPE=${{ matrix.build-type }} \
-Dexpat_ROOT=${{ env.ocio_build_path }}/ext/dist \
-Dexpat_STATIC_LIBRARY=ON \
-DImath_ROOT=${{ env.ocio_build_path }}/ext/dist \
-DImath_STATIC_LIBRARY=ON \
-Dpystring_ROOT=${{ env.ocio_build_path }}/ext/dist \
-Dyaml-cpp_ROOT=${{ env.ocio_build_path }}/ext/dist \
-Dyaml-cpp_STATIC_LIBRARY=ON \
-Dyaml-cpp_VERSION=0.7.0 \
-DZLIB_ROOT=${{ env.ocio_build_path }}/ext/dist \
-DZLIB_STATIC_LIBRARY=ON \
-Dminizip-ng_ROOT=${{ env.ocio_build_path }}/ext/dist \
-Dminizip-ng_STATIC_LIBRARY=ON
cmake --build . \
--config ${{ matrix.build-type }}
./consumer
working-directory: _build/tests/cmake-consumer-dist
# ---------------------------------------------------------------------------
# MacOS latest ext packages
# ---------------------------------------------------------------------------
macos-latest:
name: 'macOS latest
<AppleClang
config=${{ matrix.build-type }},
shared=${{ matrix.build-shared }},
cxx=${{ matrix.cxx-standard }},
python=${{ matrix.python-version }}>'
# Don't run on OCIO forks
if: github.repository == 'AcademySoftwareFoundation/OpenColorIO'
runs-on: macos-latest
strategy:
matrix:
build: [1, 2]
include:
- build: 1
build-python: ON
build-type: Release
build-shared: ON
cxx-standard: 20
enable-sanitizer: OFF
python-version: '3.11'
- build: 2
build-python: OFF
build-type: Debug
build-shared: ON
cxx-standard: 20
enable-sanitizer: ON
python-version: '3.11'
steps:
- name: Setup Python
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Checkout
uses: actions/checkout@v3
- name: Install tests env
run: share/ci/scripts/macos/install_tests_env.sh
- name: Create build directories
run: |
mkdir _install
mkdir _build
- name: Configure
run: |
cmake ../. \
-DCMAKE_INSTALL_PREFIX=../_install \
-DCMAKE_BUILD_TYPE=${{ matrix.build-type }} \
-DCMAKE_CXX_STANDARD=${{ matrix.cxx-standard }} \
-DBUILD_SHARED_LIBS=${{ matrix.build-shared }} \
-DOCIO_BUILD_DOCS=OFF \
-DOCIO_BUILD_OPENFX=ON \
-DOCIO_BUILD_GPU_TESTS=OFF \
-DOCIO_BUILD_PYTHON=${{ matrix.build-python}} \
-DOCIO_USE_SSE=ON \
-DOCIO_USE_OIIO_FOR_APPS=OFF \
-DOCIO_INSTALL_EXT_PACKAGES=ALL \
-DOCIO_WARNING_AS_ERROR=ON \
-DOCIO_ENABLE_SANITIZER=${{ matrix.enable-sanitizer }} \
-DPython_EXECUTABLE=$(which python)
working-directory: _build
- name: Build
run: |
cmake --build . \
--target install \
--config ${{ matrix.build-type }} \
-- -j$(sysctl -n hw.ncpu)
echo "ocio_build_path=$(pwd)" >> $GITHUB_ENV
working-directory: _build
- name: Test
run: ctest -V -C ${{ matrix.build-type }}
working-directory: _build
- name: Test CMake Consumer with shared OCIO
if: matrix.build-shared == 'ON'
run: |
cmake . \
-DCMAKE_PREFIX_PATH=../../../_install \
-DCMAKE_BUILD_TYPE=${{ matrix.build-type }}
cmake --build . \
--config ${{ matrix.build-type }}
./consumer
working-directory: _build/tests/cmake-consumer-dist
- name: Test CMake Consumer with static OCIO
if: matrix.build-shared == 'OFF'
# The yaml-cpp_VERSION is set below because Findyaml-cpp.cmake needs it but is unable to
# extract it from the headers, like the other modules.
#
# Prefer the static version of each dependencies by using <pkg>_STATIC_LIBRARY.
# Alternatively, this can be done by setting <pkg>_LIBRARY and <pkg>_INCLUDE_DIR to
# the static version of the package.
run: |
cmake . \
-DCMAKE_PREFIX_PATH=../../../_install \
-DCMAKE_BUILD_TYPE=${{ matrix.build-type }} \
-Dexpat_ROOT=${{ env.ocio_build_path }}/ext/dist \
-Dexpat_STATIC_LIBRARY=ON \
-DImath_ROOT=${{ env.ocio_build_path }}/ext/dist \
-DImath_STATIC_LIBRARY=ON \
-Dpystring_ROOT=${{ env.ocio_build_path }}/ext/dist \
-Dyaml-cpp_ROOT=${{ env.ocio_build_path }}/ext/dist \
-Dyaml-cpp_STATIC_LIBRARY=ON \
-Dyaml-cpp_VERSION=0.7.0 \
-DZLIB_ROOT=${{ env.ocio_build_path }}/ext/dist \
-DZLIB_STATIC_LIBRARY=ON \
-Dminizip-ng_ROOT=${{ env.ocio_build_path }}/ext/dist \
-Dminizip-ng_STATIC_LIBRARY=ON
cmake --build . \
--config ${{ matrix.build-type }}
./consumer
working-directory: _build/tests/cmake-consumer-dist
# ---------------------------------------------------------------------------
# Windows latest ext packages
# ---------------------------------------------------------------------------
windows-latest:
name: 'Windows latest
<MSVC
config=${{ matrix.build-type }},
shared=${{ matrix.build-shared }},
cxx=${{ matrix.cxx-standard }},
python=${{ matrix.python-version }}>'
# Don't run on OCIO forks
if: github.repository == 'AcademySoftwareFoundation/OpenColorIO'
runs-on: windows-latest
strategy:
matrix:
build: [1, 2]
include:
- build: 1
build-python: ON
build-type: Release
build-shared: ON
cxx-standard: 20
python-version: '3.11'
- build: 2
build-python: ON
build-type: Debug
build-shared: ON
cxx-standard: 20
python-version: '3.11'
steps:
- name: Setup Python
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Checkout
uses: actions/checkout@v3
- name: Install tests env
run: share/ci/scripts/windows/install_tests_env.sh
shell: bash
- name: Create build directories
run: |
mkdir _install
mkdir _build
shell: bash
- name: Configure
run: |
cmake ../. \
-DCMAKE_INSTALL_PREFIX=../_install \
-DCMAKE_BUILD_TYPE=${{ matrix.build-type }} \
-DCMAKE_CXX_STANDARD=${{ matrix.cxx-standard }} \
-DCMAKE_GENERATOR_PLATFORM=x64 \
-DBUILD_SHARED_LIBS=${{ matrix.build-shared }} \
-DOCIO_BUILD_DOCS=OFF \
-DOCIO_BUILD_OPENFX=ON \
-DOCIO_BUILD_GPU_TESTS=OFF \
-DOCIO_BUILD_PYTHON=${{ matrix.build-python}} \
-DOCIO_USE_SSE=ON \
-DOCIO_USE_OIIO_FOR_APPS=OFF \
-DOCIO_INSTALL_EXT_PACKAGES=ALL \
-DOCIO_WARNING_AS_ERROR=ON \
-DPython_EXECUTABLE=$(which python)
shell: bash
working-directory: _build
- name: Build
run: |
cmake --build . \
--target install \
--config ${{ matrix.build-type }}
echo "ocio_build_path=$(pwd)" >> $GITHUB_ENV
shell: bash
working-directory: _build
- name: Test
run: ctest -V -C ${{ matrix.build-type }}
shell: bash
working-directory: _build
- name: Test CMake Consumer with shared OCIO
if: matrix.build-shared == 'ON'
run: |
cmake . \
-DCMAKE_PREFIX_PATH=../../../_install \
-DCMAKE_BUILD_TYPE=${{ matrix.build-type }}
cmake --build . \
--config ${{ matrix.build-type }}
export PATH=../../../_install/bin:$PATH
./${{ matrix.build-type }}/consumer
shell: bash
working-directory: _build/tests/cmake-consumer-dist
- name: Test CMake Consumer with static OCIO
if: matrix.build-shared == 'OFF'
# The yaml-cpp_VERSION is set below because Findyaml-cpp.cmake needs it but is unable to
# extract it from the headers, like the other modules.
#
# Prefer the static version of each dependencies by using <pkg>_STATIC_LIBRARY.
# Alternatively, this can be done by setting <pkg>_LIBRARY and <pkg>_INCLUDE_DIR to
# the static version of the package.
run: |
cmake . \
-DCMAKE_PREFIX_PATH=../../../_install \
-DCMAKE_BUILD_TYPE=${{ matrix.build-type }} \
-Dexpat_ROOT=${{ env.ocio_build_path }}/ext/dist \
-Dexpat_STATIC_LIBRARY=ON \
-DImath_ROOT=${{ env.ocio_build_path }}/ext/dist \
-DImath_STATIC_LIBRARY=ON \
-Dpystring_ROOT=${{ env.ocio_build_path }}/ext/dist \
-Dyaml-cpp_ROOT=${{ env.ocio_build_path }}/ext/dist \
-Dyaml-cpp_STATIC_LIBRARY=ON \
-Dyaml-cpp_VERSION=0.7.0 \
-DZLIB_ROOT=${{ env.ocio_build_path }}/ext/dist \
-DZLIB_STATIC_LIBRARY=ON \
-Dminizip-ng_ROOT=${{ env.ocio_build_path }}/ext/dist \
-Dminizip-ng_STATIC_LIBRARY=ON
cmake --build . \
--config ${{ matrix.build-type }}
export PATH=../../../_install/bin:$PATH
./${{ matrix.build-type }}/consumer
shell: bash
working-directory: _build/tests/cmake-consumer-dist
+18 -18
View File
@@ -51,7 +51,7 @@ jobs:
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v2
- name: Build SDist
run: pipx run build --sdist
@@ -59,7 +59,7 @@ jobs:
- name: Check metadata
run: pipx run twine check dist/*
- uses: actions/upload-artifact@v3
- uses: actions/upload-artifact@v2
with:
path: dist/*.tar.gz
@@ -115,25 +115,25 @@ jobs:
arch: aarch64
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v2
- uses: actions/setup-python@v4
- uses: actions/setup-python@v2
name: Install Python
with:
python-version: '3.8'
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
uses: docker/setup-qemu-action@v1
with:
platforms: all
- name: Build wheels
uses: pypa/cibuildwheel@v2.13.1
uses: pypa/cibuildwheel@v2.11.2
env:
CIBW_BUILD: ${{ matrix.python }}
CIBW_ARCHS: ${{ matrix.arch }}
- uses: actions/upload-artifact@v3
- uses: actions/upload-artifact@v2
with:
path: ./wheelhouse/*.whl
@@ -143,7 +143,7 @@ jobs:
macos:
name: Build wheels on macOS
runs-on: macos-11
runs-on: macos-10.15
# Don't run on OCIO forks
if: |
github.event_name != 'schedule' ||
@@ -186,20 +186,20 @@ jobs:
arch: arm64
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v2
- uses: actions/setup-python@v4
- uses: actions/setup-python@v2
name: Install Python
with:
python-version: '3.8'
- name: Build wheels
uses: pypa/cibuildwheel@v2.13.1
uses: pypa/cibuildwheel@v2.11.2
env:
CIBW_BUILD: ${{ matrix.python }}
CIBW_ARCHS: ${{ matrix.arch }}
- uses: actions/upload-artifact@v3
- uses: actions/upload-artifact@v2
with:
path: ./wheelhouse/*.whl
@@ -237,20 +237,20 @@ jobs:
arch: AMD64
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v2
- uses: actions/setup-python@v4
- uses: actions/setup-python@v2
name: Install Python
with:
python-version: '3.8'
- name: Build wheels
uses: pypa/cibuildwheel@v2.13.1
uses: pypa/cibuildwheel@v2.11.2
env:
CIBW_BUILD: ${{ matrix.python }}
CIBW_ARCHS: ${{ matrix.arch }}
- uses: actions/upload-artifact@v3
- uses: actions/upload-artifact@v2
with:
path: ./wheelhouse/*.whl
@@ -260,9 +260,9 @@ jobs:
runs-on: ubuntu-latest
if: github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags/v')
steps:
- uses: actions/setup-python@v4
- uses: actions/setup-python@v2
- uses: actions/download-artifact@v3
- uses: actions/download-artifact@v2
with:
name: artifact
path: dist
+17 -193
View File
@@ -5,14 +5,13 @@
###############################################################################
# CMake definition.
cmake_minimum_required(VERSION 3.13)
cmake_minimum_required(VERSION 3.12)
set(CMAKE_MODULE_PATH
${CMAKE_MODULE_PATH}
${CMAKE_CURRENT_SOURCE_DIR}/share/cmake/utils
${CMAKE_CURRENT_SOURCE_DIR}/share/cmake/macros
${CMAKE_CURRENT_SOURCE_DIR}/share/cmake/modules
${CMAKE_CURRENT_SOURCE_DIR}/share/cmake/modules/install
${CMAKE_SOURCE_DIR}/share/cmake/utils
${CMAKE_SOURCE_DIR}/share/cmake/macros
${CMAKE_SOURCE_DIR}/share/cmake/modules
)
set(CMAKE_WARN_DEPRECATED ON)
@@ -29,7 +28,7 @@ endif()
# Project definition.
project(OpenColorIO
VERSION 2.3.0
VERSION 2.2.1
DESCRIPTION "OpenColorIO (OCIO) is a complete color management solution"
HOMEPAGE_URL https://github.com/AcademySoftwareFoundation/OpenColorIO
LANGUAGES CXX C)
@@ -56,7 +55,7 @@ include(GNUInstallDirs)
###############################################################################
# Forbid in-source build.
if(${PROJECT_SOURCE_DIR} STREQUAL ${PROJECT_BINARY_DIR})
if(${CMAKE_SOURCE_DIR} STREQUAL ${CMAKE_BINARY_DIR})
message(FATAL_ERROR
"In-source build not allowed. Please make a new sub-directory and run cmake from there.")
endif()
@@ -95,26 +94,11 @@ set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS "Debug" "Release" "MinSizeR
# Is that a valid build type?
set(_build_type_valid_ false)
foreach (_build_type_ ${CMAKE_CONFIGURATION_TYPES})
string(TOLOWER ${_build_type_} _lowercase_build_type_)
string(TOLOWER ${CMAKE_BUILD_TYPE} _lowercase_cmake_build_type_)
if (_lowercase_cmake_build_type_ STREQUAL _lowercase_build_type_)
# Build type is supported.
set(_build_type_valid_ true)
break()
endif()
endforeach()
unset(_lowercase_build_type_)
unset(_lowercase_cmake_build_type_)
if (NOT _build_type_valid_)
if(NOT "${CMAKE_BUILD_TYPE}" IN_LIST CMAKE_CONFIGURATION_TYPES)
string(REPLACE ";" ", " _CMAKE_CONFIGURATION_TYPES_STR "${CMAKE_CONFIGURATION_TYPES}")
message(FATAL_ERROR
"CMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE} is unsupported. Supported values are: ${_CMAKE_CONFIGURATION_TYPES_STR}.")
endif()
unset(_build_type_valid_)
# Is that in debug mode?
@@ -153,193 +137,33 @@ set (OCIO_PYTHON_VERSION "" CACHE STRING
option(OCIO_BUILD_JAVA "Specify whether to build java bindings" OFF)
if (WIN32)
option(OCIO_USE_WINDOWS_UNICODE "Compile with Windows Unicode support" ON)
endif()
###############################################################################
# Other preferences
option(OCIO_VERBOSE "Display more information when searching or installing dependencies" OFF)
option(OCIO_USE_SOVERSION "Enable versioning in OCIO shared library name" ON)
###############################################################################
# Warnings / debugging settings
option(OCIO_WARNING_AS_ERROR "Set build error level for CI testing" OFF)
if (NOT WIN32)
option(OCIO_ENABLE_SANITIZER "Specify whether to enable compiler sanitizers (address)" OFF)
if (WIN32)
option(OCIO_USE_WINDOWS_UNICODE "Compile with Windows Unicode support" ON)
endif()
###############################################################################
# Optimization / internal linking preferences
option(OCIO_USE_SIMD "Specify whether to enable SIMD CPU performance optimizations" ON)
option(OCIO_USE_SSE "Specify whether to enable SSE CPU performance optimizations" ON)
option(OCIO_USE_OIIO_CMAKE_CONFIG "Specify whether to look for OIIO using the generated CMake Config script instead of the custom FindOpenImageIO.cmake script" OFF)
option(OCIO_USE_OIIO_FOR_APPS "Request OIIO to build apps (ociolutimage, ocioconvert and ociodisplay), the default uses OpenEXR." OFF)
if (NOT APPLE)
if ("${CMAKE_SYSTEM_PROCESSOR}" MATCHES "(AMD64|IA64|EM64T|X86|x86_64|i386|i686)")
# Intel-based architecture (not APPLE)
set(OCIO_ARCH_X86 1)
set(OCIO_BUILD_ENABLE_OPTIMIZATIONS_SSE ON)
set(OCIO_BUILD_ENABLE_OPTIMIZATIONS_AVX ON)
set(OCIO_BUILD_ENABLE_OPTIMIZATIONS_F16C ON)
else()
set(OCIO_ARCH_X86 0)
set(OCIO_BUILD_ENABLE_OPTIMIZATIONS_SSE OFF)
set(OCIO_BUILD_ENABLE_OPTIMIZATIONS_AVX OFF)
set(OCIO_BUILD_ENABLE_OPTIMIZATIONS_F16C OFF)
endif()
elseif (APPLE)
# Multiple possible scenarios:
# A. Building on an Apple arm64 architecture for the native architecture (arm64).
# B. Building on an Apple arm64 architecture for x86_64.
# C. Building on an Apple arm64 architecture for universal binaries (x86_64 + arm64).
#
# D. Building on an Apple Intel architecture for the native architecture (x86_64).
# E. Building on an Apple Intel architecture for arm64.
# F. Building on an Apple Intel architecture for universal binaries (x86_64 + arm64).
# Check if we are NOT cross-compiling to another Apple architecture.
if (NOT DEFINED CMAKE_OSX_ARCHITECTURES OR CMAKE_OSX_ARCHITECTURES STREQUAL "")
# Building for the native architectures.
if ("${CMAKE_SYSTEM_PROCESSOR}" STREQUAL "x86_64")
# Apple Intel-based computer or Rosetta. (covers case D)
set(OCIO_ARCH_X86 1)
set(OCIO_BUILD_ENABLE_OPTIMIZATIONS_SSE ON)
# The AVX and F16C will be compiled, but it won't used at runtime by Rosetta.
set(OCIO_BUILD_ENABLE_OPTIMIZATIONS_AVX ON)
set(OCIO_BUILD_ENABLE_OPTIMIZATIONS_F16C ON)
elseif ("${CMAKE_SYSTEM_PROCESSOR}" STREQUAL "arm64")
# Apple arm64. (covers case A)
set(OCIO_ARCH_X86 0)
# OCIO translates the SSE instructions into ARM Neon with the library SSE2NEON.
set(OCIO_BUILD_ENABLE_OPTIMIZATIONS_SSE ON)
# OCIO does not translate AVX to ARM Neon.
set(OCIO_BUILD_ENABLE_OPTIMIZATIONS_AVX OFF)
# Turn F16C off since they are x86_64 instructions.
set(OCIO_BUILD_ENABLE_OPTIMIZATIONS_F16C OFF)
endif()
else()
# Cross-compiling to another Apple architecture (x86_64, arm64, or both (universal))
if ("${CMAKE_OSX_ARCHITECTURES}" STREQUAL "x86_64")
# Compiling for x86_64 regardless of native architecture.
# Covers case B assuming CMAKE_SYSTEM_PROCESSOR is arm64.
# Covers case D if CMAKE_OSX_ARCHITECTURES is set to x86_64 on x86_64 architecture.
set(OCIO_ARCH_X86 1)
set(OCIO_BUILD_ENABLE_OPTIMIZATIONS_SSE ON)
# The AVX and F16C will be compiled, but they won't used at runtime by Rosetta.
set(OCIO_BUILD_ENABLE_OPTIMIZATIONS_AVX ON)
set(OCIO_BUILD_ENABLE_OPTIMIZATIONS_F16C ON)
elseif ("${CMAKE_OSX_ARCHITECTURES}" STREQUAL "arm64")
# Compiling for arm64 regardless of native architecture.
# Covers case E assuming CMAKE_SYSTEM_PROCESSOR is x86_64.
# Covers case A if CMAKE_OSX_ARCHITECTURES is set arm64 on arm64 architecture.
set(OCIO_ARCH_X86 0)
set(OCIO_BUILD_ENABLE_OPTIMIZATIONS_SSE ON)
set(OCIO_BUILD_ENABLE_OPTIMIZATIONS_AVX OFF)
set(OCIO_BUILD_ENABLE_OPTIMIZATIONS_F16C OFF)
elseif ("${CMAKE_OSX_ARCHITECTURES}" MATCHES "(arm64;x86_64|x86_64;arm64)")
# Universal build (covers case C and F).
set(OCIO_ARCH_X86 1)
set(OCIO_BUILD_ENABLE_OPTIMIZATIONS_SSE ON)
# The AVX and F16C will be compiled, but they won't used at runtime by Rosetta.
set(OCIO_BUILD_ENABLE_OPTIMIZATIONS_AVX ON)
set(OCIO_BUILD_ENABLE_OPTIMIZATIONS_F16C ON)
endif()
endif()
endif()
option(OCIO_USE_SSE2 "Specify whether to enable SSE2 CPU performance optimizations" ${OCIO_BUILD_ENABLE_OPTIMIZATIONS_SSE})
option(OCIO_USE_SSE3 "Specify whether to enable SSE3 CPU performance optimizations" ${OCIO_BUILD_ENABLE_OPTIMIZATIONS_SSE})
option(OCIO_USE_SSSE3 "Specify whether to enable SSSE3 CPU performance optimizations" ${OCIO_BUILD_ENABLE_OPTIMIZATIONS_SSE})
option(OCIO_USE_SSE4 "Specify whether to enable SSE4 CPU performance optimizations" ${OCIO_BUILD_ENABLE_OPTIMIZATIONS_SSE})
option(OCIO_USE_SSE42 "Specify whether to enable SSE4.2 CPU performance optimizations" ${OCIO_BUILD_ENABLE_OPTIMIZATIONS_SSE})
option(OCIO_USE_AVX "Specify whether to enable AVX CPU performance optimizations" ${OCIO_BUILD_ENABLE_OPTIMIZATIONS_AVX})
option(OCIO_USE_AVX2 "Specify whether to enable AVX2 CPU performance optimizations" ${OCIO_BUILD_ENABLE_OPTIMIZATIONS_AVX})
option(OCIO_USE_AVX512 "Specify whether to enable AVX512 CPU performance optimizations" ${OCIO_BUILD_ENABLE_OPTIMIZATIONS_AVX})
option(OCIO_USE_F16C "Specify whether to enable F16C CPU performance optimizations" ${OCIO_BUILD_ENABLE_OPTIMIZATIONS_F16C})
if (APPLE)
# TODO: Revisit whether that option is necessary.
option(OCIO_USE_SSE2NEON "Specify whether to enable SSE CPU performance optimizations using SSE2NEON for Apple ARM architecture" ON)
mark_as_advanced(OCIO_USE_SSE2NEON)
endif()
###############################################################################
# GPU configuration
message(STATUS "")
message(STATUS "Checking for GPU configuration...")
include(CheckSupportGL)
###############################################################################
# Check for ARM neon here because we need to know if ARM NEON is supported
# quickly. Once we know that ARM NEON is supported, we can add sse2neon library
# to the build.
if(OCIO_USE_SIMD)
include(CheckSupportARMNeon)
if (NOT COMPILER_SUPPORTS_ARM_NEON)
# Force it to OFF since ARM Neon is not supported.
set(OCIO_USE_SSE2NEON OFF)
endif()
endif()
###############################################################################
# Add sse2neon to the build if ARM NEON intrinsics are supported.
if(OCIO_USE_SIMD AND OCIO_USE_SSE2NEON AND COMPILER_SUPPORTS_ARM_NEON)
# Install sse2neon. Please note that sse2neon is downloaded during the configure step as it is
# needed for CompilerFlags.cmake and CheckSupportSSEUsingSSE2NEON.cmake.
# Sse2neon is not treated like an imported target. The logic to find sse2neon is here because
# a find module is not suitable for sse2neon's use case.
find_path(sse2neon_INCLUDE_DIR
NAMES
sse2neon.h
HINTS
${sse2neon_ROOT}
PATH_SUFFIXES
sse2neon
include
sse2neon/include
)
# As per instructions on sse2neon's GitHub page, the following compiler flags should be used:
# "-march=armv8-a+fp+simd+crypto+crc". These flags are required for some ARM platforms that do
# not enable floating point calculations or SIMD instructions by default. However, for ARM64
# (Apple ARM platform) and x86_64 platforms, these features are already enabled by default.
# Therefore, no additional compiler flags are needed.
if (NOT sse2neon_INCLUDE_DIR)
include(Installsse2neon)
else()
# Any changes to the following lines must be replicated in Installsse2neon.cmake as well.
# Create a target for sse2neon (non-imported)
add_library(sse2neon INTERFACE)
# Add the include directories to the target.
target_include_directories(sse2neon INTERFACE "${sse2neon_INCLUDE_DIR}")
# Ignore the warnings coming from sse2neon.h as they are false positives.
target_compile_options(sse2neon INTERFACE -Wno-unused-parameter)
endif()
endif()
###############################################################################
# Define compilation and link flags
include(CompilerFlags)
###############################################################################
# External linking options
@@ -467,7 +291,7 @@ else()
set(OCIO_SETUP_NAME setup_ocio.sh)
endif()
configure_file(${PROJECT_SOURCE_DIR}/share/ocio/${OCIO_SETUP_NAME}.in
configure_file(${CMAKE_SOURCE_DIR}/share/ocio/${OCIO_SETUP_NAME}.in
${CMAKE_CURRENT_BINARY_DIR}/share/ocio/${OCIO_SETUP_NAME} @ONLY)
INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/share/ocio/${OCIO_SETUP_NAME} DESTINATION ${CMAKE_INSTALL_DATADIR}/ocio/)
@@ -481,8 +305,8 @@ INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/share/ocio/${OCIO_SETUP_NAME} DESTINAT
include(CMakePackageConfigHelpers)
set(OCIO_TARGETS_EXPORT_NAME "${PROJECT_NAME}Targets.cmake")
set(OCIO_VERSION_CONFIG "${PROJECT_BINARY_DIR}/${PROJECT_NAME}ConfigVersion.cmake")
set(OCIO_PROJECT_CONFIG "${PROJECT_BINARY_DIR}/${PROJECT_NAME}Config.cmake")
set(OCIO_VERSION_CONFIG "${CMAKE_BINARY_DIR}/${PROJECT_NAME}ConfigVersion.cmake")
set(OCIO_PROJECT_CONFIG "${CMAKE_BINARY_DIR}/${PROJECT_NAME}Config.cmake")
set(OCIO_CONFIG_INSTALL_DIR "${CMAKE_INSTALL_LIBDIR}/cmake/${PROJECT_NAME}")
set(OCIO_CUSTOM_FIND_MODULE_DIR "${CMAKE_INSTALL_PREFIX}/share/OpenColorIO/cmake/modules")
set(OCIO_CUSTOM_MACROS_MODULE_DIR "${CMAKE_INSTALL_PREFIX}/share/OpenColorIO/cmake/macros")
-2
View File
@@ -119,8 +119,6 @@ project at all ASWF TAC meetings.
* Sean Cooper - ARRI
* Michael Dolan - Epic Games
* Patrick Hodoul - Autodesk
* Zach Lewis - Method Studios
* Thomas Mansencal - WetaFX
* Carol Payne - Netflix
* Carl Rand - Weta Digital
* Mark Titchener - Foundry
-3
View File
@@ -6,6 +6,3 @@ graft share
graft src
graft tests
global-include CMakeLists.txt *.cmake *.md
global-exclude */__pycache__/*
global-exclude *.pyc
global-exclude .DS_Store
+20 -20
View File
@@ -61,11 +61,11 @@ if(${Python_VERSION_MAJOR} GREATER_EQUAL 3)
# configuration, but omits *.in to work in RTD builds.
message(STATUS "Substitute documentation variables")
file(GLOB_RECURSE DOC_IN_FILES
"${PROJECT_SOURCE_DIR}/docs/**.in"
"${PROJECT_SOURCE_DIR}/docs/conf.py"
"${CMAKE_SOURCE_DIR}/docs/**.in"
"${CMAKE_SOURCE_DIR}/docs/conf.py"
)
foreach(in_file ${DOC_IN_FILES})
string(REPLACE "${PROJECT_SOURCE_DIR}/" "${PROJECT_BINARY_DIR}/"
string(REPLACE "${CMAKE_SOURCE_DIR}/" "${CMAKE_BINARY_DIR}/"
out_file ${in_file})
string(REPLACE ".in" ""
out_file ${out_file})
@@ -73,15 +73,15 @@ if(${Python_VERSION_MAJOR} GREATER_EQUAL 3)
endforeach()
# Copy documentation source to build location
file(GLOB_RECURSE DOC_SOURCES "${PROJECT_SOURCE_DIR}/docs/*")
file(GLOB_RECURSE DOC_SOURCES "${CMAKE_SOURCE_DIR}/docs/*")
list(APPEND DOC_SOURCES
${PROJECT_SOURCE_DIR}/README.md
${PROJECT_SOURCE_DIR}/INSTALL.md
${PROJECT_SOURCE_DIR}/CHANGELOG.md
${PROJECT_SOURCE_DIR}/LICENSE
${CMAKE_SOURCE_DIR}/README.md
${CMAKE_SOURCE_DIR}/INSTALL.md
${CMAKE_SOURCE_DIR}/CHANGELOG.md
${CMAKE_SOURCE_DIR}/LICENSE
)
if(OCIO_BUILD_NUKE)
list(APPEND DOC_SOURCES ${PROJECT_SOURCE_DIR}/share/nuke/ocionuke/viewer.py)
list(APPEND DOC_SOURCES ${CMAKE_SOURCE_DIR}/share/nuke/ocionuke/viewer.py)
endif()
# Don't copy configured files. In particular this prevents overwriting conf.py,
@@ -93,15 +93,15 @@ if(${Python_VERSION_MAJOR} GREATER_EQUAL 3)
)
foreach(f ${DOC_SOURCES})
string(REGEX REPLACE "^${PROJECT_SOURCE_DIR}/" "" relpath ${f})
string(REGEX REPLACE "^${CMAKE_SOURCE_DIR}/" "" relpath ${f})
string(REGEX REPLACE "[/. ]" "_" tgtname ${relpath})
string(REGEX MATCH "^docs" IN_DOCS ${relpath})
set(SRC_PATH ${PROJECT_SOURCE_DIR}/${relpath})
set(DST_PATH ${PROJECT_BINARY_DIR}/${relpath})
set(SRC_PATH ${CMAKE_SOURCE_DIR}/${relpath})
set(DST_PATH ${CMAKE_BINARY_DIR}/${relpath})
if(NOT IN_DOCS)
get_filename_component(F_NAME ${relpath} NAME)
set(DST_PATH "${PROJECT_BINARY_DIR}/docs/${F_NAME}")
set(DST_PATH "${CMAKE_BINARY_DIR}/docs/${F_NAME}")
endif()
add_custom_command(OUTPUT ${DST_PATH}
@@ -118,16 +118,16 @@ if(${Python_VERSION_MAJOR} GREATER_EQUAL 3)
get_target_property(DOXYGEN_EXECUTABLE Doxygen::doxygen IMPORTED_LOCATION)
file(GLOB_RECURSE DOXYGEN_SOURCES
"${PROJECT_SOURCE_DIR}/include/*.h"
"${PROJECT_BINARY_DIR}/include/*.h"
"${CMAKE_SOURCE_DIR}/include/*.h"
"${CMAKE_BINARY_DIR}/include/*.h"
)
set(DOXYGEN_INDEX_XML "${PROJECT_BINARY_DIR}/docs/_doxygen/xml/index.xml")
set(DOXYGEN_INDEX_XML "${CMAKE_BINARY_DIR}/docs/_doxygen/xml/index.xml")
# Run doxygen if index.xml is behind OCIO headers or doxygen config
add_custom_command(OUTPUT ${DOXYGEN_INDEX_XML}
COMMAND "${DOXYGEN_EXECUTABLE}" "${PROJECT_BINARY_DIR}/docs/Doxyfile"
COMMAND "${DOXYGEN_EXECUTABLE}" "${CMAKE_BINARY_DIR}/docs/Doxyfile"
DEPENDS
${PROJECT_BINARY_DIR}/docs/Doxyfile
${CMAKE_BINARY_DIR}/docs/Doxyfile
${DOXYGEN_SOURCES}
COMMENT "Extracting XML files from C++ headers"
)
@@ -140,7 +140,7 @@ if(${Python_VERSION_MAJOR} GREATER_EQUAL 3)
### HTML doc target ###
file(GLOB_RECURSE SPHINX_EXTENSIONS
"${PROJECT_SOURCE_DIR}/share/docs/*.py"
"${CMAKE_SOURCE_DIR}/share/docs/*.py"
)
# Run Sphinx
@@ -148,7 +148,7 @@ if(${Python_VERSION_MAJOR} GREATER_EQUAL 3)
COMMAND
${Python_PRE_CMD} "${Sphinx_EXECUTABLE}" -b html . "${CMAKE_CURRENT_BINARY_DIR}/build-html"
DEPENDS
${PROJECT_BINARY_DIR}/docs/conf.py
${CMAKE_BINARY_DIR}/docs/conf.py
${SPHINX_EXTENSIONS}
${DOXYGEN_INDEX_XML}
COMMENT "Building html docs"
+2 -2
View File
@@ -792,7 +792,7 @@ WARN_LOGFILE =
# spaces. See also FILE_PATTERNS and EXTENSION_MAPPING
# Note: If this tag is empty the current directory is searched.
INPUT = "@PROJECT_SOURCE_DIR@/include/@CMAKE_PROJECT_NAME@"
INPUT = "@CMAKE_SOURCE_DIR@/include/@CMAKE_PROJECT_NAME@"
# This tag can be used to specify the character encoding of the source files
# that doxygen parses. Internally doxygen uses the UTF-8 encoding. Doxygen uses
@@ -2040,7 +2040,7 @@ SEARCH_INCLUDES = YES
# preprocessor.
# This tag requires that the tag SEARCH_INCLUDES is set to YES.
INCLUDE_PATH = "@PROJECT_BINARY_DIR@/include/@CMAKE_PROJECT_NAME@"
INCLUDE_PATH = "@CMAKE_BINARY_DIR@/include/@CMAKE_PROJECT_NAME@"
# You can use the INCLUDE_FILE_PATTERNS tag to specify one or more wildcard
# patterns (like *.h and *.hpp) to filter out the header-files in the
@@ -50,47 +50,6 @@
} //
.. py:attribute:: GpuShaderCreator.TEXTURE_1D
:module: PyOpenColorIO
:value: <TextureDimensions.TEXTURE_1D: 1>
.. py:attribute:: GpuShaderCreator.TEXTURE_2D
:module: PyOpenColorIO
:value: <TextureDimensions.TEXTURE_2D: 2>
.. py:class:: GpuShaderCreator.TextureDimensions
:module: PyOpenColorIO
:canonical: PyOpenColorIO.GpuShaderCreator.TextureDimensions
Dimension enum used to differentiate between 1D and 2D object/resource types.
Members:
TEXTURE_1D
TEXTURE_2D
.. py:attribute:: GpuShaderCreator.TextureDimensions.TEXTURE_1D
:module: PyOpenColorIO
:value: <TextureDimensions.TEXTURE_1D: 1>
.. py:attribute:: GpuShaderCreator.TextureDimensions.TEXTURE_2D
:module: PyOpenColorIO
:value: <TextureDimensions.TEXTURE_2D: 2>
.. py:property:: GpuShaderCreator.TextureDimensions.name
:module: PyOpenColorIO
.. py:property:: GpuShaderCreator.TextureDimensions.value
:module: PyOpenColorIO
.. py:method:: GpuShaderCreator.addToDeclareShaderCode(self: PyOpenColorIO.GpuShaderCreator, shaderCode: str) -> None
:module: PyOpenColorIO
@@ -140,10 +99,6 @@
:module: PyOpenColorIO
.. py:method:: GpuShaderCreator.getAllowTexture1D(self: PyOpenColorIO.GpuShaderCreator) -> bool
:module: PyOpenColorIO
.. py:method:: GpuShaderCreator.getCacheID(self: PyOpenColorIO.GpuShaderCreator) -> str
:module: PyOpenColorIO
@@ -193,12 +148,6 @@
:module: PyOpenColorIO
.. py:method:: GpuShaderCreator.setAllowTexture1D(self: PyOpenColorIO.GpuShaderCreator, allowed: bool) -> None
:module: PyOpenColorIO
Allow 1D GPU resource type, otherwise always using 2D resources for 1D LUTs.
.. py:method:: GpuShaderCreator.setFunctionName(self: PyOpenColorIO.GpuShaderCreator, name: str) -> None
:module: PyOpenColorIO
@@ -146,51 +146,6 @@
Create the default shader description.
.. py:attribute:: GpuShaderDesc.TEXTURE_1D
:module: PyOpenColorIO
:value: <TextureDimensions.TEXTURE_1D: 1>
.. py:attribute:: GpuShaderDesc.TEXTURE_2D
:module: PyOpenColorIO
:value: <TextureDimensions.TEXTURE_2D: 2>
.. py:class:: GpuShaderDesc.TextureDimensions
:module: PyOpenColorIO
:canonical: PyOpenColorIO.GpuShaderCreator.TextureDimensions
Dimension enum used to differentiate between 1D and 2D object/resource types.
Members:
TEXTURE_1D
TEXTURE_2D
.. py:attribute:: GpuShaderDesc.TextureDimensions.TEXTURE_1D
:module: PyOpenColorIO
:value: <TextureDimensions.TEXTURE_1D: 1>
.. py:attribute:: GpuShaderDesc.TextureDimensions.TEXTURE_2D
:module: PyOpenColorIO
:value: <TextureDimensions.TEXTURE_2D: 2>
.. py:method:: GpuShaderDesc.TextureDimensions.__init__(self: PyOpenColorIO.GpuShaderCreator.TextureDimensions, value: int) -> None
:module: PyOpenColorIO
.. py:property:: GpuShaderDesc.TextureDimensions.name
:module: PyOpenColorIO
.. py:property:: GpuShaderDesc.TextureDimensions.value
:module: PyOpenColorIO
.. py:method:: GpuShaderDesc.__init__(*args, **kwargs)
:module: PyOpenColorIO
@@ -204,10 +159,10 @@
The 'values' parameter contains the 3D LUT data which must be used as-is as the dimension and origin are hard-coded in the fragment shader program. So, it means one GPU 3D texture per entry.
.. py:method:: GpuShaderDesc.addTexture(self: PyOpenColorIO.GpuShaderDesc, textureName: str, samplerName: str, width: int, height: int, channel: PyOpenColorIO.GpuShaderCreator.TextureType, dimensions: PyOpenColorIO.GpuShaderCreator.TextureDimensions, interpolation: PyOpenColorIO.Interpolation, values: buffer) -> None
.. py:method:: GpuShaderDesc.addTexture(self: PyOpenColorIO.GpuShaderDesc, textureName: str, samplerName: str, width: int, height: int, channel: PyOpenColorIO.GpuShaderCreator.TextureType, interpolation: PyOpenColorIO.Interpolation, values: buffer) -> None
:module: PyOpenColorIO
Add a 1D or 2D texture
Add a 2D texture (1D texture if height equals 1).
.. note::
The 'values' parameter contains the LUT data which must be used as-is as the dimensions and origin are hard-coded in the fragment shader program. So, it means one GPU texture per entry.
@@ -266,10 +221,6 @@
:module: PyOpenColorIO
.. py:method:: GpuShaderDesc.getAllowTexture1D(self: PyOpenColorIO.GpuShaderCreator) -> bool
:module: PyOpenColorIO
.. py:method:: GpuShaderDesc.getCacheID(self: PyOpenColorIO.GpuShaderCreator) -> str
:module: PyOpenColorIO
@@ -333,12 +284,6 @@
:module: PyOpenColorIO
.. py:method:: GpuShaderDesc.setAllowTexture1D(self: PyOpenColorIO.GpuShaderCreator, allowed: bool) -> None
:module: PyOpenColorIO
Allow 1D GPU resource type, otherwise always using 2D resources for 1D LUTs.
.. py:method:: GpuShaderDesc.setFunctionName(self: PyOpenColorIO.GpuShaderCreator, name: str) -> None
:module: PyOpenColorIO
@@ -434,10 +379,6 @@
:module: PyOpenColorIO.GpuShaderDesc
.. py:property:: Texture.dimensions
:module: PyOpenColorIO.GpuShaderDesc
.. py:method:: Texture.getValues(self: PyOpenColorIO.GpuShaderDesc.Texture) -> numpy.ndarray
:module: PyOpenColorIO.GpuShaderDesc
@@ -7,8 +7,6 @@
Presentations & Publications
============================
* ASWF Open Source Days 2023 `video <https://www.youtube.com/watch?v=y-oq693Wl8g>`_
* OCIO wins the Pipeline Tool award at DigiPro 2022! `video <https://vimeo.com/742052701>`_
* ASWF Open Source Days 2022 `video <https://www.youtube.com/watch?v=WzFlz1HeNdI>`_
+11 -28
View File
@@ -4,45 +4,28 @@
.. _aces_cg:
OCIO CG Config for ACES
=======================
ACES CG Config
==============
The OCIO Computer Graphics (CG) config for ACES is a simple, lightweight config intended for use
The ACES Computer Graphics (CG) config is a simple, lightweight config intended for use
in typical digital content creation (DCC) apps that need robust choices for texture and
rendering spaces and a basic selection of display and view transforms.
rendering spaces and a basic selection of display and view transforms.
Users who need a more extensive set of color spaces, including digital cinema camera
color spaces and a wider set of displays and view should look at the :ref:`aces_studio`.
Please note that some of the color spaces (e.g. for texturing) are not officially part of the
ACES specifications but are included because they are widely used in VFX, animation, and games.
The latest version of this config may be downloaded from the Releases page of its GitHub
`repo. <https://github.com/AcademySoftwareFoundation/OpenColorIO-Config-ACES/releases>`_
The CG Config leverages the high quality ACES implementation built into OCIO itself
The ACES CG Config leverages the high quality ACES implementation built into OCIO itself
and so requires no external LUT files. In fact, even the config file is built into OCIO
and users may access it from any application that uses OCIO 2.2 or higher by using one of the
following strings in place of the config path:
and users may access it from any application that uses OCIO 2.2 or higher by using the
following string in place of the config path::
ocio://cg-config-v1.0.0_aces-v1.3_ocio-v2.1
``ocio://studio-config-v2.1.0_aces-v1.3_ocio-v2.3`` (for OCIO 2.3 or higher)
``ocio://studio-config-v1.0.0_aces-v1.3_ocio-v2.1`` (for OCIO 2.2 or higher)
These new configs adopt an advanced naming convention so that they can be uniquely identified:
``studio-config-v1.0.0_aces-v1.3_ocio-v2.1.ocio``
``|-----|-------------|---------|---------|---|``
``|Type | Colorspaces | ACES | Profile | |``
Where:
* Type: The type of the config, e.g., CG or Studio
* Colorspaces: The version for the color spaces and other config features
* ACES: The aces-dev version being used
* Profile: Minimum required OCIO version
The default built-in config is currently the ACES CG Config, so the even simpler:
``ocio://default`` may be used instead. Note however, that the value of the default
config may evolve over time.
The OCIO Configs Working Group collected input from the community and simplified the
naming scheme relative to the earlier OCIO v1 ACES configs. However, aliases have been
+9 -27
View File
@@ -4,15 +4,15 @@
.. _aces_studio:
OCIO Studio Config for ACES
===========================
ACES Studio Config
==================
The OCIO Studio Config for ACES is the successor to the widely used :ref:`ACES config <aces_1.0.3>`
The ACES Studio Config is the successor to the widely used :ref:`ACES config <aces_1.0.3>`
for OCIO v1.
It contains the complete set of ACES color spaces, displays, and views. In addition, it
contains some extra color spaces that are not officially part of ACES but that are widely
used in the VFX, animation, games, and post-production industries.
contains some extra color spaces that are widely used in the VFX and post-production
industries.
Users who need a simpler config that contains just the basics needed to use ACES color
management in common DCC tools are encouraged to check out the :ref:`aces_cg`.
@@ -20,29 +20,11 @@ management in common DCC tools are encouraged to check out the :ref:`aces_cg`.
The latest version of this config may be downloaded from the Releases page of its GitHub
`repo. <https://github.com/AcademySoftwareFoundation/OpenColorIO-Config-ACES/releases>`_
The Studio Config leverages the high quality ACES implementation built into OCIO itself
The ACES Studio Config leverages the high quality ACES implementation built into OCIO itself
and so requires no external LUT files. In fact, even the config file is built into OCIO
and users may access it from any application that uses OCIO 2.2 or higher by using one of the
following strings in place of the config path:
``ocio://studio-config-v2.1.0_aces-v1.3_ocio-v2.3`` (for OCIO 2.3 or higher)
``ocio://studio-config-v1.0.0_aces-v1.3_ocio-v2.1`` (for OCIO 2.2 or higher)
These new configs adopt an advanced naming convention so that they can be uniquely identified:
``studio-config-v1.0.0_aces-v1.3_ocio-v2.1.ocio``
``|-----|-------------|---------|---------|---|``
``|Type | Colorspaces | ACES | Profile | |``
Where:
* Type: The type of the config, e.g., CG or Studio
* Colorspaces: The version for the color spaces and other config features
* ACES: The aces-dev version being used
* Profile: Minimum required OCIO version
and users may access it from any application that uses OCIO 2.2 or higher by using the
following string in place of the config path::
ocio://studio-config-v1.0.0_aces-v1.3_ocio-v2.1
The OCIO Configs Working Group collected input from the community and simplified the
naming scheme relative to the earlier OCIO v1 ACES configs. However, aliases have been
+2 -22
View File
@@ -16,18 +16,6 @@ If you are a developer and would like assistance integrating OCIO into your
application, please contact ocio-dev as well.
3ds Max (Autodesk)
******************
Website : `<https://www.autodesk.com/products/3ds-max/overview>`__
Supported Version: >= 2024
Documentation :
- `Color Management <https://help.autodesk.com/view/3DSMAX/2024/ENU/?guid=GUID-AF6FB34D-5453-4AE2-A987-388A4BB5AAFD>`__
After Effects
*************
@@ -243,17 +231,9 @@ Supported Version: >= 2016
Documentation:
- `Get Started with Color Management <https://help.autodesk.com/view/MAYAUL/2024/ENU/?guid=GUID-B260195C-A0FE-4F51-9EA2-099B61B7725A>`__
- `Use an OCIO configuration file for color management <https://knowledge.autodesk.com/support/maya-lt/learn-explore/caas/CloudHelp/cloudhelp/2016/ENU/MayaLT/files/GUID-4AE9AABC-A900-4276-AFE4-F9DCD96BA03D-htm.html>`__
- `Color Management in Maya: Setting up a scene <https://youtu.be/bVYg8ZyljLs>`__
- `Color Management in Maya: Input Spaces <https://youtu.be/biGWwdqaimY>`__
- `Color Management in Maya: Previewing and Rendering <https://youtu.be/Pvxqc5NC_b4>`__
- `Color Management in Maya: Color Picking <https://youtu.be/mgKHMrJ8DIY>`__
- `Color Management in Maya: ACES default <https://youtu.be/FODVxXOIrvM>`__
- `What's New in Rendering <https://knowledge.autodesk.com/support/maya/learn-explore/caas/CloudHelp/cloudhelp/2016/ENU/Maya/files/GUID-C22F815A-8390-405B-BA50-74FEC42C75E0-htm.html>`__
Mocha Pro (Boris FX)
-10
View File
@@ -305,16 +305,6 @@ Examples::
.. TODO: examples formatting
.. _overview-ocioview:
ocioview
********
This is a new GUI tool for inspecting and editing config files. It is currently an
alpha release and we are looking for contributors to extend it or provide tutorials.
Please see the README in apps/ocioview for details about installation.
.. _overview-ociowrite:
ociowrite
+2 -2
View File
@@ -23,8 +23,8 @@ films as SpiderMan 2 (2004), Surf's Up (2007), Cloudy with a Chance of Meatballs
OpenColorIO v2 was in development from 2017 to 2020 and was feature complete as of
SIGGRAPH 2020. After a stabilization and bug-fixing period, an official 2.0.0
release was made in January 2021. Development has continued to be active since
then with the 2.1 release in 2021, the 2.2 release in 2022, and the 2.3 release
in 2023 adding even more capabilities. Here is more information about our :ref:`upgrading_to_v2`.
then with the 2.1 release in 2021 and the 2.2 release in 2022 adding even more
capabilities. Here is more information about our :ref:`upgrading_to_v2`.
About the Documentation
+31 -69
View File
@@ -24,10 +24,9 @@ Alternatives
Python
++++++
If you only need the Python binding and command-line tools, the simplest solution is to
take advantage of the pre-built wheels in the Python Package Index (PyPI)
`here <https://pypi.org/project/opencolorio>`_. It can be installed as follows, once you
have Python installed.
If you only need the Python binding, the simplest solution is to take advantage of the pre-built
wheels in the Python Package Index (PyPI) `here <https://pypi.org/project/opencolorio>`_. It
can be installed as follows, once you have Python installed.
**PyPI**::
@@ -188,26 +187,10 @@ Three ``OCIO_INSTALL_EXT_PACKAGES`` options are available::
Existing Install Hints
++++++++++++++++++++++
If the library is not installed in a typical location where CMake will find it,
you may specify the location using one of the following methods:
- Set ``-D<package_name>_DIR`` to point to the directory containing the CMake configuration file for the package.
- Set ``-D<package_name>_ROOT`` to point to the directory containing the lib and include directories.
- Set ``-D<package_name>_LIBRARY`` and ``-D<package_name>_INCLUDE_DIR`` to point to the lib and include directories.
Not all packages support all of the above options. Please refer the
OCIO CMake `find modules <https://github.com/AcademySoftwareFoundation/OpenColorIO/tree/main/share/cmake/modules>`_ for the package that you are having trouble with to see the options it supports.
Usually CMake will use the dynamic library rather than static, if both are present. In this case,
you may set <package_name>_STATIC_LIBRARY to ON to request use of the static one. If only the
static library is present (such as when OCIO builds the dependency), then the option is not needed.
The following packages support this option:
``expat``, ``yaml-cpp``, ``Imath``, ``lcms2``, and ``minizip-ng``. Using CMake 3.24+, it is
possible to prefer the static version of ``ZLIB`` with ``-DZLIB_USE_STATIC_LIBS=ON``.
The package names used by OCIO are as follows (note that these are case-sensitive):
When using libraries already on your system, the CMake variable
``-D <Package Name>_ROOT=<Path>`` may be used to specify the path to the include and
library root directory rather than have CMake try to find it. The package names used
by OCIO are as follows (note that these are case-sensitive):
Required:
@@ -231,6 +214,21 @@ Optional:
- ``GLUT``
- ``Python``
There are scenarios in which some of the dependencies may not be compiled into an
OCIO dynamic library. This is more likely when OCIO does not download the packages
itself. In these cases, it may be helpful to additionally specify the CMake variable
``-D <Package Name>_STATIC_LIBRARY=ON``. The following package names support this hint:
``expat``, ``yaml-cpp``, ``Imath``, ``lcms2``, ``ZLIB``, and ``minizip-ng``.
Rather than using ``_ROOT``, and possibly ``_STATIC_LIBRARY``, you may instead use
``-D <Package Name>_LIBRARY=<Path>`` and ``-D <Package Name>_INCLUDE_DIR=<Path>``.
In this case, the library path will control whether a static or dynamic library is used.
It may also be used to handle situations where the library and/or include files are not
in the typical location relative to the root directory.
The OCIO `CMake find modules <https://github.com/AcademySoftwareFoundation/OpenColorIO/tree/main/share/cmake/modules>`_
may be consulted for more detail on the handling of a given package and the CMake
variables it uses.
Please note that if you provide your own ``minizip-ng``, rather than having OCIO's CMake
download and build it, you will likely need to set its CMake variables the same way
@@ -265,7 +263,6 @@ CMake Options
+++++++++++++
There are many options available in `CMake.
<https://cmake.org/cmake/help/latest/guide/user-interaction/index.html#guide:User%20Interaction%20Guide>`_
Several of the most common ones are:
@@ -279,33 +276,14 @@ Here are the most common OCIO-specific CMake options (the default values are sho
- ``-DOCIO_USE_OIIO_FOR_APPS=OFF`` (Set ON to build tools with OpenImageIO rather than OpenEXR)
- ``-DOCIO_BUILD_PYTHON=ON`` (Set to OFF to not build the Python binding)
- ``-DOCIO_BUILD_OPENFX=OFF`` (Set to ON to build the OpenFX plug-ins)
- ``-DOCIO_USE_SIMD=ON`` (Set to OFF to turn off SIMD CPU performance optimizations, such as SSE and NEON)
- ``-DOCIO_USE_SSE2`` (Set to OFF to turn off SSE2 CPU performance optimizations)
- ``-DOCIO_USE_AVX`` (Set to OFF to turn off AVX CPU performance optimizations)
- ``-DOCIO_USE_AVX2`` (Set to OFF to turn off AVX2 CPU performance optimizations)
- ``-DOCIO_USE_F16C`` (Set to OFF to turn off F16C CPU performance optimizations)
- ``-DOCIO_USE_SSE=ON`` (Set to OFF to turn off SSE CPU performance optimizations)
- ``-DOCIO_BUILD_TESTS=ON`` (Set to OFF to not build the unit tests)
- ``-DOCIO_BUILD_GPU_TESTS=ON`` (Set to OFF to not build the GPU unit tests)
- ``-DOCIO_USE_HEADLESS=OFF`` (Set to ON to do headless GPU rendering)
- ``-DOCIO_USE_HEADLESS=OFF`` (Set to ON to do headless GPU reendering)
- ``-DOCIO_WARNING_AS_ERROR=ON`` (Set to OFF to turn off warnings as errors)
- ``-DOCIO_BUILD_DOCS=OFF`` (Set to ON to build the documentation)
- ``-DOCIO_BUILD_FROZEN_DOCS=OFF`` (Set to ON to update the Python documentation)
Note that OCIO will turn off any specific SIMD CPU performance optimizations if they are not supported
by the build target architecture. The default for ``OCIO_USE_SSE2``, ``OCIO_USE_AVX``, ``OCIO_USE_AVX2`` and
``OCIO_USE_F16C`` depends on the architecture, but will be ON where supported.
On MacOS, the default is to build for the native architecture that CMake is running under.
For example, if a x86_64 version of CMake is running under Rosetta, the native architecture will
be x86_64, rather then arm64. You can use the ``CMAKE_OSX_ARCHITECTURES`` option to override that.
To build universal binaries, use the following option: ``-DCMAKE_OSX_ARCHITECTURES="arm64;x86_64"``.
When doing a universal build, note that the OCIO dependencies must be built as universal libraries
too. If you are running in OCIO_INSTALL_EXT_PACKAGES=MISSING or NONE mode, your build will fail if
any of your installed libraries are not universal. The easiest way to address this is to set
OCIO_INSTALL_EXT_PACKAGES=ALL in order to let OCIO build everything. Alternatively, you may set
CMAKE_OSX_ARCHITECTURES to just the platform you are targeting.
Several command-line tools (such as ``ocioconvert``) require reading or writing image files.
If ``OCIO_USE_OIIO_FOR_APPS=OFF``, these will be built using OpenEXR rather than OpenImageIO
and therefore you will be limited to using OpenEXR files with these tools rather than the
@@ -406,7 +384,7 @@ Windows
While build environments may vary between users, the recommended way to build OCIO from source on
Windows 7 or newer is to use the scripts provided in the Windows
`share <https://github.com/AcademySoftwareFoundation/OpenColorIO/tree/main/share/dev/windows>`_
section of the OCIO repository. There are two scripts currently available.
section of the OCIO repository. There are two scripts currently available.
The first script is called
`ocio_deps.bat <https://github.com/AcademySoftwareFoundation/OpenColorIO/tree/main/share/dev/windows/ocio_deps.bat>`_
@@ -418,18 +396,14 @@ and it provides some automation to install the most difficult dependencies. Thos
- Glew
- Python dependencies for documentation
Run this command to execute the ocio_deps.bat script:
Run this command to execute the ocio_deps.bat script::
.. code-block:: bash
ocio_deps.bat --vcpkg <path to current vcpkg installation or where it should be installed>
The second script is called
`ocio.bat <https://github.com/AcademySoftwareFoundation/OpenColorIO/tree/main/share/dev/windows/ocio.bat>`_
and it provide a way to configure and build OCIO from source. Moreover, this script executes the
install step of ``cmake`` as well as the unit tests. The main use case is the following:
.. code-block:: bash
install step of ``cmake`` as well as the unit tests. The main use case is the following::
ocio.bat --b <path to build folder> --i <path to install folder>
--vcpkg <path to vcpkg installation> --ocio <path to ocio repository> --type Release
@@ -448,26 +422,14 @@ Quick environment configuration
The quickest way to set the required :ref:`environment-setup` is to
source the ``share/ocio/setup_ocio.sh`` script installed with OCIO.
On Windows, use the corresponding setup_ocio.bat file. See OCIO's install directory under
share/ocio.
On Windows, use the corresponding setup_ocio.bat file.
For a temporary configuration of your terminal, you can run the following script:
.. code-block:: bash
# Windows - Execute setup_ocio.bat
[... path to OCIO install directory]/share/ocio/setup_ocio.bat
# Unix - Execute setup_ocio.sh
[... path to OCIO install directory]\share\ocio\setup_ocio.sh
For a more permanent option, add the following to ``~/.bashrc``
For a simple single-user setup, add the following to ``~/.bashrc``
(assuming you are using bash, and the example install directory of
``/software/ocio``):
``/software/ocio``)::
.. code-block:: bash
source /software/ocio/share/ocio/setup_ocio.sh
source /software/ocio/share/ocio/setup_ocio.sh
The only environment variable you must configure manually is
:envvar:`OCIO`, which points to the configuration file you wish to
use. For prebuilt config files, see the
-1
View File
@@ -10,7 +10,6 @@ Releases
.. toctree::
:caption: Upgrading to v2
ocio_2_3
ocio_2_2
ocio_2_1
ocio_2_0
+2 -4
View File
@@ -25,8 +25,8 @@ described below. This is available in the configs section of the documentation
as :ref:`ocio-v2_demo`.
New Feature Guide
=================
New Feature List
================
New GPU Renderer
****************
@@ -657,5 +657,3 @@ For more detail, please see the GitHub release pages:
`OCIO 2.0.3 <https://github.com/AcademySoftwareFoundation/OpenColorIO/releases/tag/v2.0.3>`_
`OCIO 2.0.4 <https://github.com/AcademySoftwareFoundation/OpenColorIO/releases/tag/v2.0.4>`_
`OCIO 2.0.5 <https://github.com/AcademySoftwareFoundation/OpenColorIO/releases/tag/v2.0.5>`_
+2 -5
View File
@@ -12,9 +12,8 @@ Timeline
OpenColorIO 2.1 was delivered in August 2021 and is in the VFX Reference Platform for
calendar year 2022.
New Feature Guide
=================
New Features
============
ACES 1.3 Gamut Compression
**************************
@@ -172,5 +171,3 @@ For more detail, please see the GitHub release pages:
`OCIO 2.1.1 <https://github.com/AcademySoftwareFoundation/OpenColorIO/releases/tag/v2.1.1>`_
`OCIO 2.1.2 <https://github.com/AcademySoftwareFoundation/OpenColorIO/releases/tag/v2.1.2>`_
`OCIO 2.1.3 <https://github.com/AcademySoftwareFoundation/OpenColorIO/releases/tag/v2.1.3>`_
+17 -19
View File
@@ -13,8 +13,8 @@ OpenColorIO 2.2 was delivered in October 2022 and is in the VFX Reference Platfo
calendar year 2023.
New Feature Guide
=================
New Features
============
Built-in Configs
****************
@@ -281,14 +281,14 @@ The following algorithm is used to make the determination:
* If the color space ``isdata`` attribute is true, return false.
* If the reference space type of the color space differs from the requested reference
space type, return false.
space type, return false.
* If the color space's encoding attribute is present, return true if it matches the
expected reference space type (i.e., "scene-linear" for ``REFERENCE_SPACE_SCENE`` or
"display-linear" for ``REFERENCE_SPACE_DISPLAY``) and false otherwise.
expected reference space type (i.e., "scene-linear" for ``REFERENCE_SPACE_SCENE`` or
"display-linear" for ``REFERENCE_SPACE_DISPLAY``) and false otherwise.
* If the color space has no ``to_reference`` or ``from_reference`` transform, return true.
* Evaluate several points through the color space's transform and check if the output only
differs by a scale factor (which may be different per channel, e.g. allowing an arbitrary
matrix transform, with no offset).
differs by a scale factor (which may be different per channel, e.g. allowing an arbitrary
matrix transform, with no offset).
Note that the last step is a heuristic that may or may not be accurate. However, note
that the ``encoding`` attribute takes precedence and so config authors have the ultimate
@@ -363,26 +363,26 @@ Miscellaneous Improvements
Here are some other improvements in OCIO 2.2:
* Support for more types of ICC Monitor Profiles -- All of the parametric curve types are
now supported.
now supported.
* New hash function for calculating cache IDs -- The md5 algorithm has been replaced with
xxhash, which provides a considerable speed-up for various operations. The APIs that
return cache ID strings will obviously return different strings now, but please note that
these are not guaranteed to be unchanged across releases. (The 128-bit version of xxhash
was used, which is the same length as for md5.)
xxhash, which provides a considerable speed-up for various operations. The APIs that
return cache ID strings will obviously return different strings now, but please note that
these are not guaranteed to be unchanged across releases. (The 128-bit version of xxhash
was used, which is the same length as for md5.)
* The command-line tools ``ocioconvert``, ``ociowrite``, and ``ocioperf`` now support
using an inverse DisplayViewTransform.
using an inverse DisplayViewTransform.
* Add DisplayViewTransform and NamedTransform support to Baker.
* Several new Built-in Transforms are available for version 2.2 config files, including
ARRI LogC4.
ARRI LogC4.
* Preliminary support for ACES Metadata File (AMF) -- A prototype Python tool has been
added named ``pyocioamf`` that converts an AMF file into the OCIO native transform format
CTF. It uses a prototype ACES Reference config file that is serving as a database of ACES
Transform IDs for interpreting the AMF file.
added named ``pyocioamf`` that converts an AMF file into the OCIO native transform format
CTF. It uses a prototype ACES Reference config file that is serving as a database of ACES
Transform IDs for interpreting the AMF file.
* Support for PyPI installation from source rather than pre-built binaries.
@@ -393,5 +393,3 @@ Release Notes
For more detail, please see the GitHub release pages:
`OCIO 2.2.0 <https://github.com/AcademySoftwareFoundation/OpenColorIO/releases/tag/v2.2.0>`_
`OCIO 2.2.1 <https://github.com/AcademySoftwareFoundation/OpenColorIO/releases/tag/v2.2.1>`_
-215
View File
@@ -1,215 +0,0 @@
..
SPDX-License-Identifier: CC-BY-4.0
Copyright Contributors to the OpenColorIO Project.
OCIO 2.3 Release
================
Timeline
********
OpenColorIO 2.3 was delivered in August 2023 and is in the VFX Reference Platform for
calendar year 2024.
New Feature Guide
=================
New config editor GUI app ``ocioview``
**************************************
There is a new GUI app for inspecting and editing OCIO configs called ``ocioview``. As of
the 2.3.0 release, ``ocioview`` is currently in an alpha release (please see the README in
the apps/ocioview directory for details). Documentation and tutorials will be forthcoming
and we are looking for contributors to help with this and other tasks.
Built-in Configs
****************
An updated set of built-in CG and Studio configs is included in the 2.3 release. These include
the updates from the OCIO Configs Working Group over the past year. The updates include:
* Addition of Apple's Display P3 as both a texture space and a display
* A ``texture`` category to allow filtering of color spaces typically used for textures
* More appropriate color space assignments for the ``matte_paint`` and ``texture_paint`` roles
Additional updates for the Studio config include:
* Support for CanonLog2 CinemaGamut color space (in addition to the existing CanonLog3)
* Addition of ACES Transform IDs to better support the ACES Metadata Format (AMF)
For Users
+++++++++
The following URI strings may be provided anywhere you would normally provide a file path
to a config (e.g. as the OCIO environment variable):
To use the updated :ref:`aces_cg`, use this string for the config path::
ocio://cg-config-v2.1.0_aces-v1.3_ocio-v2.3
To use the updated :ref:`aces_studio`, use this string for the config path::
ocio://studio-config-v2.1.0_aces-v1.3_ocio-v2.3
This string will give you the current default config, which is the latest ACES CG Config::
ocio://default
Because there are now several built-in configs, there is now a short-cut to referring to
the latest versions:
This string will always give you the latest CG config::
ocio://cg-config-latest
This string will always give you the latest Studio config::
ocio://studio-config-latest
For Developers
++++++++++++++
As the built-in config collection evolves, special names such as ``ocio://default`` and
``ocio://studio-config-latest`` will point to newer versions of those configs. Therefore, it is
recommended that application developers not save those strings and instead save the string that
refers to the current version of that config. That way, it's guaranteed that there will be no
change of behavior in the future. For example, as of OCIO 2.3, ``ocio://default`` should be saved as
``ocio://cg-config-v2.1.0_aces-v1.3_ocio-v2.3``.
The method for doing this is to use the new ResolveConfigPath function. For example:
``ResolveConfigPath("ocio://default")``
And if you intend to present a list of built-in configs to users, be sure to filter
the list of configs returned by the ``BuiltinConfigRegistry`` and only show the ones
where ``isBuiltinConfigRecommended`` is True so that you are only presenting the most
recent versions of each of the built-in configs.
Improved Lut1D and Lut3D performance via AVX SIMD intrinsics
************************************************************
In some cases, this gives more than a 2x speed-up in CPU Renderer performance.
For Developers
++++++++++++++
The library now contains multiple Lut1D and Lut3D evaluation routines and the appropriate
one is selected at runtime based on which SIMD instruction set is supported by the chip.
Please let us know if you encounter any issues as you test on various flavors of x86 hardware.
Improved support for macOS ARM chips
************************************
For Developers
++++++++++++++
SSE SIMD intrinsics are now converted to the equivalent Neon intrinsics when building for
the ``arm64`` platform.
In addition, the build process for generating macOS Universal Binaries has been
improved.
OCIO command-line tools are now available via PyPI
**************************************************
For Users
+++++++++
Doing a ``pip install opencolorio`` now gives you the
`command-line tools <https://opencolorio.readthedocs.io/en/latest/guides/using_ocio/using_ocio.html#tool-overview>`_
such as ``ociocheck``, ``ociochecklut``, and ``ocioconvert``.
Enhanced methods to find an equivalent color space between configs
******************************************************************
In OCIO 2.2, several methods were introduced that used heuristics to identify a color space
in a user's config that matches one of the known color spaces in the default built-in config.
In OCIO 2.3, these methods were improved and extended as follows:
- ``IdentifyBuiltinColorSpace`` Searches a user config to find the name of an equivalent
color space to a color space in one of the built-in configs. For example, "What is the
name in this config for the ``sRGB - Texture`` color space from the default built-in config?"
- ``IdentifyInterchangeSpace`` Identifies the pair of color space names to be used as the
interchange space to allow conversion between color spaces in a user config and one of the
built-in configs. This is now the fundamental function that contains the heuristics for trying
to identify known color spaces and is used by IdentifyBuiltinColorSpace and in the
GetProcessorFrom/ToBuiltinColorSpace methods.
This improves upon and extends upon PR #1710. One piece of feedback on that PR is that it
would be helpful to be able to use the heuristics to extract the names of the interchange
color spaces rather than a Processor. This gives the application more flexibility in how
that information is persisted and may reduce the number of times that any heuristics (that
search through a config's color spaces) need to be run.
Finally, an issue was fixed in ``GetProcessorFromConfigs`` so that the returned Processor is
a no-op if either of the color spaces in the two configs is a data space.
Note that if the official interchange role(s) are present (as is required in configs with
``ocio_profile_version`` 2.2 or higher), the above methods simply use those rather than
relying on any heuristics.
Breaking API Change
*******************
For Developers
++++++++++++++
For developers that have customized their GPU Renderer by overriding the GpuShaderCreator
class, there is a minor breaking change in the API. The addTexture and getTexture virtual
methods now take a ``TextureDimensions`` parameter. This was necessary to give client apps full
control over whether 1D or 2D textures are used for Lut1D ops. Please see
`PR #1762 <https://github.com/AcademySoftwareFoundation/OpenColorIO/pull/1762>`_
for an example of how to update your implementation of these modified virtual methods.
API Enhancements
****************
For Developers
++++++++++++++
You may find the following additions to the OCIO API useful:
- There is now a ``clearProcessorCache`` method to clear the Processor, CPUProcessor, and
GPUProcessor contents from the cache present in a Config instance. This is useful if a
LUT file on disk has changed since the Config instance was created.
- The ``setAllowTexture1D`` method on the GpuShaderCreator/GpuShaderDesc class allows your
GPU Renderer implementation to always use 2D textures rather than 1D textures for Lut1D ops.
- The Config class now has ``GetProcessorFromConfigs`` variants that allow converting from
a source color space in one config to a display/view in another config.
- The Config class now has an ``isInactiveColorSpace`` method and ``getRoleColorSpace`` method.
- The CPUProcessor now has the ``isDynamic`` and ``hasDynamic`` methods that were present on
the Processor class.
- The ``ResolveConfigPath`` function converts one of the built-in config short-cut strings
into the unambiguous full URI for the current config.
- The new ``IdentifyBuiltinColorSpace`` and ``IdentifyInterchangeSpace`` methods are
described above.
New Built-in Transforms
***********************
For Config Authors
++++++++++++++++++
In config files with ``ocio_profile_version`` set to 2.3 or higher, config authors may take
advantage of the following new transform:
* ``DISPLAY - CIE-XYZ-D65_to_DisplayP3`` To implement a display for the Apple Display P3 color space
Release Notes
=============
For more detail, please see the GitHub release pages:
`OCIO 2.3.0 <https://github.com/AcademySoftwareFoundation/OpenColorIO/releases/tag/v2.3.0>`_
-7
View File
@@ -1,10 +1,3 @@
# Fix an issue with the OCIO's Linux container images that have OpenSSL under 1.1.1.
# If the container images are updated with OpenSSL 1.1.1+, the restriction on
# urllib3 version <2 can be removed.
urllib3<2
# The builds for documentation fails with <0.18.0
docutils>=0.18.1
sphinx<=7.1.2
six
testresources
recommonmark
+1 -1
View File
@@ -3,7 +3,7 @@ news:
enable : true
image : images/SpiderVerse_pmm014.1014_lm_v1_opt.jpg
title : OCIO v2 is here!
content : "Check out our [guides](https://opencolorio.readthedocs.io/en/latest/releases/_index.html#releases) for upgrading. Here are just a few highlights of new features:"
content : "Check out our [guide](https://opencolorio.readthedocs.io/en/latest/upgrading_v2/_index.html#migrating-to-v2) for upgrading. Here are just a few highlights of new features:"
caption: "OpenColorIO in use on Spider-Man™: Into the Spider-Verse"
feature_item :
# feature item loop
@@ -3,13 +3,6 @@ supported_apps:
enable : true
title : Supported Applications
portfolio_item :
# portfolio item loop
- name : Autodesk 3ds Max
image : images/supported_apps/3ds_max.png
categories : ["3D", "Animation", "Modeling", "Lighting", "Look Dev", "Texture"]
content : 3ds Max 2024 and up.
link : "https://www.autodesk.com/products/3ds-max/overview"
# portfolio item loop
- name : Adobe After Effects
image : images/supported_apps/ae.png
@@ -116,9 +109,9 @@ supported_apps:
link : "http://www.thefoundry.co.uk/products/mari"
# portfolio item loop
- name : Autodesk Maya
- name : Maya
image : images/supported_apps/maya.png
categories : ["3D", "Animation", "Modeling", "Lighting", "Look Dev", "Simulation", "Texture"]
categories : ["3D", "Animation", "Modeling", "Lighting", "Texture"]
content : Maya 2016 and up.
link : "https://www.autodesk.com/products/maya/overview"
Binary file not shown.

Before

Width:  |  Height:  |  Size: 20 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 16 KiB

After

Width:  |  Height:  |  Size: 80 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 14 KiB

After

Width:  |  Height:  |  Size: 70 KiB

+3 -2
View File
@@ -150,10 +150,11 @@ this to a Flame compatible 3dl file, simply run::
ociobakelut --format flame --lut log_to_display.lut for_flame.3dl
Reversing a LUT
Reversing a 1D LUT
++++++++++++++++++
You can apply a LUT in reverse, and write this to a new LUT::
You can apply a LUT in reverse, and write this to a new LUT (this does
not work for 3D LUT's, but will for 1D LUT's)::
bash$ ociobakelut --format flame --invlut logtosrgb.3dl srgbtolog.3dl
+74 -223
View File
@@ -125,11 +125,9 @@ public:
* Under normal usage, this is not necessary, but it can be helpful in particular instances,
* such as designing OCIO profiles, and wanting to re-read luts without restarting.
*
* \note
* This method does not apply to instance-specific caches such as the Processor cache in
* a Config instance or the GPU and CPU Processor caches in a Processor instance. So in cases
* where you still have a Config instance after calling ClearAllCaches, you should also call
* the Config's clearProcessorCache method.
* \note The method does not apply to instance specific caches such as the processor cache in a
* config instance or the GPU and CPU processor caches in a processor instance. Here deleting the
* instance flushes the cache.
*/
extern OCIOEXPORT void ClearAllCaches();
@@ -206,28 +204,6 @@ extern OCIOEXPORT ConstConfigRcPtr GetCurrentConfig();
/// Set the current configuration. This will then store a copy of the specified config.
extern OCIOEXPORT void SetCurrentConfig(const ConstConfigRcPtr & config);
/**
* \brief Make a config path forward-compatible by replacing special built-in config names
* with the current name.
*
* Application developers should call this function on any config path they intend to persist
* (e.g., to include in a file saved from a DCC).
*
* As the built-in config collection evolves, special names such as "ocio://default" and
* "ocio://studio-config-latest" will point to newer versions of those configs. Therefore, it is
* recommended that application developers not save those strings and instead save the string that
* refers to the current version of that config. That way, it's guaranteed that there will be no
* change of behavior in the future. For example, as of OCIO 2.3, "ocio://default" should be saved
* as "ocio://cg-config-v2.1.0_aces-v1.3_ocio-v2.3".
*
* Note that there is no validation done on the path. That is left to the application since
* typically the application will load the config before attempting to save its path
* and therefore catch, for example, a badly formed URI such as "ocio:default".
*
* \return Resolved path if possible. Otherwise, the original path is returned unmodified.
*/
extern OCIOEXPORT const char * ResolveConfigPath(const char * originalPath) noexcept;
/**
* \brief Extract an OCIO Config archive.
*
@@ -320,11 +296,13 @@ public:
/**
* \brief Create a configuration using a specific config file.
*
* Supports the OCIO URI format for Built-in configs.
* See \ref Config::CreateFromBuiltinConfig.
* Also supports the following OCIO URI format for Built-in configs:
* "ocio://default" - Default Built-in config.
* "ocio://<CONFIG NAME>" - A specific Built-in config. For the list of available
* <CONFIG NAME> strings, see \ref Config::CreateFromBuiltinConfig.
*
* Also supports archived configs (.ocioz files).
*
* Supports archived configs (.ocioz files).
*
* \throw Exception If the file may not be read or does not parse.
* \return The Config object.
*/
@@ -362,23 +340,15 @@ public:
/**
* \brief Create a configuration using an OCIO built-in config.
*
* \param configName Built-in config name (with or without the "ocio://" URI prefix).
*
* Also supports the following OCIO URI format for Built-in configs:
* "ocio://default" - Default Built-in config.
* "ocio://cg-config-latest" - Latest Built-in CG config.
* "ocio://studio-config-latest" - Latest Built-in Studio config.
* "ocio://<CONFIG NAME>" - A specific Built-in config.
* \param configName Built-in config name.
*
* The available configNames are:
*
* ACES Studio config, contains a more complete collection of color spaces and displays:
* "studio-config-v1.0.0_aces-v1.3_ocio-v2.1"
* "studio-config-v2.1.0_aces-v1.3_ocio-v2.3"
*
* ACES CG config, basic color spaces for computer graphics apps:
* "cg-config-v1.0.0_aces-v1.3_ocio-v2.1"
* "cg-config-v2.1.0_aces-v1.3_ocio-v2.3"
*
* More information is available at:
* %https://github.com/AcademySoftwareFoundation/OpenColorIO-Config-ACES
@@ -682,9 +652,6 @@ public:
*/
void setInactiveColorSpaces(const char * inactiveColorSpaces);
const char * getInactiveColorSpaces() const;
/// Return true if the color space name is present in the inactive_colorspaces list.
bool isInactiveColorSpace(const char * colorspace) const noexcept;
/**
* \brief Return true if the specified color space is linear.
@@ -723,77 +690,12 @@ public:
*/
bool isColorSpaceLinear(const char * colorSpace, ReferenceSpaceType referenceSpaceType) const;
/**
* \brief Find the name of the color space in the source config that is the same as
* a color space in the default built-in config. For example, setting the
* builtinColorSpaceName to "sRGB - Texture" (a color space name from that
* config), would return the name for the corresponding sRGB texture space in
* the current config (or empty if it was not found). Note that this method
* relies on heuristics which may evolve over time and which may not work on
* all configs.
*
* The method only looks at active color spaces. If the interchange roles are
* missing and heuristics are used, only scene-referred color spaces are searched.
*
* \param srcConfig The config to search for the desired color space.
* \param builtinConfig The built-in config to use. See \ref Config::CreateFromBuiltinConfig.
* \param builtinColorSpaceName Color space name in the built-in default config.
* \return Matching color space name from the source config. Empty if not found.
*
* \throw Exception if an interchange space cannot be found or the equivalent space cannot be found.
*/
static const char * IdentifyBuiltinColorSpace(const ConstConfigRcPtr & srcConfig,
const ConstConfigRcPtr & builtinConfig,
const char * builtinColorSpaceName);
/**
* \brief Identify the two names of a common color space that exists in both the
* given config and the provided built-in config that may be used for converting
* color spaces between the two configs. If both configs have the interchange
* role set, than the color spaces set to that role will be returned. Otherwise,
* heuristics will be used to try and identify a known color space in the source
* config. These are the same heuristics that are used for other methods such as
* identifyBuiltinColorSpace and GetProcessorTo/FromBuiltinColorSpace.
*
* Using this method in connection with GetProcessorFromConfigs is more efficient
* if you need to call GetProcessorTo/FromBuiltinColorSpace multiple times since it
* is only necessary to run the heuristics once (to identify the interchange spaces).
*
* The srcColorSpaceName and builtinColorSpace name are used to decide which
* interchange role to use (scene- or display-referred). However, they are not
* used if the interchange roles are not present and the heuristics are used.
* It is actually only the ReferenceSpaceType of the color spaces that are used,
* so it is not necessary to call this function multiple times if all the spaces
* are of the same type. (These are the same arguments that would also be set if
* you were instead calling GetProcessorTo/FromBuiltinColorSpace.)
*
* \param[out] srcInterchangeName Color space name from the source config.
* \param[out] builtinInterchangeName Corresponding color space name from the built-in config.
* \param srcConfig The config to search for the desired color space.
* \param srcColorSpaceName Color space name in the given config to convert to/from.
* \param builtinConfig The built-in config to use. See \ref Config::CreateFromBuiltinConfig.
* \param builtinColorSpaceName Color space name in the default built-in config.
*
* \throw Exception if either the srcInterchange or builtinInterchange cannot be identified.
*/
static void IdentifyInterchangeSpace(const char ** srcInterchangeName,
const char ** builtinInterchangeName,
const ConstConfigRcPtr & srcConfig,
const char * srcColorSpaceName,
const ConstConfigRcPtr & builtinConfig,
const char * builtinColorSpaceName);
/**
* Methods related to Roles.
*
* A role allows a config author to indicate that a given color space should be used
* for a particular purpose.
*
* Role names may be passed to most functions that accept color space names, such as
* getColorSpace. So for example, you may find the name of the color space assigned
* to the scene_linear role by getting the color space object for "scene_linear" and
* then calling getName on the color space object.
*/
//
// Roles
//
// A role is like an alias for a colorspace. You can query the colorspace
// corresponding to a role using the normal getColorSpace fcn.
/**
* \brief
@@ -818,16 +720,13 @@ public:
* Return empty string if index is out of range.
*/
const char * getRoleColorSpace(int index) const;
/**
* \brief Get the color space name used for the specified role.
*
* Return an empty string if the role is not present
*/
const char * getRoleColorSpace(const char * roleName) const noexcept;
/**
* Methods related to displays and views.
*
* \defgroup Methods related to displays and views.
* @{
*/
/**
* The following methods only manipulate active displays and views. Active
* displays and views are defined from an env. variable or from the config file.
*
@@ -944,8 +843,11 @@ public:
/// Clear all the displays.
void clearDisplays();
/** @} */
/**
* Methods related to the Virtual Display.
* \defgroup Methods related to the Virtual Display.
* @{
*
* ... (See descriptions for the non-virtual methods above.)
*
@@ -1025,6 +927,8 @@ public:
*/
int instantiateDisplayFromICCProfile(const char * ICCProfileFilepath);
/** @} */
/**
* \brief
*
@@ -1172,7 +1076,8 @@ public:
void clearViewTransforms();
/**
* Methods related to named transforms.
* \defgroup Methods related to named transforms.
* @{
*/
/**
@@ -1215,6 +1120,8 @@ public:
/// Clear all named transforms.
void clearNamedTransforms();
/** @} */
//
// File Rules
//
@@ -1343,7 +1250,7 @@ public:
*
* If the source config defines the necessary Interchange Role (typically "aces_interchange"),
* then the conversion will be well-defined and equivalent to calling GetProcessorFromConfigs
* with the source config and the Built-in config.
* with the source config and the Built-in config
*
* However, if the Interchange Roles are not present, heuristics will be used to try and
* identify a common color space in the source config that may be used to allow the conversion
@@ -1356,12 +1263,11 @@ public:
* \param srcConfig The user's source config.
* \param srcColorSpaceName The name of the color space in the source config.
* \param builtinColorSpaceName The name of the color space in the current default Built-in config.
*
* \throw Exception if either the src or builtin interchange space cannot be identified.
*/
static ConstProcessorRcPtr GetProcessorToBuiltinColorSpace(ConstConfigRcPtr srcConfig,
const char * srcColorSpaceName,
const char * builtinColorSpaceName);
static ConstProcessorRcPtr GetProcessorToBuiltinColorSpace(
ConstConfigRcPtr srcConfig,
const char * srcColorSpaceName,
const char * builtinColorSpaceName);
/**
* \brief See description of GetProcessorToBuiltinColorSpace.
*
@@ -1369,12 +1275,14 @@ public:
* \param srcConfig The user's source config.
* \param srcColorSpaceName The name of the color space in the source config.
*/
static ConstProcessorRcPtr GetProcessorFromBuiltinColorSpace(const char * builtinColorSpaceName,
ConstConfigRcPtr srcConfig,
const char * srcColorSpaceName);
static ConstProcessorRcPtr GetProcessorFromBuiltinColorSpace(
const char * builtinColorSpaceName,
ConstConfigRcPtr srcConfig,
const char * srcColorSpaceName);
/**
* \brief Get a processor to convert between color spaces in two separate configs.
* \brief Get a processor to convert between color spaces in two separate
* configs.
*
* This relies on both configs having the aces_interchange role (when srcName
* is scene-referred) or the role cie_xyz_d65_interchange (when srcName is
@@ -1394,9 +1302,6 @@ public:
/**
* The srcInterchangeName and dstInterchangeName must refer to a pair of
* color spaces in the two configs that are the same. A role name may also be used.
*
* Note: For all of the two-config GetProcessor functions, if either the source or
* destination color spaces are data spaces, the entire processor will be a no-op.
*/
static ConstProcessorRcPtr GetProcessorFromConfigs(const ConstConfigRcPtr & srcConfig,
const char * srcColorSpaceName,
@@ -1414,67 +1319,6 @@ public:
const char * dstColorSpaceName,
const char * dstInterchangeName);
/**
* \brief Get a processor to convert from a color space to a display and view in
* two separate configs.
*/
static ConstProcessorRcPtr GetProcessorFromConfigs(const ConstConfigRcPtr & srcConfig,
const char * srcColorSpaceName,
const ConstConfigRcPtr & dstConfig,
const char * dstDisplay,
const char * dstView,
TransformDirection direction);
static ConstProcessorRcPtr GetProcessorFromConfigs(const ConstContextRcPtr & srcContext,
const ConstConfigRcPtr & srcConfig,
const char * srcColorSpaceName,
const ConstContextRcPtr & dstContext,
const ConstConfigRcPtr & dstConfig,
const char * dstDisplay,
const char * dstView,
TransformDirection direction);
/**
* The srcInterchangeName and dstInterchangeName must refer to a pair of
* color spaces in the two configs that are the same. A role name may also be used.
*/
static ConstProcessorRcPtr GetProcessorFromConfigs(const ConstConfigRcPtr & srcConfig,
const char * srcColorSpaceName,
const char * srcInterchangeName,
const ConstConfigRcPtr & dstConfig,
const char * dstDisplay,
const char * dstView,
const char * dstInterchangeName,
TransformDirection direction);
static ConstProcessorRcPtr GetProcessorFromConfigs(const ConstContextRcPtr & srcContext,
const ConstConfigRcPtr & srcConfig,
const char * srcColorSpaceName,
const char * srcInterchangeName,
const ConstContextRcPtr & dstContext,
const ConstConfigRcPtr & dstConfig,
const char * dstDisplay,
const char * dstView,
const char * dstInterchangeName,
TransformDirection direction);
/// Get the Processor Cache flags.
ProcessorCacheFlags getProcessorCacheFlags() const noexcept;
/// Control the caching of processors in the config instance. By default, caching is on.
/// The flags allow turning caching off entirely or only turning it off if dynamic
/// properties are being used by the processor.
void setProcessorCacheFlags(ProcessorCacheFlags flags) const noexcept;
/**
* \brief Clears this config's cache of Processor, CPUProcessor, and GPUProcessor instances.
*
* This must be done if any of the LUT files used by these Processors have been modified.
* Note that setProcessorCacheFlags(PROCESSOR_CACHE_OFF) turns off caching but does not clear
* any existing cache.
*/
void clearProcessorCache() noexcept;
/// Set the ConfigIOProxy object used to provision the config and LUTs from somewhere other
/// than the file system. (This is set on the config's embedded Context object.)
void setConfigIOProxy(ConfigIOProxyRcPtr ciop);
@@ -1537,6 +1381,11 @@ public:
/// Do not use (needed only for pybind11).
~Config();
/// Control the caching of processors in the config instance. By default, caching is on.
/// The flags allow turning caching off entirely or only turning it off if dynamic
/// properties are being used by the processor.
void setProcessorCacheFlags(ProcessorCacheFlags flags) noexcept;
private:
Config();
@@ -2182,7 +2031,8 @@ private:
const Impl * getImpl() const { return m_impl; }
};
/** ColorSpaceSetOperators
/** \defgroup ColorSpaceSetOperators
* @{
*/
/**
@@ -2222,6 +2072,8 @@ extern OCIOEXPORT ConstColorSpaceSetRcPtr operator&&(const ConstColorSpaceSetRcP
extern OCIOEXPORT ConstColorSpaceSetRcPtr operator-(const ConstColorSpaceSetRcPtr & lcss,
const ConstColorSpaceSetRcPtr & rcss);
/** @}*/
//
// Look
@@ -2639,10 +2491,6 @@ public:
* there is one in the CPU processor.
*/
DynamicPropertyRcPtr getDynamicProperty(DynamicPropertyType type) const;
/// True if at least one dynamic property of that type exists.
bool hasDynamicProperty(DynamicPropertyType type) const noexcept;
/// True if at least one dynamic property of any type exists and is dynamic.
bool isDynamic() const noexcept;
/**
* \brief Apply to an image with any kind of channel ordering while
@@ -3206,10 +3054,6 @@ public:
virtual void setTextureMaxWidth(unsigned maxWidth) = 0;
virtual unsigned getTextureMaxWidth() const noexcept = 0;
/// Allow 1D GPU resource type, otherwise always using 2D resources for 1D LUTs.
virtual void setAllowTexture1D(bool allowed) = 0;
virtual bool getAllowTexture1D() const = 0;
/**
* To avoid global texture sampler and uniform name clashes always append an increasing index
* to the resource name.
@@ -3267,17 +3111,9 @@ public:
};
/**
* Dimension enum used to differentiate between 1D and 2D object/resource types.
*/
enum TextureDimensions : uint8_t {
TEXTURE_1D = 1,
TEXTURE_2D = 2,
};
/**
* Add a 1D or 2D texture
*
* \note
* Add a 2D texture (1D texture if height equals 1).
*
* \note
* The 'values' parameter contains the LUT data which must be used as-is as the dimensions and
* origin are hard-coded in the fragment shader program. So, it means one GPU texture per entry.
**/
@@ -3285,7 +3121,6 @@ public:
const char * samplerName,
unsigned width, unsigned height,
TextureType channel,
TextureDimensions dimensions,
Interpolation interpolation,
const float * values) = 0;
@@ -3537,7 +3372,6 @@ public:
unsigned & width,
unsigned & height,
TextureType & channel,
TextureDimensions & dimensions,
Interpolation & interpolation) const = 0;
virtual void getTextureValues(unsigned index, const float *& values) const = 0;
@@ -3770,8 +3604,22 @@ public:
*/
virtual bool isBuiltinConfigRecommended(size_t configIndex) const = 0;
// Return the full forward-compatible name of the default built-in config.
OCIO_DEPRECATED("This was marked as deprecated starting in v2.3, please use ResolveConfigPath(\"ocio://default\").")
/**
* @brief Get the default recommended built-in config.
*
* Get the name of the built-in config that is currently recommended as the default config
* to use for applications looking for basic color management.
*
* As the built-in config collection evolves, the default config name will change in future
* releases.
*
* For backwards compatibility, the name provided here will always work as an argument
* to other methods so that any previous default config may be recovered.
*
* Throws if the name is not found.
*
* @return Default's built-in config name.
*/
virtual const char * getDefaultBuiltinConfigName() const = 0;
protected:
BuiltinConfigRegistry() = default;
@@ -3801,7 +3649,8 @@ public:
virtual bool isSupported() const noexcept = 0;
/**
* Methods to access some information of the attached and active monitors.
* \defgroup Methods to access some information of the attached and active monitors.
* @{
*/
/// Get the number of active monitors reported by the operating system.
@@ -3818,6 +3667,8 @@ public:
/// Get the ICC profile path associated to the monitor.
virtual const char * getProfileFilepath(size_t idx) const = 0;
/** @} */
protected:
SystemMonitors() = default;
virtual ~SystemMonitors() = default;
+1 -15
View File
@@ -453,8 +453,6 @@ struct OCIOEXPORT GradingRGBM
double m_master{ 0. };
};
extern OCIOEXPORT bool operator==(const GradingRGBM & lhs, const GradingRGBM & rhs);
extern OCIOEXPORT bool operator!=(const GradingRGBM & lhs, const GradingRGBM & rhs);
extern OCIOEXPORT std::ostream & operator<<(std::ostream &, const GradingRGBM &);
/// Grading primary values.
@@ -490,8 +488,6 @@ struct OCIOEXPORT GradingPrimary
static double NoClampWhite();
};
extern OCIOEXPORT bool operator==(const GradingPrimary & lhs, const GradingPrimary & rhs);
extern OCIOEXPORT bool operator!=(const GradingPrimary & lhs, const GradingPrimary & rhs);
extern OCIOEXPORT std::ostream & operator<<(std::ostream &, const GradingPrimary &);
/// 2D control point used by \ref GradingBSplineCurve.
@@ -503,8 +499,6 @@ struct OCIOEXPORT GradingControlPoint
float m_y{ 0.f };
};
extern OCIOEXPORT bool operator==(const GradingControlPoint & lhs, const GradingControlPoint & rhs);
extern OCIOEXPORT bool operator!=(const GradingControlPoint & lhs, const GradingControlPoint & rhs);
extern OCIOEXPORT std::ostream & operator<<(std::ostream &, const GradingControlPoint &);
/// A BSpline curve defined with \ref GradingControlPoint.
@@ -536,8 +530,6 @@ protected:
GradingBSplineCurve() = default;
};
extern OCIOEXPORT bool operator==(const GradingBSplineCurve & lhs, const GradingBSplineCurve & rhs);
extern OCIOEXPORT bool operator!=(const GradingBSplineCurve & lhs, const GradingBSplineCurve & rhs);
extern OCIOEXPORT std::ostream & operator<<(std::ostream &, const GradingBSplineCurve &);
/**
@@ -567,8 +559,6 @@ protected:
GradingRGBCurve() = default;
};
extern OCIOEXPORT bool operator==(const GradingRGBCurve & lhs, const GradingRGBCurve & rhs);
extern OCIOEXPORT bool operator!=(const GradingRGBCurve & lhs, const GradingRGBCurve & rhs);
extern OCIOEXPORT std::ostream & operator<<(std::ostream &, const GradingRGBCurve &);
/**
@@ -612,8 +602,6 @@ struct OCIOEXPORT GradingRGBMSW
double m_width { 1. }; // Or pivot for shadows and highlights.
};
extern OCIOEXPORT bool operator==(const GradingRGBMSW & lhs, const GradingRGBMSW & rhs);
extern OCIOEXPORT bool operator!=(const GradingRGBMSW & lhs, const GradingRGBMSW & rhs);
extern OCIOEXPORT std::ostream & operator<<(std::ostream &, const GradingRGBMSW &);
/// Grading tone values.
@@ -653,8 +641,6 @@ struct OCIOEXPORT GradingTone
double m_scontrast{ 1.0 };
};
extern OCIOEXPORT bool operator==(const GradingTone & lhs, const GradingTone & rhs);
extern OCIOEXPORT bool operator!=(const GradingTone & lhs, const GradingTone & rhs);
extern OCIOEXPORT std::ostream & operator<<(std::ostream &, const GradingTone &);
/**
@@ -687,7 +673,7 @@ extern OCIOEXPORT std::ostream & operator<<(std::ostream &, const GradingTone &)
* OCIO::DynamicPropertyValue::AsGradingPrimary(dynProp);
* OCIO::GradingPrimary primary = primaryProp->getValue();
* primary.m_saturation += 0.1f;
* primaryProp->setValue(primary);
* rgbCurveProp->setValue(primary);
* }
* if (cpuProcessor->hasDynamicProperty(OCIO::DYNAMIC_PROPERTY_GRADING_RGBCURVE))
* {
+28 -5
View File
@@ -726,7 +726,8 @@ extern OCIOEXPORT ExposureContrastStyle ExposureContrastStyleFromString(const ch
extern OCIOEXPORT const char * NegativeStyleToString(NegativeStyle style);
extern OCIOEXPORT NegativeStyle NegativeStyleFromString(const char * style);
/** Env. variables.
/** \defgroup Env. variables.
* @{
*
* These environmental variables are used by the OpenColorIO library.
* For variables that allow specifying more than one token, they should be separated by commas.
@@ -775,6 +776,12 @@ extern OCIOEXPORT const char * OCIO_OPTIMIZATION_FLAGS_ENVVAR;
*/
extern OCIOEXPORT const char * OCIO_USER_CATEGORIES_ENVVAR;
/** @}*/
/** \defgroup VarsRoles
* @{
*/
// TODO: Move to .rst
/*!rst::
Roles
@@ -845,6 +852,12 @@ extern OCIOEXPORT const char * ROLE_INTERCHANGE_SCENE;
*/
extern OCIOEXPORT const char * ROLE_INTERCHANGE_DISPLAY;
/** @}*/
/** \defgroup VarsSharedView
* @{
*/
/*!rst::
Shared View
***********
@@ -857,6 +870,12 @@ Shared View
*/
extern OCIOEXPORT const char * OCIO_VIEW_USE_DISPLAY_NAME;
/** @}*/
/** \defgroup VarsFormatMetadata
* @{
*/
// TODO: Move to .rst
/*!rst::
FormatMetadata
@@ -910,6 +929,12 @@ extern OCIOEXPORT const char * METADATA_NAME;
*/
extern OCIOEXPORT const char * METADATA_ID;
/** @}*/
/** \defgroup VarsCaches
* @{
*/
/*!rst::
Caches
******
@@ -938,6 +963,8 @@ extern OCIOEXPORT const char * OCIO_DISABLE_PROCESSOR_CACHES;
// variable to disable the fallback.
extern OCIOEXPORT const char * OCIO_DISABLE_CACHE_FALLBACK;
/** @}*/
// Archive config feature
// Default filename (with extension) of an config.
@@ -945,10 +972,6 @@ extern OCIOEXPORT const char * OCIO_CONFIG_DEFAULT_NAME;
extern OCIOEXPORT const char * OCIO_CONFIG_DEFAULT_FILE_EXT;
extern OCIOEXPORT const char * OCIO_CONFIG_ARCHIVE_FILE_EXT;
// Built-in config feature
// URI Prefix
extern OCIOEXPORT const char * OCIO_BUILTIN_URI_PREFIX;
} // namespace OCIO_NAMESPACE
#endif
+2 -5
View File
@@ -2,7 +2,7 @@
requires = [
"setuptools>=42",
"wheel",
"cmake>=3.13",
"cmake>=3.12",
"ninja; sys_platform != 'win32' and platform_machine != 'arm64'",
# Documentation requirements
"six",
@@ -17,11 +17,8 @@ build-backend = "setuptools.build_meta"
[tool.cibuildwheel]
build-verbosity = "1"
test-command = "python -m PyOpenColorIOTests.OpenColorIOTestSuite"
test-requires = ["numpy"]
test-command = [
"python {project}/tests/python/OpenColorIOTestSuite.py",
"ociocheck"
]
manylinux-x86_64-image = "manylinux2014"
manylinux-i686-image = "manylinux2014"
+3 -1
View File
@@ -6,6 +6,8 @@ classifiers =
Intended Audience :: Developers
Topic :: Software Development :: Libraries :: Python Modules
Programming Language :: C++
Programming Language :: Python :: 2
Programming Language :: Python :: 2.7
Programming Language :: Python :: 3
Programming Language :: Python :: 3.7
Programming Language :: Python :: 3.8
@@ -20,7 +22,7 @@ license_files = LICENSE
long_description = file: README.md, LICENSE
long_description_content_type = text/markdown
name = opencolorio
python_requires = '>=3.7'
python_requires = '>=2.7,!=3.0.*,!=3.1.*,!=3.2.*,!=3.3.*,!=3.4.*,!=3.5.*,!=3.6.*'
url = https://opencolorio.org/
[options]
+25 -85
View File
@@ -6,6 +6,7 @@
import os
import re
import shutil
import subprocess
import sys
import tempfile
@@ -15,49 +16,27 @@ from setuptools.command.build_ext import build_ext
# Extract the project version from CMake generated ABI header.
# NOTE: When droping support for Python2 we can use
# tempfile.TemporaryDirectory() context manager instead of try...finally.
def get_version():
VERSION_REGEX = re.compile(
r"^\s*#\s*define\s+OCIO_VERSION_FULL_STR\s+\"(.*)\"\s*$", re.MULTILINE)
here = os.path.abspath(os.path.dirname(__file__))
dirpath = tempfile.mkdtemp()
with tempfile.TemporaryDirectory() as tmpdir:
try:
subprocess.check_call(["cmake", here], cwd=tmpdir)
path = os.path.join(tmpdir, "include", "OpenColorIO", "OpenColorABI.h")
with open(path) as f:
match = VERSION_REGEX.search(f.read())
return match.group(1)
except Exception as e:
raise RuntimeError(
"Unable to find OpenColorIO version: {}".format(str(e))
)
# Call CMake find_package from a dummy script and return whether the package
# has been found or not.
def cmake_find_package(package_name):
with tempfile.TemporaryDirectory() as tmpdir:
try:
cmakelist_path = os.path.join(tmpdir, "CMakeLists.txt")
with open(cmakelist_path, "w") as f:
f.write("""
cmake_minimum_required(VERSION 3.13)
project(test LANGUAGES CXX)
find_package({} REQUIRED)
""".format(package_name)
)
subprocess.check_call(
["cmake", tmpdir],
cwd=tmpdir,
stdout=subprocess.DEVNULL,
stderr=subprocess.DEVNULL
)
return True
except Exception as e:
return False
try:
stdout = subprocess.check_output(["cmake", here], cwd=dirpath)
path = os.path.join(dirpath, "include", "OpenColorIO", "OpenColorABI.h")
with open(path) as f:
match = VERSION_REGEX.search(f.read())
return match.group(1)
except Exception as e:
raise RuntimeError(
"Unable to find OpenColorIO version: {}".format(str(e))
)
finally:
shutil.rmtree(dirpath)
# Convert distutils Windows platform specifiers to CMake -A arguments
@@ -80,7 +59,6 @@ class CMakeExtension(Extension):
class CMakeBuild(build_ext):
def build_extension(self, ext):
extdir = os.path.abspath(os.path.dirname(self.get_ext_fullpath(ext.name)))
bindir = os.path.join(extdir, "bin")
# required for auto-detection & inclusion of auxiliary "native" libs
if not extdir.endswith(os.path.sep):
@@ -95,13 +73,12 @@ class CMakeBuild(build_ext):
cmake_args = [
"-DCMAKE_LIBRARY_OUTPUT_DIRECTORY={}".format(extdir),
"-DCMAKE_RUNTIME_OUTPUT_DIRECTORY={}".format(bindir),
"-DPython_EXECUTABLE={}".format(sys.executable),
# Not used on MSVC, but no harm
"-DCMAKE_BUILD_TYPE={}".format(cfg),
"-DBUILD_SHARED_LIBS=ON",
"-DOCIO_USE_SOVERSION=OFF",
"-DOCIO_BUILD_APPS=ON",
"-DBUILD_SHARED_LIBS=OFF",
"-DOCIO_BUILD_DOCS=ON",
"-DOCIO_BUILD_APPS=OFF",
"-DOCIO_BUILD_TESTS=OFF",
"-DOCIO_BUILD_GPU_TESTS=OFF",
# Make sure we build everything for the requested architecture(s)
@@ -144,8 +121,7 @@ class CMakeBuild(build_ext):
# Multi-config generators have a different way to specify configs
if not single_config:
cmake_args += [
"-DCMAKE_LIBRARY_OUTPUT_DIRECTORY_{}={}".format(cfg.upper(), extdir),
"-DCMAKE_RUNTIME_OUTPUT_DIRECTORY_{}={}".format(cfg.upper(), bindir),
"-DCMAKE_LIBRARY_OUTPUT_DIRECTORY_{}={}".format(cfg.upper(), extdir)
]
build_args += ["--config", cfg]
@@ -155,19 +131,6 @@ class CMakeBuild(build_ext):
if archs:
cmake_args += ["-DCMAKE_OSX_ARCHITECTURES={}".format(";".join(archs))]
# When building the wheel, the install step is not executed so we need
# to have the correct RPATH directly from the build tree output.
cmake_args += ["-DCMAKE_BUILD_WITH_INSTALL_RPATH=ON"]
if sys.platform.startswith("linux"):
cmake_args += ["-DCMAKE_INSTALL_RPATH={}".format("$ORIGIN;$ORIGIN/..")]
if sys.platform.startswith("darwin"):
cmake_args += ["-DCMAKE_INSTALL_RPATH={}".format("@loader_path;@loader_path/..")]
# Documentation is used for Python docstrings but we allow to build
# the wheel without docs to remove a hard dependency on doxygen.
if cmake_find_package("Doxygen"):
cmake_args += ["-DOCIO_BUILD_DOCS=ON"]
# Set CMAKE_BUILD_PARALLEL_LEVEL to control the parallel build level
# across all generators.
if "CMAKE_BUILD_PARALLEL_LEVEL" not in os.environ:
@@ -192,34 +155,11 @@ class CMakeBuild(build_ext):
setup(
version=get_version(),
package_dir={
'PyOpenColorIO': 'src/bindings/python/package',
'PyOpenColorIO.bin.pyocioamf': 'src/apps/pyocioamf',
'PyOpenColorIO.bin.pyociodisplay': 'src/apps/pyociodisplay',
'PyOpenColorIOTests': 'tests/python',
'PyOpenColorIOTests.data': 'tests/data',
},
packages=[
'PyOpenColorIO',
'PyOpenColorIO.bin.pyocioamf',
'PyOpenColorIO.bin.pyociodisplay',
],
ext_modules=[CMakeExtension("PyOpenColorIO.PyOpenColorIO")],
packages=['PyOpenColorIOTests', 'PyOpenColorIOTests.data'],
ext_modules=[CMakeExtension("PyOpenColorIO")],
cmdclass={"build_ext": CMakeBuild},
include_package_data=True,
entry_points={
'console_scripts': [
# Native applications
'ocioarchive=PyOpenColorIO.command_line:main',
'ociobakelut=PyOpenColorIO.command_line:main',
'ociocheck=PyOpenColorIO.command_line:main',
'ociochecklut=PyOpenColorIO.command_line:main',
'ocioconvert=PyOpenColorIO.command_line:main',
'ociodisplay=PyOpenColorIO.command_line:main',
'ociolutimage=PyOpenColorIO.command_line:main',
'ociomakeclf=PyOpenColorIO.command_line:main',
'ocioperf=PyOpenColorIO.command_line:main',
'ociowrite=PyOpenColorIO.command_line:main',
# Python applications
'pyocioamf=PyOpenColorIO.bin.pyocioamf.pyocioamf:main',
'pyociodisplay=PyOpenColorIO.bin.pyociodisplay.pyociodisplay:main',
]
},
include_package_data=True
)
+8 -24
View File
@@ -22,30 +22,14 @@ mkdir build
cd build
# FIXME: Revert OSL_BUILD_TESTS to OFF when OSL 1.12 is released
# CMake configure fails when tests are off, only fixed in 1.12 dev branch
if [[ $OSTYPE == 'darwin'* ]]; then
cmake -DCMAKE_BUILD_TYPE=Release \
${INSTALL_TARGET:+"-DCMAKE_INSTALL_PREFIX="${INSTALL_TARGET}""} \
-DCMAKE_CXX_STANDARD=14 \
-DCMAKE_C_COMPILER=$(brew --prefix llvm@15)/bin/clang \
-DCMAKE_CXX_COMPILER=$(brew --prefix llvm@15)/bin/clang++ \
-DOSL_BUILD_TESTS=ON \
-DVERBOSE=ON \
-DSTOP_ON_WARNING=OFF \
-DBoost_NO_BOOST_CMAKE=ON \
-DLLVM_ROOT=$(brew --prefix llvm@15) \
../.
else # not macOS
cmake -DCMAKE_BUILD_TYPE=Release \
${INSTALL_TARGET:+"-DCMAKE_INSTALL_PREFIX="${INSTALL_TARGET}""} \
-DCMAKE_CXX_STANDARD=14 \
-DOSL_BUILD_TESTS=ON \
-DVERBOSE=ON \
-DSTOP_ON_WARNING=OFF \
-DBoost_NO_BOOST_CMAKE=ON \
../.
fi
cmake -DCMAKE_BUILD_TYPE=Release \
${INSTALL_TARGET:+"-DCMAKE_INSTALL_PREFIX="${INSTALL_TARGET}""} \
-DCMAKE_CXX_STANDARD=14 \
-DOSL_BUILD_TESTS=ON \
-DVERBOSE=ON \
-DSTOP_ON_WARNING=OFF \
-DBoost_NO_BOOST_CMAKE=ON \
../.
cmake --build . \
--target install \
--config Release \
@@ -1,66 +0,0 @@
# SPDX-License-Identifier: BSD-3-Clause
# Copyright Contributors to the OpenColorIO Project.
#
# Check for compatibility between OpenEXR and OpenImageIO since OCIO requires OpenEXR 3+.
#
message(STATUS "Checking if the OpenImageIO found is built with OpenEXR 3+...")
find_path (OpenImageIO_INCLUDE_DIR
NAMES
OpenImageIO/imageio.h
HINTS
${OpenImageIO_ROOT}
# Assuming that OpenImageIO was installed normally, go back a few folders down
# to get the equivalent of OpenImageIO_ROOT.
${OpenImageIO_DIR}/../../..
PATH_SUFFIXES
OpenImageIO/include
include
)
if (NOT OpenImageIO_INCLUDE_DIR)
message(STATUS "${ColorWarning}Could not find OpenImageIO header to evaluate the OpenEXR version.")
message(STATUS "Please provide the OpenImageIO_DIR variable.")
message(STATUS "If your OpenImageIO's files are located in different root directory, \
please provide the OpenImageIO_ROOT where the include files are located.${ColorReset}")
endif()
# Try to figure out version number
set (OIIO_VERSION_HEADER "${OpenImageIO_INCLUDE_DIR}/OpenImageIO/oiioversion.h")
if (EXISTS "${OIIO_VERSION_HEADER}")
file (STRINGS "${OIIO_VERSION_HEADER}" TMP REGEX "^#define OIIO_VERSION_MAJOR .*$")
string (REGEX MATCHALL "[0-9]+" OpenImageIO_VERSION_MAJOR ${TMP})
file (STRINGS "${OIIO_VERSION_HEADER}" TMP REGEX "^#define OIIO_VERSION_MINOR .*$")
string (REGEX MATCHALL "[0-9]+" OpenImageIO_VERSION_MINOR ${TMP})
file (STRINGS "${OIIO_VERSION_HEADER}" TMP REGEX "^#define OIIO_VERSION_PATCH .*$")
string (REGEX MATCHALL "[0-9]+" OpenImageIO_VERSION_PATCH ${TMP})
file (STRINGS "${OIIO_VERSION_HEADER}" TMP REGEX "^#define OIIO_VERSION_TWEAK .*$")
if (TMP)
string (REGEX MATCHALL "[0-9]+" OpenImageIO_VERSION_TWEAK ${TMP})
else ()
set (OpenImageIO_VERSION_TWEAK 0)
endif ()
set (OpenImageIO_VERSION "${OpenImageIO_VERSION_MAJOR}.${OpenImageIO_VERSION_MINOR}.${OpenImageIO_VERSION_PATCH}.${OpenImageIO_VERSION_TWEAK}")
endif ()
set (OIIO_IMATH_HEADER "${OpenImageIO_INCLUDE_DIR}/OpenImageIO/Imath.h")
if (EXISTS "${OIIO_IMATH_HEADER}")
file(STRINGS "${OIIO_IMATH_HEADER}" TMP REGEX "^#define OIIO_USING_IMATH .*$")
string(REGEX MATCHALL "[0-9]" OIIO_IMATH_VERSION ${TMP})
if (OIIO_IMATH_VERSION LESS 3)
message(STATUS "Skipping OpenImageIO built against OpenEXR 2, please use version 3 or greater.")
else()
set(is_OpenEXR_VERSION_valid TRUE)
endif()
endif()
# clean up variables
unset(OpenImageIO_INCLUDE_DIR)
unset(OIIO_VERSION_HEADER)
unset(OIIO_VERSION_MAJOR)
unset(OIIO_VERSION_MINOR)
unset(OIIO_VERSION_PATCH)
unset(OIIO_VERSION_TWEAK)
unset(OIIO_IMATH_HEADER)
unset(OIIO_IMATH_VERSION)
+4 -4
View File
@@ -21,7 +21,7 @@ macro(get_python_pre_command)
# available.
if(WIN32)
# Use Windows path separators since this is being passed through to cmd
file(TO_NATIVE_PATH ${PROJECT_BINARY_DIR} _WIN_BINARY_DIR)
file(TO_NATIVE_PATH ${CMAKE_BINARY_DIR} _WIN_BINARY_DIR)
set(_DLL_PATH "${_WIN_BINARY_DIR}\\src\\OpenColorIO")
if(MSVC_IDE)
@@ -43,7 +43,7 @@ macro(get_python_pre_command)
# Build path list
set(_WIN_PATHS
${_PYD_PATH}
"${PROJECT_SOURCE_DIR}\\share\\docs"
"${CMAKE_SOURCE_DIR}\\share\\docs"
)
# Include optional paths from macro arguments
foreach(_PATH ${ARGN})
@@ -65,8 +65,8 @@ macro(get_python_pre_command)
else()
# Build path list
set(_PATHS
"${PROJECT_BINARY_DIR}/src/bindings/python"
"${PROJECT_SOURCE_DIR}/share/docs"
"${CMAKE_BINARY_DIR}/src/bindings/python"
"${CMAKE_SOURCE_DIR}/share/docs"
)
foreach(_PATH ${ARGN})
list(APPEND _PATHS ${_PATH})
-23
View File
@@ -1,23 +0,0 @@
# SPDX-License-Identifier: BSD-3-Clause
# Copyright Contributors to the OpenColorIO Project.
# This function is based on Pybind11's pybind11_strip.
macro(ocio_strip_binary target_name)
string(TOUPPER "${CMAKE_BUILD_TYPE}" _uppercase_CMAKE_BUILD_TYPE)
if(NOT MSVC AND NOT "${_uppercase_CMAKE_BUILD_TYPE}" MATCHES DEBUG|RELWITHDEBINFO)
if(CMAKE_STRIP)
if(APPLE)
set(_strip_opt -x)
endif()
add_custom_command(
TARGET ${target_name}
POST_BUILD
COMMAND ${CMAKE_STRIP} ${_strip_opt} $<TARGET_FILE:${target_name}>
)
unset(_strip_opt)
endif()
endif()
unset(_uppercase_CMAKE_BUILD_TYPE)
endmacro()
+3 -14
View File
@@ -6,19 +6,8 @@
macro(split_version_string version_var output_prefix)
string(REPLACE "." ";" _version_var_list ${version_var})
list(LENGTH _version_var_list _version_var_list_length)
if (_version_var_list_length GREATER_EQUAL 1)
list(GET _version_var_list 0 ${output_prefix}_VERSION_MAJOR)
endif()
if (_version_var_list_length GREATER_EQUAL 2)
list(GET _version_var_list 1 ${output_prefix}_VERSION_MINOR)
endif()
if (_version_var_list_length GREATER_EQUAL 3)
list(GET _version_var_list 2 ${output_prefix}_VERSION_PATCH)
endif()
list(GET _version_var_list 0 ${output_prefix}_VERSION_MAJOR)
list(GET _version_var_list 1 ${output_prefix}_VERSION_MINOR)
list(GET _version_var_list 2 ${output_prefix}_VERSION_PATCH)
unset(_version_var_list)
endmacro()
@@ -1,234 +0,0 @@
# SPDX-License-Identifier: BSD-3-Clause
# Copyright Contributors to the OpenColorIO Project.
include(ocio_install_dependency)
###################################################################################################
# ocio_print_versions_error is a wrapper for messages when the dependency is not found.
#
# Arguments:
# dep_name is the name of the dependency (package). Please note that dep_name is case sensitive.
# message_color is the color of the message.
#
# Note that this macro is used in ocio_handle_dependency and should be there only.
###################################################################################################
macro (ocio_print_versions_error dep_name message_color)
if(NOT ocio_dep_MIN_VERSION AND NOT ocio_dep_MAX_VERSION AND NOT ocio_dep_RECOMMENDED_VERSION)
message(STATUS "${message_color}Could NOT find ${dep_name} (no version specified)${ColorReset}")
elseif(NOT ocio_dep_MIN_VERSION AND NOT ocio_dep_RECOMMENDED_VERSION)
message(STATUS "${message_color}Could NOT find ${dep_name} (maximum version: \"${ocio_dep_MAX_VERSION)\"${ColorReset}")
elseif(NOT ocio_dep_MIN_VERSION AND NOT ocio_dep_MAX_VERSION)
message(STATUS "${message_color}Could NOT find ${dep_name} (recommended version: \"${ocio_dep_RECOMMENDED_VERSION}\")\"${ColorReset}")
elseif(NOT ocio_dep_RECOMMENDED_VERSION AND NOT ocio_dep_MAX_VERSION)
message(STATUS "${message_color}Could NOT find ${dep_name} (minimum version: \"${ocio_dep_MIN_VERSION})\"${ColorReset}")
elseif(NOT ocio_dep_MIN_VERSION)
message(STATUS "${message_color}Could NOT find ${dep_name} (recommended version: \"${ocio_dep_RECOMMENDED_VERSION}\", maximum version: \"${ocio_dep_MAX_VERSION}\")${ColorReset}")
elseif(NOT ocio_dep_RECOMMENDED_VERSION)
message(STATUS "${message_color}Could NOT find ${dep_name} (minimum version: \"${ocio_dep_MIN_VERSION}\", maximum version: \"${ocio_dep_MAX_VERSION}\")${ColorReset}")
elseif(NOT ocio_dep_MAX_VERSION)
message(STATUS "${message_color}Could NOT find ${dep_name} (minimum version: \"${ocio_dep_MIN_VERSION}\", recommended version: \"${ocio_dep_RECOMMENDED_VERSION}\")${ColorReset}")
else()
message(STATUS "${message_color}Could NOT find ${dep_name} (minimum version: \"${ocio_dep_MIN_VERSION}\", recommended version: \"${ocio_dep_RECOMMENDED_VERSION}\", max: \"${ocio_dep_MAX_VERSION}\")${ColorReset}")
endif()
endmacro()
# Using a macro because OCIO wants the scope to be the same as the caller scope.
# Find modules will set variables via the PARENT_SCOPE option and OCIO needs those
# variables in the caller scope.
###################################################################################################
# ocio_handle_dependency is a wrapper for find_package with extra options (features).
#
# Argument:
# dep_name is the name of the dependency (package). Please note that dep_name is case sensitive.
#
# Options (no value):
# REQUIRED - Whether the dependency is required or not. Fails if missing.
# PREFER_CONFIG - Call find_package in CONFIG mode internally.
# Note that it tries to find <dep_name>Config.cmake or
# <dep_name>-Config.cmake directly.
# ALLOW_INSTALL - Try to install the dependency if not found. Note that a
# corresponding Install<dep_name>.cmake file must exist.
# VERBOSE - Enable extra logging.
#
# Options (one value):
# MIN_VERSION - Minimum version for the dependency.
# MAX_VERSION - Maximum version for the dependency.
# RECOMMENDED_VERSION - Recommended version for the dependency.
# RECOMMENDED_VERSION_REASON - Reason for the recommended version.
#
# Options (multiple values):
# VERSION_VARS - List of version variables. Default to <dep_name>_VERSION.
# COMPONENTS - List of components to find. Just like find_package option.
# PROMOTE_TARGET - List of targets that needs to be globally visible by setting
# the targets property IMPORTED_GLOBAL to true. Note that the
# targets must be created by the dependency.
#
# This is a macro because OCIO wants the scope to be the same as the caller scope.
# Find modules will set variables via the PARENT_SCOPE option and OCIO needs those
# variables in the caller scope.
#
###################################################################################################
macro (ocio_handle_dependency dep_name)
cmake_parse_arguments(
# prefix
ocio_dep
# options
"REQUIRED;PREFER_CONFIG;ALLOW_INSTALL;VERBOSE"
# one value keywords
"MIN_VERSION;MAX_VERSION;RECOMMENDED_VERSION;RECOMMENDED_VERSION_REASON;PROMOTE_TARGET"
# multi value keywords
"VERSION_VARS;COMPONENTS"
# args
${ARGN})
set(ocio_dep_FORCE_INSTALLATION OFF)
if(ocio_dep_ALLOW_INSTALL AND OCIO_INSTALL_EXT_PACKAGES STREQUAL ALL)
set(ocio_dep_FORCE_INSTALLATION ON)
endif()
if(NOT ocio_dep_FORCE_INSTALLATION)
set(ocio_dep_QUIET_string "")
# Do not set to QUIET when OCIO_VERBOSE is ON.
if(NOT ocio_dep_VERBOSE AND NOT OCIO_VERBOSE)
set(${dep_name}_FIND_QUIETLY true)
set(ocio_dep_QUIET_string "QUIET")
endif()
set(ocio_dep_CONFIG_string "")
if(ocio_dep_PREFER_CONFIG)
set(ocio_dep_CONFIG_string "CONFIG")
endif()
set(ocio_dep_COMPONENTS_string "")
if(ocio_dep_COMPONENTS)
set(ocio_dep_COMPONENTS_string "COMPONENTS")
endif()
if (${dep_name}_FOUND)
# Nothing to do. Already found.
else()
# Try to find the recommended, or higher, version.
# Note that the recommended version should always be specified.
find_package(${dep_name}
${ocio_dep_RECOMMENDED_VERSION}
${ocio_dep_CONFIG_string}
${ocio_dep_COMPONENTS_string}
${ocio_dep_COMPONENTS}
${ocio_dep_QUIET_string}
${ocio_dep_UNPARSED_ARGUMENTS})
if (NOT ${dep_name}_FOUND AND ocio_dep_PREFER_CONFIG)
# Try find_package in module mode instead of config mode.
find_package(${dep_name}
${ocio_dep_RECOMMENDED_VERSION}
${ocio_dep_COMPONENTS_string}
${ocio_dep_COMPONENTS}
${ocio_dep_QUIET_string}
${ocio_dep_UNPARSED_ARGUMENTS})
endif()
if(NOT ${dep_name}_FOUND AND ocio_dep_MIN_VERSION
AND NOT ocio_dep_MIN_VERSION VERSION_EQUAL ocio_dep_MAX_VERSION
AND NOT ocio_dep_MIN_VERSION VERSION_EQUAL ocio_dep_RECOMMENDED_VERSION)
# if the recommended, or higher, version is not found, try to find dependency with
# the minimum version.
find_package(${dep_name}
${ocio_dep_MIN_VERSION}
${ocio_dep_CONFIG_string}
${ocio_dep_COMPONENTS_string}
${ocio_dep_COMPONENTS}
${ocio_dep_QUIET_string}
${ocio_dep_UNPARSED_ARGUMENTS})
if (NOT ${dep_name}_FOUND AND ocio_dep_PREFER_CONFIG)
# Try find_package in module mode instead of config mode.
find_package(${dep_name}
${ocio_dep_MIN_VERSION}
${ocio_dep_COMPONENTS_string}
${ocio_dep_COMPONENTS}
${ocio_dep_QUIET_string}
${ocio_dep_UNPARSED_ARGUMENTS})
endif()
endif()
endif()
# Check which VERSION_VARS was set by find_package.
set(_VERSION_VAR "${dep_name}_VERSION")
foreach (_vervar ${ocio_dep_VERSION_VARS})
if(${_vervar})
set(_VERSION_VAR ${_vervar})
break()
endif()
endforeach()
if(_VERSION_VAR)
set(ocio_dep_VERSION ${${_VERSION_VAR}})
endif()
# Expecting that the minimum and recommended version are always provided.
# Make sure that the version is within the valid range.
if(${dep_name}_FOUND)
if (ocio_dep_VERSION)
# Make sure that the version found is not greater than the maximum version.
if(DEFINED ocio_dep_MAX_VERSION)
if(ocio_dep_VERSION VERSION_GREATER ocio_dep_MAX_VERSION)
# Display it as an error, but do not abort right now.
message(SEND_ERROR "${ColorError}Found ${dep_name} ${ocio_dep_VERSION}, but it is over the maximum version \"${ocio_dep_MAX_VERSION}\" ${ColorReset}")
set(_${dep_name}_found_displayed true)
endif()
endif()
if(DEFINED ocio_dep_RECOMMENDED_VERSION)
if (ocio_dep_VERSION VERSION_LESS ocio_dep_RECOMMENDED_VERSION)
message(STATUS "${ColorSuccess}Found ${dep_name} (version \"${ocio_dep_VERSION}\") (recommended version: \"${ocio_dep_RECOMMENDED_VERSION}\")${ColorReset}")
if (ocio_dep_RECOMMENDED_VERSION_REASON)
message(STATUS " Reason: ${ocio_dep_RECOMMENDED_VERSION_REASON}")
endif()
set(_${dep_name}_found_displayed true)
endif()
endif()
if(NOT _${dep_name}_found_displayed)
message(STATUS "${ColorSuccess}Found ${dep_name} (version \"${ocio_dep_VERSION}\")${ColorReset}")
endif()
else()
message(STATUS "${ColorSuccess}Found ${dep_name} (no version information)${ColorReset}")
endif()
else()
if(ocio_dep_REQUIRED AND NOT ocio_dep_ALLOW_INSTALL)
set(message_color "${ColorError}")
else()
set(message_color "${ColorReset}")
endif()
ocio_print_versions_error(${dep_name} ${message_color})
if(${dep_name}_ROOT)
message(STATUS "${message_color} ${dep_name}_ROOT was: ${${dep_name}_ROOT} ${ColorReset}")
elseif($ENV{${dep_name}_ROOT})
message(STATUS "${message_color} ENV ${dep_name}_ROOT was: ${${dep_name}_ROOT} ${ColorReset}")
endif()
if(ocio_dep_ALLOW_INSTALL)
ocio_install_dependency(${dep_name} VERSION ${ocio_dep_RECOMMENDED_VERSION})
endif()
if(ocio_dep_REQUIRED)
if(NOT ${dep_name}_FOUND AND NOT ocio_dep_VERSION)
message(SEND_ERROR "${ColorError}${dep_name} is required, will abort at the end.${ColorReset}")
endif()
endif()
endif()
elseif(ocio_dep_FORCE_INSTALLATION)
# Skip the search and install dependency right away.
ocio_install_dependency(${dep_name} VERSION ${ocio_dep_RECOMMENDED_VERSION})
endif()
if(${dep_name}_FOUND AND ocio_dep_PROMOTE_TARGET)
foreach (_target_to_be_promoted_ ${ocio_dep_PROMOTE_TARGET})
set_target_properties(${_target_to_be_promoted_} PROPERTIES IMPORTED_GLOBAL TRUE)
endforeach()
endif()
endmacro()
@@ -1,46 +0,0 @@
# SPDX-License-Identifier: BSD-3-Clause
# Copyright Contributors to the OpenColorIO Project.
###################################################################################################
# ocio_install_dependency installs a dependency by calling the corresponding Install module.
# e.g. Install<dep_name>.cmake
#
# Argument:
# dep_name is the name of the dependency (package). Please note that dep_name is case sensitive.
#
# Options (one value):
# VERSION - Version to install.
###################################################################################################
macro (ocio_install_dependency dep_name)
cmake_parse_arguments(
# prefix - Must be different than the one used in ocio_handle_dependency.cmake.
ocio_id
# options
""
# one value keywords
"VERSION;PROMOTE_TARGET"
# multi value keywords
""
# args
${ARGN})
if(NOT ${dep_name}_FOUND AND OCIO_INSTALL_EXT_PACKAGES AND NOT OCIO_INSTALL_EXT_PACKAGES STREQUAL NONE)
set(OCIO_${dep_name}_RECOMMENDED_VERSION ${ocio_id_VERSION})
include(Install${dep_name})
set(_${dep_name}_built_by_ocio TRUE)
endif()
if(${dep_name}_FOUND)
if(${dep_name}_FOUND AND ocio_id_PROMOTE_TARGET)
foreach (_target_to_be_promoted_ ${ocio_id_PROMOTE_TARGET})
set_target_properties(${_target_to_be_promoted_} PROPERTIES IMPORTED_GLOBAL TRUE)
endforeach()
endif()
if (${_${dep_name}_built_by_ocio})
message(STATUS "${ColorSuccess}Installed ${dep_name} (version \"${ocio_id_VERSION}\")${ColorReset}")
endif()
endif()
unset(_${dep_name}_built_by_ocio)
endmacro()
+103 -155
View File
@@ -6,9 +6,6 @@
# by the OCIO_INSTALL_EXT_PACKAGES option.
#
include(Colors)
include(ocio_handle_dependency)
###############################################################################
### Global package options ###
@@ -35,95 +32,116 @@ if (APPLE)
set(CMAKE_FIND_APPBUNDLE LAST)
endif()
message(STATUS "")
message(STATUS "Missing a dependency? Try the following possibilities:")
message(STATUS "If the package provides CMake's configuration file, use -D<pkg>_DIR=<path to folder>.")
message(STATUS "If it doesn't provide it, try -D<pkg>_ROOT=<path to folder with lib and includes>.")
message(STATUS "Alternatively, try -D<pkg>_LIBRARY=<path to lib file> and/or -D<pkg>_INCLUDE_DIR=<path to folder>.")
message(STATUS "")
message(STATUS "Please refer to the find module under share/cmake/modules for extra information.")
###############################################################################
##
## Required dependencies
##
###############################################################################
message(STATUS "")
message(STATUS "Checking for mandatory dependencies...")
### Packages and versions ###
# expat
# https://github.com/libexpat/libexpat
ocio_handle_dependency( expat REQUIRED ALLOW_INSTALL
MIN_VERSION 2.4.1
RECOMMENDED_VERSION 2.5.0
RECOMMENDED_VERSION_REASON "CVE fixes and fix issue with symbol leakage when built as a static library")
find_package(expat 2.4.1 REQUIRED)
# yaml-cpp
# https://github.com/jbeder/yaml-cpp
ocio_handle_dependency( yaml-cpp REQUIRED ALLOW_INSTALL
MIN_VERSION 0.6.3
RECOMMENDED_VERSION 0.7.0
RECOMMENDED_VERSION_REASON "Latest version tested with OCIO")
find_package(yaml-cpp 0.7.0 REQUIRED)
# pystring
# https://github.com/imageworks/pystring
ocio_handle_dependency( pystring REQUIRED ALLOW_INSTALL
MIN_VERSION 1.1.3
RECOMMENDED_VERSION 1.1.3
RECOMMENDED_VERSION_REASON "Latest version tested with OCIO")
find_package(pystring 1.1.3 REQUIRED)
# Imath (>=3.1)
# https://github.com/AcademySoftwareFoundation/Imath
ocio_handle_dependency( Imath REQUIRED ALLOW_INSTALL
MIN_VERSION 3.1.1
RECOMMENDED_VERSION 3.1.6
RECOMMENDED_VERSION_REASON "Latest version tested with OCIO")
set(_Imath_ExternalProject_VERSION "3.1.5")
find_package(Imath 3.0 REQUIRED)
###############################################################################
# ZLIB (https://github.com/madler/zlib)
#
# The following variables can be set:
# ZLIB_ROOT Location of ZLIB library file and includes folder.
# Alternatively, ZLIB_LIBRARY and ZLIB_INCLUDE_DIR can be used.
#
# ZLIB_LIBRARY Location of ZLIB library file.
# ZLIB_INCLUDE_DIR Location of ZLIB includes folder.
#
# ZLIB_VERSION ZLIB Version (CMake 3.26+)
# ZLIB_VERSION_STRING ZLIB Version (CMake < 3.26)
#
#
# ZLIB_USE_STATIC_LIBS Set to ON if static library is prefered (CMake 3.24+)
#
### ZLIB (https://github.com/madler/zlib)
###
### The following variables can be set:
### ZLIB_ROOT Location of ZLIB library file and includes folder.
### Alternatively, ZLIB_LIBRARY and ZLIB_INCLUDE_DIR can be used.
###
### ZLIB_LIBRARY Location of ZLIB library file.
### ZLIB_INCLUDE_DIR Location of ZLIB includes folder.
###
### ZLIB_VERSION ZLIB Version (CMake 3.26+)
### ZLIB_VERSION_STRING ZLIB Version (CMake < 3.26)
###
###############################################################################
# ZLIB 1.2.13 is used since it fixes a critical vulnerability.
# See https://nvd.nist.gov/vuln/detail/CVE-2022-37434
# See https://github.com/madler/zlib/releases/tag/v1.2.13
ocio_handle_dependency( ZLIB REQUIRED ALLOW_INSTALL
MIN_VERSION 1.2.8
RECOMMENDED_VERSION 1.2.13
RECOMMENDED_VERSION_REASON "CVE fixes"
VERSION_VARS ZLIB_VERSION_STRING ZLIB_VERSION )
set(_ZLIB_FIND_VERSION "1.2.13")
set(_ZLIB_ExternalProject_VERSION ${_ZLIB_FIND_VERSION})
if(NOT OCIO_INSTALL_EXT_PACKAGES STREQUAL ALL)
# ZLIB_USE_STATIC_LIBS is supported only from CMake 3.24+.
if(${CMAKE_VERSION} VERSION_GREATER_EQUAL "3.24.0")
if (ZLIB_STATIC_LIBRARY)
set(ZLIB_USE_STATIC_LIBS "${ZLIB_STATIC_LIBRARY}")
endif()
else() # For CMake < 3.24 since ZLIB_USE_STATIC_LIBS is not available.
if(NOT ZLIB_LIBRARY)
if(DEFINED CMAKE_FIND_LIBRARY_PREFIXES)
set(_ZLIB_ORIG_CMAKE_FIND_LIBRARY_PREFIXES "${CMAKE_FIND_LIBRARY_PREFIXES}")
else()
set(_ZLIB_ORIG_CMAKE_FIND_LIBRARY_PREFIXES)
endif()
if(DEFINED CMAKE_FIND_LIBRARY_SUFFIXES)
set(_ZLIB_ORIG_CMAKE_FIND_LIBRARY_SUFFIXES "${CMAKE_FIND_LIBRARY_SUFFIXES}")
else()
set(_ZLIB_ORIG_CMAKE_FIND_LIBRARY_SUFFIXES)
endif()
# Prefix/suffix for windows.
if(WIN32)
list(APPEND CMAKE_FIND_LIBRARY_PREFIXES "" "lib")
list(APPEND CMAKE_FIND_LIBRARY_SUFFIXES ".dll.a")
endif()
# Check if static lib is preferred.
if(ZLIB_STATIC_LIBRARY OR ZLIB_USE_STATIC_LIBS)
if(WIN32)
set(CMAKE_FIND_LIBRARY_SUFFIXES .lib .a ${CMAKE_FIND_LIBRARY_SUFFIXES})
else()
set(CMAKE_FIND_LIBRARY_SUFFIXES .a)
endif()
endif()
endif()
endif()
set(_ZLIB_REQUIRED REQUIRED)
# Override REQUIRED if package can be installed
if(OCIO_INSTALL_EXT_PACKAGES STREQUAL MISSING)
set(_ZLIB_REQUIRED "")
endif()
find_package(ZLIB ${_ZLIB_FIND_VERSION} ${_ZLIB_REQUIRED})
# Restore the original find library ordering
if(DEFINED _ZLIB_ORIG_CMAKE_FIND_LIBRARY_SUFFIXES)
set(CMAKE_FIND_LIBRARY_SUFFIXES "${_ZLIB_ORIG_CMAKE_FIND_LIBRARY_SUFFIXES}")
else()
set(CMAKE_FIND_LIBRARY_SUFFIXES)
endif()
if(DEFINED _ZLIB_ORIG_CMAKE_FIND_LIBRARY_PREFIXES)
set(CMAKE_FIND_LIBRARY_PREFIXES "${_ZLIB_ORIG_CMAKE_FIND_LIBRARY_PREFIXES}")
else()
set(CMAKE_FIND_LIBRARY_PREFIXES)
endif()
endif()
if(NOT ZLIB_FOUND AND OCIO_INSTALL_EXT_PACKAGES AND NOT OCIO_INSTALL_EXT_PACKAGES STREQUAL NONE)
include(InstallZLIB)
endif()
###############################################################################
# minizip-ng
# https://github.com/zlib-ng/minizip-ng
ocio_handle_dependency( minizip-ng REQUIRED ALLOW_INSTALL
MIN_VERSION 3.0.6
RECOMMENDED_VERSION 3.0.7
RECOMMENDED_VERSION_REASON "Latest version tested with OCIO")
###############################################################################
##
## Optional dependencies
##
###############################################################################
message(STATUS "")
message(STATUS "Checking for optional dependencies...")
find_package(minizip-ng 3.0.7 REQUIRED)
if(OCIO_BUILD_APPS)
# NOTE: Depending of the compiler version lcms2 2.2 does not compile with
# C++17 so, if you change the lcms2 version update the code to compile
# lcms2 and dependencies with C++17 or higher i.e. remove the cap of C++
@@ -131,19 +149,13 @@ if(OCIO_BUILD_APPS)
# lcms2
# https://github.com/mm2/Little-CMS
ocio_handle_dependency( lcms2 REQUIRED ALLOW_INSTALL
MIN_VERSION 2.2
RECOMMENDED_VERSION 2.2
RECOMMENDED_VERSION_REASON "Latest version tested with OCIO")
find_package(lcms2 2.2 REQUIRED)
endif()
if(OCIO_BUILD_OPENFX)
# openfx
# https://github.com/ofxa/openfx
ocio_handle_dependency( openfx REQUIRED ALLOW_INSTALL
MIN_VERSION 1.4
RECOMMENDED_VERSION 1.4
RECOMMENDED_VERSION_REASON "Latest version tested with OCIO")
find_package(openfx 1.4 REQUIRED)
endif()
if (OCIO_PYTHON_VERSION AND NOT OCIO_BUILD_PYTHON)
@@ -165,105 +177,44 @@ if(OCIO_BUILD_PYTHON OR OCIO_BUILD_DOCS)
list(APPEND _Python_COMPONENTS Development)
endif()
# Python
ocio_handle_dependency( Python REQUIRED
COMPONENTS ${_Python_COMPONENTS}
MIN_VERSION ${OCIO_PYTHON_VERSION}
RECOMMENDED_VERSION ${OCIO_PYTHON_VERSION}
RECOMMENDED_VERSION_REASON "Latest version tested with OCIO")
find_package(Python ${OCIO_PYTHON_VERSION} REQUIRED
COMPONENTS ${_Python_COMPONENTS})
if(OCIO_BUILD_PYTHON)
# pybind11
# https://github.com/pybind/pybind11
# 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")
find_package(pybind11 2.9.2 REQUIRED)
endif()
endif()
# Set OpenEXR Minimum version as a variable since it it used at multiple places.
set(OpenEXR_MININUM_VERSION "3.0.5")
if((OCIO_BUILD_APPS AND OCIO_USE_OIIO_FOR_APPS) OR OCIO_BUILD_TESTS)
# OpenImageIO is required for OSL unit test and optional for apps.
# OpenImageIO
# https://github.com/OpenImageIO/oiio
set(OIIO_VERSION "2.2.14")
set(OIIO_RECOMMENDED_VERSION "2.4")
# Supported from OIIO 2.4+. Setting this for lower versions doesn't affect anything.
set(OPENIMAGEIO_CONFIG_DO_NOT_FIND_IMATH 1)
set(is_OpenEXR_VERSION_valid FALSE)
# Check for compatibility between OpenEXR and OpenImageIO.
# Will set is_OpenEXR_VERSION_valid to TRUE if valid.
include(CheckForOpenEXRCompatibility)
# Do not try to find OpenImageIO if the version of OpenEXR is too old.
if (is_OpenEXR_VERSION_valid)
###############################################################################
# OpenImageIO (https://github.com/OpenImageIO/oiio)
#
# Variables defined by OpenImageIO CMake's configuration files:
# OpenImageIO_FOUND - Indicate whether the library was found or not
# OpenImageIO_LIB_DIR - Library's directory
# OpenImageIO_INCLUDE_DIR - Location of the header files
# OpenImageIO_VERSION - Library's version
#
# Imported targets defined by this module, if found:
# OpenImageIO::OpenImageIO
# OpenImageIO::OpenImageIO_Util
#
###############################################################################
# Calling find_package in CONFIG mode using PREFER_CONFIG option as OIIO support
# config file since 2.1+ and OCIO minimum version is over that.
ocio_handle_dependency( OpenImageIO PREFER_CONFIG
MIN_VERSION ${OIIO_VERSION}
RECOMMENDED_VERSION ${OIIO_RECOMMENDED_VERSION}
PROMOTE_TARGET OpenImageIO::OpenImageIO)
if(OCIO_USE_OIIO_CMAKE_CONFIG)
# TODO: Try when OIIO 2.4 is released (https://github.com/OpenImageIO/oiio/pull/3322).
# set(OPENIMAGEIO_CONFIG_DO_NOT_FIND_IMATH 1)
find_package(OpenImageIO ${OIIO_VERSION} CONFIG)
else()
find_package(OpenImageIO ${OIIO_VERSION})
endif()
endif()
if(OCIO_BUILD_APPS)
if(OCIO_USE_OIIO_FOR_APPS AND OpenImageIO_FOUND AND TARGET OpenImageIO::OpenImageIO)
if (USE_MSVC AND OCIO_IMAGE_BACKEND STREQUAL "OpenImageIO")
# Temporary until fixed in OpenImageIO: Mute some warnings from OpenImageIO farmhash.h
# C4267 (level 3) 'var' : conversion from 'size_t' to 'type', possible loss of data
# C4244 (level 3 & 4) 'conversion' conversion from 'type1' to 'type2', possible loss of data
target_compile_options(OpenImageIO::OpenImageIO PRIVATE /wd4267 /wd4244)
endif()
add_library(OpenColorIO::ImageIOBackend ALIAS OpenImageIO::OpenImageIO)
set(OCIO_IMAGE_BACKEND OpenImageIO)
else()
###############################################################################
# OpenEXR (https://github.com/AcademySoftwareFoundation/openexr)
#
# Variables defined by OpenEXR CMake's configuration files:
# OpenEXR_FOUND - Indicate whether the library was found or not
# OpenEXR_VERSION - Library's version
#
# Imported targets defined by this module, if found:
# OpenEXR::Iex
# OpenEXR::IexConfig
# OpenEXR::IlmThread
# OpenEXR::IlmThreadConfig
# OpenEXR::OpenEXR
# OpenEXR::OpenEXRConfig
# OpenEXR::OpenEXRCore
# OpenEXR::OpenEXRUtil
#
###############################################################################
# Calling find_package in CONFIG mode using PREFER_CONFIG option.
ocio_handle_dependency( OpenEXR PREFER_CONFIG ALLOW_INSTALL
MIN_VERSION ${OpenEXR_MININUM_VERSION}
RECOMMENDED_VERSION 3.1.5
RECOMMENDED_VERSION_REASON "Latest version tested with OCIO"
PROMOTE_TARGET OpenEXR::OpenEXR)
# OpenEXR
# https://github.com/AcademySoftwareFoundation/openexr
set(_OpenEXR_ExternalProject_VERSION "3.1.5")
find_package(OpenEXR 3.0)
if(OpenEXR_FOUND AND TARGET OpenEXR::OpenEXR)
add_library(OpenColorIO::ImageIOBackend ALIAS OpenEXR::OpenEXR)
@@ -285,18 +236,15 @@ if(OCIO_BUILD_TESTS)
if(TARGET Imath::Imath)
# OpenShadingLanguage
# https://github.com/AcademySoftwareFoundation/OpenShadingLanguage
ocio_handle_dependency( OSL
MIN_VERSION 1.11
RECOMMENDED_VERSION 1.11
RECOMMENDED_VERSION_REASON "Latest version tested with OCIO")
find_package(OpenShadingLanguage 1.11)
if(NOT OSL_FOUND)
message(WARNING "Skipping build of the OpenShadingLanguage unit tests (OSL missing)")
message(WARNING "Could NOT find OpenShadingLanguage. Skipping build of the OSL unit tests.")
endif()
else()
message(WARNING "Skipping build of the OpenShadingLanguage unit tests (Imath missing)")
message(WARNING "Could NOT find Imath. Skipping build of the OSL unit tests.")
endif()
else()
message(WARNING "Skipping build of the OpenShadingLanguage unit tests (OpenImageIO missing)")
message(WARNING "Could NOT find OpenImageIO. Skipping build of the OSL unit tests.")
endif()
endif()
+126 -18
View File
@@ -1,27 +1,25 @@
# SPDX-License-Identifier: BSD-3-Clause
# Copyright Contributors to the OpenColorIO Project.
#
# Locate Imath
# Locate or install Imath
#
# Variables defined by this module:
# Imath_FOUND - Indicate whether the library was found or not
# Imath_LIBRARY - Path to the library file
# Imath_INCLUDE_DIR - Location of the header files
# Imath_VERSION - Library's version
# Imath_FOUND - If FALSE, do not try to link to ilmbase
# Imath_LIBRARY - Imath library to link to
# Imath_INCLUDE_DIR - Where to find ImathConfig.h
# Imath_VERSION - The version of the library
#
# Global targets defined by this module:
# Imath::Imath
# Targets defined by this module:
# Imath::Imath - IMPORTED target, if found
#
# Usually CMake will use the dynamic library rather than static, if both are present.
# In this case, you may set Imath_STATIC_LIBRARY to ON to request use of the static one.
# If only the static library is present (such as when OCIO builds the dependency), then the option
# is not needed.
# By default, the dynamic libraries of Imath will be found. To find the
# static ones instead, you must set the Imath_STATIC_LIBRARY variable to
# TRUE before calling find_package(Imath ...).
#
# If the library is not installed in a typical location where CMake will find it, you may specify
# the location using one of the following methods:
# -- Set -DImath_DIR to point to the directory containing the CMake configuration file for the package.
# -- Set -DImath_ROOT to point to the directory containing the lib and include directories.
# -- Set -DImath_LIBRARY and -DImath_INCLUDE_DIR to point to the lib and include directories.
# If Imath is not installed in a standard path, you can use the
# Imath_ROOT variable to tell CMake where to find it. If it is not found
# and OCIO_INSTALL_EXT_PACKAGES is set to MISSING or ALL, Imath will be
# downloaded, built, and statically-linked into libOpenColorIO at build time.
#
###############################################################################
@@ -133,12 +131,122 @@ endif()
###############################################################################
### Create target
if (Imath_FOUND AND NOT TARGET Imath::Imath)
if (NOT TARGET Imath::Imath)
add_library(Imath::Imath UNKNOWN IMPORTED GLOBAL)
add_library(Imath::ImathConfig INTERFACE IMPORTED GLOBAL)
set(_Imath_TARGET_CREATE TRUE)
endif()
###############################################################################
### Install package from source ###
if(NOT Imath_FOUND AND OCIO_INSTALL_EXT_PACKAGES AND NOT OCIO_INSTALL_EXT_PACKAGES STREQUAL NONE)
include(ExternalProject)
include(GNUInstallDirs)
set(_EXT_DIST_ROOT "${CMAKE_BINARY_DIR}/ext/dist")
set(_EXT_BUILD_ROOT "${CMAKE_BINARY_DIR}/ext/build")
# Set find_package standard args
set(Imath_FOUND TRUE)
if(_Imath_ExternalProject_VERSION)
set(Imath_VERSION ${_Imath_ExternalProject_VERSION})
else()
set(Imath_VERSION ${Imath_FIND_VERSION})
endif()
set(Imath_INCLUDE_DIR "${_EXT_DIST_ROOT}/${CMAKE_INSTALL_INCLUDEDIR}")
# Set the expected library name
if(BUILD_TYPE_DEBUG)
set(_Imath_LIB_SUFFIX "_d")
endif()
include(VersionUtils)
split_version_string(${Imath_VERSION} _Imath_ExternalProject)
set(_Imath_LIB_VER "${_Imath_ExternalProject_VERSION_MAJOR}_${_Imath_ExternalProject_VERSION_MINOR}")
set(Imath_LIBRARY
"${_EXT_DIST_ROOT}/${CMAKE_INSTALL_LIBDIR}/${CMAKE_STATIC_LIBRARY_PREFIX}Imath-${_Imath_LIB_VER}${_Imath_LIB_SUFFIX}${CMAKE_STATIC_LIBRARY_SUFFIX}")
if(_Imath_TARGET_CREATE)
if(MSVC)
set(Imath_CXX_FLAGS "${Imath_CXX_FLAGS} /EHsc")
endif()
string(STRIP "${Imath_CXX_FLAGS}" Imath_CXX_FLAGS)
set(Imath_CMAKE_ARGS
${Imath_CMAKE_ARGS}
-DCMAKE_CXX_VISIBILITY_PRESET=${CMAKE_CXX_VISIBILITY_PRESET}
-DCMAKE_VISIBILITY_INLINES_HIDDEN=${CMAKE_VISIBILITY_INLINES_HIDDEN}
-DCMAKE_POSITION_INDEPENDENT_CODE=ON
-DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE}
-DCMAKE_CXX_FLAGS=${Imath_CXX_FLAGS}
-DCMAKE_CXX_STANDARD=${CMAKE_CXX_STANDARD}
-DCMAKE_INSTALL_MESSAGE=${CMAKE_INSTALL_MESSAGE}
-DCMAKE_INSTALL_PREFIX=${_EXT_DIST_ROOT}
-DCMAKE_INSTALL_BINDIR=${CMAKE_INSTALL_BINDIR}
-DCMAKE_INSTALL_DATADIR=${CMAKE_INSTALL_DATADIR}
-DCMAKE_INSTALL_LIBDIR=${CMAKE_INSTALL_LIBDIR}
-DCMAKE_INSTALL_INCLUDEDIR=${CMAKE_INSTALL_INCLUDEDIR}
-DCMAKE_OBJECT_PATH_MAX=${CMAKE_OBJECT_PATH_MAX}
-DBUILD_SHARED_LIBS=OFF
-DBUILD_TESTING=OFF
-DPYTHON=OFF
-DDOCS=OFF
-DIMATH_HALF_USE_LOOKUP_TABLE=OFF
)
if(CMAKE_TOOLCHAIN_FILE)
set(Imath_CMAKE_ARGS
${Imath_CMAKE_ARGS} -DCMAKE_TOOLCHAIN_FILE=${CMAKE_TOOLCHAIN_FILE})
endif()
if(APPLE)
string(REPLACE ";" "$<SEMICOLON>" ESCAPED_CMAKE_OSX_ARCHITECTURES "${CMAKE_OSX_ARCHITECTURES}")
set(Imath_CMAKE_ARGS
${Imath_CMAKE_ARGS}
-DCMAKE_OSX_DEPLOYMENT_TARGET=${CMAKE_OSX_DEPLOYMENT_TARGET}
-DCMAKE_OSX_ARCHITECTURES=${ESCAPED_CMAKE_OSX_ARCHITECTURES}
)
endif()
if (ANDROID)
set(Imath_CMAKE_ARGS
${Imath_CMAKE_ARGS}
-DANDROID_PLATFORM=${ANDROID_PLATFORM}
-DANDROID_ABI=${ANDROID_ABI}
-DANDROID_STL=${ANDROID_STL})
endif()
# Hack to let imported target be built from ExternalProject_Add
file(MAKE_DIRECTORY ${Imath_INCLUDE_DIR})
ExternalProject_Add(imath_install
GIT_REPOSITORY "https://github.com/AcademySoftwareFoundation/Imath.git"
GIT_TAG "v${Imath_VERSION}"
GIT_CONFIG advice.detachedHead=false
GIT_SHALLOW TRUE
PREFIX "${_EXT_BUILD_ROOT}/Imath"
BUILD_BYPRODUCTS ${Imath_LIBRARY}
CMAKE_ARGS ${Imath_CMAKE_ARGS}
EXCLUDE_FROM_ALL TRUE
BUILD_COMMAND ""
INSTALL_COMMAND
${CMAKE_COMMAND} --build .
--config ${CMAKE_BUILD_TYPE}
--target install
--parallel
)
add_dependencies(Imath::Imath imath_install)
message(STATUS "Installing Imath: ${Imath_LIBRARY} (version \"${Imath_VERSION}\")")
endif()
endif()
###############################################################################
### Configure target ###
@@ -154,4 +262,4 @@ if(_Imath_TARGET_CREATE)
)
mark_as_advanced(Imath_INCLUDE_DIR Imath_LIBRARY Imath_VERSION)
endif()
endif()
+2 -2
View File
@@ -89,8 +89,8 @@ FIND_PACKAGE_HANDLE_STANDARD_ARGS( "Nuke" DEFAULT_MSG
SET( Nuke_API_VERSION "" )
IF( NUKE_FOUND )
TRY_RUN(NUKE_VERSION_EXITCODE NUKE_VERSION_COMPILED
${PROJECT_BINARY_DIR}
${PROJECT_SOURCE_DIR}/share/cmake/modules/src/TestForDDImageVersion.cxx
${CMAKE_BINARY_DIR}
${CMAKE_SOURCE_DIR}/share/cmake/modules/src/TestForDDImageVersion.cxx
COMPILE_DEFINITIONS
"-I${Nuke_INCLUDE_DIR}"
RUN_OUTPUT_VARIABLE
@@ -1,13 +1,13 @@
# SPDX-License-Identifier: BSD-3-Clause
# Copyright Contributors to the OpenColorIO Project.
#
# Install OpenEXR
# Locate or install OpenEXR.
#
# Variables defined by this module:
# OpenEXR_FOUND - Indicate whether the library was found or not
# OpenEXR_LIBRARY - Path to the library file
# OpenEXR_INCLUDE_DIR - Location of the header files
# OpenEXR_VERSION - Library's version
# OpenEXR_FOUND - If FALSE, do not try to link to OpenEXR
# OpenEXR_LIBRARY - OpenEXR library to link to
# OpenEXR_INCLUDE_DIR - Where to find OpenEXR headers
# OpenEXR_VERSION - The version of the library
#
# Imported targets defined by this module, if found:
# OpenEXR::Iex
@@ -19,10 +19,51 @@
# OpenEXR::OpenEXRCore
# OpenEXR::OpenEXRUtil
#
# Depending on user options when configuring OCIO, OpenEXR can be used to
# build libOpenColorIOimageioapphelpers.
# By default, the dynamic libraries of OpenEXR will be found. To find the
# static ones instead, you must set the OpenEXR_STATIC_LIBRARY variable to
# TRUE before calling find_package(OpenEXR ...).
#
# If OpenEXR is not installed in a standard path, you can use the
# OpenEXR_ROOT variable to tell CMake where to find it. If it is not found
# and OCIO_INSTALL_EXT_PACKAGES is set to MISSING or ALL, OpenEXR will be
# downloaded, statically-built, and used to generate
# libOpenColorIOimageioapphelpers.
#
###############################################################################
### Try to find package ###
if(NOT OCIO_INSTALL_EXT_PACKAGES STREQUAL ALL)
set(_OpenEXR_REQUIRED_VARS OpenEXR_LIBRARY)
set(_OpenEXR_LIB_VER "${OpenEXR_FIND_VERSION_MAJOR}_${OpenEXR_FIND_VERSION_MINOR}")
if(NOT DEFINED OpenEXR_ROOT)
# Search for OpenEXRConfig.cmake
find_package(OpenEXR ${OpenEXR_FIND_VERSION} CONFIG QUIET)
endif()
if(OpenEXR_FOUND)
get_target_property(OpenEXR_LIBRARY OpenEXR::OpenEXR LOCATION)
get_target_property(OpenEXR_INCLUDE_DIR OpenEXR::OpenEXR INTERFACE_INCLUDE_DIRECTORIES)
# IMPORTED_GLOBAL property must be set to TRUE since alisasing a non-global imported target
# is not possible until CMake 3.18+.
set_target_properties(OpenEXR::OpenEXR PROPERTIES IMPORTED_GLOBAL TRUE)
endif()
# Override REQUIRED if package can be installed
if(OCIO_INSTALL_EXT_PACKAGES STREQUAL MISSING)
set(OpenEXR_FIND_REQUIRED FALSE)
endif()
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(OpenEXR
REQUIRED_VARS
${_OpenEXR_REQUIRED_VARS}
VERSION_VAR
OpenEXR_VERSION
)
endif()
###############################################################################
### Create target
@@ -44,17 +85,19 @@ if(NOT OpenEXR_FOUND AND OCIO_INSTALL_EXT_PACKAGES AND NOT OCIO_INSTALL_EXT_PACK
include(ExternalProject)
include(GNUInstallDirs)
set(_EXT_DIST_ROOT "${PROJECT_BINARY_DIR}/ext/dist")
set(_EXT_BUILD_ROOT "${PROJECT_BINARY_DIR}/ext/build")
set(_EXT_DIST_ROOT "${CMAKE_BINARY_DIR}/ext/dist")
set(_EXT_BUILD_ROOT "${CMAKE_BINARY_DIR}/ext/build")
# Required dependency
# Not trying to find ZLIB here since it is a required dependency of OCIO.
if(NOT ZLIB_FOUND)
message(STATUS "ZLIB is required to build OpenEXR.")
return()
find_package(ZLIB)
if(NOT ZLIB_FOUND)
message(STATUS "ZLib is required to build OpenEXR.")
return()
endif()
endif()
ocio_handle_dependency(Threads)
find_package(Threads)
if(NOT Threads_FOUND)
message(STATUS "Threads is required to build OpenEXR.")
return()
@@ -62,8 +105,8 @@ if(NOT OpenEXR_FOUND AND OCIO_INSTALL_EXT_PACKAGES AND NOT OCIO_INSTALL_EXT_PACK
# Set find_package standard args
set(OpenEXR_FOUND TRUE)
if(OCIO_OpenEXR_RECOMMENDED_VERSION)
set(OpenEXR_VERSION ${OCIO_OpenEXR_RECOMMENDED_VERSION})
if(_OpenEXR_ExternalProject_VERSION)
set(OpenEXR_VERSION ${_OpenEXR_ExternalProject_VERSION})
else()
set(OpenEXR_VERSION ${OpenEXR_FIND_VERSION})
endif()
@@ -75,9 +118,9 @@ if(NOT OpenEXR_FOUND AND OCIO_INSTALL_EXT_PACKAGES AND NOT OCIO_INSTALL_EXT_PACK
endif()
include(VersionUtils)
split_version_string(${OpenEXR_VERSION} _OpenEXR)
split_version_string(${OpenEXR_VERSION} _OpenEXR_ExternalProject)
set(_OpenEXR_LIB_VER "${_OpenEXR_VERSION_MAJOR}_${_OpenEXR_VERSION_MINOR}")
set(_OpenEXR_LIB_VER "${_OpenEXR_ExternalProject_VERSION_MAJOR}_${_OpenEXR_ExternalProject_VERSION_MINOR}")
set_target_location(Iex)
set_target_location(IlmThread)
@@ -160,8 +203,7 @@ if(NOT OpenEXR_FOUND AND OCIO_INSTALL_EXT_PACKAGES AND NOT OCIO_INSTALL_EXT_PACK
${CMAKE_COMMAND} --build .
--config ${CMAKE_BUILD_TYPE}
--target install
# Prevent some CI jobs to fail when building.
# --parallel
--parallel
)
# Additional targets. ALIAS to UNKNOWN imported target is only possible
@@ -177,9 +219,7 @@ if(NOT OpenEXR_FOUND AND OCIO_INSTALL_EXT_PACKAGES AND NOT OCIO_INSTALL_EXT_PACK
add_dependencies(OpenEXR::OpenEXR openexr_install)
if(OCIO_VERBOSE)
message(STATUS "Installing OpenEXR: ${OpenEXR_LIBRARY} (version \"${OpenEXR_VERSION}\")")
endif()
message(STATUS "Installing OpenEXR: ${OpenEXR_LIBRARY} (version \"${OpenEXR_VERSION}\")")
endif()
endif()
@@ -201,7 +241,6 @@ if(_OpenEXR_TARGET_CREATE)
IMPORTED_LOCATION ${IlmThread_LIBRARY}
INTERFACE_INCLUDE_DIRECTORIES "${OpenEXR_INCLUDE_DIR}"
INTERFACE_LINK_LIBRARIES "OpenEXR::IlmThreadConfig;OpenEXR::IlmThreadConfig;OpenEXR::Iex;Threads::Threads"
STATIC_LIBRARY_OPTIONS "-no_warning_for_no_symbols"
)
set_target_properties(OpenEXR::IlmThreadConfig PROPERTIES
INTERFACE_INCLUDE_DIRECTORIES "${OpenEXR_INCLUDE_DIR};${OpenEXR_INCLUDE_DIR}/OpenEXR"
@@ -218,7 +257,6 @@ if(_OpenEXR_TARGET_CREATE)
IMPORTED_LOCATION ${OpenEXRCore_LIBRARY}
INTERFACE_INCLUDE_DIRECTORIES "${OpenEXR_INCLUDE_DIR}"
INTERFACE_LINK_LIBRARIES "OpenEXR::IlmThreadConfig;ZLIB::ZLIB;\$<LINK_ONLY:Imath::ImathConfig>"
STATIC_LIBRARY_OPTIONS "-no_warning_for_no_symbols"
)
set_target_properties(OpenEXR::OpenEXRUtil PROPERTIES
IMPORTED_LOCATION ${OpenEXRUtil_LIBRARY}
+174
View File
@@ -0,0 +1,174 @@
###########################################################################
# OpenImageIO https://www.openimageio.org
# Copyright 2008-present Contributors to the OpenImageIO project.
# SPDX-License-Identifier: BSD-3-Clause
# https://github.com/OpenImageIO/oiio/blob/master/LICENSE.md
#
# For an up-to-date version of this file, see:
# https://github.com/OpenImageIO/oiio/blob/master/src/cmake/Modules/FindOpenImageIO.cmake
#
###########################################################################
#
# CMake module to find OpenImageIO
#
# This module will set
# OpenImageIO_FOUND True, if found
# OPENIMAGEIO_INCLUDES directory where headers are found
# OPENIMAGEIO_LIBRARIES libraries for OIIO
# OPENIMAGEIO_LIBRARY_DIRS library dirs for OIIO
# OPENIMAGEIO_VERSION Version ("major.minor.patch.tweak")
# OPENIMAGEIO_VERSION_MAJOR Version major number
# OPENIMAGEIO_VERSION_MINOR Version minor number
# OPENIMAGEIO_VERSION_PATCH Version minor patch
# OPENIMAGEIO_VERSION_TWEAK Version minor tweak
#
# Imported targets:
# OpenImageIO::OpenImageIO The libOpenImageIO library.
# OpenImageIO::oiiotool The oiiotool executable.
#
# Special inputs:
# OpenImageIO_ROOT - if using CMake >= 3.12, will automatically search
# this area for OIIO components.
# OPENIMAGEIO_ROOT_DIR - custom "prefix" location of OIIO installation
# (expecting bin, lib, include subdirectories)
# This is deprecated, but will work for a while.
# OpenImageIO_FIND_QUIETLY - if set, print minimal console output
# OIIO_LIBNAME_SUFFIX - if set, optional nonstandard library suffix
#
###########################################################################
#
# NOTE: This file is deprecated.
#
# In OIIO 2.1+, we generate OpenImageIOConfig.cmake files that are now the
# preferred way for downstream projecs to find an installed OIIO. There
# should be no need to copy this FindOpenImageIO.cmake file into downstream
# projects, *unless* they need to work with a range of OIIO vesions that
# may include <2.1, which would lack the generated config files.
#
###########################################################################
# If 'OPENIMAGE_HOME' not set, use the env variable of that name if available
if (NOT OPENIMAGEIO_ROOT_DIR AND NOT $ENV{OPENIMAGEIO_ROOT_DIR} STREQUAL "")
set (OPENIMAGEIO_ROOT_DIR $ENV{OPENIMAGEIO_ROOT_DIR})
endif ()
find_library (OPENIMAGEIO_LIBRARY
NAMES
OpenImageIO${OIIO_LIBNAME_SUFFIX}
HINTS
${OPENIMAGEIO_ROOT_DIR}
PATH_SUFFIXES
lib64
lib
OpenImageIO/lib
)
find_library (OPENIMAGEIO_UTIL_LIBRARY
NAMES
OpenImageIO_Util${OIIO_LIBNAME_SUFFIX}
HINTS
${OPENIMAGEIO_ROOT_DIR}
PATH_SUFFIXES
lib64
lib
OpenImageIO/lib
)
find_path (OPENIMAGEIO_INCLUDE_DIR
NAMES
OpenImageIO/imageio.h
HINTS
${OPENIMAGEIO_ROOT_DIR}
PATH_SUFFIXES
OpenImageIO/include
)
find_program (OIIOTOOL_BIN
NAMES
oiiotool
HINTS
${OPENIMAGEIO_ROOT_DIR}
PATH_SUFFIXES
OpenImageIO/bin
)
# Try to figure out version number
set (OIIO_VERSION_HEADER "${OPENIMAGEIO_INCLUDE_DIR}/OpenImageIO/oiioversion.h")
if (EXISTS "${OIIO_VERSION_HEADER}")
file (STRINGS "${OIIO_VERSION_HEADER}" TMP REGEX "^#define OIIO_VERSION_MAJOR .*$")
string (REGEX MATCHALL "[0-9]+" OPENIMAGEIO_VERSION_MAJOR ${TMP})
file (STRINGS "${OIIO_VERSION_HEADER}" TMP REGEX "^#define OIIO_VERSION_MINOR .*$")
string (REGEX MATCHALL "[0-9]+" OPENIMAGEIO_VERSION_MINOR ${TMP})
file (STRINGS "${OIIO_VERSION_HEADER}" TMP REGEX "^#define OIIO_VERSION_PATCH .*$")
string (REGEX MATCHALL "[0-9]+" OPENIMAGEIO_VERSION_PATCH ${TMP})
file (STRINGS "${OIIO_VERSION_HEADER}" TMP REGEX "^#define OIIO_VERSION_TWEAK .*$")
if (TMP)
string (REGEX MATCHALL "[0-9]+" OPENIMAGEIO_VERSION_TWEAK ${TMP})
else ()
set (OPENIMAGEIO_VERSION_TWEAK 0)
endif ()
set (OPENIMAGEIO_VERSION "${OPENIMAGEIO_VERSION_MAJOR}.${OPENIMAGEIO_VERSION_MINOR}.${OPENIMAGEIO_VERSION_PATCH}.${OPENIMAGEIO_VERSION_TWEAK}")
endif ()
set (OIIO_IMATH_HEADER "${OPENIMAGEIO_INCLUDE_DIR}/OpenImageIO/Imath.h")
if (EXISTS "${OIIO_IMATH_HEADER}")
file (STRINGS "${OIIO_IMATH_HEADER}" TMP REGEX "^#define OIIO_USING_IMATH .*$")
string (REGEX MATCHALL "[0-9]" OIIO_IMATH_VERSION ${TMP})
if (OIIO_IMATH_VERSION LESS 3)
message(STATUS "Skipping OpenImageIO built against OpenEXR 2, please use version 3 or greater.")
return ()
endif ()
endif ()
include (FindPackageHandleStandardArgs)
find_package_handle_standard_args (
OpenImageIO
FOUND_VAR
OpenImageIO_FOUND
REQUIRED_VARS
OPENIMAGEIO_INCLUDE_DIR
OPENIMAGEIO_LIBRARY
OPENIMAGEIO_VERSION
VERSION_VAR
OPENIMAGEIO_VERSION
)
set (OPENIMAGEIO_FOUND ${OpenImageIO_FOUND}) # Old name
if (OpenImageIO_FOUND)
set (OPENIMAGEIO_INCLUDES ${OPENIMAGEIO_INCLUDE_DIR})
set (OPENIMAGEIO_LIBRARIES ${OPENIMAGEIO_LIBRARY})
get_filename_component (OPENIMAGEIO_LIBRARY_DIRS "${OPENIMAGEIO_LIBRARY}" DIRECTORY)
if (NOT OpenImageIO_FIND_QUIETLY)
message ( STATUS "OpenImageIO includes = ${OPENIMAGEIO_INCLUDE_DIR}" )
message ( STATUS "OpenImageIO libraries = ${OPENIMAGEIO_LIBRARIES}" )
message ( STATUS "OpenImageIO library_dirs = ${OPENIMAGEIO_LIBRARY_DIRS}" )
endif ()
if (NOT TARGET OpenImageIO::OpenImageIO)
add_library(OpenImageIO::OpenImageIO UNKNOWN IMPORTED)
set_target_properties(OpenImageIO::OpenImageIO PROPERTIES
INTERFACE_INCLUDE_DIRECTORIES "${OPENIMAGEIO_INCLUDES}")
set_property(TARGET OpenImageIO::OpenImageIO APPEND PROPERTY
IMPORTED_LOCATION "${OPENIMAGEIO_LIBRARIES}")
endif ()
# Starting with OIIO v2.3, some utility classes are now only declared in OpenImageIO_Util
# (and not in both libraries like in older versions).
if (${OPENIMAGEIO_VERSION} VERSION_GREATER_EQUAL "2.3" AND NOT TARGET OpenImageIO::OpenImageIO_Util)
add_library(OpenImageIO::OpenImageIO_Util UNKNOWN IMPORTED)
set_target_properties(OpenImageIO::OpenImageIO_Util PROPERTIES
IMPORTED_LOCATION "${OPENIMAGEIO_UTIL_LIBRARY}")
target_link_libraries(OpenImageIO::OpenImageIO INTERFACE OpenImageIO::OpenImageIO_Util)
endif ()
# Starting with OIIO v2.3, OIIO needs to compile at least in C++14.
if (${OPENIMAGEIO_VERSION} VERSION_GREATER_EQUAL "2.3" AND ${CMAKE_CXX_STANDARD} LESS_EQUAL 11)
set(OpenImageIO_FOUND OFF)
message(WARNING "Need C++14 or higher to compile with OpenImageIO ${OPENIMAGEIO_VERSION}.")
endif ()
endif ()
mark_as_advanced (
OPENIMAGEIO_INCLUDE_DIR
OPENIMAGEIO_LIBRARY
)
@@ -1,54 +1,51 @@
# SPDX-License-Identifier: BSD-3-Clause
# Copyright Contributors to the OpenColorIO Project.
#
# Locate OpenShadingLanguage (OSL)
# Locate or install OpenShadingLanguage (OSL)
#
# Variables defined by this module:
# OSL_FOUND - Indicate whether the library was found or not
# OSL_LIB_DIR - Location of the libary files
# OSL_INCLUDE_DIR - Location of the header files
# OSL_VERSION - Library's version
# OSL_SHADERS_INCLUDE_DIR - Location of the shader's header files
# OSL_SHADERS_DIR - Used for OSL unit tests
#
# These variables are set only when OSL_ROOT is provided:
# oslcomp_LIBRARY - Path to the library file
# oslexec_LIBRARY - Path to the library file
#
# Global targets defined by this module:
# osl::osl
#
# Usually CMake will use the dynamic library rather than static, if both are present.
#
# If the library is not installed in a typical location where CMake will find it, you may specify
# the location using one of the following methods:
# -- Set -DOpenShadingLanguage_DIR to point to the directory containing the CMake configuration file for the package.
# -- Set -DOpenShadingLanguage_ROOT to point to the directory containing the lib and include directories.
# If the library is not installed in a standard path, you can use the OSL_ROOT
# variable to tell CMake where to find it.
#
if(NOT TARGET osl::osl)
add_library(osl::osl INTERFACE IMPORTED GLOBAL)
set(OSL_FOUND OFF)
endif()
###############################################################################
### Try to find package ###
if(NOT DEFINED OSL_ROOT)
find_package(OSL ${OSL_FIND_VERSION} CONFIG QUIET)
find_package(OSL ${OpenShadingLanguage_FIND_VERSION} CONFIG)
set(OpenShadingLanguage_VERSION ${OSL_VERSION})
# TODO: No variable to have the share directory?
set(OSL_SHADERS_INCLUDE_DIR ${OSL_INCLUDE_DIR}/../share)
# Variable used by the OSL unit tests.
set(OSL_SHADERS_DIR ${OSL_SHADERS_INCLUDE_DIR}/OSL/shaders)
include (FindPackageHandleStandardArgs)
find_package_handle_standard_args (OSL
REQUIRED_VARS
OSL_INCLUDE_DIR
OSL_LIB_DIR
VERSION_VAR
OSL_VERSION
find_package_handle_standard_args (OpenShadingLanguage
FOUND_VAR OpenShadingLanguage_FOUND
REQUIRED_VARS OSL_INCLUDE_DIR OSL_LIB_DIR OpenShadingLanguage_VERSION
VERSION_VAR OpenShadingLanguage_VERSION
)
set(OSL_FOUND ${OpenShadingLanguage_FOUND})
else()
set(OSL_INCLUDE_DIR ${OSL_ROOT}/include)
set(OSL_VERSION_HEADER "${OSL_INCLUDE_DIR}/OSL/oslversion.h")
if(EXISTS "${OSL_VERSION_HEADER}")
# Try to figure out version number
file (STRINGS "${OSL_VERSION_HEADER}" TMP REGEX "^#define OSL_LIBRARY_VERSION_MAJOR .*$")
string (REGEX MATCHALL "[0-9]+" OSL_VERSION_MAJOR ${TMP})
@@ -57,14 +54,12 @@ else()
file (STRINGS "${OSL_VERSION_HEADER}" TMP REGEX "^#define OSL_LIBRARY_VERSION_PATCH .*$")
string (REGEX MATCHALL "[0-9]+" OSL_VERSION_PATCH ${TMP})
file (STRINGS "${OSL_VERSION_HEADER}" TMP REGEX "^#define OSL_LIBRARY_VERSION_TWEAK .*$")
if (TMP)
string (REGEX MATCHALL "[0-9]+" OSL_VERSION_TWEAK ${TMP})
else ()
set (OSL_VERSION_TWEAK 0)
endif ()
set (OSL_VERSION "${OSL_VERSION_MAJOR}.${OSL_VERSION_MINOR}.${OSL_VERSION_PATCH}.${OSL_VERSION_TWEAK}")
set (OpenShadingLanguage_VERSION "${OSL_VERSION_MAJOR}.${OSL_VERSION_MINOR}.${OSL_VERSION_PATCH}.${OSL_VERSION_TWEAK}")
# Find the oslcomp library.
find_library(oslcomp_LIBRARY
@@ -97,41 +92,58 @@ else()
)
set(OSL_SHADERS_INCLUDE_DIR ${OSL_ROOT}/share)
# Variable used by the OSL unit tests.
set(OSL_SHADERS_DIR ${OSL_SHADERS_INCLUDE_DIR}/OSL/shaders)
if(EXISTS "${OSL_SHADERS_DIR}")
# Variable used by the OSL unit tests.
set(OSL_FOUND ON)
endif()
endif()
include (FindPackageHandleStandardArgs)
find_package_handle_standard_args (OSL
REQUIRED_VARS
OSL_INCLUDE_DIR
OSL_SHADERS_DIR
oslcomp_LIBRARY
oslexec_LIBRARY
VERSION_VAR
OSL_VERSION
find_package_handle_standard_args (OpenShadingLanguage
FOUND_VAR OpenShadingLanguage_FOUND
REQUIRED_VARS OSL_INCLUDE_DIR oslcomp_LIBRARY oslexec_LIBRARY OpenShadingLanguage_VERSION
VERSION_VAR OpenShadingLanguage_VERSION
)
set(OSL_FOUND ${OpenShadingLanguage_FOUND})
endif()
###############################################################################
### Create target
### Check the C++ version ###
if(NOT TARGET osl::osl)
add_library(osl::osl INTERFACE IMPORTED GLOBAL)
# TODO: Which version starts to impose C++14?
if(${CMAKE_CXX_STANDARD} LESS_EQUAL 11)
set(OSL_FOUND OFF)
message(WARNING "Need C++14 or higher to compile OpenShadingLanguage. Skipping build of the OSL unit tests")
endif()
###############################################################################
### Configure target ###
if(OSL_FOUND)
if (NOT OSL_FIND_QUIETLY)
message(STATUS "OpenShadingLanguage includes = ${OSL_INCLUDE_DIR}")
message(STATUS "OpenShadingLanguage shaders = ${OSL_SHADERS_DIR}")
message(STATUS "OpenShadingLanguage library dir = ${OSL_LIB_DIR}")
endif ()
list(APPEND LIB_INCLUDE_DIRS ${OSL_INCLUDE_DIR})
list(APPEND LIB_INCLUDE_DIRS ${OSL_SHADERS_INCLUDE_DIR})
target_include_directories(osl::osl INTERFACE "${LIB_INCLUDE_DIRS}")
target_link_libraries(osl::osl INTERFACE OSL::oslcomp OSL::oslexec)
# C++14 is required for OSL 1.12+
if (${OSL_VERSION} VERSION_GREATER_EQUAL "1.12" AND ${CMAKE_CXX_STANDARD} LESS_EQUAL 11)
if (${OpenShadingLanguage_VERSION} VERSION_GREATER_EQUAL "1.12" AND ${CMAKE_CXX_STANDARD} LESS_EQUAL 11)
set(OSL_FOUND OFF)
message(WARNING "Need C++14 or higher to compile OpenShadingLanguage. Skipping build the OSL unit tests")
endif()
@@ -140,4 +152,5 @@ if(OSL_FOUND)
oslcomp_LIBRARY oslcomp_FOUND
oslexec_LIBRARY oslexec_FOUND
)
endif()
+6 -6
View File
@@ -4,14 +4,14 @@
# Locate Sphinx (Python documentation generator)
#
# Variables defined by this module:
# Sphinx_FOUND - Indicate whether the executable was found or not
# Sphinx_EXECUTABLE - Path to the executable file
# Sphinx_FOUND
# Sphinx_EXECUTABLE (CACHE)
#
# Usage:
# find_package(Sphinx)
#
# If the executable is not installed in a typical location where CMake will find it, you may specify
# the location using one of the following methods:
# -- Set -DSphinx_ROOT to point to the directory containing the executable.
# -- Set -DSphinx_EXECUTABLE to point to executable file.
# If Sphinx is not installed in a standard path, add it to the Sphinx_ROOT
# variable to tell CMake where to find it.
#
find_package(Python QUIET COMPONENTS Interpreter)
+132 -18
View File
@@ -1,27 +1,25 @@
# SPDX-License-Identifier: BSD-3-Clause
# Copyright Contributors to the OpenColorIO Project.
#
# Locate expat
# Locate or install expat
#
# Variables defined by this module:
# expat_FOUND - Indicate whether the library was found or not
# expat_LIBRARY - Path to the library file
# expat_INCLUDE_DIR - Location of the header files
# expat_VERSION - Library's version
# expat_FOUND - If FALSE, do not try to link to expat
# expat_LIBRARY - expat library to link to
# expat_INCLUDE_DIR - Where to find expat.h
# expat_VERSION - The version of the library
#
# Global targets defined by this module:
# expat::expat
# Targets defined by this module:
# expat::expat - IMPORTED target, if found
#
# Usually CMake will use the dynamic library rather than static, if both are present.
# In this case, you may set expat_STATIC_LIBRARY to ON to request use of the static one.
# If only the static library is present (such as when OCIO builds the dependency), then the option
# is not needed.
# By default, the dynamic libraries of expat will be found. To find the static
# ones instead, you must set the expat_STATIC_LIBRARY variable to TRUE
# before calling find_package(expat ...).
#
# If the library is not installed in a typical location where CMake will find it, you may specify
# the location using one of the following methods:
# -- Set -Dexpat_DIR to point to the directory containing the CMake configuration file for the package.
# -- Set -Dexpat_ROOT to point to the directory containing the lib and include directories.
# -- Set -Dexpat_LIBRARY and -Dexpat_INCLUDE_DIR to point to the lib and include directories.
# If expat is not installed in a standard path, you can use the expat_ROOT
# variable to tell CMake where to find it. If it is not found and
# OCIO_INSTALL_EXT_PACKAGES is set to MISSING or ALL, expat will be downloaded,
# built, and statically-linked into libOpenColorIO at build time.
#
###############################################################################
@@ -98,6 +96,7 @@ if(NOT OCIO_INSTALL_EXT_PACKAGES STREQUAL ALL)
expat/include
)
# Expat uses prefix "lib" on all platform by default.
# Library name doesn't change in debug.
@@ -201,11 +200,126 @@ endif()
###############################################################################
### Create target
if(expat_FOUND AND NOT TARGET expat::expat)
if(NOT TARGET expat::expat)
add_library(expat::expat UNKNOWN IMPORTED GLOBAL)
set(_expat_TARGET_CREATE TRUE)
endif()
###############################################################################
### Install package from source ###
if(NOT expat_FOUND AND OCIO_INSTALL_EXT_PACKAGES AND NOT OCIO_INSTALL_EXT_PACKAGES STREQUAL NONE)
include(ExternalProject)
include(GNUInstallDirs)
set(_EXT_DIST_ROOT "${CMAKE_BINARY_DIR}/ext/dist")
set(_EXT_BUILD_ROOT "${CMAKE_BINARY_DIR}/ext/build")
# Set find_package standard args
set(expat_FOUND TRUE)
set(expat_VERSION ${expat_FIND_VERSION})
set(expat_INCLUDE_DIR "${_EXT_DIST_ROOT}/${CMAKE_INSTALL_INCLUDEDIR}")
# Set the expected library name
if(WIN32)
if(BUILD_TYPE_DEBUG)
set(_expat_LIB_SUFFIX "d")
endif()
# Static Linking, Multi-threaded Dll naming (>=2.2.8):
# https://github.com/libexpat/libexpat/blob/R_2_2_8/expat/win32/README.txt
set(_expat_LIB_SUFFIX "${_expat_LIB_SUFFIX}MD")
endif()
# Expat use a hardcoded lib prefix instead of CMAKE_STATIC_LIBRARY_PREFIX
# https://github.com/libexpat/libexpat/blob/R_2_4_1/expat/CMakeLists.txt#L374
set(_expat_LIB_PREFIX "lib")
set(expat_LIBRARY
"${_EXT_DIST_ROOT}/${CMAKE_INSTALL_LIBDIR}/${_expat_LIB_PREFIX}expat${_expat_LIB_SUFFIX}${CMAKE_STATIC_LIBRARY_SUFFIX}")
if(_expat_TARGET_CREATE)
if(MSVC)
set(EXPAT_C_FLAGS "${EXPAT_C_FLAGS} /EHsc")
set(EXPAT_CXX_FLAGS "${EXPAT_CXX_FLAGS} /EHsc")
endif()
string(STRIP "${EXPAT_C_FLAGS}" EXPAT_C_FLAGS)
string(STRIP "${EXPAT_CXX_FLAGS}" EXPAT_CXX_FLAGS)
set(EXPAT_CMAKE_ARGS
${EXPAT_CMAKE_ARGS}
-DCMAKE_POLICY_DEFAULT_CMP0063=NEW
-DCMAKE_C_VISIBILITY_PRESET=${CMAKE_C_VISIBILITY_PRESET}
-DCMAKE_CXX_VISIBILITY_PRESET=${CMAKE_CXX_VISIBILITY_PRESET}
-DCMAKE_VISIBILITY_INLINES_HIDDEN=${CMAKE_VISIBILITY_INLINES_HIDDEN}
-DCMAKE_POSITION_INDEPENDENT_CODE=ON
-DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE}
-DCMAKE_C_FLAGS=${EXPAT_C_FLAGS}
-DCMAKE_CXX_FLAGS=${EXPAT_CXX_FLAGS}
-DCMAKE_CXX_STANDARD=${CMAKE_CXX_STANDARD}
-DCMAKE_INSTALL_MESSAGE=${CMAKE_INSTALL_MESSAGE}
-DCMAKE_INSTALL_PREFIX=${_EXT_DIST_ROOT}
-DCMAKE_INSTALL_BINDIR=${CMAKE_INSTALL_BINDIR}
-DCMAKE_INSTALL_DATADIR=${CMAKE_INSTALL_DATADIR}
-DCMAKE_INSTALL_LIBDIR=${CMAKE_INSTALL_LIBDIR}
-DCMAKE_INSTALL_INCLUDEDIR=${CMAKE_INSTALL_INCLUDEDIR}
-DCMAKE_OBJECT_PATH_MAX=${CMAKE_OBJECT_PATH_MAX}
-DEXPAT_BUILD_DOCS=OFF
-DEXPAT_BUILD_EXAMPLES=OFF
-DEXPAT_BUILD_TESTS=OFF
-DEXPAT_BUILD_TOOLS=OFF
-DEXPAT_SHARED_LIBS=OFF
)
if(CMAKE_TOOLCHAIN_FILE)
set(EXPAT_CMAKE_ARGS
${EXPAT_CMAKE_ARGS} -DCMAKE_TOOLCHAIN_FILE=${CMAKE_TOOLCHAIN_FILE})
endif()
if(APPLE)
string(REPLACE ";" "$<SEMICOLON>" ESCAPED_CMAKE_OSX_ARCHITECTURES "${CMAKE_OSX_ARCHITECTURES}")
set(EXPAT_CMAKE_ARGS
${EXPAT_CMAKE_ARGS}
-DCMAKE_OSX_DEPLOYMENT_TARGET=${CMAKE_OSX_DEPLOYMENT_TARGET}
-DCMAKE_OSX_ARCHITECTURES=${ESCAPED_CMAKE_OSX_ARCHITECTURES}
)
endif()
if (ANDROID)
set(EXPAT_CMAKE_ARGS
${EXPAT_CMAKE_ARGS}
-DANDROID_PLATFORM=${ANDROID_PLATFORM}
-DANDROID_ABI=${ANDROID_ABI}
-DANDROID_STL=${ANDROID_STL})
endif()
# Hack to let imported target be built from ExternalProject_Add
file(MAKE_DIRECTORY ${expat_INCLUDE_DIR})
ExternalProject_Add(expat_install
GIT_REPOSITORY "https://github.com/libexpat/libexpat.git"
GIT_TAG "R_${expat_FIND_VERSION_MAJOR}_${expat_FIND_VERSION_MINOR}_${expat_FIND_VERSION_PATCH}"
GIT_CONFIG advice.detachedHead=false
GIT_SHALLOW TRUE
PREFIX "${_EXT_BUILD_ROOT}/libexpat"
BUILD_BYPRODUCTS ${expat_LIBRARY}
SOURCE_SUBDIR expat
CMAKE_ARGS ${EXPAT_CMAKE_ARGS}
EXCLUDE_FROM_ALL TRUE
BUILD_COMMAND ""
INSTALL_COMMAND
${CMAKE_COMMAND} --build .
--config ${CMAKE_BUILD_TYPE}
--target install
--parallel
)
add_dependencies(expat::expat expat_install)
message(STATUS "Installing expat: ${expat_LIBRARY} (version \"${expat_VERSION}\")")
endif()
endif()
###############################################################################
### Configure target ###
@@ -216,4 +330,4 @@ if(_expat_TARGET_CREATE)
)
mark_as_advanced(expat_INCLUDE_DIR expat_LIBRARY expat_VERSION)
endif()
endif()
+111 -14
View File
@@ -1,7 +1,7 @@
# SPDX-License-Identifier: BSD-3-Clause
# Copyright Contributors to the OpenColorIO Project.
#
# Locate lcms2
# Locate or install lcms2
#
# Variables defined by this module:
# lcms2_FOUND - If FALSE, do not try to link to lcms
@@ -9,20 +9,24 @@
# lcms2_INCLUDE_DIR - Where to find lcms2.h
# lcms2_VERSION - The version of the library
#
# Global targets defined by this module:
# Targets defined by this module:
# lcms2::lcms2 - IMPORTED target, if found
#
# Usually CMake will use the dynamic library rather than static, if both are present.
# In this case, you may set lcms2_STATIC_LIBRARY to ON to request use of the static one.
# If only the static library is present (such as when OCIO builds the dependency), then the option
# is not needed.
# By default, the dynamic libraries of lcms2 will be found. To find the static
# ones instead, you must set the lcms2_STATIC_LIBRARY variable to TRUE
# before calling find_package(lcms2 ...).
#
# If the library is not installed in a typical location where CMake will find it, you may specify
# the location using one of the following methods:
# -- Set -Dlcms2_ROOT to point to the directory containing the lib and include directories.
# -- Set -Dlcms2_LIBRARY and -Dlcms2_INCLUDE_DIR to point to the lib and include directories.
# If lcms2 is not installed in a standard path, you can use the lcms2_ROOT
# variable to tell CMake where to find it. If it is not found and
# OCIO_INSTALL_EXT_PACKAGES is set to MISSING or ALL, lcms2 will be
# downloaded, built, and statically-linked into libOpenColorIO at build time.
#
if(NOT TARGET lcms2::lcms2)
add_library(lcms2::lcms2 UNKNOWN IMPORTED GLOBAL)
set(_lcms2_TARGET_CREATE TRUE)
endif()
###############################################################################
### Try to find package ###
@@ -91,11 +95,104 @@ if(NOT OCIO_INSTALL_EXT_PACKAGES STREQUAL ALL)
endif()
###############################################################################
### Configure target ###
### Install package from source ###
if(lcms2_FOUND AND NOT TARGET lcms2::lcms2)
add_library(lcms2::lcms2 UNKNOWN IMPORTED GLOBAL)
set(_lcms2_TARGET_CREATE TRUE)
if(NOT lcms2_FOUND AND OCIO_INSTALL_EXT_PACKAGES AND NOT OCIO_INSTALL_EXT_PACKAGES STREQUAL NONE)
include(ExternalProject)
set(_EXT_DIST_ROOT "${CMAKE_BINARY_DIR}/ext/dist")
set(_EXT_BUILD_ROOT "${CMAKE_BINARY_DIR}/ext/build")
# Set find_package standard args
set(lcms2_FOUND TRUE)
set(lcms2_VERSION ${lcms2_FIND_VERSION})
set(lcms2_INCLUDE_DIR "${_EXT_DIST_ROOT}/${CMAKE_INSTALL_INCLUDEDIR}/lcms2")
set(lcms2_LIBRARY
"${_EXT_DIST_ROOT}/${CMAKE_INSTALL_LIBDIR}/${CMAKE_STATIC_LIBRARY_PREFIX}lcms2${CMAKE_STATIC_LIBRARY_SUFFIX}")
if(_lcms2_TARGET_CREATE)
if(UNIX)
set(lcms2_C_FLAGS "${lcms2_C_FLAGS} -fvisibility=hidden -fPIC")
endif()
if("${CMAKE_CXX_COMPILER_ID}" MATCHES "GNU")
set(lcms2_C_FLAGS "${lcms2_C_FLAGS} -Wno-aggressive-loop-optimizations")
endif()
string(STRIP "${lcms2_C_FLAGS}" lcms2_C_FLAGS)
# NOTE: Depending of the compiler version lcm2 2.2 does not compile with C++17 so revert
# to C++11 because the library is only used by a cmd line tool.
set(lcms2_CXX_STANDARD ${CMAKE_CXX_STANDARD})
if(${CMAKE_CXX_STANDARD} GREATER_EQUAL 17)
set(lcms2_CXX_STANDARD 11)
endif()
set(lcms2_CMAKE_ARGS
${lcms2_CMAKE_ARGS}
-DCMAKE_C_FLAGS=${lcms2_C_FLAGS}
-DCMAKE_CXX_STANDARD=${lcms2_CXX_STANDARD}
-DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE}
-DCMAKE_INSTALL_MESSAGE=${CMAKE_INSTALL_MESSAGE}
-DCMAKE_INSTALL_PREFIX=${_EXT_DIST_ROOT}
-DCMAKE_INSTALL_BINDIR=${CMAKE_INSTALL_BINDIR}
-DCMAKE_INSTALL_LIBDIR=${CMAKE_INSTALL_LIBDIR}
-DCMAKE_INSTALL_INCLUDEDIR=${CMAKE_INSTALL_INCLUDEDIR}
-DCMAKE_OBJECT_PATH_MAX=${CMAKE_OBJECT_PATH_MAX}
-DBUILD_SHARED_LIBS=OFF
)
if(CMAKE_TOOLCHAIN_FILE)
set(lcms2_CMAKE_ARGS
${lcms2_CMAKE_ARGS} -DCMAKE_TOOLCHAIN_FILE=${CMAKE_TOOLCHAIN_FILE})
endif()
if(APPLE)
string(REPLACE ";" "$<SEMICOLON>" ESCAPED_CMAKE_OSX_ARCHITECTURES "${CMAKE_OSX_ARCHITECTURES}")
set(lcms2_CMAKE_ARGS
${lcms2_CMAKE_ARGS}
-DCMAKE_OSX_DEPLOYMENT_TARGET=${CMAKE_OSX_DEPLOYMENT_TARGET}
-DCMAKE_OSX_ARCHITECTURES=${ESCAPED_CMAKE_OSX_ARCHITECTURES}
)
endif()
if (ANDROID)
set(lcms2_CMAKE_ARGS
${lcms2_CMAKE_ARGS}
-DANDROID_PLATFORM=${ANDROID_PLATFORM}
-DANDROID_ABI=${ANDROID_ABI}
-DANDROID_STL=${ANDROID_STL})
endif()
# Hack to let imported target be built from ExternalProject_Add
file(MAKE_DIRECTORY ${lcms2_INCLUDE_DIR})
ExternalProject_Add(lcms2_install
GIT_REPOSITORY "https://github.com/mm2/Little-CMS.git"
GIT_TAG "lcms${lcms2_VERSION}"
GIT_CONFIG advice.detachedHead=false
GIT_SHALLOW TRUE
PREFIX "${_EXT_BUILD_ROOT}/Little-CMS"
BUILD_BYPRODUCTS ${lcms2_LIBRARY}
CMAKE_ARGS ${lcms2_CMAKE_ARGS}
EXCLUDE_FROM_ALL TRUE
PATCH_COMMAND
${CMAKE_COMMAND} -E copy
"${CMAKE_SOURCE_DIR}/share/cmake/projects/Buildlcms2.cmake"
"CMakeLists.txt"
BUILD_COMMAND ""
INSTALL_COMMAND
${CMAKE_COMMAND} --build .
--config ${CMAKE_BUILD_TYPE}
--target install
--parallel
)
add_dependencies(lcms2::lcms2 lcms2_install)
message(STATUS "Installing lcms2: ${lcms2_LIBRARY} (version \"${lcms2_VERSION}\")")
endif()
endif()
###############################################################################
+117 -17
View File
@@ -1,7 +1,7 @@
# SPDX-License-Identifier: BSD-3-Clause
# Copyright Contributors to the OpenColorIO Project.
#
# Locate minizip-ng
# Locate or install minizip-ng
#
# Variables defined by this module:
# minizip-ng_FOUND - If FALSE, do not try to link to minizip-ng
@@ -9,20 +9,13 @@
# minizip-ng_INCLUDE_DIR - Where to find mz.h and other headers
# minizip-ng_VERSION - The version of the library
#
# Global targets defined by this module:
# Targets defined by this module:
# MINIZIP::minizip-ng - IMPORTED target, if found
#
# Usually CMake will use the dynamic library rather than static, if both are present.
# In this case, you may set minizip-ng_STATIC_LIBRARY to ON to request use of the static one.
# If only the static library is present (such as when OCIO builds the dependency), then the option
# is not needed.
#
# If the library is not installed in a typical location where CMake will find it, you may specify
# the location using one of the following methods:
# -- Set -Dminizip-ng_DIR to point to the directory containing the CMake configuration file for the package.
# -- Set -Dminizip-ng_ROOT to point to the directory containing the lib and include directories.
# -- Set -Dminizip-ng_LIBRARY and -Dminizip-ng_INCLUDE_DIR to point to the lib and include directories.
#
# If minizip-ng is not installed in a standard path, you can use the minizip-ng_ROOT
# variable to tell CMake where to find it. If it is not found and
# OCIO_INSTALL_EXT_PACKAGES is set to MISSING or ALL, minizip-ng will be downloaded,
# built, and statically-linked into libOpenColorIO at build time.
#
# For external builds of minizip-ng, please note that the same build options should be used.
# Using more options, such as enabling other compression methods, will provoke linking issue
@@ -30,7 +23,6 @@
#
# e.g. Setting MZ_BZIP2=ON will cause linking issue since OCIO will not be linked against BZIP2.
#
###############################################################################
### Try to find package ###
@@ -48,7 +40,7 @@ if(NOT OCIO_INSTALL_EXT_PACKAGES STREQUAL ALL)
# Search for minizip-ng-config.cmake
find_package(minizip-ng ${minizip-ng_FIND_VERSION} CONFIG QUIET)
endif()
if (minizip-ng_FOUND)
get_target_property(minizip-ng_INCLUDE_DIR MINIZIP::minizip-ng INTERFACE_INCLUDE_DIRECTORIES)
get_target_property(minizip-ng_LIBRARY MINIZIP::minizip-ng LOCATION)
@@ -184,12 +176,120 @@ endif()
###############################################################################
### Create target
if(minizip-ng_FOUND AND NOT TARGET MINIZIP::minizip-ng)
if(NOT TARGET MINIZIP::minizip-ng)
add_library(MINIZIP::minizip-ng UNKNOWN IMPORTED GLOBAL)
set(_minizip-ng_TARGET_CREATE TRUE)
endif()
###############################################################################
### Install package from source ###
if(NOT minizip-ng_FOUND AND OCIO_INSTALL_EXT_PACKAGES AND NOT OCIO_INSTALL_EXT_PACKAGES STREQUAL NONE)
include(ExternalProject)
include(GNUInstallDirs)
set(_EXT_DIST_ROOT "${CMAKE_BINARY_DIR}/ext/dist")
set(_EXT_BUILD_ROOT "${CMAKE_BINARY_DIR}/ext/build")
# Set find_package standard args
set(minizip-ng_FOUND TRUE)
set(minizip-ng_VERSION ${minizip-ng_FIND_VERSION})
set(minizip-ng_INCLUDE_DIR "${_EXT_DIST_ROOT}/${CMAKE_INSTALL_INCLUDEDIR}/minizip-ng")
# Minizip-ng use a hardcoded lib prefix instead of CMAKE_STATIC_LIBRARY_PREFIX
set(_minizip-ng_LIB_PREFIX "lib")
set(minizip-ng_LIBRARY
"${_EXT_DIST_ROOT}/${CMAKE_INSTALL_LIBDIR}/${_minizip-ng_LIB_PREFIX}minizip-ng${_minizip-ng_LIB_SUFFIX}${CMAKE_STATIC_LIBRARY_SUFFIX}")
if(_minizip-ng_TARGET_CREATE)
set(minizip-ng_CMAKE_ARGS
${minizip-ng_CMAKE_ARGS}
-DCMAKE_CXX_VISIBILITY_PRESET=${CMAKE_CXX_VISIBILITY_PRESET}
-DCMAKE_VISIBILITY_INLINES_HIDDEN=${CMAKE_VISIBILITY_INLINES_HIDDEN}
-DCMAKE_POSITION_INDEPENDENT_CODE=ON
-DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE}
-DCMAKE_CXX_STANDARD=${CMAKE_CXX_STANDARD}
-DCMAKE_INSTALL_MESSAGE=${CMAKE_INSTALL_MESSAGE}
-DCMAKE_INSTALL_PREFIX=${_EXT_DIST_ROOT}
-DCMAKE_INSTALL_BINDIR=${CMAKE_INSTALL_BINDIR}
-DCMAKE_INSTALL_DATADIR=${CMAKE_INSTALL_DATADIR}
-DCMAKE_INSTALL_LIBDIR=${CMAKE_INSTALL_LIBDIR}
# Since the other modules create a subfolder for the includes by default and since
# minizip-ng does not, a suffix is added to CMAKE_INSTALL_INCLUDEDIR in order to
# install the headers under a subdirectory named "minizip-ng".
# Note that this does not affect external builds for minizip-ng.
-DCMAKE_INSTALL_INCLUDEDIR=${CMAKE_INSTALL_INCLUDEDIR}/minizip-ng
-DCMAKE_OBJECT_PATH_MAX=${CMAKE_OBJECT_PATH_MAX}
-DBUILD_SHARED_LIBS=OFF
-DMZ_OPENSSL=OFF
-DMZ_LIBBSD=OFF
-DMZ_BUILD_TESTS=OFF
-DMZ_COMPAT=OFF
-DMZ_BZIP2=OFF
-DMZ_LZMA=OFF
-DMZ_LIBCOMP=OFF
-DMZ_ZSTD=OFF
-DMZ_PKCRYPT=OFF
-DMZ_WZAES=OFF
-DMZ_SIGNING=OFF
-DMZ_ZLIB=ON
-DMZ_ICONV=OFF
-DMZ_FETCH_LIBS=OFF
-DMZ_FORCE_FETCH_LIBS=OFF
-DZLIB_LIBRARY=${ZLIB_LIBRARIES}
-DZLIB_INCLUDE_DIR=${ZLIB_INCLUDE_DIRS}
)
if(CMAKE_TOOLCHAIN_FILE)
set(minizip-ng_CMAKE_ARGS
${minizip-ng_CMAKE_ARGS} -DCMAKE_TOOLCHAIN_FILE=${CMAKE_TOOLCHAIN_FILE})
endif()
if(APPLE)
string(REPLACE ";" "$<SEMICOLON>" ESCAPED_CMAKE_OSX_ARCHITECTURES "${CMAKE_OSX_ARCHITECTURES}")
set(minizip-ng_CMAKE_ARGS
${minizip-ng_CMAKE_ARGS}
-DCMAKE_OSX_DEPLOYMENT_TARGET=${CMAKE_OSX_DEPLOYMENT_TARGET}
-DCMAKE_OSX_ARCHITECTURES=${ESCAPED_CMAKE_OSX_ARCHITECTURES}
)
endif()
if (ANDROID)
set(minizip-ng_CMAKE_ARGS
${minizip-ng_CMAKE_ARGS}
-DANDROID_PLATFORM=${ANDROID_PLATFORM}
-DANDROID_ABI=${ANDROID_ABI}
-DANDROID_STL=${ANDROID_STL})
endif()
endif()
# Hack to let imported target be built from ExternalProject_Add
file(MAKE_DIRECTORY ${minizip-ng_INCLUDE_DIR})
ExternalProject_Add(minizip-ng_install
GIT_REPOSITORY "https://github.com/zlib-ng/minizip-ng.git"
GIT_TAG "${minizip-ng_VERSION}"
GIT_CONFIG advice.detachedHead=false
GIT_SHALLOW TRUE
PREFIX "${_EXT_BUILD_ROOT}/libminizip-ng"
BUILD_BYPRODUCTS ${minizip-ng_LIBRARY}
CMAKE_ARGS ${minizip-ng_CMAKE_ARGS}
EXCLUDE_FROM_ALL TRUE
BUILD_COMMAND ""
INSTALL_COMMAND
${CMAKE_COMMAND} --build .
--config ${CMAKE_BUILD_TYPE}
--target install
--parallel
)
add_dependencies(MINIZIP::minizip-ng minizip-ng_install)
message(STATUS "Installing minizip-ng: ${minizip-ng_LIBRARY} (version \"${minizip-ng_VERSION}\")")
endif()
###############################################################################
### Configure target ###
+53 -15
View File
@@ -1,23 +1,27 @@
# SPDX-License-Identifier: BSD-3-Clause
# Copyright Contributors to the OpenColorIO Project.
#
# Locate openfx
# Locate or install openfx
#
# Variables defined by this module:
# openfx_FOUND - Indicate whether the library was found or not
# openfx_INCLUDE_DIR - Location of the header files
# openfx_VERSION - Library's version
# openfx_FOUND - If FALSE, do not try to include openfx
# openfx_INCLUDE_DIR - Where to find ofxCore.h
# openfx_VERSION - The version of the library
#
# Global targets defined by this module:
# openfx::module
# Targets defined by this module:
# openfx::module - IMPORTED target, if found
#
# Usually CMake will use the dynamic library rather than static, if both are present.
#
# If the library is not installed in a typical location where CMake will find it, you may specify
# the location using the following method:
# -- Set -Dopenfx_ROOT to point to the directory containing the lib and include directories.
# If openfx is not installed in a standard path, you can use the
# openfx_ROOT variable to tell CMake where to find it. If it is not found
# and OCIO_INSTALL_EXT_PACKAGES is set to MISSING or ALL, openfx will be
# downloaded at build time.
#
if(NOT TARGET openfx::module)
add_library(openfx::module INTERFACE IMPORTED GLOBAL)
set(_openfx_TARGET_CREATE TRUE)
endif()
###############################################################################
### Try to find package ###
@@ -52,11 +56,45 @@ if(NOT OCIO_INSTALL_EXT_PACKAGES STREQUAL ALL)
endif()
###############################################################################
### Create target
### Install package from source ###
if(openfx_FOUND AND NOT TARGET openfx::module)
add_library(openfx::module INTERFACE IMPORTED GLOBAL)
set(_openfx_TARGET_CREATE TRUE)
if(NOT openfx_FOUND AND OCIO_INSTALL_EXT_PACKAGES AND NOT OCIO_INSTALL_EXT_PACKAGES STREQUAL NONE)
include(ExternalProject)
include(GNUInstallDirs)
set(_EXT_DIST_ROOT "${CMAKE_BINARY_DIR}/ext/dist")
set(_EXT_BUILD_ROOT "${CMAKE_BINARY_DIR}/ext/build")
set(_openfx_INSTALL_DIR "${_EXT_BUILD_ROOT}/openfx/src/openfx_install")
# Set find_package standard args
set(openfx_FOUND TRUE)
set(openfx_VERSION ${openfx_FIND_VERSION})
set(openfx_INCLUDE_DIR "${_EXT_DIST_ROOT}/${CMAKE_INSTALL_INCLUDEDIR}/openfx")
if(_openfx_TARGET_CREATE)
# Hack to let imported target be built from ExternalProject_Add
file(MAKE_DIRECTORY ${openfx_INCLUDE_DIR})
ExternalProject_Add(openfx_install
GIT_REPOSITORY "https://github.com/ofxa/openfx.git"
GIT_TAG "OFX_Release_${openfx_FIND_VERSION_MAJOR}_${openfx_FIND_VERSION_MINOR}_TAG"
GIT_CONFIG advice.detachedHead=false
GIT_SHALLOW TRUE
PREFIX "${_EXT_BUILD_ROOT}/openfx"
BUILD_BYPRODUCTS ${openfx_INCLUDE_DIR}
CONFIGURE_COMMAND ""
BUILD_COMMAND
${CMAKE_COMMAND} -E copy_directory
"${_EXT_BUILD_ROOT}/openfx/src/openfx_install/include"
"${openfx_INCLUDE_DIR}"
INSTALL_COMMAND ""
CMAKE_ARGS ${openfx_CMAKE_ARGS}
EXCLUDE_FROM_ALL TRUE
)
add_dependencies(openfx::module openfx_install)
message(STATUS "Installing openfx: ${openfx_INCLUDE_DIR} (version \"${openfx_VERSION}\")")
endif()
endif()
###############################################################################
+91 -11
View File
@@ -1,23 +1,20 @@
# SPDX-License-Identifier: BSD-3-Clause
# Copyright Contributors to the OpenColorIO Project.
#
# Locate pybind11
# Locate or install pybind11
#
# Variables defined by this module:
# pybind11_FOUND - If FALSE, do not try to link to pybind11
# pybind11_INCLUDE_DIR - Where to find pybind11.h
# pybind11_VERSION - The version of the library
#
# Global targets defined by this module:
# pybind11::module
# Targets defined by this module:
# pybind11::module - IMPORTED target, if found
#
# Usually CMake will use the dynamic library rather than static, if both are present.
#
# If the library is not installed in a typical location where CMake will find it, you may specify
# the location using one of the following methods:
# -- Set -Dpybind11_DIR to point to the directory containing the CMake configuration file for the package.
# -- Set -Dpybind11_ROOT to point to the directory containing the lib and include directories.
# -- Set -Dpybind11_LIBRARY and -Dpybind11_INCLUDE_DIR to point to the lib and include directories.
# If pybind11 is not installed in a standard path, you can use the
# pybind11_ROOT variable to tell CMake where to find it. If it is not found
# and OCIO_INSTALL_EXT_PACKAGES is set to MISSING or ALL, pybind11 will be
# downloaded at build time.
#
###############################################################################
@@ -129,11 +126,94 @@ endif()
###############################################################################
### Create target ###
if(pybind11_FOUND AND NOT TARGET pybind11::module)
if(NOT TARGET pybind11::module)
add_library(pybind11::module INTERFACE IMPORTED GLOBAL)
set(_pybind11_TARGET_CREATE TRUE)
endif()
###############################################################################
### Install package from source ###
if(NOT pybind11_FOUND AND OCIO_INSTALL_EXT_PACKAGES AND NOT OCIO_INSTALL_EXT_PACKAGES STREQUAL NONE)
include(ExternalProject)
include(GNUInstallDirs)
set(_EXT_DIST_ROOT "${CMAKE_BINARY_DIR}/ext/dist")
set(_EXT_BUILD_ROOT "${CMAKE_BINARY_DIR}/ext/build")
# Set find_package standard args
set(pybind11_FOUND TRUE)
set(pybind11_VERSION ${pybind11_FIND_VERSION})
set(pybind11_INCLUDE_DIR "${_EXT_DIST_ROOT}/${CMAKE_INSTALL_INCLUDEDIR}")
if(_pybind11_TARGET_CREATE)
# Hack to let imported target be built from ExternalProject_Add
file(MAKE_DIRECTORY ${pybind11_INCLUDE_DIR})
set(pybind11_CMAKE_ARGS
${pybind11_CMAKE_ARGS}
-DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE}
-DCMAKE_CXX_STANDARD=${CMAKE_CXX_STANDARD}
-DCMAKE_INSTALL_MESSAGE=${CMAKE_INSTALL_MESSAGE}
-DCMAKE_INSTALL_PREFIX=${_EXT_DIST_ROOT}
-DCMAKE_INSTALL_BINDIR=${CMAKE_INSTALL_BINDIR}
-DCMAKE_INSTALL_DATADIR=${CMAKE_INSTALL_DATADIR}
-DCMAKE_INSTALL_LIBDIR=${CMAKE_INSTALL_LIBDIR}
-DCMAKE_INSTALL_INCLUDEDIR=${CMAKE_INSTALL_INCLUDEDIR}
-DCMAKE_OBJECT_PATH_MAX=${CMAKE_OBJECT_PATH_MAX}
# Using FindPython mode (PYBIND11_FINDPYTHON=ON) doesn't seem to
# work when building on docker manylinux images where Development
# component is not available but is hardcoded in pybind11 script.
-DPYTHON_EXECUTABLE=${Python_EXECUTABLE}
-DPYBIND11_INSTALL=ON
-DPYBIND11_TEST=OFF
)
if(CMAKE_TOOLCHAIN_FILE)
set(pybind11_CMAKE_ARGS
${pybind11_CMAKE_ARGS} -DCMAKE_TOOLCHAIN_FILE=${CMAKE_TOOLCHAIN_FILE})
endif()
if(APPLE)
string(REPLACE ";" "$<SEMICOLON>" ESCAPED_CMAKE_OSX_ARCHITECTURES "${CMAKE_OSX_ARCHITECTURES}")
set(pybind11_CMAKE_ARGS
${pybind11_CMAKE_ARGS}
-DCMAKE_OSX_DEPLOYMENT_TARGET=${CMAKE_OSX_DEPLOYMENT_TARGET}
-DCMAKE_OSX_ARCHITECTURES=${ESCAPED_CMAKE_OSX_ARCHITECTURES}
)
endif()
if (ANDROID)
set(pybind11_CMAKE_ARGS
${pybind11_CMAKE_ARGS}
-DANDROID_PLATFORM=${ANDROID_PLATFORM}
-DANDROID_ABI=${ANDROID_ABI}
-DANDROID_STL=${ANDROID_STL})
endif()
ExternalProject_Add(pybind11_install
GIT_REPOSITORY "https://github.com/pybind/pybind11.git"
GIT_TAG "v${pybind11_FIND_VERSION}"
GIT_CONFIG advice.detachedHead=false
GIT_SHALLOW TRUE
PREFIX "${_EXT_BUILD_ROOT}/pybind11"
BUILD_BYPRODUCTS ${pybind11_INCLUDE_DIR}
CMAKE_ARGS ${pybind11_CMAKE_ARGS}
EXCLUDE_FROM_ALL TRUE
BUILD_COMMAND ""
INSTALL_COMMAND
${CMAKE_COMMAND} --build .
--config ${CMAKE_BUILD_TYPE}
--target install
--parallel
)
add_dependencies(pybind11::module pybind11_install)
message(STATUS "Installing pybind11: ${pybind11_INCLUDE_DIR} (version \"${pybind11_VERSION}\")")
endif()
endif()
###############################################################################
### Configure target ###
+103 -17
View File
@@ -1,25 +1,26 @@
# SPDX-License-Identifier: BSD-3-Clause
# Copyright Contributors to the OpenColorIO Project.
#
# Locate pystring
# Locate or install pystring
#
# Variables defined by this module:
# pystring_FOUND - Indicate whether the library was found or not
# pystring_LIBRARY - Path to the library file
# pystring_INCLUDE_DIR - Location of the header files
# pystring_VERSION - Library's version
# pystring_FOUND - If FALSE, do not try to link to pystring
# pystring_LIBRARY - Where to find pystring
# pystring_INCLUDE_DIR - Where to find pystring.h
#
# Global targets defined by this module:
# Targets defined by this module:
# pystring::pystring - IMPORTED target, if found
#
# Usually CMake will use the dynamic library rather than static, if both are present.
#
# If the library is not installed in a typical location where CMake will find it, you may specify
# the location using one of the following methods:
# -- Set -Dpystring_ROOT to point to the directory containing the lib and include directories.
# -- Set -Dpystring_LIBRARY and -Dpystring_INCLUDE_DIR to point to the lib and include directories.
# If pystring is not installed in a standard path, you can use the
# pystring_ROOT variable to tell CMake where to find it. If it is not found
# and OCIO_INSTALL_EXT_PACKAGES is set to MISSING or ALL, pystring will be
# downloaded, built, and statically-linked into libOpenColorIO at build time.
#
if(NOT TARGET pystring::pystring)
add_library(pystring::pystring UNKNOWN IMPORTED GLOBAL)
set(_pystring_TARGET_CREATE TRUE)
endif()
###############################################################################
### Try to find package ###
@@ -63,11 +64,96 @@ if(NOT OCIO_INSTALL_EXT_PACKAGES STREQUAL ALL)
endif()
###############################################################################
### Configure target ###
### Install package from source ###
if(pystring_FOUND AND NOT TARGET pystring::pystring)
add_library(pystring::pystring UNKNOWN IMPORTED GLOBAL)
set(_pystring_TARGET_CREATE TRUE)
if(NOT pystring_FOUND AND OCIO_INSTALL_EXT_PACKAGES AND NOT OCIO_INSTALL_EXT_PACKAGES STREQUAL NONE)
include(ExternalProject)
set(_EXT_DIST_ROOT "${CMAKE_BINARY_DIR}/ext/dist")
set(_EXT_BUILD_ROOT "${CMAKE_BINARY_DIR}/ext/build")
# Set find_package standard args
set(pystring_FOUND TRUE)
set(pystring_VERSION ${pystring_FIND_VERSION})
set(pystring_INCLUDE_DIR "${_EXT_DIST_ROOT}/${CMAKE_INSTALL_INCLUDEDIR}")
set(pystring_LIBRARY
"${_EXT_DIST_ROOT}/${CMAKE_INSTALL_LIBDIR}/${CMAKE_STATIC_LIBRARY_PREFIX}pystring${CMAKE_STATIC_LIBRARY_SUFFIX}")
if(_pystring_TARGET_CREATE)
if(MSVC)
set(pystring_CXX_FLAGS "${pystring_CXX_FLAGS} /EHsc")
endif()
string(STRIP "${pystring_CXX_FLAGS}" pystring_CXX_FLAGS)
set(pystring_CMAKE_ARGS
${pystring_CMAKE_ARGS}
-DCMAKE_CXX_VISIBILITY_PRESET=${CMAKE_CXX_VISIBILITY_PRESET}
-DCMAKE_VISIBILITY_INLINES_HIDDEN=${CMAKE_VISIBILITY_INLINES_HIDDEN}
-DCMAKE_POSITION_INDEPENDENT_CODE=ON
-DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE}
-DCMAKE_CXX_FLAGS=${pystring_CXX_FLAGS}
-DCMAKE_CXX_STANDARD=${CMAKE_CXX_STANDARD}
-DCMAKE_INSTALL_MESSAGE=${CMAKE_INSTALL_MESSAGE}
-DCMAKE_INSTALL_PREFIX=${_EXT_DIST_ROOT}
-DCMAKE_INSTALL_BINDIR=${CMAKE_INSTALL_BINDIR}
-DCMAKE_INSTALL_LIBDIR=${CMAKE_INSTALL_LIBDIR}
-DCMAKE_INSTALL_INCLUDEDIR=${CMAKE_INSTALL_INCLUDEDIR}
-DCMAKE_OBJECT_PATH_MAX=${CMAKE_OBJECT_PATH_MAX}
)
if(CMAKE_TOOLCHAIN_FILE)
set(pystring_CMAKE_ARGS
${pystring_CMAKE_ARGS} -DCMAKE_TOOLCHAIN_FILE=${CMAKE_TOOLCHAIN_FILE})
endif()
if(APPLE)
string(REPLACE ";" "$<SEMICOLON>" ESCAPED_CMAKE_OSX_ARCHITECTURES "${CMAKE_OSX_ARCHITECTURES}")
set(pystring_CMAKE_ARGS
${pystring_CMAKE_ARGS}
-DCMAKE_OSX_DEPLOYMENT_TARGET=${CMAKE_OSX_DEPLOYMENT_TARGET}
-DCMAKE_OSX_ARCHITECTURES=${ESCAPED_CMAKE_OSX_ARCHITECTURES}
)
endif()
if (ANDROID)
set(pystring_CMAKE_ARGS
${pystring_CMAKE_ARGS}
-DANDROID_PLATFORM=${ANDROID_PLATFORM}
-DANDROID_ABI=${ANDROID_ABI}
-DANDROID_STL=${ANDROID_STL})
endif()
# Hack to let imported target be built from ExternalProject_Add
file(MAKE_DIRECTORY ${pystring_INCLUDE_DIR})
ExternalProject_Add(pystring_install
GIT_REPOSITORY "https://github.com/imageworks/pystring.git"
GIT_TAG "v${pystring_FIND_VERSION}"
GIT_CONFIG advice.detachedHead=false
GIT_SHALLOW TRUE
PREFIX "${_EXT_BUILD_ROOT}/pystring"
BUILD_BYPRODUCTS ${pystring_LIBRARY}
CMAKE_ARGS ${pystring_CMAKE_ARGS}
EXCLUDE_FROM_ALL TRUE
PATCH_COMMAND
${CMAKE_COMMAND} -E copy
"${CMAKE_SOURCE_DIR}/share/cmake/projects/Buildpystring.cmake"
"CMakeLists.txt"
BUILD_COMMAND ""
INSTALL_COMMAND
${CMAKE_COMMAND} --build .
--config ${CMAKE_BUILD_TYPE}
--target install
--parallel
)
add_dependencies(pystring::pystring pystring_install)
message(STATUS "Installing pystring: ${pystring_LIBRARY} (version \"${pystring_VERSION}\")")
endif()
endif()
###############################################################################
@@ -80,4 +166,4 @@ if(_pystring_TARGET_CREATE)
)
mark_as_advanced(pystring_INCLUDE_DIR pystring_LIBRARY pystring_VERSION)
endif()
endif()
+131 -36
View File
@@ -1,32 +1,25 @@
# SPDX-License-Identifier: BSD-3-Clause
# Copyright Contributors to the OpenColorIO Project.
#
# Locate yaml-cpp
# Locate or install yaml-cpp
#
# Variables defined by this module:
# yaml-cpp_FOUND - Indicate whether the library was found or not
# yaml-cpp_LIBRARY - Path to the library file
# yaml-cpp_INCLUDE_DIR - Location of the header files
# yaml-cpp_VERSION - Library's version
# yaml-cpp_FOUND - If FALSE, do not try to link to yamlcpp
# yaml-cpp_LIBRARY - yaml-cpp library to link to
# yaml-cpp_INCLUDE_DIR - Where to find yaml.h
# yaml-cpp_VERSION - The version of the library
#
# Global targets defined by this module:
# yaml-cpp
# Targets defined by this module:
# yaml-cpp - IMPORTED target, if found
#
# For compatibility with the upstream CMake package, the following variables and targets are defined:
# yaml-cpp::yaml-cpp - Alias of the yaml-cpp target
# YAML_CPP_LIBRARIES - Libraries to link against yaml-cpp
# YAML_CPP_INCLUDE_DIR - Include directory
# By default, the dynamic libraries of yaml-cpp will be found. To find the
# static ones instead, you must set the yaml-cpp_STATIC_LIBRARY variable to
# TRUE before calling find_package(yaml-cpp ...).
#
# Usually CMake will use the dynamic library rather than static, if both are present.
# In this case, you may set yaml-cpp_STATIC_LIBRARY to ON to request use of the static one.
# If only the static library is present (such as when OCIO builds the dependency), then the option
# is not needed.
#
# If the library is not installed in a typical location where CMake will find it, you may specify
# the location using one of the following methods:
# -- Set -Dyaml-cpp_DIR to point to the directory containing the CMake configuration file for the package.
# -- Set -Dyaml-cpp_ROOT to point to the directory containing the lib and include directories.
# -- Set -Dyaml-cpp_LIBRARY and -Dyaml-cpp_INCLUDE_DIR to point to the lib and include directories.
# If yaml-cpp is not installed in a standard path, you can use the
# yaml-cpp_ROOT variable to tell CMake where to find it. If it is not found
# and OCIO_INSTALL_EXT_PACKAGES is set to MISSING or ALL, yaml-cpp will be
# downloaded, built, and statically-linked into libOpenColorIO at build time.
#
###############################################################################
@@ -135,13 +128,128 @@ if(NOT OCIO_INSTALL_EXT_PACKAGES STREQUAL ALL)
endif()
###############################################################################
### Create target
### Create target (if previous 'find_package' call hasn't) ###
if(yaml-cpp_FOUND AND NOT TARGET yaml-cpp)
if(NOT TARGET yaml-cpp)
add_library(yaml-cpp UNKNOWN IMPORTED GLOBAL)
set(_yaml-cpp_TARGET_CREATE TRUE)
endif()
###############################################################################
### Install package from source ###
if(NOT yaml-cpp_FOUND AND OCIO_INSTALL_EXT_PACKAGES AND NOT OCIO_INSTALL_EXT_PACKAGES STREQUAL NONE)
include(ExternalProject)
include(GNUInstallDirs)
set(_EXT_DIST_ROOT "${CMAKE_BINARY_DIR}/ext/dist")
set(_EXT_BUILD_ROOT "${CMAKE_BINARY_DIR}/ext/build")
# Set find_package standard args
set(yaml-cpp_FOUND TRUE)
set(yaml-cpp_VERSION ${yaml-cpp_FIND_VERSION})
set(yaml-cpp_INCLUDE_DIR "${_EXT_DIST_ROOT}/${CMAKE_INSTALL_INCLUDEDIR}")
# Starting from 0.7.0, this is included on all platforms, we could also
# override CMAKE_DEBUG_POSTFIX to bypass it.
if(BUILD_TYPE_DEBUG)
string(APPEND _yaml-cpp_LIB_SUFFIX "d")
endif()
# Set the expected library name
set(yaml-cpp_LIBRARY
"${_EXT_DIST_ROOT}/${CMAKE_INSTALL_LIBDIR}/${CMAKE_STATIC_LIBRARY_PREFIX}yaml-cpp${_yaml-cpp_LIB_SUFFIX}${CMAKE_STATIC_LIBRARY_SUFFIX}")
if(_yaml-cpp_TARGET_CREATE)
if(MSVC)
set(yaml-cpp_CXX_FLAGS "${yaml-cpp_CXX_FLAGS} /EHsc")
endif()
if(UNIX)
if(USE_CLANG)
# Remove some global 'shadow' warnings.
set(yaml-cpp_CXX_FLAGS "${yaml-cpp_CXX_FLAGS} -Wno-shadow")
endif()
endif()
string(STRIP "${yaml-cpp_CXX_FLAGS}" yaml-cpp_CXX_FLAGS)
set(yaml-cpp_CMAKE_ARGS
${yaml-cpp_CMAKE_ARGS}
-DCMAKE_POLICY_DEFAULT_CMP0063=NEW
-DCMAKE_CXX_VISIBILITY_PRESET=${CMAKE_CXX_VISIBILITY_PRESET}
-DCMAKE_VISIBILITY_INLINES_HIDDEN=${CMAKE_VISIBILITY_INLINES_HIDDEN}
-DCMAKE_POSITION_INDEPENDENT_CODE=ON
-DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE}
-DCMAKE_CXX_FLAGS=${yaml-cpp_CXX_FLAGS}
-DCMAKE_CXX_STANDARD=${CMAKE_CXX_STANDARD}
-DCMAKE_INSTALL_MESSAGE=${CMAKE_INSTALL_MESSAGE}
-DCMAKE_INSTALL_PREFIX=${_EXT_DIST_ROOT}
-DCMAKE_INSTALL_BINDIR=${CMAKE_INSTALL_BINDIR}
-DCMAKE_INSTALL_DATADIR=${CMAKE_INSTALL_DATADIR}
-DCMAKE_INSTALL_LIBDIR=${CMAKE_INSTALL_LIBDIR}
-DCMAKE_INSTALL_INCLUDEDIR=${CMAKE_INSTALL_INCLUDEDIR}
-DCMAKE_OBJECT_PATH_MAX=${CMAKE_OBJECT_PATH_MAX}
-DBUILD_SHARED_LIBS=OFF
-DYAML_BUILD_SHARED_LIBS=OFF
-DYAML_CPP_BUILD_TESTS=OFF
-DYAML_CPP_BUILD_TOOLS=OFF
-DYAML_CPP_BUILD_CONTRIB=OFF
)
if(CMAKE_TOOLCHAIN_FILE)
set(yaml-cpp_CMAKE_ARGS
${yaml-cpp_CMAKE_ARGS} -DCMAKE_TOOLCHAIN_FILE=${CMAKE_TOOLCHAIN_FILE})
endif()
if(APPLE)
string(REPLACE ";" "$<SEMICOLON>" ESCAPED_CMAKE_OSX_ARCHITECTURES "${CMAKE_OSX_ARCHITECTURES}")
set(yaml-cpp_CMAKE_ARGS
${yaml-cpp_CMAKE_ARGS}
-DCMAKE_OSX_DEPLOYMENT_TARGET=${CMAKE_OSX_DEPLOYMENT_TARGET}
-DCMAKE_OSX_ARCHITECTURES=${ESCAPED_CMAKE_OSX_ARCHITECTURES}
)
endif()
if (ANDROID)
set(yaml-cpp_CMAKE_ARGS
${yaml-cpp_CMAKE_ARGS}
-DANDROID_PLATFORM=${ANDROID_PLATFORM}
-DANDROID_ABI=${ANDROID_ABI}
-DANDROID_STL=${ANDROID_STL})
endif()
set(yaml-cpp_GIT_TAG "yaml-cpp-${yaml-cpp_VERSION}")
# Hack to let imported target be built from ExternalProject_Add
file(MAKE_DIRECTORY ${yaml-cpp_INCLUDE_DIR})
ExternalProject_Add(yaml-cpp_install
GIT_REPOSITORY "https://github.com/jbeder/yaml-cpp.git"
GIT_TAG ${yaml-cpp_GIT_TAG}
GIT_CONFIG advice.detachedHead=false
GIT_SHALLOW TRUE
PREFIX "${_EXT_BUILD_ROOT}/yaml-cpp"
BUILD_BYPRODUCTS ${yaml-cpp_LIBRARY}
CMAKE_ARGS ${yaml-cpp_CMAKE_ARGS}
EXCLUDE_FROM_ALL TRUE
BUILD_COMMAND ""
INSTALL_COMMAND
${CMAKE_COMMAND} --build .
--config ${CMAKE_BUILD_TYPE}
--target install
--parallel
)
add_dependencies(yaml-cpp yaml-cpp_install)
message(STATUS
"Installing yaml-cpp: ${yaml-cpp_LIBRARY} (version \"${yaml-cpp_VERSION}\")"
)
endif()
endif()
###############################################################################
### Configure target ###
@@ -153,16 +261,3 @@ if(_yaml-cpp_TARGET_CREATE)
mark_as_advanced(yaml-cpp_INCLUDE_DIR yaml-cpp_LIBRARY yaml-cpp_VERSION)
endif()
###############################################################################
### Set variables for compatibility ###
if(TARGET yaml-cpp AND NOT TARGET yaml-cpp::yaml-cpp)
add_library(yaml-cpp::yaml-cpp ALIAS yaml-cpp)
endif()
if(yaml-cpp_INCLUDE_DIR)
set(YAML_CPP_INCLUDE_DIR "${yaml-cpp_INCLUDE_DIR}")
endif()
set(YAML_CPP_LIBRARIES yaml-cpp::yaml-cpp)
@@ -7,15 +7,17 @@
# CMake's FindZLIB when installing ZLIB manually.
#
# Variables defined by this module:
# ZLIB_FOUND - Indicate whether the library was found or not
# ZLIB_LIBRARY - Path to the library file
# ZLIB_INCLUDE_DIR - Location of the header files
# ZLIB_VERSION - Library's version
# ZLIB_FOUND - If FALSE, do not try to link to zlib
# ZLIB_LIBRARIES - ZLIB library to link to
# ZLIB_INCLUDE_DIRS - Where to find zlib.h and other headers
# ZLIB_VERSION - The version of the library
#
# Global targets defined by this module:
# ZLIB::ZLIB
# Targets defined by this module:
# ZLIB::ZLIB - Properties:
# IMPORTED_LOCATION ${ZLIB_LIBRARIES}
# INTERFACE_INCLUDE_DIRECTORIES ${ZLIB_INCLUDE_DIRS}
#
###############################################################################
###############################################################################
### Create target
@@ -32,8 +34,8 @@ if(NOT ZLIB_FOUND AND OCIO_INSTALL_EXT_PACKAGES AND NOT OCIO_INSTALL_EXT_PACKAGE
include(ExternalProject)
include(GNUInstallDirs)
set(_EXT_DIST_ROOT "${PROJECT_BINARY_DIR}/ext/dist")
set(_EXT_BUILD_ROOT "${PROJECT_BINARY_DIR}/ext/build")
set(_EXT_DIST_ROOT "${CMAKE_BINARY_DIR}/ext/dist")
set(_EXT_BUILD_ROOT "${CMAKE_BINARY_DIR}/ext/build")
if(WIN32)
set(_ZLIB_LIB_NAME "zlib")
@@ -45,8 +47,8 @@ if(NOT ZLIB_FOUND AND OCIO_INSTALL_EXT_PACKAGES AND NOT OCIO_INSTALL_EXT_PACKAGE
# Set find_package standard args
set(ZLIB_FOUND TRUE)
if(OCIO_ZLIB_RECOMMENDED_VERSION)
set(ZLIB_VERSION ${OCIO_ZLIB_RECOMMENDED_VERSION})
if(_ZLIB_ExternalProject_VERSION)
set(ZLIB_VERSION ${_ZLIB_ExternalProject_VERSION})
else()
set(ZLIB_VERSION ${ZLIB_FIND_VERSION})
endif()
@@ -68,10 +70,6 @@ if(NOT ZLIB_FOUND AND OCIO_INSTALL_EXT_PACKAGES AND NOT OCIO_INSTALL_EXT_PACKAGE
if(_ZLIB_TARGET_CREATE)
set(ZLIB_CMAKE_ARGS
${ZLIB_CMAKE_ARGS}
# Setting policy CMP0042 when building ZLIB since that project is using an old CMake
# version as the cmake_minimum_required and that version has no knowledge of the policy.
# Since that policy gets unset, it causes a warning with CMake 3.25+.
-DCMAKE_POLICY_DEFAULT_CMP0042=NEW
-DCMAKE_CXX_VISIBILITY_PRESET=${CMAKE_CXX_VISIBILITY_PRESET}
-DCMAKE_VISIBILITY_INLINES_HIDDEN=${CMAKE_VISIBILITY_INLINES_HIDDEN}
-DCMAKE_POSITION_INDEPENDENT_CODE=ON
@@ -136,17 +134,11 @@ if(NOT ZLIB_FOUND AND OCIO_INSTALL_EXT_PACKAGES AND NOT OCIO_INSTALL_EXT_PACKAGE
add_dependencies(ZLIB::ZLIB ZLIB_install)
# FindZLIB from CMake needs ZLIB_LIBRARY and ZLIB_INCLUDE_DIR.
# Starting CMake 3.17+, The mark_as_advanced() command no longer creates a cache entry if one
# does not already exist. (See policy CMP0102)
# For that reasons, ZLIB_LIBRARY and ZLIB_INCLUDE_DIR are set in the CMake's Cache since ZLIB
# is needed by other OCIO dependencies.
set(ZLIB_LIBRARY ${ZLIB_LIBRARIES} CACHE STRING "ZLIB library file")
set(ZLIB_INCLUDE_DIR ${ZLIB_INCLUDE_DIRS} CACHE STRING "ZLIB includes directory")
if(OCIO_VERBOSE)
message(STATUS "Installing ZLIB: ${ZLIB_LIBRARIES} (version \"${ZLIB_VERSION}\") ")
endif()
# Setting those variables to follow the same naming as the other OCIO custom find modules.
set(ZLIB_LIBRARY ${ZLIB_LIBRARIES})
set(ZLIB_INCLUDE_DIR ${ZLIB_INCLUDE_DIRS})
message(STATUS "Installing ZLIB: ${ZLIB_LIBRARIES} (version \"${ZLIB_VERSION}\")")
endif()
@@ -160,4 +152,4 @@ if(_ZLIB_TARGET_CREATE)
)
mark_as_advanced(ZLIB_INCLUDE_DIRS ZLIB_LIBRARIES ZLIB_VERSION)
endif()
endif()
@@ -1,154 +0,0 @@
# SPDX-License-Identifier: BSD-3-Clause
# Copyright Contributors to the OpenColorIO Project.
#
# Install Imath
#
# Variables defined by this module:
# Imath_FOUND - Indicate whether the library was found or not
# Imath_LIBRARY - Path to the library file
# Imath_INCLUDE_DIR - Location of the header files
# Imath_VERSION - Library's version
#
# Global targets defined by this module:
# Imath::Imath
# Imath::ImathConfig
#
###############################################################################
### Create target
if (NOT TARGET Imath::Imath)
add_library(Imath::Imath UNKNOWN IMPORTED GLOBAL)
add_library(Imath::ImathConfig INTERFACE IMPORTED GLOBAL)
set(_Imath_TARGET_CREATE TRUE)
endif()
###############################################################################
### Install package from source ###
if(NOT Imath_FOUND AND OCIO_INSTALL_EXT_PACKAGES AND NOT OCIO_INSTALL_EXT_PACKAGES STREQUAL NONE)
include(ExternalProject)
include(GNUInstallDirs)
set(_EXT_DIST_ROOT "${PROJECT_BINARY_DIR}/ext/dist")
set(_EXT_BUILD_ROOT "${PROJECT_BINARY_DIR}/ext/build")
# Set find_package standard args
set(Imath_FOUND TRUE)
if(OCIO_Imath_RECOMMENDED_VERSION)
set(Imath_VERSION ${OCIO_Imath_RECOMMENDED_VERSION})
else()
set(Imath_VERSION ${Imath_FIND_VERSION})
endif()
set(Imath_INCLUDE_DIR "${_EXT_DIST_ROOT}/${CMAKE_INSTALL_INCLUDEDIR}")
# Set the expected library name
if(BUILD_TYPE_DEBUG)
set(_Imath_LIB_SUFFIX "_d")
endif()
include(VersionUtils)
split_version_string(${Imath_VERSION} _Imath_ExternalProject)
set(_Imath_LIB_VER "${_Imath_ExternalProject_VERSION_MAJOR}_${_Imath_ExternalProject_VERSION_MINOR}")
set(Imath_LIBRARY
"${_EXT_DIST_ROOT}/${CMAKE_INSTALL_LIBDIR}/${CMAKE_STATIC_LIBRARY_PREFIX}Imath-${_Imath_LIB_VER}${_Imath_LIB_SUFFIX}${CMAKE_STATIC_LIBRARY_SUFFIX}")
if(_Imath_TARGET_CREATE)
if(MSVC)
set(Imath_CXX_FLAGS "${Imath_CXX_FLAGS} /EHsc")
endif()
string(STRIP "${Imath_CXX_FLAGS}" Imath_CXX_FLAGS)
set(Imath_CMAKE_ARGS
${Imath_CMAKE_ARGS}
-DCMAKE_CXX_VISIBILITY_PRESET=${CMAKE_CXX_VISIBILITY_PRESET}
-DCMAKE_VISIBILITY_INLINES_HIDDEN=${CMAKE_VISIBILITY_INLINES_HIDDEN}
-DCMAKE_POSITION_INDEPENDENT_CODE=ON
-DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE}
-DCMAKE_CXX_FLAGS=${Imath_CXX_FLAGS}
-DCMAKE_CXX_STANDARD=${CMAKE_CXX_STANDARD}
-DCMAKE_INSTALL_MESSAGE=${CMAKE_INSTALL_MESSAGE}
-DCMAKE_INSTALL_PREFIX=${_EXT_DIST_ROOT}
-DCMAKE_INSTALL_BINDIR=${CMAKE_INSTALL_BINDIR}
-DCMAKE_INSTALL_DATADIR=${CMAKE_INSTALL_DATADIR}
-DCMAKE_INSTALL_LIBDIR=${CMAKE_INSTALL_LIBDIR}
-DCMAKE_INSTALL_INCLUDEDIR=${CMAKE_INSTALL_INCLUDEDIR}
-DCMAKE_OBJECT_PATH_MAX=${CMAKE_OBJECT_PATH_MAX}
-DBUILD_SHARED_LIBS=OFF
-DBUILD_TESTING=OFF
-DPYTHON=OFF
-DDOCS=OFF
-DIMATH_HALF_USE_LOOKUP_TABLE=OFF
)
if(CMAKE_TOOLCHAIN_FILE)
set(Imath_CMAKE_ARGS
${Imath_CMAKE_ARGS} -DCMAKE_TOOLCHAIN_FILE=${CMAKE_TOOLCHAIN_FILE})
endif()
if(APPLE)
string(REPLACE ";" "$<SEMICOLON>" ESCAPED_CMAKE_OSX_ARCHITECTURES "${CMAKE_OSX_ARCHITECTURES}")
set(Imath_CMAKE_ARGS
${Imath_CMAKE_ARGS}
-DCMAKE_OSX_DEPLOYMENT_TARGET=${CMAKE_OSX_DEPLOYMENT_TARGET}
-DCMAKE_OSX_ARCHITECTURES=${ESCAPED_CMAKE_OSX_ARCHITECTURES}
)
endif()
if (ANDROID)
set(Imath_CMAKE_ARGS
${Imath_CMAKE_ARGS}
-DANDROID_PLATFORM=${ANDROID_PLATFORM}
-DANDROID_ABI=${ANDROID_ABI}
-DANDROID_STL=${ANDROID_STL})
endif()
# Hack to let imported target be built from ExternalProject_Add
file(MAKE_DIRECTORY ${Imath_INCLUDE_DIR})
ExternalProject_Add(imath_install
GIT_REPOSITORY "https://github.com/AcademySoftwareFoundation/Imath.git"
GIT_TAG "v${Imath_VERSION}"
GIT_CONFIG advice.detachedHead=false
GIT_SHALLOW TRUE
PREFIX "${_EXT_BUILD_ROOT}/Imath"
BUILD_BYPRODUCTS ${Imath_LIBRARY}
CMAKE_ARGS ${Imath_CMAKE_ARGS}
EXCLUDE_FROM_ALL TRUE
BUILD_COMMAND ""
INSTALL_COMMAND
${CMAKE_COMMAND} --build .
--config ${CMAKE_BUILD_TYPE}
--target install
--parallel
)
add_dependencies(Imath::Imath imath_install)
if(OCIO_VERBOSE)
message(STATUS "Installing Imath: ${Imath_LIBRARY} (version \"${Imath_VERSION}\")")
endif()
endif()
endif()
###############################################################################
### Configure target ###
if(_Imath_TARGET_CREATE)
file(MAKE_DIRECTORY ${Imath_INCLUDE_DIR}/Imath)
set_target_properties(Imath::Imath PROPERTIES
IMPORTED_LOCATION ${Imath_LIBRARY}
INTERFACE_INCLUDE_DIRECTORIES "${Imath_INCLUDE_DIR};${Imath_INCLUDE_DIR}/Imath"
)
set_target_properties(Imath::ImathConfig PROPERTIES
INTERFACE_INCLUDE_DIRECTORIES "${Imath_INCLUDE_DIR};${Imath_INCLUDE_DIR}/Imath"
)
mark_as_advanced(Imath_INCLUDE_DIR Imath_LIBRARY Imath_VERSION)
endif()
@@ -1,161 +0,0 @@
# SPDX-License-Identifier: BSD-3-Clause
# Copyright Contributors to the OpenColorIO Project.
#
# Install expat
#
# Variables defined by this module:
# expat_FOUND - Indicate whether the library was found or not
# expat_LIBRARY - Path to the library file
# expat_INCLUDE_DIR - Location of the header files
# expat_VERSION - Library's version
#
# Global targets defined by this module:
# expat::expat
#
###############################################################################
### Create target
if(NOT TARGET expat::expat)
add_library(expat::expat UNKNOWN IMPORTED GLOBAL)
set(_expat_TARGET_CREATE TRUE)
endif()
###############################################################################
### Install package from source ###
if(NOT expat_FOUND AND OCIO_INSTALL_EXT_PACKAGES AND NOT OCIO_INSTALL_EXT_PACKAGES STREQUAL NONE)
include(ExternalProject)
include(GNUInstallDirs)
set(_EXT_DIST_ROOT "${PROJECT_BINARY_DIR}/ext/dist")
set(_EXT_BUILD_ROOT "${PROJECT_BINARY_DIR}/ext/build")
# Set find_package standard args
set(expat_FOUND TRUE)
if(OCIO_expat_RECOMMENDED_VERSION)
set(expat_VERSION ${OCIO_expat_RECOMMENDED_VERSION})
else()
set(expat_VERSION ${expat_FIND_VERSION})
endif()
set(expat_INCLUDE_DIR "${_EXT_DIST_ROOT}/${CMAKE_INSTALL_INCLUDEDIR}")
# Set the expected library name
if(WIN32)
if(BUILD_TYPE_DEBUG)
set(_expat_LIB_SUFFIX "d")
endif()
# Static Linking, Multi-threaded Dll naming (>=2.2.8):
# https://github.com/libexpat/libexpat/blob/R_2_2_8/expat/win32/README.txt
set(_expat_LIB_SUFFIX "${_expat_LIB_SUFFIX}MD")
endif()
# Expat use a hardcoded lib prefix instead of CMAKE_STATIC_LIBRARY_PREFIX
# https://github.com/libexpat/libexpat/blob/R_2_4_1/expat/CMakeLists.txt#L374
set(_expat_LIB_PREFIX "lib")
set(expat_LIBRARY
"${_EXT_DIST_ROOT}/${CMAKE_INSTALL_LIBDIR}/${_expat_LIB_PREFIX}expat${_expat_LIB_SUFFIX}${CMAKE_STATIC_LIBRARY_SUFFIX}")
if(_expat_TARGET_CREATE)
if(MSVC)
set(EXPAT_C_FLAGS "${EXPAT_C_FLAGS} /EHsc")
set(EXPAT_CXX_FLAGS "${EXPAT_CXX_FLAGS} /EHsc")
endif()
string(STRIP "${EXPAT_C_FLAGS}" EXPAT_C_FLAGS)
string(STRIP "${EXPAT_CXX_FLAGS}" EXPAT_CXX_FLAGS)
set(EXPAT_CMAKE_ARGS
${EXPAT_CMAKE_ARGS}
-DCMAKE_POLICY_DEFAULT_CMP0063=NEW
-DCMAKE_C_VISIBILITY_PRESET=${CMAKE_C_VISIBILITY_PRESET}
-DCMAKE_CXX_VISIBILITY_PRESET=${CMAKE_CXX_VISIBILITY_PRESET}
-DCMAKE_VISIBILITY_INLINES_HIDDEN=${CMAKE_VISIBILITY_INLINES_HIDDEN}
-DCMAKE_POSITION_INDEPENDENT_CODE=ON
-DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE}
-DCMAKE_C_FLAGS=${EXPAT_C_FLAGS}
-DCMAKE_CXX_FLAGS=${EXPAT_CXX_FLAGS}
-DCMAKE_CXX_STANDARD=${CMAKE_CXX_STANDARD}
-DCMAKE_INSTALL_MESSAGE=${CMAKE_INSTALL_MESSAGE}
-DCMAKE_INSTALL_PREFIX=${_EXT_DIST_ROOT}
-DCMAKE_INSTALL_BINDIR=${CMAKE_INSTALL_BINDIR}
-DCMAKE_INSTALL_DATADIR=${CMAKE_INSTALL_DATADIR}
-DCMAKE_INSTALL_LIBDIR=${CMAKE_INSTALL_LIBDIR}
-DCMAKE_INSTALL_INCLUDEDIR=${CMAKE_INSTALL_INCLUDEDIR}
-DCMAKE_OBJECT_PATH_MAX=${CMAKE_OBJECT_PATH_MAX}
-DEXPAT_BUILD_DOCS=OFF
-DEXPAT_BUILD_EXAMPLES=OFF
-DEXPAT_BUILD_TESTS=OFF
-DEXPAT_BUILD_TOOLS=OFF
-DEXPAT_SHARED_LIBS=OFF
)
if(CMAKE_TOOLCHAIN_FILE)
set(EXPAT_CMAKE_ARGS
${EXPAT_CMAKE_ARGS} -DCMAKE_TOOLCHAIN_FILE=${CMAKE_TOOLCHAIN_FILE})
endif()
if(APPLE)
string(REPLACE ";" "$<SEMICOLON>" ESCAPED_CMAKE_OSX_ARCHITECTURES "${CMAKE_OSX_ARCHITECTURES}")
set(EXPAT_CMAKE_ARGS
${EXPAT_CMAKE_ARGS}
-DCMAKE_OSX_DEPLOYMENT_TARGET=${CMAKE_OSX_DEPLOYMENT_TARGET}
-DCMAKE_OSX_ARCHITECTURES=${ESCAPED_CMAKE_OSX_ARCHITECTURES}
)
endif()
if (ANDROID)
set(EXPAT_CMAKE_ARGS
${EXPAT_CMAKE_ARGS}
-DANDROID_PLATFORM=${ANDROID_PLATFORM}
-DANDROID_ABI=${ANDROID_ABI}
-DANDROID_STL=${ANDROID_STL})
endif()
# Hack to let imported target be built from ExternalProject_Add
file(MAKE_DIRECTORY ${expat_INCLUDE_DIR})
string(REPLACE "." ";" VERSION_LIST ${expat_VERSION})
list(GET VERSION_LIST 0 expat_VERSION_MAJOR)
list(GET VERSION_LIST 1 expat_VERSION_MINOR)
list(GET VERSION_LIST 2 expat_VERSION_PATCH)
ExternalProject_Add(expat_install
GIT_REPOSITORY "https://github.com/libexpat/libexpat.git"
GIT_TAG "R_${expat_VERSION_MAJOR}_${expat_VERSION_MINOR}_${expat_VERSION_PATCH}"
GIT_CONFIG advice.detachedHead=false
GIT_SHALLOW TRUE
PREFIX "${_EXT_BUILD_ROOT}/libexpat"
BUILD_BYPRODUCTS ${expat_LIBRARY}
SOURCE_SUBDIR expat
CMAKE_ARGS ${EXPAT_CMAKE_ARGS}
EXCLUDE_FROM_ALL TRUE
BUILD_COMMAND ""
INSTALL_COMMAND
${CMAKE_COMMAND} --build .
--config ${CMAKE_BUILD_TYPE}
--target install
--parallel
)
add_dependencies(expat::expat expat_install)
if(OCIO_VERBOSE)
message(STATUS "Installing expat: ${expat_LIBRARY} (version \"${expat_VERSION}\")")
endif()
endif()
endif()
###############################################################################
### Configure target ###
if(_expat_TARGET_CREATE)
set_target_properties(expat::expat PROPERTIES
IMPORTED_LOCATION ${expat_LIBRARY}
INTERFACE_INCLUDE_DIRECTORIES ${expat_INCLUDE_DIR}
)
mark_as_advanced(expat_INCLUDE_DIR expat_LIBRARY expat_VERSION)
endif()
@@ -1,142 +0,0 @@
# SPDX-License-Identifier: BSD-3-Clause
# Copyright Contributors to the OpenColorIO Project.
#
# Install lcms2
#
# Variables defined by this module:
# lcms2_FOUND - Indicate whether the library was found or not
# lcms2_LIBRARY - Path to the library file
# lcms2_INCLUDE_DIR - Location of the header files
# lcms2_VERSION - Library's version
#
# Global targets defined by this module:
# lcms2::lcms2
#
###############################################################################
### Configure target ###
if(NOT TARGET lcms2::lcms2)
add_library(lcms2::lcms2 UNKNOWN IMPORTED GLOBAL)
set(_lcms2_TARGET_CREATE TRUE)
endif()
###############################################################################
### Install package from source ###
if(NOT lcms2_FOUND AND OCIO_INSTALL_EXT_PACKAGES AND NOT OCIO_INSTALL_EXT_PACKAGES STREQUAL NONE)
include(ExternalProject)
set(_EXT_DIST_ROOT "${PROJECT_BINARY_DIR}/ext/dist")
set(_EXT_BUILD_ROOT "${PROJECT_BINARY_DIR}/ext/build")
# Set find_package standard args
set(lcms2_FOUND TRUE)
if(OCIO_lcms2_RECOMMENDED_VERSION)
set(lcms2_VERSION ${OCIO_lcms2_RECOMMENDED_VERSION})
else()
set(lcms2_VERSION ${lcms2_FIND_VERSION})
endif()
set(lcms2_INCLUDE_DIR "${_EXT_DIST_ROOT}/${CMAKE_INSTALL_INCLUDEDIR}/lcms2")
set(lcms2_LIBRARY
"${_EXT_DIST_ROOT}/${CMAKE_INSTALL_LIBDIR}/${CMAKE_STATIC_LIBRARY_PREFIX}lcms2${CMAKE_STATIC_LIBRARY_SUFFIX}")
if(_lcms2_TARGET_CREATE)
if(UNIX)
set(lcms2_C_FLAGS "${lcms2_C_FLAGS} -fvisibility=hidden -fPIC")
endif()
if("${CMAKE_CXX_COMPILER_ID}" MATCHES "GNU")
set(lcms2_C_FLAGS "${lcms2_C_FLAGS} -Wno-aggressive-loop-optimizations")
endif()
string(STRIP "${lcms2_C_FLAGS}" lcms2_C_FLAGS)
# NOTE: Depending of the compiler version lcm2 2.2 does not compile with C++17 so revert
# to C++11 because the library is only used by a cmd line tool.
set(lcms2_CXX_STANDARD ${CMAKE_CXX_STANDARD})
if(${CMAKE_CXX_STANDARD} GREATER_EQUAL 17)
set(lcms2_CXX_STANDARD 11)
endif()
set(lcms2_CMAKE_ARGS
${lcms2_CMAKE_ARGS}
-DCMAKE_C_FLAGS=${lcms2_C_FLAGS}
-DCMAKE_CXX_STANDARD=${lcms2_CXX_STANDARD}
-DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE}
-DCMAKE_INSTALL_MESSAGE=${CMAKE_INSTALL_MESSAGE}
-DCMAKE_INSTALL_PREFIX=${_EXT_DIST_ROOT}
-DCMAKE_INSTALL_BINDIR=${CMAKE_INSTALL_BINDIR}
-DCMAKE_INSTALL_LIBDIR=${CMAKE_INSTALL_LIBDIR}
-DCMAKE_INSTALL_INCLUDEDIR=${CMAKE_INSTALL_INCLUDEDIR}
-DCMAKE_OBJECT_PATH_MAX=${CMAKE_OBJECT_PATH_MAX}
-DBUILD_SHARED_LIBS=OFF
)
if(CMAKE_TOOLCHAIN_FILE)
set(lcms2_CMAKE_ARGS
${lcms2_CMAKE_ARGS} -DCMAKE_TOOLCHAIN_FILE=${CMAKE_TOOLCHAIN_FILE})
endif()
if(APPLE)
string(REPLACE ";" "$<SEMICOLON>" ESCAPED_CMAKE_OSX_ARCHITECTURES "${CMAKE_OSX_ARCHITECTURES}")
set(lcms2_CMAKE_ARGS
${lcms2_CMAKE_ARGS}
-DCMAKE_OSX_DEPLOYMENT_TARGET=${CMAKE_OSX_DEPLOYMENT_TARGET}
-DCMAKE_OSX_ARCHITECTURES=${ESCAPED_CMAKE_OSX_ARCHITECTURES}
)
endif()
if (ANDROID)
set(lcms2_CMAKE_ARGS
${lcms2_CMAKE_ARGS}
-DANDROID_PLATFORM=${ANDROID_PLATFORM}
-DANDROID_ABI=${ANDROID_ABI}
-DANDROID_STL=${ANDROID_STL})
endif()
# Hack to let imported target be built from ExternalProject_Add
file(MAKE_DIRECTORY ${lcms2_INCLUDE_DIR})
ExternalProject_Add(lcms2_install
GIT_REPOSITORY "https://github.com/mm2/Little-CMS.git"
GIT_TAG "lcms${lcms2_VERSION}"
GIT_CONFIG advice.detachedHead=false
GIT_SHALLOW TRUE
PREFIX "${_EXT_BUILD_ROOT}/Little-CMS"
BUILD_BYPRODUCTS ${lcms2_LIBRARY}
CMAKE_ARGS ${lcms2_CMAKE_ARGS}
EXCLUDE_FROM_ALL TRUE
PATCH_COMMAND
${CMAKE_COMMAND} -E copy
"${PROJECT_SOURCE_DIR}/share/cmake/projects/Buildlcms2.cmake"
"CMakeLists.txt"
BUILD_COMMAND ""
INSTALL_COMMAND
${CMAKE_COMMAND} --build .
--config ${CMAKE_BUILD_TYPE}
--target install
--parallel
)
add_dependencies(lcms2::lcms2 lcms2_install)
if(OCIO_VERBOSE)
message(STATUS "Installing lcms2: ${lcms2_LIBRARY} (version \"${lcms2_VERSION}\")")
endif()
endif()
endif()
###############################################################################
### Configure target ###
if(_lcms2_TARGET_CREATE)
set_target_properties(lcms2::lcms2 PROPERTIES
IMPORTED_LOCATION ${lcms2_LIBRARY}
INTERFACE_INCLUDE_DIRECTORIES ${lcms2_INCLUDE_DIR}
)
mark_as_advanced(lcms2_INCLUDE_DIR lcms2_LIBRARY lcms2_VERSION)
endif()
@@ -1,154 +0,0 @@
# SPDX-License-Identifier: BSD-3-Clause
# Copyright Contributors to the OpenColorIO Project.
#
# Install minizip-ng
#
# Variables defined by this module:
# minizip-ng_FOUND - Indicate whether the library was found or not
# minizip-ng_LIBRARY - Path to the library file
# minizip-ng_INCLUDE_DIR - Location of the header files
# minizip-ng_VERSION - Library's version
#
# Global targets defined by this module:
# minizip-ng::minizip-ng
#
# Link against the following target:
# ZLIB::ZLIB
#
###############################################################################
### Create target
if(NOT TARGET MINIZIP::minizip-ng)
add_library(MINIZIP::minizip-ng UNKNOWN IMPORTED GLOBAL)
set(_minizip-ng_TARGET_CREATE TRUE)
endif()
###############################################################################
### Install package from source ###
if(NOT minizip-ng_FOUND AND OCIO_INSTALL_EXT_PACKAGES AND NOT OCIO_INSTALL_EXT_PACKAGES STREQUAL NONE)
include(ExternalProject)
include(GNUInstallDirs)
set(_EXT_DIST_ROOT "${PROJECT_BINARY_DIR}/ext/dist")
set(_EXT_BUILD_ROOT "${PROJECT_BINARY_DIR}/ext/build")
# Set find_package standard args
set(minizip-ng_FOUND TRUE)
if(OCIO_minizip-ng_RECOMMENDED_VERSION)
set(minizip-ng_VERSION ${OCIO_minizip-ng_RECOMMENDED_VERSION})
else()
set(minizip-ng_VERSION ${minizip-ng_FIND_VERSION})
endif()
set(minizip-ng_INCLUDE_DIR "${_EXT_DIST_ROOT}/${CMAKE_INSTALL_INCLUDEDIR}/minizip-ng")
# Minizip-ng use a hardcoded lib prefix instead of CMAKE_STATIC_LIBRARY_PREFIX
set(_minizip-ng_LIB_PREFIX "lib")
set(minizip-ng_LIBRARY
"${_EXT_DIST_ROOT}/${CMAKE_INSTALL_LIBDIR}/${_minizip-ng_LIB_PREFIX}minizip-ng${_minizip-ng_LIB_SUFFIX}${CMAKE_STATIC_LIBRARY_SUFFIX}")
if(_minizip-ng_TARGET_CREATE)
set(minizip-ng_CMAKE_ARGS
${minizip-ng_CMAKE_ARGS}
-DCMAKE_CXX_VISIBILITY_PRESET=${CMAKE_CXX_VISIBILITY_PRESET}
-DCMAKE_VISIBILITY_INLINES_HIDDEN=${CMAKE_VISIBILITY_INLINES_HIDDEN}
-DCMAKE_POSITION_INDEPENDENT_CODE=ON
-DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE}
-DCMAKE_CXX_STANDARD=${CMAKE_CXX_STANDARD}
-DCMAKE_INSTALL_MESSAGE=${CMAKE_INSTALL_MESSAGE}
-DCMAKE_INSTALL_PREFIX=${_EXT_DIST_ROOT}
-DCMAKE_INSTALL_BINDIR=${CMAKE_INSTALL_BINDIR}
-DCMAKE_INSTALL_DATADIR=${CMAKE_INSTALL_DATADIR}
-DCMAKE_INSTALL_LIBDIR=${CMAKE_INSTALL_LIBDIR}
# Since the other modules create a subfolder for the includes by default and since
# minizip-ng does not, a suffix is added to CMAKE_INSTALL_INCLUDEDIR in order to
# install the headers under a subdirectory named "minizip-ng".
# Note that this does not affect external builds for minizip-ng.
-DCMAKE_INSTALL_INCLUDEDIR=${CMAKE_INSTALL_INCLUDEDIR}/minizip-ng
-DCMAKE_OBJECT_PATH_MAX=${CMAKE_OBJECT_PATH_MAX}
-DBUILD_SHARED_LIBS=OFF
-DMZ_OPENSSL=OFF
-DMZ_LIBBSD=OFF
-DMZ_BUILD_TESTS=OFF
-DMZ_COMPAT=OFF
-DMZ_BZIP2=OFF
-DMZ_LZMA=OFF
-DMZ_LIBCOMP=OFF
-DMZ_ZSTD=OFF
-DMZ_PKCRYPT=OFF
-DMZ_WZAES=OFF
-DMZ_SIGNING=OFF
-DMZ_ZLIB=ON
-DMZ_ICONV=OFF
-DMZ_FETCH_LIBS=OFF
-DMZ_FORCE_FETCH_LIBS=OFF
-DZLIB_LIBRARY=${ZLIB_LIBRARIES}
-DZLIB_INCLUDE_DIR=${ZLIB_INCLUDE_DIRS}
)
if(CMAKE_TOOLCHAIN_FILE)
set(minizip-ng_CMAKE_ARGS
${minizip-ng_CMAKE_ARGS} -DCMAKE_TOOLCHAIN_FILE=${CMAKE_TOOLCHAIN_FILE})
endif()
if(APPLE)
string(REPLACE ";" "$<SEMICOLON>" ESCAPED_CMAKE_OSX_ARCHITECTURES "${CMAKE_OSX_ARCHITECTURES}")
set(minizip-ng_CMAKE_ARGS
${minizip-ng_CMAKE_ARGS}
-DCMAKE_OSX_DEPLOYMENT_TARGET=${CMAKE_OSX_DEPLOYMENT_TARGET}
-DCMAKE_OSX_ARCHITECTURES=${ESCAPED_CMAKE_OSX_ARCHITECTURES}
)
endif()
if (ANDROID)
set(minizip-ng_CMAKE_ARGS
${minizip-ng_CMAKE_ARGS}
-DANDROID_PLATFORM=${ANDROID_PLATFORM}
-DANDROID_ABI=${ANDROID_ABI}
-DANDROID_STL=${ANDROID_STL})
endif()
endif()
# Hack to let imported target be built from ExternalProject_Add
file(MAKE_DIRECTORY ${minizip-ng_INCLUDE_DIR})
ExternalProject_Add(minizip-ng_install
GIT_REPOSITORY "https://github.com/zlib-ng/minizip-ng.git"
GIT_TAG "${minizip-ng_VERSION}"
GIT_CONFIG advice.detachedHead=false
GIT_SHALLOW TRUE
PREFIX "${_EXT_BUILD_ROOT}/libminizip-ng"
BUILD_BYPRODUCTS ${minizip-ng_LIBRARY}
CMAKE_ARGS ${minizip-ng_CMAKE_ARGS}
EXCLUDE_FROM_ALL TRUE
BUILD_COMMAND ""
INSTALL_COMMAND
${CMAKE_COMMAND} --build .
--config ${CMAKE_BUILD_TYPE}
--target install
--parallel
)
add_dependencies(MINIZIP::minizip-ng minizip-ng_install)
if(OCIO_VERBOSE)
message(STATUS "Installing minizip-ng: ${minizip-ng_LIBRARY} (version \"${minizip-ng_VERSION}\")")
endif()
endif()
###############################################################################
### Configure target ###
if(_minizip-ng_TARGET_CREATE)
set_target_properties(MINIZIP::minizip-ng PROPERTIES
IMPORTED_LOCATION "${minizip-ng_LIBRARY}"
INTERFACE_INCLUDE_DIRECTORIES "${minizip-ng_INCLUDE_DIR}"
)
mark_as_advanced(minizip-ng_INCLUDE_DIR minizip-ng_LIBRARY minizip-ng_VERSION)
target_link_libraries(MINIZIP::minizip-ng INTERFACE ZLIB::ZLIB)
endif()
@@ -1,86 +0,0 @@
# SPDX-License-Identifier: BSD-3-Clause
# Copyright Contributors to the OpenColorIO Project.
#
# Install openfx
#
# Variables defined by this module:
# openfx_FOUND - Indicate whether the library was found or not
# openfx_INCLUDE_DIR - Location of the header files
# openfx_VERSION - Library's version
#
# Global targets defined by this module:
# openfx::module
#
###############################################################################
### Create target
if(NOT TARGET openfx::module)
add_library(openfx::module INTERFACE IMPORTED GLOBAL)
set(_openfx_TARGET_CREATE TRUE)
endif()
###############################################################################
### Install package from source ###
if(NOT openfx_FOUND AND OCIO_INSTALL_EXT_PACKAGES AND NOT OCIO_INSTALL_EXT_PACKAGES STREQUAL NONE)
include(ExternalProject)
include(GNUInstallDirs)
set(_EXT_DIST_ROOT "${PROJECT_BINARY_DIR}/ext/dist")
set(_EXT_BUILD_ROOT "${PROJECT_BINARY_DIR}/ext/build")
set(_openfx_INSTALL_DIR "${_EXT_BUILD_ROOT}/openfx/src/openfx_install")
# Set find_package standard args
set(openfx_FOUND TRUE)
if(OCIO_openfx_RECOMMENDED_VERSION)
set(openfx_VERSION ${OCIO_openfx_RECOMMENDED_VERSION})
else()
set(openfx_VERSION ${openfx_FIND_VERSION})
endif()
set(openfx_INCLUDE_DIR "${_EXT_DIST_ROOT}/${CMAKE_INSTALL_INCLUDEDIR}/openfx")
if(_openfx_TARGET_CREATE)
# Hack to let imported target be built from ExternalProject_Add
file(MAKE_DIRECTORY ${openfx_INCLUDE_DIR})
include(VersionUtils)
split_version_string(${openfx_VERSION} openfx)
ExternalProject_Add(openfx_install
GIT_REPOSITORY "https://github.com/ofxa/openfx.git"
# The latest version from 2015 is OFX_Release_1_4_TAG.
# Need to be careful since older version might have the patch number in the tag.
GIT_TAG "OFX_Release_${openfx_VERSION_MAJOR}_${openfx_VERSION_MINOR}_TAG"
GIT_CONFIG advice.detachedHead=false
GIT_SHALLOW TRUE
PREFIX "${_EXT_BUILD_ROOT}/openfx"
BUILD_BYPRODUCTS ${openfx_INCLUDE_DIR}
CONFIGURE_COMMAND ""
BUILD_COMMAND
${CMAKE_COMMAND} -E copy_directory
"${_EXT_BUILD_ROOT}/openfx/src/openfx_install/include"
"${openfx_INCLUDE_DIR}"
INSTALL_COMMAND ""
CMAKE_ARGS ${openfx_CMAKE_ARGS}
EXCLUDE_FROM_ALL TRUE
)
add_dependencies(openfx::module openfx_install)
if(OCIO_VERBOSE)
message(STATUS "Installing openfx: ${openfx_INCLUDE_DIR} (version \"${openfx_VERSION}\")")
endif()
endif()
endif()
###############################################################################
### Configure target ###
if(_openfx_TARGET_CREATE)
set_target_properties(openfx::module PROPERTIES
INTERFACE_INCLUDE_DIRECTORIES ${openfx_INCLUDE_DIR}
)
mark_as_advanced(openfx_INCLUDE_DIR)
endif()
@@ -1,122 +0,0 @@
# SPDX-License-Identifier: BSD-3-Clause
# Copyright Contributors to the OpenColorIO Project.
#
# Install pybind11
#
# Variables defined by this module:
# pybind11_FOUND - Indicate whether the library was found or not
# pybind11_INCLUDE_DIR - Location of the header files
# pybind11_VERSION - Library's version
#
# Global targets defined by this module:
# pybind11::module
#
###############################################################################
### Create target ###
if(NOT TARGET pybind11::module)
add_library(pybind11::module INTERFACE IMPORTED GLOBAL)
set(_pybind11_TARGET_CREATE TRUE)
endif()
###############################################################################
### Install package from source ###
if(NOT pybind11_FOUND AND OCIO_INSTALL_EXT_PACKAGES AND NOT OCIO_INSTALL_EXT_PACKAGES STREQUAL NONE)
include(ExternalProject)
include(GNUInstallDirs)
set(_EXT_DIST_ROOT "${PROJECT_BINARY_DIR}/ext/dist")
set(_EXT_BUILD_ROOT "${PROJECT_BINARY_DIR}/ext/build")
# Set find_package standard args
set(pybind11_FOUND TRUE)
if(OCIO_pybind11_RECOMMENDED_VERSION)
set(pybind11_VERSION ${OCIO_pybind11_RECOMMENDED_VERSION})
else()
set(pybind11_VERSION ${pybind11_FIND_VERSION})
endif()
set(pybind11_INCLUDE_DIR "${_EXT_DIST_ROOT}/${CMAKE_INSTALL_INCLUDEDIR}")
if(_pybind11_TARGET_CREATE)
# Hack to let imported target be built from ExternalProject_Add
file(MAKE_DIRECTORY ${pybind11_INCLUDE_DIR})
set(pybind11_CMAKE_ARGS
${pybind11_CMAKE_ARGS}
-DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE}
-DCMAKE_CXX_STANDARD=${CMAKE_CXX_STANDARD}
-DCMAKE_INSTALL_MESSAGE=${CMAKE_INSTALL_MESSAGE}
-DCMAKE_INSTALL_PREFIX=${_EXT_DIST_ROOT}
-DCMAKE_INSTALL_BINDIR=${CMAKE_INSTALL_BINDIR}
-DCMAKE_INSTALL_DATADIR=${CMAKE_INSTALL_DATADIR}
-DCMAKE_INSTALL_LIBDIR=${CMAKE_INSTALL_LIBDIR}
-DCMAKE_INSTALL_INCLUDEDIR=${CMAKE_INSTALL_INCLUDEDIR}
-DCMAKE_OBJECT_PATH_MAX=${CMAKE_OBJECT_PATH_MAX}
# Using FindPython mode (PYBIND11_FINDPYTHON=ON) doesn't seem to
# work when building on docker manylinux images where Development
# component is not available but is hardcoded in pybind11 script.
-DPYTHON_EXECUTABLE=${Python_EXECUTABLE}
-DPYBIND11_INSTALL=ON
-DPYBIND11_TEST=OFF
)
if(CMAKE_TOOLCHAIN_FILE)
set(pybind11_CMAKE_ARGS
${pybind11_CMAKE_ARGS} -DCMAKE_TOOLCHAIN_FILE=${CMAKE_TOOLCHAIN_FILE})
endif()
if(APPLE)
string(REPLACE ";" "$<SEMICOLON>" ESCAPED_CMAKE_OSX_ARCHITECTURES "${CMAKE_OSX_ARCHITECTURES}")
set(pybind11_CMAKE_ARGS
${pybind11_CMAKE_ARGS}
-DCMAKE_OSX_DEPLOYMENT_TARGET=${CMAKE_OSX_DEPLOYMENT_TARGET}
-DCMAKE_OSX_ARCHITECTURES=${ESCAPED_CMAKE_OSX_ARCHITECTURES}
)
endif()
if (ANDROID)
set(pybind11_CMAKE_ARGS
${pybind11_CMAKE_ARGS}
-DANDROID_PLATFORM=${ANDROID_PLATFORM}
-DANDROID_ABI=${ANDROID_ABI}
-DANDROID_STL=${ANDROID_STL})
endif()
ExternalProject_Add(pybind11_install
GIT_REPOSITORY "https://github.com/pybind/pybind11.git"
GIT_TAG "v${pybind11_VERSION}"
GIT_CONFIG advice.detachedHead=false
GIT_SHALLOW TRUE
PREFIX "${_EXT_BUILD_ROOT}/pybind11"
BUILD_BYPRODUCTS ${pybind11_INCLUDE_DIR}
CMAKE_ARGS ${pybind11_CMAKE_ARGS}
EXCLUDE_FROM_ALL TRUE
BUILD_COMMAND ""
INSTALL_COMMAND
${CMAKE_COMMAND} --build .
--config ${CMAKE_BUILD_TYPE}
--target install
--parallel
)
add_dependencies(pybind11::module pybind11_install)
if(OCIO_VERBOSE)
message(STATUS "Installing pybind11: ${pybind11_INCLUDE_DIR} (version \"${pybind11_VERSION}\")")
endif()
endif()
endif()
###############################################################################
### Configure target ###
if(_pybind11_TARGET_CREATE)
set_target_properties(pybind11::module PROPERTIES
INTERFACE_INCLUDE_DIRECTORIES ${pybind11_INCLUDE_DIR}
)
mark_as_advanced(pybind11_INCLUDE_DIR pybind11_VERSION)
endif()
@@ -1,134 +0,0 @@
# SPDX-License-Identifier: BSD-3-Clause
# Copyright Contributors to the OpenColorIO Project.
#
# Install pystring
#
# Variables defined by this module:
# pystring_FOUND - Indicate whether the library was found or not
# pystring_LIBRARY - Path to the library file
# pystring_INCLUDE_DIR - Location of the header files
# pystring_VERSION - Library's version
#
# Global targets defined by this module:
# pystring::pystring
#
###############################################################################
### Configure target ###
if(NOT TARGET pystring::pystring)
add_library(pystring::pystring UNKNOWN IMPORTED GLOBAL)
set(_pystring_TARGET_CREATE TRUE)
endif()
###############################################################################
### Install package from source ###
if(NOT pystring_FOUND AND OCIO_INSTALL_EXT_PACKAGES AND NOT OCIO_INSTALL_EXT_PACKAGES STREQUAL NONE)
include(ExternalProject)
set(_EXT_DIST_ROOT "${PROJECT_BINARY_DIR}/ext/dist")
set(_EXT_BUILD_ROOT "${PROJECT_BINARY_DIR}/ext/build")
# Set find_package standard args
set(pystring_FOUND TRUE)
if(OCIO_pystring_RECOMMENDED_VERSION)
set(pystring_VERSION ${OCIO_pystring_RECOMMENDED_VERSION})
else()
set(pystring_VERSION ${pystring_FIND_VERSION})
endif()
set(pystring_INCLUDE_DIR "${_EXT_DIST_ROOT}/${CMAKE_INSTALL_INCLUDEDIR}")
set(pystring_LIBRARY
"${_EXT_DIST_ROOT}/${CMAKE_INSTALL_LIBDIR}/${CMAKE_STATIC_LIBRARY_PREFIX}pystring${CMAKE_STATIC_LIBRARY_SUFFIX}")
if(_pystring_TARGET_CREATE)
if(MSVC)
set(pystring_CXX_FLAGS "${pystring_CXX_FLAGS} /EHsc")
endif()
string(STRIP "${pystring_CXX_FLAGS}" pystring_CXX_FLAGS)
set(pystring_CMAKE_ARGS
${pystring_CMAKE_ARGS}
-DCMAKE_CXX_VISIBILITY_PRESET=${CMAKE_CXX_VISIBILITY_PRESET}
-DCMAKE_VISIBILITY_INLINES_HIDDEN=${CMAKE_VISIBILITY_INLINES_HIDDEN}
-DCMAKE_POSITION_INDEPENDENT_CODE=ON
-DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE}
-DCMAKE_CXX_FLAGS=${pystring_CXX_FLAGS}
-DCMAKE_CXX_STANDARD=${CMAKE_CXX_STANDARD}
-DCMAKE_INSTALL_MESSAGE=${CMAKE_INSTALL_MESSAGE}
-DCMAKE_INSTALL_PREFIX=${_EXT_DIST_ROOT}
-DCMAKE_INSTALL_BINDIR=${CMAKE_INSTALL_BINDIR}
-DCMAKE_INSTALL_LIBDIR=${CMAKE_INSTALL_LIBDIR}
-DCMAKE_INSTALL_INCLUDEDIR=${CMAKE_INSTALL_INCLUDEDIR}
-DCMAKE_OBJECT_PATH_MAX=${CMAKE_OBJECT_PATH_MAX}
)
if(CMAKE_TOOLCHAIN_FILE)
set(pystring_CMAKE_ARGS
${pystring_CMAKE_ARGS} -DCMAKE_TOOLCHAIN_FILE=${CMAKE_TOOLCHAIN_FILE})
endif()
if(APPLE)
string(REPLACE ";" "$<SEMICOLON>" ESCAPED_CMAKE_OSX_ARCHITECTURES "${CMAKE_OSX_ARCHITECTURES}")
set(pystring_CMAKE_ARGS
${pystring_CMAKE_ARGS}
-DCMAKE_OSX_DEPLOYMENT_TARGET=${CMAKE_OSX_DEPLOYMENT_TARGET}
-DCMAKE_OSX_ARCHITECTURES=${ESCAPED_CMAKE_OSX_ARCHITECTURES}
)
endif()
if (ANDROID)
set(pystring_CMAKE_ARGS
${pystring_CMAKE_ARGS}
-DANDROID_PLATFORM=${ANDROID_PLATFORM}
-DANDROID_ABI=${ANDROID_ABI}
-DANDROID_STL=${ANDROID_STL})
endif()
# Hack to let imported target be built from ExternalProject_Add
file(MAKE_DIRECTORY ${pystring_INCLUDE_DIR})
ExternalProject_Add(pystring_install
GIT_REPOSITORY "https://github.com/imageworks/pystring.git"
GIT_TAG "v${pystring_VERSION}"
GIT_CONFIG advice.detachedHead=false
GIT_SHALLOW TRUE
PREFIX "${_EXT_BUILD_ROOT}/pystring"
BUILD_BYPRODUCTS ${pystring_LIBRARY}
CMAKE_ARGS ${pystring_CMAKE_ARGS}
EXCLUDE_FROM_ALL TRUE
PATCH_COMMAND
${CMAKE_COMMAND} -E copy
"${PROJECT_SOURCE_DIR}/share/cmake/projects/Buildpystring.cmake"
"CMakeLists.txt"
BUILD_COMMAND ""
INSTALL_COMMAND
${CMAKE_COMMAND} --build .
--config ${CMAKE_BUILD_TYPE}
--target install
--parallel
)
add_dependencies(pystring::pystring pystring_install)
if(OCIO_VERBOSE)
message(STATUS "Installing pystring: ${pystring_LIBRARY} (version \"${pystring_VERSION}\")")
endif()
endif()
endif()
###############################################################################
### Configure target ###
if(_pystring_TARGET_CREATE)
set_target_properties(pystring::pystring PROPERTIES
IMPORTED_LOCATION ${pystring_LIBRARY}
INTERFACE_INCLUDE_DIRECTORIES ${pystring_INCLUDE_DIR}
)
mark_as_advanced(pystring_INCLUDE_DIR pystring_LIBRARY pystring_VERSION)
endif()
@@ -1,43 +0,0 @@
# SPDX-License-Identifier: BSD-3-Clause
# Copyright Contributors to the OpenColorIO Project.
#
# Install sse2neon (header-only version)
# https://github.com/DLTcollab/sse2neon
#
#
# Global targets defined by this module:
# sse2neon
###############################################################################
# Download sse2neon using FetchContent and make it available at configure time.
include(FetchContent)
set(FETCHCONTENT_BASE_DIR "${CMAKE_BINARY_DIR}/ext/build/sse2neon")
FetchContent_Declare(sse2neon
GIT_REPOSITORY https://github.com/DLTcollab/sse2neon.git
GIT_TAG v1.6.0
)
# FetchContent_MakeAvailable is not available until CMake 3.14+.
# Using FetchContent_GetProperties and FetchContent_Populate instead.
FetchContent_GetProperties(sse2neon)
if(NOT sse2neon_POPULATED)
FetchContent_Populate(sse2neon)
set(_EXT_DIST_INCLUDE "${CMAKE_BINARY_DIR}/ext/dist/${CMAKE_INSTALL_INCLUDEDIR}")
file(COPY "${sse2neon_SOURCE_DIR}/sse2neon.h" DESTINATION "${_EXT_DIST_INCLUDE}/sse2neon")
# sse2neon_INCLUDE_DIR is used internally for CheckSupportSSEUsingSSE2NEON.cmake and to create sse2neon
# target for OCIO.
set(sse2neon_INCLUDE_DIR "${sse2neon_SOURCE_DIR}")
# Any changes to the following lines must be replicated in ./CMakeLists.txt as well.
# Create a target for sse2neon (non-imported)
add_library(sse2neon INTERFACE)
# Add the include directories to the target.
target_include_directories(sse2neon INTERFACE "${sse2neon_INCLUDE_DIR}")
# Ignore the warnings coming from sse2neon.h as they are false positives.
target_compile_options(sse2neon INTERFACE -Wno-unused-parameter)
endif()
@@ -1,171 +0,0 @@
# SPDX-License-Identifier: BSD-3-Clause
# Copyright Contributors to the OpenColorIO Project.
#
# Install yaml-cpp
#
# Variables defined by this module:
# yaml-cpp_FOUND - Indicate whether the library was found or not
# yaml-cpp_LIBRARY - Path to the library file
# yaml-cpp_INCLUDE_DIR - Location of the header files
# yaml-cpp_VERSION - Library's version
#
# Global targets defined by this module:
# yaml-cpp::yaml-cpp
#
# For compatibility with the upstream CMake package, the following variables and targets are defined:
# yaml-cpp::yaml-cpp - Alias of the yaml-cpp target
# YAML_CPP_LIBRARIES - Libraries to link against yaml-cpp
# YAML_CPP_INCLUDE_DIR - Include directory
#
###############################################################################
### Create target (if previous 'find_package' call hasn't) ###
if(NOT TARGET yaml-cpp)
add_library(yaml-cpp UNKNOWN IMPORTED GLOBAL)
set(_yaml-cpp_TARGET_CREATE TRUE)
endif()
###############################################################################
### Install package from source ###
if(NOT yaml-cpp_FOUND AND OCIO_INSTALL_EXT_PACKAGES AND NOT OCIO_INSTALL_EXT_PACKAGES STREQUAL NONE)
include(ExternalProject)
include(GNUInstallDirs)
set(_EXT_DIST_ROOT "${PROJECT_BINARY_DIR}/ext/dist")
set(_EXT_BUILD_ROOT "${PROJECT_BINARY_DIR}/ext/build")
# Set find_package standard args
set(yaml-cpp_FOUND TRUE)
if(OCIO_yaml-cpp_RECOMMENDED_VERSION)
set(yaml-cpp_VERSION ${OCIO_yaml-cpp_RECOMMENDED_VERSION})
else()
set(yaml-cpp_VERSION ${yaml-cpp_FIND_VERSION})
endif()
set(yaml-cpp_INCLUDE_DIR "${_EXT_DIST_ROOT}/${CMAKE_INSTALL_INCLUDEDIR}")
# Starting from 0.7.0, this is included on all platforms, we could also
# override CMAKE_DEBUG_POSTFIX to bypass it.
if(BUILD_TYPE_DEBUG)
string(APPEND _yaml-cpp_LIB_SUFFIX "d")
endif()
# Set the expected library name
set(yaml-cpp_LIBRARY
"${_EXT_DIST_ROOT}/${CMAKE_INSTALL_LIBDIR}/${CMAKE_STATIC_LIBRARY_PREFIX}yaml-cpp${_yaml-cpp_LIB_SUFFIX}${CMAKE_STATIC_LIBRARY_SUFFIX}")
if(_yaml-cpp_TARGET_CREATE)
if(MSVC)
set(yaml-cpp_CXX_FLAGS "${yaml-cpp_CXX_FLAGS} /EHsc")
endif()
if(UNIX)
if(USE_CLANG)
# Remove some global 'shadow' warnings.
set(yaml-cpp_CXX_FLAGS "${yaml-cpp_CXX_FLAGS} -Wno-shadow")
endif()
endif()
string(STRIP "${yaml-cpp_CXX_FLAGS}" yaml-cpp_CXX_FLAGS)
set(yaml-cpp_CMAKE_ARGS
${yaml-cpp_CMAKE_ARGS}
-DCMAKE_POLICY_DEFAULT_CMP0063=NEW
-DCMAKE_CXX_VISIBILITY_PRESET=${CMAKE_CXX_VISIBILITY_PRESET}
-DCMAKE_VISIBILITY_INLINES_HIDDEN=${CMAKE_VISIBILITY_INLINES_HIDDEN}
-DCMAKE_POSITION_INDEPENDENT_CODE=ON
-DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE}
-DCMAKE_CXX_FLAGS=${yaml-cpp_CXX_FLAGS}
-DCMAKE_CXX_STANDARD=${CMAKE_CXX_STANDARD}
-DCMAKE_INSTALL_MESSAGE=${CMAKE_INSTALL_MESSAGE}
-DCMAKE_INSTALL_PREFIX=${_EXT_DIST_ROOT}
-DCMAKE_INSTALL_BINDIR=${CMAKE_INSTALL_BINDIR}
-DCMAKE_INSTALL_DATADIR=${CMAKE_INSTALL_DATADIR}
-DCMAKE_INSTALL_LIBDIR=${CMAKE_INSTALL_LIBDIR}
-DCMAKE_INSTALL_INCLUDEDIR=${CMAKE_INSTALL_INCLUDEDIR}
-DCMAKE_OBJECT_PATH_MAX=${CMAKE_OBJECT_PATH_MAX}
-DBUILD_SHARED_LIBS=OFF
-DYAML_BUILD_SHARED_LIBS=OFF
-DYAML_CPP_BUILD_TESTS=OFF
-DYAML_CPP_BUILD_TOOLS=OFF
-DYAML_CPP_BUILD_CONTRIB=OFF
)
if(CMAKE_TOOLCHAIN_FILE)
set(yaml-cpp_CMAKE_ARGS
${yaml-cpp_CMAKE_ARGS} -DCMAKE_TOOLCHAIN_FILE=${CMAKE_TOOLCHAIN_FILE})
endif()
if(APPLE)
string(REPLACE ";" "$<SEMICOLON>" ESCAPED_CMAKE_OSX_ARCHITECTURES "${CMAKE_OSX_ARCHITECTURES}")
set(yaml-cpp_CMAKE_ARGS
${yaml-cpp_CMAKE_ARGS}
-DCMAKE_OSX_DEPLOYMENT_TARGET=${CMAKE_OSX_DEPLOYMENT_TARGET}
-DCMAKE_OSX_ARCHITECTURES=${ESCAPED_CMAKE_OSX_ARCHITECTURES}
)
endif()
if (ANDROID)
set(yaml-cpp_CMAKE_ARGS
${yaml-cpp_CMAKE_ARGS}
-DANDROID_PLATFORM=${ANDROID_PLATFORM}
-DANDROID_ABI=${ANDROID_ABI}
-DANDROID_STL=${ANDROID_STL})
endif()
set(yaml-cpp_GIT_TAG "yaml-cpp-${yaml-cpp_VERSION}")
# Hack to let imported target be built from ExternalProject_Add
file(MAKE_DIRECTORY ${yaml-cpp_INCLUDE_DIR})
ExternalProject_Add(yaml-cpp_install
GIT_REPOSITORY "https://github.com/jbeder/yaml-cpp.git"
GIT_TAG ${yaml-cpp_GIT_TAG}
GIT_CONFIG advice.detachedHead=false
GIT_SHALLOW TRUE
PREFIX "${_EXT_BUILD_ROOT}/yaml-cpp"
BUILD_BYPRODUCTS ${yaml-cpp_LIBRARY}
CMAKE_ARGS ${yaml-cpp_CMAKE_ARGS}
EXCLUDE_FROM_ALL TRUE
BUILD_COMMAND ""
INSTALL_COMMAND
${CMAKE_COMMAND} --build .
--config ${CMAKE_BUILD_TYPE}
--target install
--parallel
)
add_dependencies(yaml-cpp yaml-cpp_install)
if(OCIO_VERBOSE)
message(STATUS "Installing yaml-cpp: ${yaml-cpp_LIBRARY} (version \"${yaml-cpp_VERSION}\")")
endif()
endif()
endif()
###############################################################################
### Configure target ###
if(_yaml-cpp_TARGET_CREATE)
set_target_properties(yaml-cpp PROPERTIES
IMPORTED_LOCATION ${yaml-cpp_LIBRARY}
INTERFACE_INCLUDE_DIRECTORIES ${yaml-cpp_INCLUDE_DIR}
)
mark_as_advanced(yaml-cpp_INCLUDE_DIR yaml-cpp_LIBRARY yaml-cpp_VERSION)
endif()
###############################################################################
### Set variables for compatibility ###
if(TARGET yaml-cpp AND NOT TARGET yaml-cpp::yaml-cpp)
add_library(yaml-cpp::yaml-cpp ALIAS yaml-cpp)
endif()
if(yaml-cpp_INCLUDE_DIR)
set(YAML_CPP_INCLUDE_DIR "${yaml-cpp_INCLUDE_DIR}")
endif()
set(YAML_CPP_LIBRARIES yaml-cpp::yaml-cpp)
+2 -3
View File
@@ -15,13 +15,12 @@ file(GLOB SOURCES "src/*.c" "src/*.h")
add_library(${PROJECT_NAME} STATIC ${HEADERS} ${SOURCES})
if(UNIX)
set(lcms2_C_FLAGS "${lcms2_C_FLAGS};-fPIC")
set(lcms2_C_FLAGS "${lcms2_C_FLAGS} -fPIC")
endif()
set_target_properties(${PROJECT_NAME} PROPERTIES
LIBRARY_OUTPUT_NAME "${PROJECT_NAME}"
COMPILE_OPTIONS "${PLATFORM_COMPILE_OPTIONS};${lcms2_C_FLAGS}"
LINK_OPTIONS "${PLATFORM_LINK_OPTIONS}"
COMPILE_FLAGS "${PLATFORM_COMPILE_FLAGS} ${lcms2_C_FLAGS}"
PUBLIC_HEADER "${HEADERS}"
)
+2 -3
View File
@@ -18,12 +18,11 @@ set(SOURCES
add_library(${PROJECT_NAME} STATIC ${HEADERS} ${SOURCES})
if(UNIX)
set(pystring_CXX_FLAGS "${pystring_CXX_FLAGS};-fPIC")
set(pystring_CXX_FLAGS "${pystring_CXX_FLAGS} -fPIC")
endif()
set_target_properties(${PROJECT_NAME} PROPERTIES
COMPILE_OPTIONS "${PLATFORM_COMPILE_OPTIONS};${pystring_CXX_FLAGS}"
LINK_OPTIONS "${PLATFORM_LINK_OPTIONS}"
COMPILE_FLAGS "${PLATFORM_COMPILE_FLAGS} ${pystring_CXX_FLAGS}"
PUBLIC_HEADER "${HEADERS}"
)
@@ -1,27 +0,0 @@
# SPDX-License-Identifier: BSD-3-Clause
# Copyright Contributors to the OpenColorIO Project.
# Checks for ARM NEON availability
include(CheckCXXSourceCompiles)
set(_cmake_osx_architectures_orig "${CMAKE_OSX_ARCHITECTURES}")
if(APPLE)
set(CMAKE_OSX_ARCHITECTURES "arm64")
endif()
set(source_code "
#include <arm_neon.h>
int main()
{
float32x4_t v = vdupq_n_f32(0);
return 0;
}")
check_cxx_source_compiles ("${source_code}" COMPILER_SUPPORTS_ARM_NEON)
set(CMAKE_OSX_ARCHITECTURES "${_cmake_osx_architectures_orig}")
unset(_cmake_osx_architectures_orig)
mark_as_advanced(COMPILER_SUPPORTS_ARM_NEON)
-60
View File
@@ -1,60 +0,0 @@
# SPDX-License-Identifier: BSD-3-Clause
# Copyright Contributors to the OpenColorIO Project.
set(_cmake_cxx_flags_orig "${CMAKE_CXX_FLAGS}")
if(APPLE AND ("${CMAKE_OSX_ARCHITECTURES}" MATCHES "arm64;x86_64"
OR "${CMAKE_OSX_ARCHITECTURES}" MATCHES "x86_64;arm64"))
set(__universal_build 1)
set(_cmake_osx_architectures_orig "${CMAKE_OSX_ARCHITECTURES}")
endif()
if(MSVC)
set(CMAKE_CXX_FLAGS "/w /arch:AVX")
elseif(USE_GCC OR USE_CLANG)
set(CMAKE_CXX_FLAGS "-w -mavx")
endif()
if (APPLE AND __universal_build)
# Force the test to build under x86_64
set(CMAKE_OSX_ARCHITECTURES "x86_64")
# Apple has an automatic translation layer from SSE to ARM Neon.
endif()
set(AVX_CODE "
#include <iostream>
#include <immintrin.h>
int main()
{
// Create two arrays of floats
float a[8] = {1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0};
float b[8] = {2.0, 4.0, 6.0, 8.0, 10.0, 12.0, 14.0, 16.0};
_mm256_add_ps(_mm256_load_ps(a), _mm256_load_ps(b));
return 0;
}
")
file(WRITE "${CMAKE_BINARY_DIR}/CMakeTmp/avx_test.cpp" "${AVX_CODE}")
message(STATUS "Performing Test COMPILER_SUPPORTS_AVX")
try_compile(COMPILER_SUPPORTS_AVX
"${CMAKE_BINARY_DIR}/CMakeTmp"
"${CMAKE_BINARY_DIR}/CMakeTmp/avx_test.cpp"
)
if(COMPILER_SUPPORTS_AVX)
message(STATUS "Performing Test COMPILER_SUPPORTS_AVX - Success")
else()
message(STATUS "Performing Test COMPILER_SUPPORTS_AVX - Failed")
endif()
set(CMAKE_CXX_FLAGS "${_cmake_cxx_flags_orig}")
unset(_cmake_cxx_flags_orig)
if(__universal_build)
set(CMAKE_OSX_ARCHITECTURES "${_cmake_osx_architectures_orig}")
unset(_cmake_osx_architectures_orig)
unset(__universal_build)
endif()
-68
View File
@@ -1,68 +0,0 @@
# SPDX-License-Identifier: BSD-3-Clause
# Copyright Contributors to the OpenColorIO Project.
include(CheckCXXSourceCompiles)
set(_cmake_cxx_flags_orig "${CMAKE_CXX_FLAGS}")
if(APPLE AND ("${CMAKE_OSX_ARCHITECTURES}" MATCHES "arm64;x86_64"
OR "${CMAKE_OSX_ARCHITECTURES}" MATCHES "x86_64;arm64"))
set(__universal_build 1)
set(_cmake_osx_architectures_orig "${CMAKE_OSX_ARCHITECTURES}")
endif()
if(MSVC)
set(CMAKE_CXX_FLAGS "/w /arch:AVX2")
elseif(USE_GCC OR USE_CLANG)
set(CMAKE_CXX_FLAGS "-w -mavx2 -mfma -mf16c")
endif()
if (APPLE AND __universal_build)
# Force the test to build under x86_64
set(CMAKE_OSX_ARCHITECTURES "x86_64")
# Apple has an automatic translation layer from SSE to ARM Neon.
endif()
set(AVX2_CODE "
#include <immintrin.h>
int main()
{
__m256i a = _mm256_set_epi32(1, 2, 3, 4, 5, 6, 7, 8);
__m256i b = _mm256_set_epi32(8, 7, 6, 5, 4, 3, 2, 1);
__m256i result = _mm256_add_epi32(a, b);
__m256 result_f16c = _mm256_cvtph_ps(_mm_set_epi16(1, 2, 3, 4, 5, 6, 7, 8));
__m256 result_fma = _mm256_fmadd_ps(
_mm256_set_ps(1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0),
_mm256_set_ps(8.0, 7.0, 6.0, 5.0, 4.0, 3.0, 2.0, 1.0),
_mm256_set_ps(1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0)
);
return 0;
}
")
file(WRITE "${CMAKE_BINARY_DIR}/CMakeTmp/avx2_test.cpp" "${AVX2_CODE}")
message(STATUS "Performing Test COMPILER_SUPPORTS_AVX2")
try_compile(COMPILER_SUPPORTS_AVX2
"${CMAKE_BINARY_DIR}/CMakeTmp"
"${CMAKE_BINARY_DIR}/CMakeTmp/avx2_test.cpp"
)
if(COMPILER_SUPPORTS_AVX2)
message(STATUS "Performing Test COMPILER_SUPPORTS_AVX2 - Success")
else()
message(STATUS "Performing Test COMPILER_SUPPORTS_AVX2 - Failed")
endif()
set(CMAKE_CXX_FLAGS "${_cmake_cxx_flags_orig}")
unset(_cmake_cxx_flags_orig)
if(__universal_build)
set(CMAKE_OSX_ARCHITECTURES "${_cmake_osx_architectures_orig}")
unset(_cmake_osx_architectures_orig)
unset(__universal_build)
endif()
@@ -1,56 +0,0 @@
# SPDX-License-Identifier: BSD-3-Clause
# Copyright Contributors to the OpenColorIO Project.
include(CheckCXXSourceCompiles)
set(_cmake_cxx_flags_orig "${CMAKE_CXX_FLAGS}")
if(APPLE AND ("${CMAKE_OSX_ARCHITECTURES}" MATCHES "arm64;x86_64"
OR "${CMAKE_OSX_ARCHITECTURES}" MATCHES "x86_64;arm64"))
set(__universal_build 1)
set(_cmake_osx_architectures_orig "${CMAKE_OSX_ARCHITECTURES}")
endif()
if(MSVC)
set(CMAKE_CXX_FLAGS "/w /arch:AVX512")
elseif(USE_GCC OR USE_CLANG)
set(CMAKE_CXX_FLAGS "-w -mavx512f")
endif()
if (APPLE AND __universal_build)
# Force the test to build under x86_64
set(CMAKE_OSX_ARCHITECTURES "x86_64")
# Apple has an automatic translation layer from SSE to ARM Neon.
endif()
set(AVX512_CODE "
#include <immintrin.h>
int main() {
__m512i vec = _mm512_set1_epi32(42);
return 0;
}
")
file(WRITE "${CMAKE_BINARY_DIR}/CMakeTmp/avx512_test.cpp" "${AVX512_CODE}")
message(STATUS "Performing Test COMPILER_SUPPORTS_AVX512")
try_compile(COMPILER_SUPPORTS_AVX512
"${CMAKE_BINARY_DIR}/CMakeTmp"
"${CMAKE_BINARY_DIR}/CMakeTmp/avx512_test.cpp"
)
if(COMPILER_SUPPORTS_AVX512)
message(STATUS "Performing Test COMPILER_SUPPORTS_AVX512 - Success")
else()
message(STATUS "Performing Test COMPILER_SUPPORTS_AVX512 - Failed")
endif()
set(CMAKE_CXX_FLAGS "${_cmake_cxx_flags_orig}")
unset(_cmake_cxx_flags_orig)
if(__universal_build)
set(CMAKE_OSX_ARCHITECTURES "${_cmake_osx_architectures_orig}")
unset(_cmake_osx_architectures_orig)
unset(__universal_build)
endif()
-56
View File
@@ -1,56 +0,0 @@
# SPDX-License-Identifier: BSD-3-Clause
# Copyright Contributors to the OpenColorIO Project.
include(CheckCXXSourceCompiles)
set(_cmake_cxx_flags_orig "${CMAKE_CXX_FLAGS}")
if(APPLE AND ("${CMAKE_OSX_ARCHITECTURES}" MATCHES "arm64;x86_64"
OR "${CMAKE_OSX_ARCHITECTURES}" MATCHES "x86_64;arm64"))
set(__universal_build 1)
set(_cmake_osx_architectures_orig "${CMAKE_OSX_ARCHITECTURES}")
endif()
# MSVC doesn't have flags
if(USE_GCC OR USE_CLANG)
set(CMAKE_CXX_FLAGS "-w -mf16c")
endif()
if (APPLE AND __universal_build)
# Force the test to build under x86_64
set(CMAKE_OSX_ARCHITECTURES "x86_64")
# Apple has an automatic translation layer from SSE to ARM Neon.
endif()
set(F16C_CODE "
#include <immintrin.h>
int main()
{
_mm_cvtph_ps(_mm_set1_epi16(0x3C00));
return 0;
}
")
file(WRITE "${CMAKE_BINARY_DIR}/CMakeTmp/f16c_test.cpp" "${F16C_CODE}")
message(STATUS "Performing Test COMPILER_SUPPORTS_F16C")
try_compile(COMPILER_SUPPORTS_F16C
"${CMAKE_BINARY_DIR}/CMakeTmp"
"${CMAKE_BINARY_DIR}/CMakeTmp/f16c_test.cpp"
)
if(COMPILER_SUPPORTS_F16C)
message(STATUS "Performing Test COMPILER_SUPPORTS_F16C - Success")
else()
message(STATUS "Performing Test COMPILER_SUPPORTS_F16C - Failed")
endif()
set(CMAKE_CXX_FLAGS "${_cmake_cxx_flags_orig}")
unset(_cmake_cxx_flags_orig)
if(__universal_build)
set(CMAKE_OSX_ARCHITECTURES "${_cmake_osx_architectures_orig}")
unset(_cmake_osx_architectures_orig)
unset(__universal_build)
endif()
+11 -16
View File
@@ -7,30 +7,28 @@
include(PackageUtils)
include(SelectLibraryConfigurations)
include(Colors)
include(ocio_handle_dependency)
if((OCIO_BUILD_TESTS AND OCIO_BUILD_GPU_TESTS) OR OCIO_BUILD_APPS)
set(OCIO_GL_ENABLED ON)
set(OCIO_USE_GLVND OFF)
set(OCIO_EGL_HEADLESS OFF)
ocio_handle_dependency(OpenGL COMPONENTS OpenGL)
find_package(OpenGL COMPONENTS OpenGL)
if(NOT OpenGL_OpenGL_FOUND AND NOT OPENGL_GLU_FOUND)
package_root_message(OpenGL)
set(OCIO_GL_ENABLED OFF)
endif()
if(NOT APPLE)
# On some Linux platform, the glew-config.cmake is found first.
# PREFER_CONFIG assure that config mode will be used first and fallback to module mode.
ocio_handle_dependency( GLEW PREFER_CONFIG
MIN_VERSION 2.1.0
RECOMMENDED_VERSION 2.1.0
RECOMMENDED_VERSION_REASON "Latest version tested with OCIO")
# On some Linux platform, the glew-config.cmake is found first so make it explicit
# to fall back on the regular search if not found.
find_package(GLEW CONFIG QUIET)
if(NOT GLEW_FOUND)
package_root_message(GLEW)
set(OCIO_GL_ENABLED OFF)
find_package(GLEW)
if(NOT GLEW_FOUND)
package_root_message(GLEW)
set(OCIO_GL_ENABLED OFF)
endif()
else()
# Expected variables GLEW_LIBRARIES and GLEW_INCLUDE_DIRS are missing so create
# the mandatory one.
@@ -69,10 +67,7 @@ if((OCIO_BUILD_TESTS AND OCIO_BUILD_GPU_TESTS) OR OCIO_BUILD_APPS)
endif()
endif()
ocio_handle_dependency( GLUT
MIN_VERSION 3.2.1
RECOMMENDED_VERSION 3.2.1
RECOMMENDED_VERSION_REASON "Latest version tested with OCIO")
find_package(GLUT)
if(NOT GLUT_FOUND)
package_root_message(GLUT)
set(OCIO_GL_ENABLED OFF)
@@ -95,7 +90,7 @@ if((OCIO_BUILD_TESTS AND OCIO_BUILD_GPU_TESTS) OR OCIO_BUILD_APPS)
message(STATUS "Can't find EGL without GLVND support; can't render headlessly")
set(OCIO_USE_HEADLESS OFF)
else()
ocio_handle_dependency(OpenGL COMPONENTS EGL)
find_package(OpenGL COMPONENTS EGL)
if(NOT OpenGL_EGL_FOUND)
message(WARNING "EGL component missing; can't render headlessly")
set(OCIO_USE_HEADLESS OFF)
+17 -51
View File
@@ -3,67 +3,33 @@
include(CheckCXXSourceCompiles)
set(_cmake_cxx_flags_orig "${CMAKE_CXX_FLAGS}")
set(_cmake_required_flags_old "${CMAKE_REQUIRED_FLAGS}")
if(APPLE AND ("${CMAKE_OSX_ARCHITECTURES}" MATCHES "arm64;x86_64"
OR "${CMAKE_OSX_ARCHITECTURES}" MATCHES "x86_64;arm64"))
set(__universal_build 1)
set(_cmake_osx_architectures_orig "${CMAKE_OSX_ARCHITECTURES}")
endif()
if(MSVC)
# x86_64 always has SSE2
if("${CMAKE_SIZEOF_VOID_P}" STREQUAL "8")
# Simulate the same message we would get by using check_cxx_source_compiles.
message(STATUS "x86_64 always support SSE2 - COMPILER_SUPPORTS_SSE2 - Success")
# By setting the variable to 1, tuhe check_cxx_source_compiles will be skipped automatically.
set(COMPILER_SUPPORTS_SSE2 1)
else()
check_cxx_compiler_flag("/arch:SSE2" COMPILER_SUPPORTS_SSE2)
if(NOT CMAKE_SIZE_OF_VOID_P EQUAL 8)
# As CheckCXXCompilerFlag implicitly uses CMAKE_CXX_FLAGS some custom flags could trigger
# unrelated warnings causing a detection failure. So, the code disables all warnings to focus
# on the SSE2 detection.
if(USE_MSVC)
set(CMAKE_REQUIRED_FLAGS "/w /arch:SSE2")
elseif(USE_GCC OR USE_CLANG)
set(CMAKE_REQUIRED_FLAGS "-w -msse2")
endif()
elseif(USE_GCC OR USE_CLANG)
set(CMAKE_CXX_FLAGS "-w -msse2")
endif()
if (APPLE AND __universal_build)
# Force the test to build under x86_64
set(CMAKE_OSX_ARCHITECTURES "x86_64")
# Apple has an automatic translation layer from SSE to ARM Neon.
endif()
set(SSE2_CODE "
check_cxx_source_compiles ("
#include <emmintrin.h>
int main()
{
int main ()
{
__m128d a, b;
double vals[2] = {0};
a = _mm_loadu_pd (vals);
b = _mm_add_pd (a,a);
_mm_storeu_pd (vals,b);
return (0);
}
")
}"
HAVE_SSE2)
file(WRITE "${CMAKE_BINARY_DIR}/CMakeTmp/sse2_test.cpp" "${SSE2_CODE}")
set(CMAKE_REQUIRED_FLAGS "${_cmake_required_flags_old}")
unset(_cmake_required_flags_old)
message(STATUS "Performing Test COMPILER_SUPPORTS_SSE2")
try_compile(COMPILER_SUPPORTS_SSE2
"${CMAKE_BINARY_DIR}/CMakeTmp"
"${CMAKE_BINARY_DIR}/CMakeTmp/sse2_test.cpp"
)
if(COMPILER_SUPPORTS_SSE2)
message(STATUS "Performing Test COMPILER_SUPPORTS_SSE2 - Success")
else()
message(STATUS "Performing Test COMPILER_SUPPORTS_SSE2 - Failed")
endif()
set(CMAKE_REQUIRED_FLAGS "${_cmake_cxx_flags_orig}")
unset(_cmake_cxx_flags_orig)
if(__universal_build)
set(CMAKE_OSX_ARCHITECTURES "${_cmake_osx_architectures_orig}")
unset(_cmake_osx_architectures_orig)
unset(__universal_build)
endif()
mark_as_advanced(HAVE_SSE2)
-56
View File
@@ -1,56 +0,0 @@
# SPDX-License-Identifier: BSD-3-Clause
# Copyright Contributors to the OpenColorIO Project.
include(CheckCXXSourceCompiles)
set(_cmake_cxx_flags_orig "${CMAKE_CXX_FLAGS}")
if(APPLE AND ("${CMAKE_OSX_ARCHITECTURES}" MATCHES "arm64;x86_64"
OR "${CMAKE_OSX_ARCHITECTURES}" MATCHES "x86_64;arm64"))
set(__universal_build 1)
set(_cmake_osx_architectures_orig "${CMAKE_OSX_ARCHITECTURES}")
endif()
# MSVC doesn't have flags
if(USE_GCC OR USE_CLANG)
set(CMAKE_CXX_FLAGS "-w -msse3")
endif()
if (APPLE AND __universal_build)
# Force the test to build under x86_64
set(CMAKE_OSX_ARCHITECTURES "x86_64")
# Apple has an automatic translation layer from SSE to ARM Neon.
endif()
set(SSE3_CODE "
#include <pmmintrin.h>
int main()
{
_mm_addsub_ps(_mm_setzero_ps(), _mm_setzero_ps());
return 0;
}
")
file(WRITE "${CMAKE_BINARY_DIR}/CMakeTmp/sse3_test.cpp" "${SSE3_CODE}")
message(STATUS "Performing Test COMPILER_SUPPORTS_SSE3")
try_compile(COMPILER_SUPPORTS_SSE3
"${CMAKE_BINARY_DIR}/CMakeTmp"
"${CMAKE_BINARY_DIR}/CMakeTmp/sse3_test.cpp"
)
if(COMPILER_SUPPORTS_SSE3)
message(STATUS "Performing Test COMPILER_SUPPORTS_SSE3 - Success")
else()
message(STATUS "Performing Test COMPILER_SUPPORTS_SSE3 - Failed")
endif()
set(CMAKE_CXX_FLAGS "${_cmake_cxx_flags_orig}")
unset(_cmake_cxx_flags_orig)
if(__universal_build)
set(CMAKE_OSX_ARCHITECTURES "${_cmake_osx_architectures_orig}")
unset(_cmake_osx_architectures_orig)
unset(__universal_build)
endif()
-56
View File
@@ -1,56 +0,0 @@
# SPDX-License-Identifier: BSD-3-Clause
# Copyright Contributors to the OpenColorIO Project.
include(CheckCXXSourceCompiles)
set(_cmake_cxx_flags_orig "${CMAKE_CXX_FLAGS}")
if(APPLE AND ("${CMAKE_OSX_ARCHITECTURES}" MATCHES "arm64;x86_64"
OR "${CMAKE_OSX_ARCHITECTURES}" MATCHES "x86_64;arm64"))
set(__universal_build 1)
set(_cmake_osx_architectures_orig "${CMAKE_OSX_ARCHITECTURES}")
endif()
# MSVC doesn't have flags
if(USE_GCC OR USE_CLANG)
set(CMAKE_CXX_FLAGS "-w -msse4")
endif()
if (APPLE AND __universal_build)
# Force the test to build under x86_64
set(CMAKE_OSX_ARCHITECTURES "x86_64")
# Apple has an automatic translation layer from SSE to ARM Neon.
endif()
set(SSE4_CODE "
#include <smmintrin.h>
int main()
{
_mm_blend_epi16(_mm_setzero_si128(), _mm_setzero_si128(), 0);
return 0;
}
")
file(WRITE "${CMAKE_BINARY_DIR}/CMakeTmp/sse4_test.cpp" "${SSE4_CODE}")
message(STATUS "Performing Test COMPILER_SUPPORTS_SSE4")
try_compile(COMPILER_SUPPORTS_SSE4
"${CMAKE_BINARY_DIR}/CMakeTmp"
"${CMAKE_BINARY_DIR}/CMakeTmp/sse4_test.cpp"
)
if(COMPILER_SUPPORTS_SSE4)
message(STATUS "Performing Test COMPILER_SUPPORTS_SSE4 - Success")
else()
message(STATUS "Performing Test COMPILER_SUPPORTS_SSE4 - Failed")
endif()
set(CMAKE_CXX_FLAGS "${_cmake_cxx_flags_orig}")
unset(_cmake_cxx_flags_orig)
if(__universal_build)
set(CMAKE_OSX_ARCHITECTURES "${_cmake_osx_architectures_orig}")
unset(_cmake_osx_architectures_orig)
unset(__universal_build)
endif()
-56
View File
@@ -1,56 +0,0 @@
# SPDX-License-Identifier: BSD-3-Clause
# Copyright Contributors to the OpenColorIO Project.
include(CheckCXXSourceCompiles)
set(_cmake_cxx_flags_orig "${CMAKE_CXX_FLAGS}")
if(APPLE AND ("${CMAKE_OSX_ARCHITECTURES}" MATCHES "arm64;x86_64"
OR "${CMAKE_OSX_ARCHITECTURES}" MATCHES "x86_64;arm64"))
set(__universal_build 1)
set(_cmake_osx_architectures_orig "${CMAKE_OSX_ARCHITECTURES}")
endif()
# MSVC doesn't have flags
if(USE_GCC OR USE_CLANG)
set(CMAKE_CXX_FLAGS "-w -msse4.2")
endif()
if (APPLE AND __universal_build)
# Force the test to build under x86_64
set(CMAKE_OSX_ARCHITECTURES "x86_64")
# Apple has an automatic translation layer from SSE to ARM Neon.
endif()
set(SSE42_CODE "
#include <nmmintrin.h>
int main()
{
_mm_cmpgt_epi64(_mm_set_epi64x(5, 10), _mm_set_epi64x(8, 5));
return 0;
}
")
file(WRITE "${CMAKE_BINARY_DIR}/CMakeTmp/sse42_test.cpp" "${SSE42_CODE}")
message(STATUS "Performing Test COMPILER_SUPPORTS_SSE42")
try_compile(COMPILER_SUPPORTS_SSE42
"${CMAKE_BINARY_DIR}/CMakeTmp"
"${CMAKE_BINARY_DIR}/CMakeTmp/sse42_test.cpp"
)
if(COMPILER_SUPPORTS_SSE42)
message(STATUS "Performing Test COMPILER_SUPPORTS_SSE42 - Success")
else()
message(STATUS "Performing Test COMPILER_SUPPORTS_SSE42 - Failed")
endif()
set(CMAKE_CXX_FLAGS "${_cmake_cxx_flags_orig}")
unset(_cmake_cxx_flags_orig)
if(__universal_build)
set(CMAKE_OSX_ARCHITECTURES "${_cmake_osx_architectures_orig}")
unset(_cmake_osx_architectures_orig)
unset(__universal_build)
endif()
@@ -1,70 +0,0 @@
# SPDX-License-Identifier: BSD-3-Clause
# Copyright Contributors to the OpenColorIO Project.
include(CheckCXXSourceCompiles)
set(_cmake_required_flags_orig "${CMAKE_REQUIRED_FLAGS}")
set(_cmake_required_includes_orig "${CMAKE_REQUIRED_INCLUDES}")
set(_cmake_osx_architectures_orig "${CMAKE_OSX_ARCHITECTURES}")
if(APPLE AND COMPILER_SUPPORTS_ARM_NEON)
if("${CMAKE_OSX_ARCHITECTURES}" MATCHES "arm64;x86_64" OR
"${CMAKE_OSX_ARCHITECTURES}" MATCHES "x86_64;arm64")
# universal build
# Force the test to build under arm64
set(CMAKE_OSX_ARCHITECTURES "arm64")
endif()
set(SSE2NEON_CODE "
#include <sse2neon.h>
int main()
{
// SSE2
__m128d a, b;
double vals[2] = {0};
a = _mm_loadu_pd (vals);
b = _mm_add_pd (a,a);
_mm_storeu_pd (vals,b);
// SSE3
_mm_addsub_ps(_mm_setzero_ps(), _mm_setzero_ps());
// SSSE3
_mm_shuffle_epi8(_mm_setzero_si128(), _mm_setzero_si128());
// SSE4
_mm_blend_epi16(_mm_setzero_si128(), _mm_setzero_si128(), 0);
// SSE 4.2
_mm_cmpgt_epi64(_mm_set_epi64x(5, 10), _mm_set_epi64x(8, 5));
return (0);
}
")
file(WRITE "${CMAKE_BINARY_DIR}/CMakeTmp/sse2neon_test.cpp" "${SSE2NEON_CODE}")
message(STATUS "Performing Test COMPILER_SUPPORTS_SSE_WITH_SSE2NEON")
try_compile(COMPILER_SUPPORTS_SSE_WITH_SSE2NEON
"${CMAKE_BINARY_DIR}/CMakeTmp"
"${CMAKE_BINARY_DIR}/CMakeTmp/sse2neon_test.cpp"
COMPILE_DEFINITIONS "-I${sse2neon_INCLUDE_DIR}"
)
if(COMPILER_SUPPORTS_SSE_WITH_SSE2NEON)
message(STATUS "Performing Test COMPILER_SUPPORTS_SSE_WITH_SSE2NEON - Success")
else()
message(STATUS "Performing Test COMPILER_SUPPORTS_SSE_WITH_SSE2NEON - Failed")
endif()
endif()
set(CMAKE_REQUIRED_FLAGS "${_cmake_required_flags_orig}")
set(CMAKE_REQUIRED_INCLUDES "${_cmake_required_includes_orig}")
set(CMAKE_OSX_ARCHITECTURES "${_cmake_osx_architectures_orig}")
unset(_cmake_required_flags_orig)
unset(_cmake_required_includes_orig)
unset(_cmake_osx_architectures_orig)
-56
View File
@@ -1,56 +0,0 @@
# SPDX-License-Identifier: BSD-3-Clause
# Copyright Contributors to the OpenColorIO Project.
include(CheckCXXSourceCompiles)
set(_cmake_cxx_flags_orig "${CMAKE_CXX_FLAGS}")
if(APPLE AND ("${CMAKE_OSX_ARCHITECTURES}" MATCHES "arm64;x86_64"
OR "${CMAKE_OSX_ARCHITECTURES}" MATCHES "x86_64;arm64"))
set(__universal_build 1)
set(_cmake_osx_architectures_orig "${CMAKE_OSX_ARCHITECTURES}")
endif()
# MSVC doesn't have flags
if(USE_GCC OR USE_CLANG)
set(CMAKE_CXX_FLAGS "-w -msse3")
endif()
if (APPLE AND __universal_build)
# Force the test to build under x86_64
set(CMAKE_OSX_ARCHITECTURES "x86_64")
# Apple has an automatic translation layer from SSE to ARM Neon.
endif()
set(SSSE3_CODE "
#include <tmmintrin.h>
int main()
{
_mm_shuffle_epi8(_mm_setzero_si128(), _mm_setzero_si128());
return 0;
}
")
file(WRITE "${CMAKE_BINARY_DIR}/CMakeTmp/ssse3_test.cpp" "${SSSE3_CODE}")
message(STATUS "Performing Test COMPILER_SUPPORTS_SSSE3")
try_compile(COMPILER_SUPPORTS_SSSE3
"${CMAKE_BINARY_DIR}/CMakeTmp"
"${CMAKE_BINARY_DIR}/CMakeTmp/ssse3_test.cpp"
)
if(COMPILER_SUPPORTS_SSSE3)
message(STATUS "Performing Test COMPILER_SUPPORTS_SSSE3 - Success")
else()
message(STATUS "Performing Test COMPILER_SUPPORTS_SSSE3 - Failed")
endif()
set(CMAKE_CXX_FLAGS "${_cmake_cxx_flags_orig}")
unset(_cmake_cxx_flags_orig)
if(__universal_build)
set(CMAKE_OSX_ARCHITECTURES "${_cmake_osx_architectures_orig}")
unset(_cmake_osx_architectures_orig)
unset(__universal_build)
endif()
@@ -1,98 +0,0 @@
# SPDX-License-Identifier: BSD-3-Clause
# Copyright Contributors to the OpenColorIO Project.
###############################################################################
# Check if compiler supports X86 SIMD extensions
# These checks use try_compile instead of check_cxx_source_compiles because the latter was causing
# false positives on Apple ARM architectures.
include(CheckSupportAVX)
include(CheckSupportAVX2)
include(CheckSupportAVX512)
include(CheckSupportSSE42)
include(CheckSupportSSE4)
include(CheckSupportSSSE3)
include(CheckSupportSSE3)
include(CheckSupportSSE2)
include(CheckSupportF16C)
if(MSVC)
if (COMPILER_SUPPORTS_SSE2)
set(OCIO_SSE2_ARGS "/arch:SSE2")
endif()
if (COMPILER_SUPPORTS_AVX)
set(OCIO_AVX_ARGS "/arch:AVX")
endif()
if (COMPILER_SUPPORTS_AVX2)
set(OCIO_AVX2_ARGS "/arch:AVX2")
endif()
else()
if (COMPILER_SUPPORTS_SSE2)
set(OCIO_SSE2_ARGS "-msse2")
endif()
if (COMPILER_SUPPORTS_AVX)
set(OCIO_AVX_ARGS "-mavx")
endif()
if (COMPILER_SUPPORTS_AVX2)
set(OCIO_AVX2_ARGS "-mavx2" "-mfma")
endif()
endif()
if(${OCIO_USE_AVX512} AND NOT ${COMPILER_SUPPORTS_AVX512})
message(STATUS "OCIO_USE_AVX512 requested but compiler does not support, disabling")
set(OCIO_USE_AVX512 OFF)
endif()
if(${OCIO_USE_AVX2} AND NOT ${COMPILER_SUPPORTS_AVX2})
message(STATUS "OCIO_USE_AVX2 requested but compiler does not support, disabling")
set(OCIO_USE_AVX2 OFF)
endif()
if(${OCIO_USE_AVX} AND NOT ${COMPILER_SUPPORTS_AVX})
message(STATUS "OCIO_USE_AVX requested but compiler does not support, disabling")
set(OCIO_USE_AVX OFF)
endif()
if(${OCIO_USE_SSE42} AND NOT ${COMPILER_SUPPORTS_SSE42})
message(STATUS "OCIO_USE_SSE42 requested but compiler does not support, disabling")
set(OCIO_USE_SSE42 OFF)
endif()
if(${OCIO_USE_SSE4} AND NOT ${COMPILER_SUPPORTS_SSE4})
message(STATUS "OCIO_USE_SSE4 requested but compiler does not support, disabling")
set(OCIO_USE_SSE4 OFF)
endif()
if(${OCIO_USE_SSSE3} AND NOT ${COMPILER_SUPPORTS_SSSE3})
message(STATUS "OCIO_USE_SSSE3 requested but compiler does not support, disabling")
set(OCIO_USE_SSSE3 OFF)
endif()
if(${OCIO_USE_SSE3} AND NOT ${COMPILER_SUPPORTS_SSE3})
message(STATUS "OCIO_USE_SSE3 requested but compiler does not support, disabling")
set(OCIO_USE_SSE3 OFF)
endif()
if(${OCIO_USE_SSE2} AND NOT ${COMPILER_SUPPORTS_SSE2})
message(STATUS "OCIO_USE_SSE2 requested but compiler does not support, disabling")
set(OCIO_USE_SSE2 OFF)
endif()
if(${OCIO_USE_F16C} AND NOT ${COMPILER_SUPPORTS_F16C})
message(STATUS "OCIO_USE_F16C requested but compiler does not support, disabling")
set(OCIO_USE_F16C OFF)
endif()
if(${OCIO_USE_F16C})
if(NOT MSVC)
list(APPEND OCIO_AVX_ARGS -mf16c)
list(APPEND OCIO_AVX2_ARGS -mf16c)
endif()
endif()
-16
View File
@@ -1,16 +0,0 @@
# SPDX-License-Identifier: BSD-3-Clause
# Copyright Contributors to the OpenColorIO Project.
string (ASCII 27 ColorEsc)
set(ColorReset "${ColorEsc}[m")
# Error
set(ColorError "${ColorEsc}[31m")
# Green
set(ColorSuccess "${ColorEsc}[32m")
# Yellow
set(ColorWarning "${ColorEsc}[33m")
set(ColorInfo "${ColorEsc}[34m")
set(ColorBoldWhite "${ColorEsc}[1;37m")
+30 -65
View File
@@ -5,118 +5,72 @@
###############################################################################
# Define the global compilation and link flags.
set(PLATFORM_COMPILE_OPTIONS "")
set(PLATFORM_LINK_OPTIONS "")
###############################################################################
# Verify SIMD compatibility
if(OCIO_USE_SIMD)
if (OCIO_ARCH_X86)
include(CheckSupportX86SIMD)
endif()
if (OCIO_USE_SSE2NEON AND COMPILER_SUPPORTS_ARM_NEON)
include(CheckSupportSSEUsingSSE2NEON)
if(NOT COMPILER_SUPPORTS_SSE_WITH_SSE2NEON)
set(OCIO_USE_SSE2NEON OFF)
endif()
endif()
else()
set(OCIO_USE_SSE2 OFF)
set(OCIO_USE_SSE3 OFF)
set(OCIO_USE_SSSE3 OFF)
set(OCIO_USE_SSE4 OFF)
set(OCIO_USE_SSE42 OFF)
set(OCIO_USE_AVX OFF)
set(OCIO_USE_AVX2 OFF)
set(OCIO_USE_AVX512 OFF)
set(OCIO_USE_F16C OFF)
set(OCIO_USE_SSE2NEON OFF)
endif()
if (NOT COMPILER_SUPPORTS_SSE2 AND NOT COMPILER_SUPPORTS_SSE_WITH_SSE2NEON AND
NOT COMPILER_SUPPORTS_SSE3 AND NOT COMPILER_SUPPORTS_SSSE3 AND
NOT COMPILER_SUPPORTS_SSE4 AND NOT COMPILER_SUPPORTS_SSE42 AND
NOT COMPILER_SUPPORTS_AVX AND NOT COMPILER_SUPPORTS_AVX2 AND NOT COMPILER_SUPPORTS_AVX512 AND
NOT COMPILER_SUPPORTS_F16C)
message(STATUS "Disabling SIMD optimizations, as the target doesn't support them")
set(OCIO_USE_SIMD OFF)
endif()
###############################################################################
# Compile flags
set(PLATFORM_COMPILE_FLAGS "")
if(USE_MSVC)
set(PLATFORM_COMPILE_OPTIONS "${PLATFORM_COMPILE_OPTIONS};/DUSE_MSVC")
set(PLATFORM_COMPILE_FLAGS "${PLATFORM_COMPILE_FLAGS} /DUSE_MSVC")
# /we4062 Enables warning in switch when an enumeration value is not explicitly handled.
set(PLATFORM_COMPILE_OPTIONS "${PLATFORM_COMPILE_OPTIONS};/EHsc;/DWIN32;/we4062")
set(PLATFORM_COMPILE_FLAGS "${PLATFORM_COMPILE_FLAGS} /EHsc /DWIN32 /we4062")
if(${CMAKE_CXX_STANDARD} GREATER_EQUAL 17)
# Inheriting from std::iterator is deprecated starting with C++17 and Yaml 0.6.3 does that.
set(PLATFORM_COMPILE_OPTIONS
"${PLATFORM_COMPILE_OPTIONS};/D_SILENCE_CXX17_ITERATOR_BASE_CLASS_DEPRECATION_WARNING"
set(PLATFORM_COMPILE_FLAGS
"${PLATFORM_COMPILE_FLAGS} /D_SILENCE_CXX17_ITERATOR_BASE_CLASS_DEPRECATION_WARNING"
)
endif()
# Explicitely specify the default warning level i.e. /W3.
# Note: Do not use /Wall (i.e. /W4) which adds 'informational' warnings.
set(PLATFORM_COMPILE_OPTIONS "${PLATFORM_COMPILE_OPTIONS};/W3")
set(PLATFORM_COMPILE_FLAGS "${PLATFORM_COMPILE_FLAGS} /W3")
# Do enable C4701 (Potentially uninitialized local variable 'name' used), which is level 4.
# This is because strtoX-based from_chars leave the value variable unmodified.
set(PLATFORM_COMPILE_OPTIONS "${PLATFORM_COMPILE_OPTIONS};/we4701")
set(PLATFORM_COMPILE_FLAGS "${PLATFORM_COMPILE_FLAGS} /we4701")
if(OCIO_WARNING_AS_ERROR)
set(PLATFORM_COMPILE_OPTIONS "${PLATFORM_COMPILE_OPTIONS};/WX")
set(PLATFORM_COMPILE_FLAGS "${PLATFORM_COMPILE_FLAGS} /WX")
endif()
elseif(USE_CLANG)
set(PLATFORM_COMPILE_OPTIONS "${PLATFORM_COMPILE_OPTIONS};-DUSE_CLANG")
set(PLATFORM_COMPILE_FLAGS "${PLATFORM_COMPILE_FLAGS} -DUSE_CLANG")
# Use of 'register' specifier must be removed for C++17 support.
set(PLATFORM_COMPILE_OPTIONS "${PLATFORM_COMPILE_OPTIONS};-Wno-deprecated-register")
set(PLATFORM_COMPILE_FLAGS "${PLATFORM_COMPILE_FLAGS} -Wno-deprecated-register")
elseif(USE_GCC)
set(PLATFORM_COMPILE_OPTIONS "${PLATFORM_COMPILE_OPTIONS};-DUSE_GCC")
set(PLATFORM_COMPILE_FLAGS "${PLATFORM_COMPILE_FLAGS} -DUSE_GCC")
endif()
if(USE_GCC OR USE_CLANG)
set(PLATFORM_COMPILE_OPTIONS "${PLATFORM_COMPILE_OPTIONS};-Wall")
set(PLATFORM_COMPILE_FLAGS "${PLATFORM_COMPILE_FLAGS} -Wall")
# Add more warning detection.
set(PLATFORM_COMPILE_OPTIONS "${PLATFORM_COMPILE_OPTIONS};-Wextra")
set(PLATFORM_COMPILE_FLAGS "${PLATFORM_COMPILE_FLAGS} -Wextra")
# -Wswitch-enum Enables warning in switch when an enumeration value is not explicitly handled.
set(PLATFORM_COMPILE_OPTIONS "${PLATFORM_COMPILE_OPTIONS};-Wswitch-enum")
set(PLATFORM_COMPILE_FLAGS "${PLATFORM_COMPILE_FLAGS} -Wswitch-enum")
if(OCIO_WARNING_AS_ERROR)
set(PLATFORM_COMPILE_OPTIONS "${PLATFORM_COMPILE_OPTIONS};-Werror")
set(PLATFORM_COMPILE_FLAGS "${PLATFORM_COMPILE_FLAGS} -Werror")
endif()
if(APPLE)
# TODO: There are still some deprecated methods.
set(PLATFORM_COMPILE_OPTIONS "${PLATFORM_COMPILE_OPTIONS};-Wno-deprecated-declarations")
endif()
if(OCIO_ENABLE_SANITIZER)
set(PLATFORM_COMPILE_OPTIONS "${PLATFORM_COMPILE_OPTIONS};-fno-omit-frame-pointer;-fsanitize=address")
set(PLATFORM_LINK_OPTIONS "${PLATFORM_LINK_OPTIONS};-fsanitize=address")
set(PLATFORM_COMPILE_FLAGS "${PLATFORM_COMPILE_FLAGS} -Wno-deprecated-declarations")
endif()
endif()
# An advanced variable will not be displayed in any of the cmake GUIs
mark_as_advanced(PLATFORM_COMPILE_OPTIONS)
mark_as_advanced(PLATFORM_LINK_OPTIONS)
mark_as_advanced(PLATFORM_COMPILE_FLAGS)
###############################################################################
@@ -129,10 +83,21 @@ set_unless_defined(CMAKE_CXX_VISIBILITY_PRESET hidden)
set_unless_defined(CMAKE_VISIBILITY_INLINES_HIDDEN YES)
###############################################################################
# Define if SSE2 can be used.
include(CheckSupportSSE2)
if(NOT HAVE_SSE2)
message(STATUS "Disabling SSE optimizations, as the target doesn't support them")
set(OCIO_USE_SSE OFF)
endif(NOT HAVE_SSE2)
###############################################################################
# Define RPATH.
if (UNIX AND NOT CMAKE_SKIP_RPATH AND NOT CMAKE_INSTALL_RPATH)
if (UNIX AND NOT CMAKE_SKIP_RPATH)
# With the 'usual' install path structure in mind, search from the bin directory
# (i.e. a binary loading a dynamic library) and then from the current directory
# (i.e. dynamic library loading another dynamic library).
+1 -1
View File
@@ -206,7 +206,7 @@ if !DO_CONFIGURE!==1 (
-DOCIO_BUILD_TESTS=ON^
-DOCIO_BUILD_GPU_TESTS=ON^
-DOCIO_BUILD_DOCS=OFF^
-DOCIO_USE_SIMD=ON^
-DOCIO_USE_SSE=ON^
-DOCIO_WARNING_AS_ERROR=ON^
-DOCIO_BUILD_JAVA=OFF^
"!OCIO_PATH!"
+4 -4
View File
@@ -114,8 +114,8 @@ def configure_file(src_filename, dst_filename):
"""
logger.info("Configuring file: {} -> {}".format(src_filename, dst_filename))
# PROJECT_SOURCE_DIR
# PROJECT_BINARY_DIR
# CMAKE_SOURCE_DIR
# CMAKE_BINARY_DIR
source_dir = binary_dir = ROOT
# CMAKE_PROJECT_NAME
@@ -145,8 +145,8 @@ def configure_file(src_filename, dst_filename):
data = f.read()
data = data\
.replace("@PROJECT_SOURCE_DIR@", source_dir)\
.replace("@PROJECT_BINARY_DIR@", binary_dir)\
.replace("@CMAKE_SOURCE_DIR@", source_dir)\
.replace("@CMAKE_BINARY_DIR@", binary_dir)\
.replace("@CMAKE_PROJECT_NAME@", name)\
.replace("@CMAKE_PROJECT_VERSION@", version)\
.replace("@CMAKE_PROJECT_DESCRIPTION@", desc)\
-338
View File
@@ -1,338 +0,0 @@
// SPDX-License-Identifier: BSD-3-Clause
// Copyright Contributors to the OpenColorIO Project.
#ifndef INCLUDED_OCIO_AVX_H
#define INCLUDED_OCIO_AVX_H
#include "CPUInfo.h"
#if OCIO_USE_AVX
#include <immintrin.h>
#include <stdio.h>
#include <OpenColorIO/OpenColorIO.h>
#include "BitDepthUtils.h"
// Macros for alignment declarations
#define AVX_SIMD_BYTES 32
#define AVX_ALIGN(decl) alignas(AVX_SIMD_BYTES) decl
namespace OCIO_NAMESPACE
{
inline __m256 avx_movelh_ps(__m256 a, __m256 b)
{
return _mm256_castpd_ps(_mm256_unpacklo_pd(_mm256_castps_pd(a), _mm256_castps_pd(b)));
}
inline __m256 avx_movehl_ps(__m256 a, __m256 b)
{
// NOTE: this is a and b are reversed to match sse2 movhlps which is different than unpckhpd
return _mm256_castpd_ps(_mm256_unpackhi_pd(_mm256_castps_pd(b), _mm256_castps_pd(a)));
}
inline __m256 avx_clamp(__m256 value, const __m256& maxValue)
{
value = _mm256_max_ps(value, _mm256_setzero_ps());
return _mm256_min_ps(value, maxValue);
}
inline void avxRGBATranspose_4x4_4x4(__m256 row0, __m256 row1, __m256 row2, __m256 row3,
__m256 &out_r, __m256 &out_g, __m256 &out_b, __m256 &out_a )
{
// the rgba transpose result will look this
//
// 0 1 2 3 0 1 2 3 0 1 2 3 0 1 2 3
// r0, g0, b0, a0 | r1, g1, b1, a1 r0, r2, r4, r6 | r1, r3, r5, r7
// r2, g2, b2, a2 | r3, g3, b3, a3 <==> g0, g2, g4, g6 | g1, g3, g5, g7
// r4, g4, b4, a4 | r5, g5, b5, a5 <==> b0, b2, b4, b6 | b1, b3, b5, b7
// r6, g6, b6, a6 | r7, g7, b7, a7 a0, a2, a4, a6 | a1, a4, a5, a7
// each 128 lane is transposed independently,
// the channel values end up with a even/odd shuffled order because of this.
// if exact order is important more cross lane shuffling is needed
__m256 tmp0 = _mm256_unpacklo_ps(row0, row1);
__m256 tmp2 = _mm256_unpacklo_ps(row2, row3);
__m256 tmp1 = _mm256_unpackhi_ps(row0, row1);
__m256 tmp3 = _mm256_unpackhi_ps(row2, row3);
out_r = avx_movelh_ps(tmp0, tmp2);
out_g = avx_movehl_ps(tmp2, tmp0);
out_b = avx_movelh_ps(tmp1, tmp3);
out_a = avx_movehl_ps(tmp3, tmp1);
}
inline __m256i avx_load_u8(__m128i a)
{
__m128i b = _mm_shuffle_epi32(a, _MM_SHUFFLE(1,0,3,1));
b = _mm_cvtepu8_epi32(b);
a = _mm_cvtepu8_epi32(a);
return _mm256_insertf128_si256(_mm256_castsi128_si256(a), b, 1);
}
inline __m128i avx_pack_u8(__m256i a, __m256i b)
{
const __m128i lo0_shuf = _mm_setr_epi8( 0, 4, 8,12, -1,-1,-1, -1, -1,-1,-1,-1, -1,-1,-1,-1);
const __m128i lo1_shuf = _mm_setr_epi8( -1,-1,-1,-1, 0, 4, 8, 12, -1,-1,-1,-1, -1,-1,-1,-1);
const __m128i hi0_shuf = _mm_setr_epi8( -1,-1,-1,-1, -1,-1,-1, -1, 0, 4, 8, 12, -1,-1,-1,-1);
const __m128i hi1_shuf = _mm_setr_epi8( -1,-1,-1,-1, -1,-1,-1, -1, -1,-1,-1,-1, 0, 4, 8, 12);
__m128i lo0 = _mm_shuffle_epi8(_mm256_castsi256_si128(a), lo0_shuf);
__m128i lo1 = _mm_shuffle_epi8(_mm256_extractf128_si256(a, 1), lo1_shuf);
__m128i hi0 = _mm_shuffle_epi8(_mm256_castsi256_si128(b), hi0_shuf);
__m128i hi1 = _mm_shuffle_epi8(_mm256_extractf128_si256(b, 1), hi1_shuf);
return _mm_or_si128(_mm_or_si128(_mm_or_si128(lo0, lo1), hi0), hi1);
}
// Note Packing functions perform no 0.0 - 1.0 normalization
// but perform 0 - max value clamping for integer formats
template<BitDepth BD> struct AVXRGBAPack {};
template <>
struct AVXRGBAPack<BIT_DEPTH_UINT8>
{
static inline void Load(const uint8_t *in, __m256& r, __m256& g, __m256& b, __m256& a)
{
__m256i rgba_00_07 = _mm256_loadu_si256((const __m256i*)in);
__m128i rgba_00_03 =_mm256_castsi256_si128(rgba_00_07);
__m128i rgba_04_07 =_mm256_extractf128_si256(rgba_00_07, 1);
// : 0, 1, 2, 3 | 4, 5, 6, 7 | 8, 9, 10, 11 | 12, 13, 14, 15
// rgba_x03 : r0, g0, b0, a0 | r1, g1, b1, a1 | r2, g2, b2, a2 | r3, g3, b3, a3
// rgba_x47 : r4, g4, b4, a4 | r5, g5, b5, a5 | r6, g6, b6, a6 | r7, g7, b7, a7
__m256 rgba0 = _mm256_cvtepi32_ps(avx_load_u8(rgba_00_03));
__m256 rgba1 = _mm256_cvtepi32_ps(avx_load_u8(_mm_shuffle_epi32(rgba_00_03, _MM_SHUFFLE(3, 2, 3, 2))));
__m256 rgba2 = _mm256_cvtepi32_ps(avx_load_u8(rgba_04_07));
__m256 rgba3 = _mm256_cvtepi32_ps(avx_load_u8(_mm_shuffle_epi32(rgba_04_07, _MM_SHUFFLE(3, 2, 3, 2))));
avxRGBATranspose_4x4_4x4(rgba0, rgba1, rgba2, rgba3, r, g, b, a);
}
static inline void Store(uint8_t *out, __m256 r, __m256 g, __m256 b, __m256 a)
{
__m256 rgba0, rgba1, rgba2, rgba3;
const __m256 maxValue = _mm256_set1_ps(255.0f);
avxRGBATranspose_4x4_4x4(r, g, b, a, rgba0, rgba1, rgba2, rgba3);
rgba0 = avx_clamp(rgba0, maxValue);
rgba1 = avx_clamp(rgba1, maxValue);
rgba2 = avx_clamp(rgba2, maxValue);
rgba3 = avx_clamp(rgba3, maxValue);
// NOTE note using cvtps which will round based on MXCSR register defaults to _MM_ROUND_NEAREST
__m256i rgba01 = _mm256_cvtps_epi32(rgba0);
__m256i rgba23 = _mm256_cvtps_epi32(rgba1);
__m256i rgba45 = _mm256_cvtps_epi32(rgba2);
__m256i rgba67 = _mm256_cvtps_epi32(rgba3);
__m128i lo = avx_pack_u8(rgba01, rgba23);
__m128i hi = avx_pack_u8(rgba45, rgba67);
__m256i rgba = _mm256_insertf128_si256(_mm256_castsi128_si256(lo), hi, 1);
_mm256_storeu_si256((__m256i*)out, rgba);
}
};
inline __m256i avx_unpack_u16(__m128i a)
{
__m128i b = _mm_shuffle_epi32(a, _MM_SHUFFLE(1,0,3,2));
b = _mm_cvtepu16_epi32(b);
a = _mm_cvtepu16_epi32(a);
return _mm256_insertf128_si256(_mm256_castsi128_si256(a), b, 1);
}
inline __m128i avx_pack_u16(__m256i a)
{
const __m128i lo_pack_shuffle16 = _mm_setr_epi8( 0, 1, 4, 5,
8, 9, 12, 13,
-1, -1, -1, -1,
-1, -1, -1, -1);
const __m128i hi_pack_shuffle16 = _mm_setr_epi8(-1, -1, -1, -1,
-1, -1, -1, -1,
0, 1, 4, 5,
8, 9, 12, 13);
__m128i hi = _mm256_extractf128_si256(a, 1);
__m128i lo = _mm256_castsi256_si128(a);
lo = _mm_shuffle_epi8(lo, lo_pack_shuffle16);
hi = _mm_shuffle_epi8(hi, hi_pack_shuffle16);
return _mm_or_si128(lo, hi);
}
template<BitDepth BD>
struct AVXRGBAPack16
{
typedef typename BitDepthInfo<BD>::Type Type;
static inline void Load(const Type *in, __m256& r, __m256& g, __m256& b, __m256& a)
{
// const __m256 scale = _mm256_set1_ps(1.0f / (float)BitDepthInfo<BD>::maxValue);
__m256i rgba_00_03 = _mm256_loadu_si256((const __m256i*)(in + 0));
__m256i rgba_04_07 = _mm256_loadu_si256((const __m256i*)(in + 16));
__m256 rgba0 = _mm256_cvtepi32_ps(avx_unpack_u16(_mm256_castsi256_si128(rgba_00_03)));
__m256 rgba1 = _mm256_cvtepi32_ps(avx_unpack_u16(_mm256_extractf128_si256(rgba_00_03, 1)));
__m256 rgba2 = _mm256_cvtepi32_ps(avx_unpack_u16(_mm256_castsi256_si128(rgba_04_07)));
__m256 rgba3 = _mm256_cvtepi32_ps(avx_unpack_u16(_mm256_extractf128_si256(rgba_04_07, 1)));
avxRGBATranspose_4x4_4x4(rgba0, rgba1, rgba2, rgba3, r, g, b, a);
}
static inline void Store(Type *out, __m256 r, __m256 g, __m256 b, __m256 a)
{
__m256 rgba0, rgba1, rgba2, rgba3;
__m128i lo, hi;
__m256i rgba;
const __m256 maxValue = _mm256_set1_ps((float)BitDepthInfo<BD>::maxValue);
avxRGBATranspose_4x4_4x4(r, g, b, a, rgba0, rgba1, rgba2, rgba3);
rgba0 = avx_clamp(rgba0, maxValue);
rgba1 = avx_clamp(rgba1, maxValue);
rgba2 = avx_clamp(rgba2, maxValue);
rgba3 = avx_clamp(rgba3, maxValue);
// NOTE note using cvtps which will round based on MXCSR register defaults to _MM_ROUND_NEAREST
__m256i rgba01 = _mm256_cvtps_epi32(rgba0);
__m256i rgba23 = _mm256_cvtps_epi32(rgba1);
__m256i rgba45 = _mm256_cvtps_epi32(rgba2);
__m256i rgba67 = _mm256_cvtps_epi32(rgba3);
lo = avx_pack_u16(rgba01);
hi = avx_pack_u16(rgba23);
rgba = _mm256_insertf128_si256(_mm256_castsi128_si256(lo), hi, 1);
_mm256_storeu_si256((__m256i*)(out+0), rgba);
lo = avx_pack_u16(rgba45);
hi = avx_pack_u16(rgba67);
rgba = _mm256_insertf128_si256(_mm256_castsi128_si256(lo), hi, 1);
_mm256_storeu_si256((__m256i*)(out+16), rgba);
}
};
template <>
struct AVXRGBAPack<BIT_DEPTH_UINT10>
{
static inline void Load(const uint16_t *in, __m256& r, __m256& g, __m256& b, __m256& a)
{
AVXRGBAPack16<BIT_DEPTH_UINT10>::Load(in, r, g, b, a);
}
static inline void Store(uint16_t *out, __m256 r, __m256 g, __m256 b, __m256 a)
{
AVXRGBAPack16<BIT_DEPTH_UINT10>::Store(out, r, g, b, a);
}
};
template <>
struct AVXRGBAPack<BIT_DEPTH_UINT12>
{
static inline void Load(const uint16_t *in, __m256& r, __m256& g, __m256& b, __m256& a)
{
AVXRGBAPack16<BIT_DEPTH_UINT12>::Load(in, r, g, b, a);
}
static inline void Store(uint16_t *out, __m256 r, __m256 g, __m256 b, __m256 a)
{
AVXRGBAPack16<BIT_DEPTH_UINT12>::Store(out, r, g, b, a);
}
};
template <>
struct AVXRGBAPack<BIT_DEPTH_UINT16>
{
static inline void Load(const uint16_t *in, __m256& r, __m256& g, __m256& b, __m256& a)
{
AVXRGBAPack16<BIT_DEPTH_UINT16>::Load(in, r, g, b, a);
}
static inline void Store(uint16_t *out, __m256 r, __m256 g, __m256 b, __m256 a)
{
AVXRGBAPack16<BIT_DEPTH_UINT16>::Store(out, r, g, b, a);
}
};
#if OCIO_USE_F16C
template <>
struct AVXRGBAPack<BIT_DEPTH_F16>
{
static inline void Load(const half *in, __m256& r, __m256& g, __m256& b, __m256& a)
{
__m256i rgba_00_03 = _mm256_loadu_si256((const __m256i*)(in + 0));
__m256i rgba_04_07 = _mm256_loadu_si256((const __m256i*)(in + 16));
__m256 rgba0 = _mm256_cvtph_ps(_mm256_castsi256_si128(rgba_00_03));
__m256 rgba1 = _mm256_cvtph_ps(_mm256_extractf128_si256(rgba_00_03, 1));
__m256 rgba2 = _mm256_cvtph_ps(_mm256_castsi256_si128(rgba_04_07));
__m256 rgba3 = _mm256_cvtph_ps(_mm256_extractf128_si256(rgba_04_07, 1));
avxRGBATranspose_4x4_4x4(rgba0, rgba1, rgba2, rgba3, r, g, b, a);
}
static inline void Store(half *out, __m256 r, __m256 g, __m256 b, __m256 a)
{
__m256 rgba0, rgba1, rgba2, rgba3;
__m256i rgba;
avxRGBATranspose_4x4_4x4(r, g, b, a, rgba0, rgba1, rgba2, rgba3);
__m128i rgba00_03 = _mm256_cvtps_ph(rgba0, 0);
__m128i rgba04_07 = _mm256_cvtps_ph(rgba1, 0);
__m128i rgba08_11 = _mm256_cvtps_ph(rgba2, 0);
__m128i rgba12_16 = _mm256_cvtps_ph(rgba3, 0);
rgba = _mm256_insertf128_si256(_mm256_castsi128_si256(rgba00_03), rgba04_07, 1);
_mm256_storeu_si256((__m256i*)(out+0), rgba);
rgba = _mm256_insertf128_si256(_mm256_castsi128_si256(rgba08_11), rgba12_16, 1);
_mm256_storeu_si256((__m256i*)(out+16), rgba);
}
};
#endif
template <>
struct AVXRGBAPack<BIT_DEPTH_F32>
{
static inline void Load(const float *in, __m256& r, __m256& g, __m256& b, __m256& a)
{
__m256 rgba0 = _mm256_loadu_ps(in + 0);
__m256 rgba1 = _mm256_loadu_ps(in + 8);
__m256 rgba2 = _mm256_loadu_ps(in + 16);
__m256 rgba3 = _mm256_loadu_ps(in + 24);
avxRGBATranspose_4x4_4x4(rgba0, rgba1, rgba2, rgba3, r, g, b, a);
}
static inline void Store(float *out, __m256 r, __m256 g, __m256 b, __m256 a)
{
__m256 rgba0, rgba1, rgba2, rgba3;
avxRGBATranspose_4x4_4x4(r, g, b, a, rgba0, rgba1, rgba2, rgba3);
_mm256_storeu_ps(out + 0, rgba0);
_mm256_storeu_ps(out + 8, rgba1);
_mm256_storeu_ps(out + 16, rgba2);
_mm256_storeu_ps(out + 24, rgba3);
}
};
} // namespace OCIO_NAMESPACE
#endif // OCIO_USE_AVX
#endif // INCLUDED_OCIO_AVX_H
-306
View File
@@ -1,306 +0,0 @@
// SPDX-License-Identifier: BSD-3-Clause
// Copyright Contributors to the OpenColorIO Project.
#ifndef INCLUDED_OCIO_AVX2_H
#define INCLUDED_OCIO_AVX2_H
#include "CPUInfo.h"
#if OCIO_USE_AVX2
#include <immintrin.h>
#include <stdio.h>
#include <OpenColorIO/OpenColorIO.h>
#include "BitDepthUtils.h"
// Macros for alignment declarations
#define AVX2_SIMD_BYTES 32
#define AVX2_ALIGN(decl) alignas(AVX2_SIMD_BYTES) decl
namespace OCIO_NAMESPACE
{
inline __m256 avx2_movelh_ps(__m256 a, __m256 b)
{
return _mm256_castpd_ps(_mm256_unpacklo_pd(_mm256_castps_pd(a), _mm256_castps_pd(b)));
}
inline __m256 avx2_movehl_ps(__m256 a, __m256 b)
{
// NOTE: this is a and b are reversed to match sse2 movhlps which is different than unpckhpd
return _mm256_castpd_ps(_mm256_unpackhi_pd(_mm256_castps_pd(b), _mm256_castps_pd(a)));
}
inline __m256 avx2_clamp(__m256 value, const __m256& maxValue)
{
value = _mm256_max_ps(value, _mm256_setzero_ps());
return _mm256_min_ps(value, maxValue);
}
inline void avx2RGBATranspose_4x4_4x4(__m256 row0, __m256 row1, __m256 row2, __m256 row3,
__m256 &out_r, __m256 &out_g, __m256 &out_b, __m256 &out_a )
{
// the rgba transpose result will look this
//
// 0 1 2 3 0 1 2 3 0 1 2 3 0 1 2 3
// r0, g0, b0, a0 | r1, g1, b1, a1 r0, r2, r4, r6 | r1, r3, r5, r7
// r2, g2, b2, a2 | r3, g3, b3, a3 <==> g0, g2, g4, g6 | g1, g3, g5, g7
// r4, g4, b4, a4 | r5, g5, b5, a5 <==> b0, b2, b4, b6 | b1, b3, b5, b7
// r6, g6, b6, a6 | r7, g7, b7, a7 a0, a2, a4, a6 | a1, a4, a5, a7
// each 128 lane is transposed independently,
// the channel values end up with a even/odd shuffled order because of this.
// if exact order is important more cross lane shuffling is needed
__m256 tmp0 = _mm256_unpacklo_ps(row0, row1);
__m256 tmp2 = _mm256_unpacklo_ps(row2, row3);
__m256 tmp1 = _mm256_unpackhi_ps(row0, row1);
__m256 tmp3 = _mm256_unpackhi_ps(row2, row3);
out_r = avx2_movelh_ps(tmp0, tmp2);
out_g = avx2_movehl_ps(tmp2, tmp0);
out_b = avx2_movelh_ps(tmp1, tmp3);
out_a = avx2_movehl_ps(tmp3, tmp1);
}
// Note Packing functions perform no 0.0 - 1.0 normalization
// but perform 0 - max value clamping for integer formats
template<BitDepth BD> struct AVX2RGBAPack {};
template <>
struct AVX2RGBAPack<BIT_DEPTH_UINT8>
{
static inline void Load(const uint8_t *in, __m256& r, __m256& g, __m256& b, __m256& a)
{
__m256i rgba_00_07 = _mm256_loadu_si256((const __m256i*)in);
__m128i rgba_00_03 =_mm256_castsi256_si128(rgba_00_07);
__m128i rgba_04_07 =_mm256_extractf128_si256(rgba_00_07, 1);
// : 0, 1, 2, 3 | 4, 5, 6, 7 | 8, 9, 10, 11 | 12, 13, 14, 15
// rgba_x03 : r0, g0, b0, a0 | r1, g1, b1, a1 | r2, g2, b2, a2 | r3, g3, b3, a3
// rgba_x47 : r4, g4, b4, a4 | r5, g5, b5, a5 | r6, g6, b6, a6 | r7, g7, b7, a7
__m256 rgba0 = _mm256_cvtepi32_ps(_mm256_cvtepu8_epi32(rgba_00_03));
__m256 rgba1 = _mm256_cvtepi32_ps(_mm256_cvtepu8_epi32(_mm_shuffle_epi32(rgba_00_03, _MM_SHUFFLE(3, 2, 3, 2))));
__m256 rgba2 = _mm256_cvtepi32_ps(_mm256_cvtepu8_epi32(rgba_04_07));
__m256 rgba3 = _mm256_cvtepi32_ps(_mm256_cvtepu8_epi32(_mm_shuffle_epi32(rgba_04_07, _MM_SHUFFLE(3, 2, 3, 2))));
avx2RGBATranspose_4x4_4x4(rgba0, rgba1, rgba2, rgba3, r, g, b, a);
}
static inline void Store(uint8_t *out, __m256 r, __m256 g, __m256 b, __m256 a)
{
__m256 rgba0, rgba1, rgba2, rgba3;
const __m256 maxValue = _mm256_set1_ps(255.0f);
avx2RGBATranspose_4x4_4x4(r, g, b, a, rgba0, rgba1, rgba2, rgba3);
rgba0 = avx2_clamp(rgba0, maxValue);
rgba1 = avx2_clamp(rgba1, maxValue);
rgba2 = avx2_clamp(rgba2, maxValue);
rgba3 = avx2_clamp(rgba3, maxValue);
// NOTE note using cvtps which will round based on MXCSR register defaults to _MM_ROUND_NEAREST
__m256i rgba01 = _mm256_cvtps_epi32(rgba0);
__m256i rgba23 = _mm256_cvtps_epi32(rgba1);
__m256i rgba45 = _mm256_cvtps_epi32(rgba2);
__m256i rgba67 = _mm256_cvtps_epi32(rgba3);
const __m256i rgba_shuf_a = _mm256_setr_epi8( 0, 4, 8, 12, -1,-1,-1, -1, -1,-1,-1,-1, -1,-1,-1,-1,
-1,-1,-1, -1, 0, 4, 8, 12, -1,-1,-1,-1, -1,-1,-1,-1);
const __m256i rgba_shuf_b = _mm256_setr_epi8(-1,-1,-1,-1, -1,-1,-1,-1, 0, 4, 8, 12, -1,-1,-1,-1,
-1,-1,-1,-1, -1,-1,-1,-1, -1,-1,-1, -1, 0, 4, 8, 12);
rgba01 = _mm256_shuffle_epi8(rgba01, rgba_shuf_a);
rgba23 = _mm256_shuffle_epi8(rgba23, rgba_shuf_b);
rgba01 = _mm256_or_si256(rgba01, rgba23);
__m128i lo = _mm_or_si128(_mm256_castsi256_si128(rgba01), _mm256_extractf128_si256(rgba01, 1));
rgba45 = _mm256_shuffle_epi8(rgba45, rgba_shuf_a);
rgba67 = _mm256_shuffle_epi8(rgba67, rgba_shuf_b);
rgba45 = _mm256_or_si256(rgba45, rgba67);
__m128i hi = _mm_or_si128(_mm256_castsi256_si128(rgba45), _mm256_extractf128_si256(rgba45, 1));
__m256i rgba = _mm256_inserti128_si256(_mm256_castsi128_si256(lo), hi, 1);
_mm256_storeu_si256((__m256i*)out, rgba);
}
};
template<BitDepth BD>
struct AVX2RGBAPack16
{
typedef typename BitDepthInfo<BD>::Type Type;
static inline void Load(const Type *in, __m256& r, __m256& g, __m256& b, __m256& a)
{
// const __m256 scale = _mm256_set1_ps(1.0f / (float)BitDepthInfo<BD>::maxValue);
__m256i rgba_00_03 = _mm256_loadu_si256((const __m256i*)(in + 0));
__m256i rgba_04_07 = _mm256_loadu_si256((const __m256i*)(in + 16));
__m256 rgba0 = _mm256_cvtepi32_ps(_mm256_cvtepu16_epi32(_mm256_castsi256_si128(rgba_00_03)));
__m256 rgba1 = _mm256_cvtepi32_ps(_mm256_cvtepu16_epi32(_mm256_extractf128_si256(rgba_00_03, 1)));
__m256 rgba2 = _mm256_cvtepi32_ps(_mm256_cvtepu16_epi32(_mm256_castsi256_si128(rgba_04_07)));
__m256 rgba3 = _mm256_cvtepi32_ps(_mm256_cvtepu16_epi32(_mm256_extractf128_si256(rgba_04_07, 1)));
avx2RGBATranspose_4x4_4x4(rgba0, rgba1, rgba2, rgba3, r, g, b, a);
}
static inline void Store(Type *out, __m256 r, __m256 g, __m256 b, __m256 a)
{
__m256 rgba0, rgba1, rgba2, rgba3;
__m128i lo, hi;
__m256i rgba;
const __m256 maxValue = _mm256_set1_ps((float)BitDepthInfo<BD>::maxValue);
avx2RGBATranspose_4x4_4x4(r, g, b, a, rgba0, rgba1, rgba2, rgba3);
rgba0 = avx2_clamp(rgba0, maxValue);
rgba1 = avx2_clamp(rgba1, maxValue);
rgba2 = avx2_clamp(rgba2, maxValue);
rgba3 = avx2_clamp(rgba3, maxValue);
// NOTE note using cvtps which will round based on MXCSR register defaults to _MM_ROUND_NEAREST
__m256i rgba01 = _mm256_cvtps_epi32(rgba0);
__m256i rgba23 = _mm256_cvtps_epi32(rgba1);
__m256i rgba45 = _mm256_cvtps_epi32(rgba2);
__m256i rgba67 = _mm256_cvtps_epi32(rgba3);
const __m256i rgba_shuf = _mm256_setr_epi8( 0, 1, 4, 5, 8, 9, 12, 13, -1,-1,-1,-1, -1,-1, -1 ,-1,
-1,-1,-1,-1, -1, -1, -1, -1, 0, 1, 4, 5, 8, 9, 12, 13);
rgba01 = _mm256_shuffle_epi8(rgba01, rgba_shuf);
lo = _mm_or_si128(_mm256_castsi256_si128(rgba01), _mm256_extractf128_si256(rgba01, 1));
rgba23 = _mm256_shuffle_epi8(rgba23, rgba_shuf);
hi = _mm_or_si128(_mm256_castsi256_si128(rgba23), _mm256_extractf128_si256(rgba23, 1));
rgba = _mm256_inserti128_si256(_mm256_castsi128_si256(lo), hi, 1);
_mm256_storeu_si256((__m256i*)(out+0), rgba);
rgba45 = _mm256_shuffle_epi8(rgba45, rgba_shuf);
lo = _mm_or_si128(_mm256_castsi256_si128(rgba45), _mm256_extractf128_si256(rgba45, 1));
rgba67 = _mm256_shuffle_epi8(rgba67, rgba_shuf);
hi = _mm_or_si128(_mm256_castsi256_si128(rgba67), _mm256_extractf128_si256(rgba67, 1));
rgba = _mm256_inserti128_si256(_mm256_castsi128_si256(lo), hi, 1);
_mm256_storeu_si256((__m256i*)(out+16), rgba);
}
};
template <>
struct AVX2RGBAPack<BIT_DEPTH_UINT10>
{
static inline void Load(const uint16_t *in, __m256& r, __m256& g, __m256& b, __m256& a)
{
AVX2RGBAPack16<BIT_DEPTH_UINT10>::Load(in, r, g, b, a);
}
static inline void Store(uint16_t *out, __m256 r, __m256 g, __m256 b, __m256 a)
{
AVX2RGBAPack16<BIT_DEPTH_UINT10>::Store(out, r, g, b, a);
}
};
template <>
struct AVX2RGBAPack<BIT_DEPTH_UINT12>
{
static inline void Load(const uint16_t *in, __m256& r, __m256& g, __m256& b, __m256& a)
{
AVX2RGBAPack16<BIT_DEPTH_UINT12>::Load(in, r, g, b, a);
}
static inline void Store(uint16_t *out, __m256 r, __m256 g, __m256 b, __m256 a)
{
AVX2RGBAPack16<BIT_DEPTH_UINT12>::Store(out, r, g, b, a);
}
};
template <>
struct AVX2RGBAPack<BIT_DEPTH_UINT16>
{
static inline void Load(const uint16_t *in, __m256& r, __m256& g, __m256& b, __m256& a)
{
AVX2RGBAPack16<BIT_DEPTH_UINT16>::Load(in, r, g, b, a);
}
static inline void Store(uint16_t *out, __m256 r, __m256 g, __m256 b, __m256 a)
{
AVX2RGBAPack16<BIT_DEPTH_UINT16>::Store(out, r, g, b, a);
}
};
#if OCIO_USE_F16C
template <>
struct AVX2RGBAPack<BIT_DEPTH_F16>
{
static inline void Load(const half *in, __m256& r, __m256& g, __m256& b, __m256& a)
{
__m256i rgba_00_03 = _mm256_loadu_si256((const __m256i*)(in + 0));
__m256i rgba_04_07 = _mm256_loadu_si256((const __m256i*)(in + 16));
__m256 rgba0 = _mm256_cvtph_ps(_mm256_castsi256_si128(rgba_00_03));
__m256 rgba1 = _mm256_cvtph_ps(_mm256_extractf128_si256(rgba_00_03, 1));
__m256 rgba2 = _mm256_cvtph_ps(_mm256_castsi256_si128(rgba_04_07));
__m256 rgba3 = _mm256_cvtph_ps(_mm256_extractf128_si256(rgba_04_07, 1));
avx2RGBATranspose_4x4_4x4(rgba0, rgba1, rgba2, rgba3, r, g, b, a);
}
static inline void Store(half *out, __m256 r, __m256 g, __m256 b, __m256 a)
{
__m256 rgba0, rgba1, rgba2, rgba3;
__m256i rgba;
avx2RGBATranspose_4x4_4x4(r, g, b, a, rgba0, rgba1, rgba2, rgba3);
__m128i rgba00_03 = _mm256_cvtps_ph(rgba0, 0);
__m128i rgba04_07 = _mm256_cvtps_ph(rgba1, 0);
__m128i rgba08_11 = _mm256_cvtps_ph(rgba2, 0);
__m128i rgba12_16 = _mm256_cvtps_ph(rgba3, 0);
rgba = _mm256_inserti128_si256(_mm256_castsi128_si256(rgba00_03), rgba04_07, 1);
_mm256_storeu_si256((__m256i*)(out+0), rgba);
rgba = _mm256_inserti128_si256(_mm256_castsi128_si256(rgba08_11), rgba12_16, 1);
_mm256_storeu_si256((__m256i*)(out+16), rgba);
}
};
#endif
template <>
struct AVX2RGBAPack<BIT_DEPTH_F32>
{
static inline void Load(const float *in, __m256& r, __m256& g, __m256& b, __m256& a)
{
const __m256i rgba_idx = _mm256_setr_epi32(0, 8, 16, 24, 4, 12, 20, 28);
r = _mm256_i32gather_ps(in + 0, rgba_idx, 4);
g = _mm256_i32gather_ps(in + 1, rgba_idx, 4);
b = _mm256_i32gather_ps(in + 2, rgba_idx, 4);
a = _mm256_i32gather_ps(in + 3, rgba_idx, 4);
}
static inline void Store(float *out, __m256 r, __m256 g, __m256 b, __m256 a)
{
__m256 rgba0, rgba1, rgba2, rgba3;
avx2RGBATranspose_4x4_4x4(r, g, b, a, rgba0, rgba1, rgba2, rgba3);
_mm256_storeu_ps(out + 0, rgba0);
_mm256_storeu_ps(out + 8, rgba1);
_mm256_storeu_ps(out + 16, rgba2);
_mm256_storeu_ps(out + 24, rgba3);
}
};
} // namespace OCIO_NAMESPACE
#endif // OCIO_USE_AVX2
#endif // INCLUDED_OCIO_AVX2_H
+28 -52
View File
@@ -17,10 +17,8 @@ set(SOURCES
ColorSpace.cpp
ColorSpaceSet.cpp
Config.cpp
ConfigUtils.cpp
Context.cpp
ContextVariableUtils.cpp
CPUInfo.cpp
CPUProcessor.cpp
Display.cpp
DynamicProperty.cpp
@@ -116,16 +114,10 @@ set(SOURCES
ops/log/LogUtils.cpp
ops/lut1d/Lut1DOp.cpp
ops/lut1d/Lut1DOpCPU.cpp
ops/lut1d/Lut1DOpCPU_SSE2.cpp
ops/lut1d/Lut1DOpCPU_AVX.cpp
ops/lut1d/Lut1DOpCPU_AVX2.cpp
ops/lut1d/Lut1DOpData.cpp
ops/lut1d/Lut1DOpGPU.cpp
ops/lut3d/Lut3DOp.cpp
ops/lut3d/Lut3DOpCPU.cpp
ops/lut3d/Lut3DOpCPU_SSE2.cpp
ops/lut3d/Lut3DOpCPU_AVX.cpp
ops/lut3d/Lut3DOpCPU_AVX2.cpp
ops/lut3d/Lut3DOpData.cpp
ops/lut3d/Lut3DOpGPU.cpp
ops/matrix/MatrixOpCPU.cpp
@@ -206,18 +198,6 @@ endif()
configure_file(res/OpenColorIO.pc.in ${CMAKE_CURRENT_BINARY_DIR}/OpenColorIO.pc @ONLY)
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/OpenColorIO.pc DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig)
if(OCIO_USE_SIMD AND (OCIO_ARCH_X86 OR OCIO_USE_SSE2NEON))
# Note that these files are gated by preprocessors to remove them based on the OCIO_USE_* vars.
set_property(SOURCE ops/lut1d/Lut1DOpCPU_SSE2.cpp APPEND PROPERTY COMPILE_OPTIONS ${OCIO_SSE2_ARGS})
set_property(SOURCE ops/lut1d/Lut1DOpCPU_AVX.cpp APPEND PROPERTY COMPILE_OPTIONS ${OCIO_AVX_ARGS})
set_property(SOURCE ops/lut1d/Lut1DOpCPU_AVX2.cpp APPEND PROPERTY COMPILE_OPTIONS ${OCIO_AVX2_ARGS})
set_property(SOURCE ops/lut3d/Lut3DOpCPU_SSE2.cpp APPEND PROPERTY COMPILE_OPTIONS ${OCIO_SSE2_ARGS})
set_property(SOURCE ops/lut3d/Lut3DOpCPU_AVX.cpp APPEND PROPERTY COMPILE_OPTIONS ${OCIO_AVX_ARGS})
set_property(SOURCE ops/lut3d/Lut3DOpCPU_AVX2.cpp APPEND PROPERTY COMPILE_OPTIONS ${OCIO_AVX2_ARGS})
endif()
configure_file(CPUInfoConfig.h.in CPUInfoConfig.h)
add_library(OpenColorIO ${SOURCES})
# Require at least a C++11 compatible compiler for consumer projects.
@@ -235,17 +215,17 @@ if(BUILD_SHARED_LIBS AND WIN32)
endif()
set(HEADER_LOCATION "${PROJECT_SOURCE_DIR}/include/OpenColorIO")
set(HEADER_LOCATION "${CMAKE_SOURCE_DIR}/include/OpenColorIO")
file(GLOB_RECURSE INSTALL_HEADERS "${HEADER_LOCATION}/*.h")
# Some part of the build process expect to find the ABI header here,
# notably the documentation.
set(ABI_HEADER_LOCATION "${PROJECT_BINARY_DIR}/include/OpenColorIO")
set(ABI_HEADER_LOCATION "${CMAKE_BINARY_DIR}/include/OpenColorIO")
list(APPEND INSTALL_HEADERS ${ABI_HEADER_LOCATION}/OpenColorABI.h)
configure_file("${HEADER_LOCATION}/OpenColorABI.h.in" "${ABI_HEADER_LOCATION}/OpenColorABI.h" @ONLY)
# Built-in configs
set(CONFIGS_HEADER_LOCATION "${PROJECT_BINARY_DIR}/generated_include")
set(CONFIGS_HEADER_LOCATION "${CMAKE_BINARY_DIR}/generated_include")
file(GLOB CONFIGS_PATHS "builtinconfigs/configs/*.ocio")
# Loop through the .ocio config files.
foreach(C ${CONFIGS_PATHS})
@@ -266,7 +246,7 @@ foreach(C ${CONFIGS_PATHS})
# Append 0x00 to null-terminated the string.
string(APPEND FORMATTED_HEX ",0x00")
# Set the dynamically named variable "${CONFIG_NAME}" to the config in HEX.
set(${CONFIG_NAME} ${FORMATTED_HEX})
endforeach()
@@ -289,7 +269,6 @@ set(BUILD_INCLUDES
${HEADER_LOCATION}
${CMAKE_CURRENT_SOURCE_DIR}
${ABI_HEADER_LOCATION}
${CMAKE_CURRENT_BINARY_DIR}
)
target_include_directories(OpenColorIO
@@ -309,14 +288,10 @@ target_link_libraries(OpenColorIO
"$<BUILD_INTERFACE:utils::from_chars>"
"$<BUILD_INTERFACE:utils::strings>"
"$<BUILD_INTERFACE:xxHash>"
${YAML_CPP_LIBRARIES}
yaml-cpp
MINIZIP::minizip-ng
)
if(OCIO_USE_SIMD AND OCIO_USE_SSE2NEON AND COMPILER_SUPPORTS_SSE_WITH_SSE2NEON)
target_link_libraries(OpenColorIO PRIVATE $<BUILD_INTERFACE:sse2neon>)
endif()
if(APPLE)
target_link_libraries(OpenColorIO
PRIVATE
@@ -347,6 +322,13 @@ if(BUILD_SHARED_LIBS OR (OCIO_BUILD_PYTHON AND UNIX))
set_property(TARGET OpenColorIO PROPERTY POSITION_INDEPENDENT_CODE ON)
endif()
if(OCIO_USE_SSE)
target_compile_definitions(OpenColorIO
PRIVATE
USE_SSE
)
endif()
if(MSVC AND BUILD_TYPE_DEBUG AND BUILD_SHARED_LIBS)
set_target_properties(OpenColorIO PROPERTIES
PDB_NAME ${PROJECT_NAME}${OCIO_LIBNAME_SUFFIX}_${OpenColorIO_VERSION_MAJOR}_${OpenColorIO_VERSION_MINOR}
@@ -371,13 +353,20 @@ if(WIN32)
endif()
endif()
set(CUSTOM_LINK_FLAGS ${PLATFORM_LINK_OPTIONS})
set_target_properties(OpenColorIO PROPERTIES
OUTPUT_NAME ${PROJECT_NAME}${OCIO_LIBNAME_SUFFIX}
COMPILE_FLAGS "${PLATFORM_COMPILE_FLAGS}"
VERSION ${OpenColorIO_VERSION}
SOVERSION ${SOVERSION}
PUBLIC_HEADER "${INSTALL_HEADERS}"
)
if(UNIX AND NOT APPLE)
# Also hide all the symbols of dependent libraries to prevent clashes if
# an app using this project is linked against other versions of our
# dependencies.
set(CUSTOM_LINK_FLAGS "${CUSTOM_LINK_FLAGS};-Wl,--exclude-libs,ALL")
set_property (TARGET OpenColorIO
APPEND PROPERTY LINK_FLAGS "-Wl,--exclude-libs,ALL")
elseif(APPLE)
if (expat_LIBRARY)
get_filename_component(_expat_LIBDIR "${expat_LIBRARY}" DIRECTORY)
@@ -394,36 +383,23 @@ elseif(APPLE)
set(_minizip-ng_NAME "minizip")
elseif(minizip-ng_LIBRARY)
get_filename_component(_minizip-ng_LIBDIR "${minizip-ng_LIBRARY}" DIRECTORY)
set(_minizip-ng_NAME "minizip-ng")
set(_minizip-ng_NAME "minizip-ng")
endif()
if (_minizip-ng_LIBDIR)
# Add the path to CMake list of search paths for libraries.
list(APPEND _OCIO_LINK_FLAGS_LIST_ "-Wl,-L${_minizip-ng_LIBDIR}")
# Hide the minizip-ng symbols.
list(APPEND _OCIO_LINK_FLAGS_LIST_ "-Wl,-hidden-l${_minizip-ng_NAME}")
endif()
list(APPEND _OCIO_LINK_FLAGS_LIST_ "-Wl,-hidden-l${_minizip-ng_NAME}")
endif()
if (_OCIO_LINK_FLAGS_LIST_)
list(JOIN _OCIO_LINK_FLAGS_LIST_ ";" _OCIO_LINK_FLAGS_LIST_)
set(CUSTOM_LINK_FLAGS "${CUSTOM_LINK_FLAGS};${_OCIO_LINK_FLAGS_LIST_}")
endif()
list(JOIN _OCIO_LINK_FLAGS_LIST_ " " _OCIO_LINK_FLAGS_LIST_)
set_property (TARGET OpenColorIO
APPEND PROPERTY LINK_FLAGS "${_OCIO_LINK_FLAGS_LIST_}")
endif()
endif()
if (OCIO_USE_SOVERSION)
set_target_properties(OpenColorIO PROPERTIES
VERSION ${OpenColorIO_VERSION}
SOVERSION ${SOVERSION}
)
endif()
set_target_properties(OpenColorIO PROPERTIES
OUTPUT_NAME ${PROJECT_NAME}${OCIO_LIBNAME_SUFFIX}
COMPILE_OPTIONS "${PLATFORM_COMPILE_OPTIONS}"
LINK_OPTIONS "${CUSTOM_LINK_FLAGS}"
PUBLIC_HEADER "${INSTALL_HEADERS}"
)
if(MSVC AND BUILD_SHARED_LIBS)
# Install the pdb file if any.
install(FILES $<TARGET_PDB_FILE:${PROJECT_NAME}> DESTINATION ${CMAKE_INSTALL_BINDIR} OPTIONAL)
-211
View File
@@ -1,211 +0,0 @@
// SPDX-License-Identifier: BSD-3-Clause
// Copyright Contributors to the OpenColorIO Project.
#include "CPUInfo.h"
#include <string.h>
#if _WIN32
#include <limits.h>
#include <intrin.h>
typedef unsigned __int32 uint32_t;
typedef __int64 int64_t;
#else
#include <stdint.h>
#endif
namespace OCIO_NAMESPACE
{
#if !defined(__aarch64__) && OCIO_ARCH_X86 // Intel-based processor or Apple Rosetta x86_64.
namespace {
union CPUIDResult
{
int i[4];
char c[16];
struct {
uint32_t eax;
uint32_t ebx;
uint32_t ecx;
uint32_t edx;
} reg;
};
static inline int64_t xgetbv()
{
int index = 0;
#if _MSC_VER
return _xgetbv(index);
#else
int eax = 0;
int edx = 0;
__asm__ volatile (".byte 0x0f, 0x01, 0xd0" : "=a"(eax), "=d"(edx) : "c" (index));
return (int64_t)edx << 32 | (int64_t)eax;
#endif
}
static inline void cpuid(int index, int *data)
{
#if _MSC_VER
__cpuid(data, index);
#else
__asm__ volatile (
"mov %%rbx, %%rsi \n\t"
"cpuid \n\t"
"xchg %%rbx, %%rsi"
: "=a" (data[0]), "=S" (data[1]), "=c" (data[2]), "=d" (data[3])
: "0" (index), "2"(0));
#endif
}
} // anonymous namespace
CPUInfo::CPUInfo()
{
flags = 0, family = 0, model = 0;
memset(name, 0, sizeof(name));
memset(vendor, 0, sizeof(vendor));
CPUIDResult info;
uint32_t max_std_level, max_ext_level;
int64_t xcr = 0;
cpuid(0, info.i);
max_std_level = info.i[0];
memcpy(vendor + 0, &info.i[1], 4);
memcpy(vendor + 4, &info.i[3], 4);
memcpy(vendor + 8, &info.i[2], 4);
if (max_std_level >= 1)
{
cpuid(1, info.i);
family = ((info.reg.eax >> 8) & 0xf) + ((info.reg.eax >> 20) & 0xff);
model = ((info.reg.eax >> 4) & 0xf) + ((info.reg.eax >> 12) & 0xf0);
if (info.reg.edx & (1 << 26))
flags |= X86_CPU_FLAG_SSE2;
if (info.reg.ecx & 1)
flags |= X86_CPU_FLAG_SSE3;
if (info.reg.ecx & 0x00000200)
flags |= X86_CPU_FLAG_SSSE3;
if (info.reg.ecx & 0x00080000)
flags |= X86_CPU_FLAG_SSE4;
if (info.reg.ecx & 0x00100000)
flags |= X86_CPU_FLAG_SSE42;
/* Check OSXSAVE and AVX bits */
if (info.reg.ecx & 0x18000000)
{
xcr = xgetbv();
if(xcr & 0x6) {
flags |= X86_CPU_FLAG_AVX;
if(info.reg.ecx & 0x20000000) {
flags |= X86_CPU_FLAG_F16C;
}
}
}
}
if (max_std_level >= 7)
{
cpuid(7, info.i);
if ((flags & X86_CPU_FLAG_AVX) && (info.reg.ebx & 0x00000020))
flags |= X86_CPU_FLAG_AVX2;
/* OPMASK/ZMM state */
if ((xcr & 0xe0) == 0xe0) {
if ((flags & X86_CPU_FLAG_AVX2) && (info.reg.ebx & 0xd0030000))
flags |= X86_CPU_FLAG_AVX512;
}
}
cpuid(0x80000000, info.i);
max_ext_level = info.i[0];
if (max_ext_level >= 0x80000001)
{
cpuid(0x80000001, info.i);
if (!strncmp(vendor, "AuthenticAMD", 12)) {
/* Athlon64, some Opteron, and some Sempron processors */
if (flags & X86_CPU_FLAG_SSE2 && !(info.reg.ecx & 0x00000040))
flags |= X86_CPU_FLAG_SSE2_SLOW;
/* Bulldozer and Jaguar based CPUs */
if ((family == 0x15 || family == 0x16) && (flags & X86_CPU_FLAG_AVX))
flags |= X86_CPU_FLAG_AVX_SLOW;
/* Zen 3 and earlier have slow gather */
if ((family <= 0x19) && (flags & X86_CPU_FLAG_AVX2))
flags |= X86_CPU_FLAG_AVX2_SLOWGATHER;
}
}
if (!strncmp(vendor, "GenuineIntel", 12))
{
if (family == 6 && (model == 9 || model == 13 || model == 14))
{
if (flags & X86_CPU_FLAG_SSE2)
flags |= X86_CPU_FLAG_SSE2_SLOW;
if (flags & X86_CPU_FLAG_SSE3)
flags |= X86_CPU_FLAG_SSE3_SLOW;
}
/* Conroe has a slow shuffle unit */
if ((flags & X86_CPU_FLAG_SSSE3) && !(flags & X86_CPU_FLAG_SSE4) && family == 6 && model < 23)
flags |= X86_CPU_FLAG_SSSE3_SLOW;
/* Haswell has slow gather */
if ((flags & X86_CPU_FLAG_AVX2) && family == 6 && model < 70)
flags |= X86_CPU_FLAG_AVX2_SLOWGATHER;
}
// get cpu brand string
for(int index = 0; index < 3; index++)
{
cpuid(0x80000002 + index, (int *)(name + 16*index));
}
}
CPUInfo& CPUInfo::instance()
{
static CPUInfo singleton = CPUInfo();
return singleton;
}
#elif defined(__aarch64__) // ARM Processor or Apple ARM.
CPUInfo::CPUInfo()
{
flags = 0;
memset(name, 0, sizeof(name));
snprintf(name, sizeof(name), "%s", "ARM");
// SSE2NEON library supports SSE, SSE2, SSE3, SSSE3, SSE4.1 and SSE4.2.
// It does not support any AVX instructions.
if (OCIO_USE_SSE2)
{
flags |= X86_CPU_FLAG_SSE2;
flags |= X86_CPU_FLAG_SSE3;
flags |= X86_CPU_FLAG_SSSE3;
flags |= X86_CPU_FLAG_SSE4;
flags |= X86_CPU_FLAG_SSE42;
}
}
CPUInfo& CPUInfo::instance()
{
static CPUInfo singleton = CPUInfo();
return singleton;
}
#endif
} // namespace OCIO_NAMESPACE
-125
View File
@@ -1,125 +0,0 @@
// SPDX-License-Identifier: BSD-3-Clause
// Copyright Contributors to the OpenColorIO Project.
#ifndef CPUInfo_H
#define CPUInfo_H
#include <OpenColorIO/OpenColorIO.h>
#include "CPUInfoConfig.h"
namespace OCIO_NAMESPACE
{
#define X86_CPU_FLAG_SSE2 (1 << 0) // SSE2 functions
#define X86_CPU_FLAG_SSE2_SLOW (1 << 1) // SSE2 supported, but usually not faster than regular MMX/SSE (e.g. Core1)
#define X86_CPU_FLAG_SSE3 (1 << 2) // Prescott SSE3 functions
#define X86_CPU_FLAG_SSE3_SLOW (1 << 3) // SSE3 supported, but usually not faster than regular MMX/SSE (e.g. Core1)
#define X86_CPU_FLAG_SSSE3 (1 << 4) // Conroe SSSE3 functions
#define X86_CPU_FLAG_SSSE3_SLOW (1 << 5) // SSSE3 supported, but usually not faster than SSE2
#define X86_CPU_FLAG_SSE4 (1 << 6) // Penryn SSE4.1 functions
#define X86_CPU_FLAG_SSE42 (1 << 7) // Nehalem SSE4.2 functions
#define X86_CPU_FLAG_AVX (1 << 8) // AVX functions: requires OS support even if YMM registers aren't used
#define X86_CPU_FLAG_AVX_SLOW (1 << 9) // AVX supported, but slow when using YMM registers (e.g. Bulldozer)
#define X86_CPU_FLAG_AVX2 (1 << 10) // AVX2 functions: requires OS support even if YMM registers aren't used
#define X86_CPU_FLAG_AVX2_SLOWGATHER (1 << 11) // CPU has slow gathers.
#define X86_CPU_FLAG_AVX512 (1 << 12) // AVX-512 functions: requires OS support even if YMM/ZMM registers aren't used
#define X86_CPU_FLAG_F16C (1 << 13) // CPU Has FP16C half float, AVX2 should always have this??
#define x86_check_flags(cpuext) \
(OCIO_USE_ ## cpuext && ((flags) & X86_CPU_FLAG_ ## cpuext))
#if !defined(__aarch64__) && OCIO_ARCH_X86 // Intel-based processor or Apple Rosetta x86_64.
struct CPUInfo
{
unsigned int flags;
int family;
int model;
char name[65];
char vendor[13];
CPUInfo();
static CPUInfo& instance();
const char *getName() const { return name;}
const char *getVendor() const { return vendor; }
bool hasSSE2() const { return x86_check_flags(SSE2); }
bool SSE2Slow() const { return (OCIO_USE_SSE2 && (flags & X86_CPU_FLAG_SSE2_SLOW)); }
bool hasSSE3() const { return x86_check_flags(SSE3); }
bool SSE3Slow() const { return (OCIO_USE_SSE3 && (flags & X86_CPU_FLAG_SSE3_SLOW)); }
bool hasSSSE3() const { return x86_check_flags(SSSE3); }
bool SSSE3Slow() const { return (OCIO_USE_SSSE3 && (flags & X86_CPU_FLAG_SSSE3_SLOW)); }
bool hasSSE4() const { return x86_check_flags(SSE4); }
bool hasSSE42() const { return x86_check_flags(SSE42); }
bool hasAVX() const { return x86_check_flags(AVX); }
bool AVXSlow() const { return (OCIO_USE_AVX && (flags & X86_CPU_FLAG_AVX_SLOW)); }
bool hasAVX2() const { return x86_check_flags(AVX2); }
bool AVX2SlowGather() const { return (OCIO_USE_AVX2 && (flags & X86_CPU_FLAG_AVX2_SLOWGATHER)); }
bool hasAVX512() const { return x86_check_flags(AVX512); }
bool hasF16C() const { return x86_check_flags(F16C); }
};
#undef x86_check_flags
#elif defined(__aarch64__) // ARM Processor or Apple ARM.
#define check_flags(cpuext) \
(OCIO_USE_ ## cpuext && ((flags) & X86_CPU_FLAG_ ## cpuext))
struct CPUInfo
{
unsigned int flags;
char name[65];
CPUInfo();
static CPUInfo& instance();
bool hasSSE2() const { return x86_check_flags(SSE2); }
bool SSE2Slow() const { return false; }
bool hasSSE3() const { return x86_check_flags(SSE3); }
bool SSE3Slow() const { return false; }
bool hasSSSE3() const { return x86_check_flags(SSSE3); }
bool SSSE3Slow() const { return false; }
bool hasSSE4() const { return x86_check_flags(SSE4); }
bool hasSSE42() const { return false; }
// Apple M1 does not support AVX SIMD instructions through Rosetta.
// SSE2NEON library does not supports AVX SIMD instructions.
bool hasAVX() const { return false; }
bool AVXSlow() const { return false; }
bool hasAVX2() const { return false; }
bool AVX2SlowGather() const { return false; }
bool hasAVX512() const { return false; }
bool hasF16C() const { return false; }
};
#undef x86_check_flags
#endif
} // namespace OCIO_NAMESPACE
#endif // CPUInfo_H
-51
View File
@@ -1,51 +0,0 @@
// SPDX-License-Identifier: BSD-3-Clause
// Copyright Contributors to the OpenColorIO Project.
#cmakedefine01 OCIO_ARCH_X86
// Relevant only for arm64 architecture.
#if defined(__aarch64__)
#cmakedefine01 OCIO_USE_SSE2NEON
#endif
// On the Apple platform, a universal build is created for both x86_64 and arm64 architectures.
// CMake will run only one "configure" step, build for x86_64 and arm64, and then create a
// single binary that includes both architectures.
// This means that for a universal build, the OCIO_USE_SSEx, OCIO_USE_AVXx, OCIO_USE_F16C, etc.
// flags can be enabled simultaneously. Therefore, we need to check whether we are currently
// building the x86_64 side or the arm64 side. This can be done by checking the OCIO_ARCH_X86 and
// aarch64 defines.
// Building for x86_64 processor on a non-ARM host architecture
// OR Building on/for an ARM architecture and using SSE2NEON.
#if (OCIO_ARCH_X86 && !defined(__aarch64__)) || (defined(__aarch64__) && OCIO_USE_SSE2NEON)
#cmakedefine01 OCIO_USE_SSE2
#cmakedefine01 OCIO_USE_SSE3
#cmakedefine01 OCIO_USE_SSSE3
#cmakedefine01 OCIO_USE_SSE4
#cmakedefine01 OCIO_USE_SSE42
#else // non-intel based architecture or ARM architecture without OCIO_USE_SSE2NEON=ON
// Overwrite the values from cmake as these will not be supported on a non-intel architecture
// or arm64 with sse2neon disabled.
#define OCIO_USE_SSE2 0
#define OCIO_USE_SSE3 0
#define OCIO_USE_SSSE3 0
#define OCIO_USE_SSE4 0
#define OCIO_USE_SSE42 0
#endif
// Building for x86_64 processor on a non-ARM host architecture
#if OCIO_ARCH_X86 && !defined(__aarch64__)
#cmakedefine01 OCIO_USE_AVX
#cmakedefine01 OCIO_USE_AVX2
#cmakedefine01 OCIO_USE_AVX512
#cmakedefine01 OCIO_USE_F16C
#else // non-intel based architecture
// Overwrite the values from cmake as these will not be supported on a non-intel architecture.
#define OCIO_USE_AVX 0
#define OCIO_USE_AVX2 0
#define OCIO_USE_AVX512 0
#define OCIO_USE_F16C 0
#endif
-56
View File
@@ -239,52 +239,6 @@ case in: \
throw Exception("Unsupported bit-depths");
}
bool CPUProcessor::Impl::isDynamic() const noexcept
{
if (m_inBitDepthOp->isDynamic())
{
return true;
}
for (const auto & op : m_cpuOps)
{
if (op->isDynamic())
{
return true;
}
}
if (m_outBitDepthOp->isDynamic())
{
return true;
}
return false;
}
bool CPUProcessor::Impl::hasDynamicProperty(DynamicPropertyType type) const noexcept
{
if (m_inBitDepthOp->hasDynamicProperty(type))
{
return true;
}
for (const auto & op : m_cpuOps)
{
if (op->hasDynamicProperty(type))
{
return true;
}
}
if (m_outBitDepthOp->hasDynamicProperty(type))
{
return true;
}
return false;
}
DynamicPropertyRcPtr CPUProcessor::Impl::getDynamicProperty(DynamicPropertyType type) const
{
if (m_inBitDepthOp->hasDynamicProperty(type))
@@ -518,16 +472,6 @@ BitDepth CPUProcessor::getOutputBitDepth() const
return getImpl()->getOutputBitDepth();
}
bool CPUProcessor::isDynamic() const noexcept
{
return getImpl()->isDynamic();
}
bool CPUProcessor::hasDynamicProperty(DynamicPropertyType type) const noexcept
{
return getImpl()->hasDynamicProperty(type);
}
DynamicPropertyRcPtr CPUProcessor::getDynamicProperty(DynamicPropertyType type) const
{
return getImpl()->getDynamicProperty(type);
-2
View File
@@ -39,8 +39,6 @@ public:
BitDepth getInputBitDepth() const noexcept { return m_inBitDepth; }
BitDepth getOutputBitDepth() const noexcept { return m_outBitDepth; }
bool isDynamic() const noexcept;
bool hasDynamicProperty(DynamicPropertyType type) const noexcept;
DynamicPropertyRcPtr getDynamicProperty(DynamicPropertyType type) const;
void apply(const ImageDesc & imgDesc) const;
+5
View File
@@ -54,6 +54,11 @@ public:
AutoMutex lock(m_mutex);
m_enabled = enable;
if (!isEnabled())
{
m_entries.clear();
}
}
inline bool isEnabled() const noexcept { return !m_envDisableAllCaches && m_enabled; }
+505 -369
View File
File diff suppressed because it is too large Load Diff
-675
View File
@@ -1,675 +0,0 @@
// SPDX-License-Identifier: BSD-3-Clause
// Copyright Contributors to the OpenColorIO Project.
#include "ConfigUtils.h"
#include "MathUtils.h"
#include "utils/StringUtils.h"
namespace OCIO_NAMESPACE
{
namespace ConfigUtils
{
//////////////////////////////////////////////////////////////////////////////////////
// The following code needs to know the names of some of the color spaces in the
// built-in default config. If the color space names of that config are ever
// modified, the following strings should be kept in sync.
// Name of the sRGB space in the built-in config.
//
const char * getSRGBColorSpaceName()
{
constexpr const char * srgbColorSpaceName = "sRGB - Texture";
return srgbColorSpaceName;
}
// Define the set of candidate built-in default config reference linear color spaces that
// will be used when searching through the source config. If the source config scene-referred
// reference space is the equivalent of one of these spaces, it should be possible to identify
// it with the following heuristics.
//
const char * getBuiltinLinearSpaceName(int index)
{
constexpr const char * builtinLinearSpaces[] = { "ACES2065-1",
"ACEScg",
"Linear Rec.709 (sRGB)",
"Linear P3-D65",
"Linear Rec.2020" };
return builtinLinearSpaces[Clamp(index, 0, 4)];
}
// The number of items available from getBuiltinLinearSpaceName. (Obviously, update this
// integer if that list changes.)
//
inline int getNumberOfbuiltinLinearSpaces()
{
return 5;
}
//////////////////////////////////////////////////////////////////////////////////////
// Use the interchange roles in the pair of provided configs to return the color space
// names to be used for the conversion between the provided pair of color spaces.
// Note that the color space names returned depend on the image state of the provided
// color spaces. The returned color space names are the names that the interchange
// roles point to and the function checks that they exist. An exception is raised if
// there are problems with the input arguments or if the interchange roles are present
// but point to color spaces that don't exist. If the interchange roles are simply
// not present, no exception is thrown but false is returned. If the returned interchange
// color space names are present and exist, true is returned.
//
// This function does NOT use any heuristics.
//
// [out] srcInterchangeCSName -- Name of the interchange color space from the src config.
// [out] dstInterchangeCSName -- Name of the interchange color space from the dst config.
// [out] interchangeType -- The ReferenceSpaceType of the interchange color space.
// srcConfig -- Source config object.
// srcName -- Name of the color space to be converted from the source config.
// May be empty if the source color space is unknown.
// dstConfig -- Destination config object.
// dstName -- Name of the color space to be converted from the destination config.
// Returns True if the necessary interchange roles were found.
//
bool GetInterchangeRolesForColorSpaceConversion(const char ** srcInterchangeCSName,
const char ** dstInterchangeCSName,
ReferenceSpaceType & interchangeType,
const ConstConfigRcPtr & srcConfig,
const char * srcName,
const ConstConfigRcPtr & dstConfig,
const char * dstName)
{
ConstColorSpaceRcPtr dstColorSpace = dstConfig->getColorSpace(dstName);
if (!dstColorSpace)
{
std::ostringstream os;
os << "Could not find destination color space '" << dstName << "'.";
throw Exception(os.str().c_str());
}
interchangeType = REFERENCE_SPACE_SCENE;
if (srcName && !*srcName)
{
// If srcName is empty, just use the reference type of the destination side.
// In this scenario, the source color space is unknown but the assumption is
// that when it is found it will have the same reference space type as the
// destination color space.
if (dstColorSpace->getReferenceSpaceType() == REFERENCE_SPACE_DISPLAY)
{
interchangeType = REFERENCE_SPACE_DISPLAY;
}
}
else
{
ConstColorSpaceRcPtr srcColorSpace = srcConfig->getColorSpace(srcName);
if (!srcColorSpace)
{
std::ostringstream os;
os << "Could not find source color space '" << srcName << "'.";
throw Exception(os.str().c_str());
}
// Only use the display-referred reference space if both color spaces are
// display-referred. If only one of the spaces is display-referred, it's
// better to use the scene-referred space since the conversion to scene-
// referred will happen within the config that has the display-referred
// color space. The config with the scene-referred color space may not
// even have a default view transform to use. In addition, it's important
// that this function always use the same reference space even if the order
// of src & dst is swapped, so the result is the inverse (which it might
// not be if the view transform in the opposite config is used).
if (srcColorSpace->getReferenceSpaceType() == REFERENCE_SPACE_DISPLAY &&
dstColorSpace->getReferenceSpaceType() == REFERENCE_SPACE_DISPLAY)
{
interchangeType = REFERENCE_SPACE_DISPLAY;
}
}
const char * interchangeRoleName = (interchangeType == REFERENCE_SPACE_SCENE)
? ROLE_INTERCHANGE_SCENE : ROLE_INTERCHANGE_DISPLAY;
if (!srcConfig->hasRole(interchangeRoleName))
{
return false;
}
// Get the color space name assigned to the interchange role.
ConstColorSpaceRcPtr srcInterchangeCS = srcConfig->getColorSpace(interchangeRoleName);
if (!srcInterchangeCS)
{
std::ostringstream os;
os << "The role '" << interchangeRoleName << "' refers to a color space ";
os << "that is missing in the source config.";
throw Exception(os.str().c_str());
}
*srcInterchangeCSName = srcInterchangeCS->getName();
if (!dstConfig->hasRole(interchangeRoleName))
{
return false;
}
// Get the color space name assigned to the interchange role.
ConstColorSpaceRcPtr dstInterchangeCS = dstConfig->getColorSpace(interchangeRoleName);
if (!dstInterchangeCS)
{
std::ostringstream os;
os << "The role '" << interchangeRoleName << "' refers to a color space ";
os << "that is missing in the destination config.";
throw Exception(os.str().c_str());
}
*dstInterchangeCSName = dstInterchangeCS->getName();
return true;
}
// Return true if the color space name or its aliases contains sRGB (case-insensitive).
//
bool containsSRGB(ConstColorSpaceRcPtr & cs)
{
std::string name = StringUtils::Lower(cs->getName());
if (StringUtils::Find(name, "srgb") != std::string::npos)
{
return true;
}
size_t nbOfAliases = cs->getNumAliases();
for (size_t i = 0; i < nbOfAliases; i++)
{
if (StringUtils::Find(cs->getAlias(i), "srgb") != std::string::npos)
{
return true;
}
}
return false;
}
// Find a color space where isData is false and it has neither a to_ref or from_ref
// transform. Currently only selecting scene-referred spaces. Note: this returns
// the first reference space found, even if it is inactive. Returns empty if none
// are found.
//
const char * getRefSpaceName(const ConstConfigRcPtr & cfg)
{
// It's important to support inactive spaces since sometimes the only reference space
// may be inactive, e.g. the display-referred reference in the built-in configs.
int nbCs = cfg->getNumColorSpaces(SEARCH_REFERENCE_SPACE_SCENE, COLORSPACE_ALL);
for (int i = 0; i < nbCs; i++)
{
const char * csname = cfg->getColorSpaceNameByIndex(SEARCH_REFERENCE_SPACE_SCENE,
COLORSPACE_ALL,
i);
ConstColorSpaceRcPtr cs = cfg->getColorSpace(csname);
if (cs->isData())
{
continue;
}
ConstTransformRcPtr t = cs->getTransform(COLORSPACE_DIR_TO_REFERENCE);
if (t != nullptr)
{
continue;
}
t = cs->getTransform(COLORSPACE_DIR_FROM_REFERENCE);
if (t != nullptr)
{
continue;
}
return csname;
}
return "";
}
// Return false if the supplied Processor modifies any of the supplied float values
// by more than the supplied absolute tolerance amount.
//
bool isIdentityTransform(ConstProcessorRcPtr proc,
std::vector<float> & RGBAvals,
float absTolerance)
{
std::vector<float> out(RGBAvals.size(), 0.f);
PackedImageDesc desc( &RGBAvals[0], (long) RGBAvals.size() / 4, 1, CHANNEL_ORDERING_RGBA );
PackedImageDesc descDst( &out[0], (long) RGBAvals.size() / 4, 1, CHANNEL_ORDERING_RGBA );
ConstCPUProcessorRcPtr cpu = proc->getOptimizedCPUProcessor(OPTIMIZATION_NONE);
cpu->apply(desc, descDst);
for (size_t i = 0; i < out.size(); i++)
{
if (!EqualWithAbsError(RGBAvals[i], out[i], absTolerance))
{
return false;
}
}
return true;
}
// Helper to avoid color spaces that are without transforms or are data spaces.
//
bool hasNoTransform(const ConstColorSpaceRcPtr & cs)
{
if (cs->isData())
{
return true;
}
ConstTransformRcPtr srcTransform = cs->getTransform(COLORSPACE_DIR_TO_REFERENCE);
if (!srcTransform)
{
srcTransform = cs->getTransform(COLORSPACE_DIR_FROM_REFERENCE);
if (srcTransform)
{
return false;
}
else
{
return true;
}
}
return false;
}
// Test the supplied color space against a set of color spaces in the built-in config.
// If a match is found, it indicates what reference space is used by the config.
// Return the index into the list of built-in linear spaces, or -1 if not found.
//
// srcConfig -- Source config object.
// srcRefName -- Name of a scene-referred reference color space in the src config.
// cs -- Color space from the source config to test.
// builtinConfig -- The built-in config object.
// Returns the index into the list of built-in linear spaces.
//
int getReferenceSpaceFromLinearSpace(const ConstConfigRcPtr & srcConfig,
const char * srcRefName,
const ConstColorSpaceRcPtr & cs,
const ConstConfigRcPtr & builtinConfig)
{
// Currently only handling scene-referred spaces in the heuristics.
if (cs->getReferenceSpaceType() == REFERENCE_SPACE_DISPLAY)
{
return -1;
}
// Don't check spaces without transforms / data spaces.
if (hasNoTransform(cs))
{
return -1;
}
// Define a set of (somewhat arbitrary) RGB values to test whether the combined transform is
// enough of an identity.
std::vector<float> vals = { 0.7f, 0.4f, 0.02f, 0.f,
0.02f, 0.6f, -0.2f, 0.f,
0.3f, 0.02f, 1.5f, 0.f,
0.f, 0.f, 0.f, 0.f,
1.f, 1.f, 1.f, 0.f };
// Test the transform from the test color space to its reference space against all combinations
// of the built-in linear color spaces. If one of them results in an identity, that identifies
// what the source color space and reference space are.
for (int i = 0; i < getNumberOfbuiltinLinearSpaces(); i++)
{
for (int j = 0; j < getNumberOfbuiltinLinearSpaces(); j++)
{
// Ensure the built-in side of the conversion is never an identity, since if
// both the src side and built-in side are an identity, it would seem as though
// the reference space has been identified, but in fact it would not be.
if (i != j)
{
ConstProcessorRcPtr proc = Config::GetProcessorFromConfigs(
srcConfig,
cs->getName(),
srcRefName,
builtinConfig,
getBuiltinLinearSpaceName(i),
getBuiltinLinearSpaceName(j));
if (isIdentityTransform(proc, vals, 1e-3f))
{
return j;
}
}
}
}
return -1;
}
// Test the supplied color space against a set of color spaces in the built-in config
// to see if it matches an sRGB texture color space with one of a set of known primaries
// used as its reference space. If a match is found, it indicates what reference space
// is used by the config. Return the index into the list of built-in linear spaces,
// or -1 if not found.
//
// srcConfig -- Source config object.
// srcRefName -- Name of a scene-referred reference color space in the src config.
// cs -- Color space from the source config to test.
// builtinConfig -- The built-in config object.
// Returns the index into the list of built-in linear spaces.
//
int getReferenceSpaceFromSRGBSpace(const ConstConfigRcPtr & srcConfig,
const char * srcRefName,
const ConstColorSpaceRcPtr cs,
const ConstConfigRcPtr & builtinConfig)
{
// Currently only handling scene-referred spaces in the heuristics.
if (cs->getReferenceSpaceType() == REFERENCE_SPACE_DISPLAY)
{
return -1;
}
// Get a transform in the to-reference direction.
ConstTransformRcPtr toRefTransform;
ConstTransformRcPtr ctransform = cs->getTransform(COLORSPACE_DIR_TO_REFERENCE);
if (ctransform)
{
toRefTransform = ctransform;
}
else
{
ctransform = cs->getTransform(COLORSPACE_DIR_FROM_REFERENCE);
if (ctransform)
{
TransformRcPtr transform = ctransform->createEditableCopy();
transform->setDirection(TRANSFORM_DIR_INVERSE);
toRefTransform = transform;
}
else
{
// Don't check spaces without transforms / data spaces.
return -1;
}
}
// First check if it has the right non-linearity. The objective is to fail quickly on color
// spaces that are definitely not sRGB before proceeding to the longer test of guessing the
// reference space primaries.
// Break point is at 0.039286, so include at least one value below this.
std::vector<float> vals =
{
0.5f, 0.5f, 0.5f,
0.03f, 0.03f, 0.03f,
0.25f, 0.25f, 0.25f,
0.75f, 0.75f, 0.75f,
0.f, 0.f, 0.f,
1.f, 1.f , 1.f
};
std::vector<float> out(vals.size(), 0.f);
PackedImageDesc desc( &vals[0], (long) vals.size() / 3, 1, CHANNEL_ORDERING_RGB );
PackedImageDesc descDst( &out[0], (long) vals.size() / 3, 1, CHANNEL_ORDERING_RGB );
ConstProcessorRcPtr proc = srcConfig->getProcessor(toRefTransform, TRANSFORM_DIR_FORWARD);
ConstCPUProcessorRcPtr cpu = proc->getOptimizedCPUProcessor(OPTIMIZATION_NONE);
// Convert the non-linear values to linear.
cpu->apply(desc, descDst);
for (size_t i = 0; i < out.size(); i++)
{
// Apply the sRGB function to convert the processed linear values back to non-linear.
// Please see GammaOpUtils.cpp. This value provides continuity at the breakpoint.
if (out[i] <= 0.0030399346397784323f)
{
out[i] *= 12.923210180787857f;
}
else
{
out[i] = 1.055f * std::pow(out[i], 1.f / 2.4f) - 0.055f;
}
// Compare against the original source values.
if (!EqualWithAbsError(vals[i], out[i], 1e-3f))
{
return -1;
}
}
// Define a (somewhat arbitrary) set of RGB values to test whether the transform is in fact
// converting sRGB texture values to the candidate reference space. It includes 0.02 which is
// on the sRGB linear segment, color values, and neutral values.
vals = { 0.7f, 0.4f, 0.02f, 0.f,
0.02f, 0.6f, 0.2f, 0.f,
0.3f, 0.02f, 0.5f, 0.f,
0.f, 0.f, 0.f, 0.f,
1.f, 1.f, 1.f, 0.f, };
// The color space has the sRGB non-linearity. Now try combining the transform with a
// transform from the Built-in config that goes from a variety of reference spaces to an
// sRGB texture space. If the result is an identity, then that tells what the source config
// reference space is.
for (int i = 0; i < getNumberOfbuiltinLinearSpaces(); i++)
{
ConstProcessorRcPtr proc = Config::GetProcessorFromConfigs(srcConfig,
cs->getName(),
srcRefName,
builtinConfig,
getSRGBColorSpaceName(),
getBuiltinLinearSpaceName(i));
if (isIdentityTransform(proc, vals, 1e-3f))
{
return i;
}
}
return -1;
}
// Identify the interchange spaces of the source config and the built-in default config
// that should be used to convert from the src color space to the built-in color space,
// or vice-versa. Throws if no suitable spaces are found.
//
// [out] srcInterchange -- Name of the interchange color space from the source config.
// [out] builtinInterchange -- Name of the interchange color space from the built-in config.
// srcConfig -- Source config object.
// srcColorSpaceName -- Name of the color space to be converted from the source config.
// builtinConfig -- Built-in config object.
// builtinColorSpaceName -- Name of the color space to be converted from the built-in config.
//
// Throws an exception if an interchange space cannot be found.
//
void IdentifyInterchangeSpace(const char ** srcInterchange,
const char ** builtinInterchange,
const ConstConfigRcPtr & srcConfig,
const char * srcColorSpaceName,
const ConstConfigRcPtr & builtinConfig,
const char * builtinColorSpaceName)
{
// Before resorting to heuristics, check if the configs already have the interchange
// roles defined.
//
// Note that this is the only place that srcColorSpaceName and builtinColorSpaceName
// are used, in order to determine whether the scene- or display-referred interchange
// role is most appropriate. These color spaces are not used below for the heuristics.
ReferenceSpaceType interchangeType;
if ( GetInterchangeRolesForColorSpaceConversion(srcInterchange, builtinInterchange,
interchangeType,
srcConfig, srcColorSpaceName,
builtinConfig, builtinColorSpaceName) )
{
// No need for the heuristics.
return;
}
// Use heuristics to try and find a color space in the source config that matches
// a color space in the Built-in config.
// Currently only handling scene-referred spaces in the heuristics.
if (builtinConfig->getColorSpace(builtinColorSpaceName)->getReferenceSpaceType()
== REFERENCE_SPACE_DISPLAY)
{
std::ostringstream os;
os << "The heuristics currently only support scene-referred color spaces. "
<< "Please set the interchange roles.";
throw Exception(os.str().c_str());
}
// Identify the name of a reference space in the source config.
*srcInterchange = getRefSpaceName(srcConfig);
if (!*srcInterchange)
{
std::ostringstream os;
os << "The supplied config does not have a color space for the reference.";
throw Exception(os.str().c_str());
}
// The heuristics need to create a lot of Processors and send RGB values through
// them to try and identify a known color space. Turn off the Processor cache in
// the configs to avoid polluting the cache with transforms that won't be reused
// and avoid the overhead of maintaining the cache.
SuspendCacheGuard srcGuard(srcConfig);
SuspendCacheGuard builtinGuard(builtinConfig);
// Check for an sRGB texture space.
int refColorSpacePrimsIndex = -1;
int nbCs = srcConfig->getNumColorSpaces();
for (int i = 0; i < nbCs; i++)
{
ConstColorSpaceRcPtr cs = srcConfig->getColorSpace(srcConfig->getColorSpaceNameByIndex(i));
if (containsSRGB(cs))
{
refColorSpacePrimsIndex = getReferenceSpaceFromSRGBSpace(srcConfig,
*srcInterchange,
cs,
builtinConfig);
// Break out when a match is found.
if (refColorSpacePrimsIndex > -1) break;
}
}
if (refColorSpacePrimsIndex < 0)
{
// Check for a scene-linear space with known primaries.
nbCs = srcConfig->getNumColorSpaces();
for (int i = 0; i < nbCs; i++)
{
ConstColorSpaceRcPtr cs = srcConfig->getColorSpace(srcConfig->getColorSpaceNameByIndex(i));
if (srcConfig->isColorSpaceLinear(cs->getName(), REFERENCE_SPACE_SCENE))
{
refColorSpacePrimsIndex = getReferenceSpaceFromLinearSpace(srcConfig,
*srcInterchange,
cs,
builtinConfig);
// Break out when a match is found.
if (refColorSpacePrimsIndex > -1) break;
}
}
}
if (refColorSpacePrimsIndex > -1)
{
*builtinInterchange = getBuiltinLinearSpaceName(refColorSpacePrimsIndex);
}
else
{
std::ostringstream os;
os << "Heuristics were not able to find a known color space in the provided config. "
<< "Please set the interchange roles.";
throw Exception(os.str().c_str());
}
}
// Try to find the name of a color space in the source config that is equivalent to the
// specified color space from the provided built-in config. Only active color spaces
// are searched.
//
// srcConfig -- The source config object to search.
// builtinConfig -- The built-in config object containing the desired color space.
// builtinColorSpaceName -- Name of the desired color space from the built-in config.
// Returns the name of the color space in the source config.
//
// \throw Exception if an interchange space cannot be found or the equivalent space cannot be found.
//
const char * IdentifyBuiltinColorSpace(const ConstConfigRcPtr & srcConfig,
const ConstConfigRcPtr & builtinConfig,
const char * builtinColorSpaceName)
{
// Note: Technically, the built-in config could be any config, if the interchange
// roles are set in both configs, and the supplied built-in config supports the list
// of color spaces returned by getBuiltinLinearSpaceName.
ConstColorSpaceRcPtr builtinColorSpace = builtinConfig->getColorSpace(builtinColorSpaceName);
if (!builtinColorSpace)
{
std::ostringstream os;
os << "Built-in config does not contain the requested color space: "
<< builtinColorSpaceName << ".";
throw Exception(os.str().c_str());
}
ReferenceSpaceType builtinRefSpaceType = builtinColorSpace->getReferenceSpaceType();
// Identify interchange spaces. Passing an empty string for the source color space
// means that only the builtinColorSpace will be used to determine the reference
// space type of the interchange role. Will throw if the space cannot be found.
// Only color spaces in the srcConfig that have the same reference type as the
// builtinColorSpace will be searched by the heuristics below.
const char * srcInterchangeName = nullptr;
const char * builtinInterchangeName = nullptr;
IdentifyInterchangeSpace(&srcInterchangeName,
&builtinInterchangeName,
srcConfig,
"",
builtinConfig,
builtinColorSpaceName);
// The heuristics need to create a lot of Processors and send RGB values through
// them to try and identify a known color space. Turn off the Processor cache in
// the configs to avoid polluting the cache with transforms that won't be reused
// and avoid the overhead of maintaining the cache.
SuspendCacheGuard srcGuard(srcConfig);
SuspendCacheGuard builtinGuard(builtinConfig);
if (*builtinInterchangeName)
{
std::vector<float> vals = { 0.7f, 0.4f, 0.02f, 0.f,
0.02f, 0.6f, 0.2f, 0.f,
0.3f, 0.02f, 0.5f, 0.f,
0.f, 0.f, 0.f, 0.f,
1.f, 1.f, 1.f, 0.f };
// Loop over each non-data color space in the source config and test if the conversion to
// the specified space in the built-in config is an identity.
//
// Note that there is a possibility that both the source and built-in sides of the
// transform could be an identity (e.g., if the user asks for ACES2065-1 and that is
// also the reference space in both configs). However, this would not prevent the
// algorithm from returning the correct result, as long as the interchange spaces
// were correctly identified.
int nbCs = srcConfig->getNumColorSpaces();
for (int i = 0; i < nbCs; i++)
{
ConstColorSpaceRcPtr cs = srcConfig->getColorSpace(srcConfig->getColorSpaceNameByIndex(i));
if (cs->isData() || (cs->getReferenceSpaceType() != builtinRefSpaceType))
{
continue;
}
ConstProcessorRcPtr proc = Config::GetProcessorFromConfigs(srcConfig,
cs->getName(),
srcInterchangeName,
builtinConfig,
builtinColorSpaceName,
builtinInterchangeName);
if (isIdentityTransform(proc, vals, 1e-3f))
{
return cs->getName();
}
}
}
std::ostringstream os;
os << "Heuristics were not able to find an equivalent to the requested color space: "
<< builtinColorSpaceName << ".";
throw Exception(os.str().c_str());
}
} // namespace ConfigUtils
} // namespace OCIO_NAMESPACE
-64
View File
@@ -1,64 +0,0 @@
// SPDX-License-Identifier: BSD-3-Clause
// Copyright Contributors to the OpenColorIO Project.
#ifndef INCLUDED_OCIO_CONFIG_UTILS_H
#define INCLUDED_OCIO_CONFIG_UTILS_H
#include <OpenColorIO/OpenColorIO.h>
namespace OCIO_NAMESPACE
{
namespace ConfigUtils
{
bool GetInterchangeRolesForColorSpaceConversion(const char ** srcInterchangeCSName,
const char ** dstInterchangeCSName,
ReferenceSpaceType & interchangeType,
const ConstConfigRcPtr & srcConfig,
const char * srcName,
const ConstConfigRcPtr & dstConfig,
const char * dstName);
void IdentifyInterchangeSpace(const char ** srcInterchange,
const char ** builtinInterchange,
const ConstConfigRcPtr & srcConfig,
const char * srcColorSpaceName,
const ConstConfigRcPtr & builtinConfig,
const char * builtinColorSpaceName);
const char * IdentifyBuiltinColorSpace(const ConstConfigRcPtr & srcConfig,
const ConstConfigRcPtr & builtinConfig,
const char * builtinColorSpaceName);
// Temporarily deactivate the Processor cache on a Config object.
// Currently, this also clears the cache.
//
class SuspendCacheGuard
{
public:
SuspendCacheGuard();
SuspendCacheGuard(const SuspendCacheGuard &) = delete;
SuspendCacheGuard & operator=(const SuspendCacheGuard &) = delete;
SuspendCacheGuard(const ConstConfigRcPtr & config)
: m_config(config), m_origCacheFlags(config->getProcessorCacheFlags())
{
m_config->setProcessorCacheFlags(PROCESSOR_CACHE_OFF);
}
~SuspendCacheGuard()
{
m_config->setProcessorCacheFlags(m_origCacheFlags);
}
private:
ConstConfigRcPtr m_config = nullptr;
ProcessorCacheFlags m_origCacheFlags;
};
} // namespace ConfigUtils
} // namespace OCIO_NAMESPACE
#endif // INCLUDED_OCIO_CONFIG_UTILS_H

Some files were not shown because too many files have changed in this diff Show More