Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Python wheels workflow and build backend #4428

Open
wants to merge 180 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 178 commits
Commits
Show all changes
180 commits
Select commit Hold shift + click to select a range
d8e0955
build: Improve Python3 component detection
zachlewis Jul 23, 2024
df83fc8
Add pyproject.toml for building wheels with scikit-build-core
zachlewis Jul 23, 2024
5e86b2d
int(python): Adjust module metadata
zachlewis Jul 26, 2024
ea2432a
build(deps): Improve ability to build, link, and alias shared and sta…
zachlewis Jul 29, 2024
5c1a1b8
build(deps): Add libjpeg-turbo recipe
zachlewis Jul 29, 2024
78fed97
refactor: Simplify structure of Python module
zachlewis Jul 29, 2024
bd271a3
docs: clarify that IBA::rotate params are pixel coordinates (#4358)
lgritz Jul 26, 2024
d298bad
build: A few cmake cleanups and minor code rearrangements (#4359)
lgritz Jul 29, 2024
f9d7f21
Revert libdeflate-related changes to externalpackages.cmake
zachlewis Jul 30, 2024
f555161
build(python): set RPATHs to relative paths to distribution's 'libs' …
zachlewis Jul 30, 2024
5f70b0a
build(python): Improve pip-based build experience
zachlewis Jul 31, 2024
3337f70
build(python): Force TIFF to always build locally only for CIBW
zachlewis Jul 31, 2024
50f0b4e
cleanup: fix comment, whitespace
zachlewis Aug 7, 2024
2013d09
build: pyproject housekeeping
zachlewis Aug 7, 2024
7180872
build: slim down wheels w/ refactored CIBW repair-wheel-command step
zachlewis Aug 7, 2024
1997724
build: add `rye` artifacts to gitignore
zachlewis Aug 8, 2024
80acc8c
build: simplify wheel_edit task
zachlewis Aug 8, 2024
2ee72cd
cleanup: add copyright and license information to tasks.py
zachlewis Aug 8, 2024
0f5e1a3
build(deps): add zlib build recipe
zachlewis Aug 27, 2024
13f60ce
build(deps): add yaml-cpp build recipe
zachlewis Aug 30, 2024
b96525e
build(python): On windows, include Development.Embed Python3 component
zachlewis Sep 4, 2024
42caf75
build(python): Increase verbosity of scikit-build-core build
zachlewis Sep 6, 2024
5a70d3e
build(wheels): Refine build process and Windows compatibility
zachlewis Sep 9, 2024
151333f
cleanup(python): formatting for PEP compliance
zachlewis Sep 10, 2024
0810544
ci: add wheel workflow
zachlewis Sep 10, 2024
bf4265e
fix(IB): copy/paste error in the ImageBuf iterator copy constructor (…
antond-weta Aug 1, 2024
1c7cd37
feat(oiiotool): additional stack commands and --for improvement (#4348)
lgritz Aug 7, 2024
ea63dbb
int: Rename env OIIOTOOL_METADATA_HISTORY -> OPENIMAGEIO_METADATA_HIS…
lgritz Aug 7, 2024
781ee80
feat(jpeg): output hint "jpeg:iptc" (#4346)
lgritz Aug 7, 2024
6eddaf5
fix(png): round dpi resolution to nearest 0.1 (#4347)
lgritz Aug 7, 2024
5ca303d
raw: expose additional white balancing hints (#4360)
antond-weta Aug 7, 2024
3599081
api: move OIIO::pvt::error and log_time into the exposed OIIO namespa…
lgritz Aug 7, 2024
2db7b90
admin: Relicense code under Apache 2.0 (#3905)
lgritz Aug 10, 2024
2c10095
api: add pvt::heapsize() and pvt::footprint() methods and image cache…
bfraboni Aug 11, 2024
a7c8fd8
deps: Make OCIO 2.2+ a required dependency (#4367)
lgritz Aug 12, 2024
c4b6bb0
fix(oiiotool): `-i:ch=...` didn't fix up alpha and z channels (#4373)
lgritz Aug 12, 2024
25df0aa
cleanup: Remove unused test output ref from old dependency versions (…
lgritz Aug 15, 2024
a1d809b
build: CI sanitizer test improvements (#4374)
lgritz Aug 15, 2024
1f45b2f
build(deps): Raise libheif minimum to 1.11 (#4380)
lgritz Aug 15, 2024
becb6e8
fix(windows): fix for setenv() on Windows (#4381)
ssh4net Aug 16, 2024
0eedbcb
build: Don't link libOpenImageIO against OpenCV (#4363)
lgritz Aug 16, 2024
ef615c8
api: use shared_ptr for ImageCache and TextureSystem (#4377)
lgritz Aug 16, 2024
87d2e70
Bump version to indicate ABI changes
lgritz Aug 16, 2024
3122823
ci: Bump ABI standard in master
lgritz Aug 16, 2024
ce0b5b8
cleanup: Fix typo where apostrophe was used for possessive of 'it' (#…
JGoldstone Aug 16, 2024
660d068
style: Turn on clang-format for ivmain.cpp (#4382)
lgritz Aug 16, 2024
9db71c5
int: Beef up some error messages (#4369)
lgritz Aug 16, 2024
bd12ec9
docs: typo fix (#4385)
lgritz Aug 21, 2024
1a0adf6
fix: Catch potential OCIO exception that we were missing (#4379)
lgritz Aug 21, 2024
f27f092
ptex: Store full metadata only at subimage 0, miplevel 0 for ptex fil…
lgritz Aug 21, 2024
cad150d
fix(png): bug in associateAlpha botched alpha=0 pixels (#4386)
lgritz Aug 21, 2024
d8ad61f
feat(iba): IBA::demosaic() for bayer pattern demosaicing (#4366)
antond-weta Aug 26, 2024
14f7bb0
build: Add proper detection of new FFmpeg versions (#4394)
darbyjohnston Aug 27, 2024
066e571
docs: clarify TextureSystem::create use of imagecache when shared=tru…
lgritz Aug 28, 2024
8289357
fix(iba): Add missing version of warp (#4390)
lgritz Aug 28, 2024
087605a
feat(ffmpeg): FFmpeg additional metadata (#4396)
darbyjohnston Aug 31, 2024
9e5d1e5
fix(iba): IBA::transpose() didn't set output image's format to input …
lgritz Aug 31, 2024
acb513a
dev: span utility improvements (#4398)
lgritz Aug 31, 2024
f784415
feat(raw): make the crop match in-camera JPEG (#4397)
antond-weta Aug 31, 2024
22dfb86
api!: add virtual heapsize() and footprint() to ImageInput and ImageO…
bfraboni Sep 2, 2024
1c3370e
refactor!: de-virtualize IC and TS (#4384)
lgritz Sep 2, 2024
9818a04
feat: implement support for OCIO NamedTransforms (#4393)
zachlewis Sep 2, 2024
6384b5d
fix: Don't let fmtlib exceptions crash the app (#4400)
lgritz Sep 2, 2024
11e84e6
CHANGES and bump version to 2.6.5.0
lgritz Sep 2, 2024
e1fc73f
Update ABI reference commit / stage for developer preview v2.6.5.0
lgritz Sep 3, 2024
e19ab97
Bump version after developer preview tag
lgritz Sep 6, 2024
a8362ad
docs: Switch license name in docs (#4407)
lgritz Sep 6, 2024
be9027f
api: Fold span_util.h contents into span.h (#4402)
lgritz Sep 6, 2024
1ddddd8
api(IB): Add span-based constuctors to ImageBuf (#4401)
lgritz Sep 9, 2024
f4f5ee8
ci: Bump the dependency versions for the 'latest' test to the actual …
lgritz Sep 9, 2024
9e40cb0
ci: add a workflow that builds docs (#4413)
lgritz Sep 9, 2024
36c5275
ci: adjust wheel cron and add workflow_dispatch
zachlewis Sep 10, 2024
5397de1
ci: temporarily remove the push "tags" constraint for the wheel workflow
zachlewis Sep 10, 2024
68c5497
ci(wheel): Updated deployment target for MacOS
zachlewis Sep 10, 2024
e3f07e1
fix(python): updated PYTHON_SITE_DIR setting for skbuild
zachlewis Sep 10, 2024
c18d241
fix(python): For macOS, ensure dependencies are built for the correct…
zachlewis Sep 10, 2024
d85dfc8
fix(ci): Move per-platform repair-wheel-cmd to correct parts of config
zachlewis Sep 10, 2024
d719823
ci(wheels): temporarily use "Release" instead of "MinSizeRel" bld type
zachlewis Sep 10, 2024
0505040
docs: Convert more examples within the imagebufalgo chapter. (#4039)
buddly27 Sep 11, 2024
318e4ff
test: Fix tests that were writing into ref (#4418)
lgritz Sep 11, 2024
4c91126
fix(deps): Turn off building shared libs for libdeflate; refind zlib
zachlewis Sep 11, 2024
4ef5553
fix(deps): Don't try to refind a config for ZLIB
zachlewis Sep 11, 2024
edff8a6
docs: Add a few words about building with the python build-backend.
zachlewis Sep 13, 2024
245c51e
cleanup: add and clarify pyproject.toml comments
zachlewis Sep 13, 2024
e52c3cf
ci: prepare Wheels workflow for PR
zachlewis Sep 13, 2024
6d25552
ci(wheels): use "oiiotool --help" as a test command.
zachlewis Sep 13, 2024
16793db
ci(wheels): Use new pypi "trusted publisher" workflow
zachlewis Sep 16, 2024
edda093
ci(wheels): Exclude unnecessary directories from the source distribution
zachlewis Sep 16, 2024
f465ba5
Merge branch 'master' into python_cibuildwheels
zachlewis Sep 16, 2024
d0adf3a
ci(wheels): Build macos arm64 wheels on macos arm64 runners
zachlewis Sep 16, 2024
d6872e5
deps: add build recipe for PNG
zachlewis Sep 16, 2024
5904090
deps(PNG): always build static PNG
zachlewis Sep 16, 2024
3cbb73d
deps(PNG): Always build with -fPIC
zachlewis Sep 16, 2024
0fdace1
deps(PNG): Always build shared libs
zachlewis Sep 16, 2024
0160971
deps(PNG): adjust libpng library install dir
zachlewis Sep 16, 2024
35210f1
deps(PNG): disable Framework build for libpng
zachlewis Sep 17, 2024
889e46d
ci(wheels): Use newer macos x86_64 runners, and refine publish condition
zachlewis Sep 17, 2024
f5e118d
deps(yaml-cpp): specify that yaml-cpp is a dependency of OCIO
zachlewis Sep 17, 2024
16d634e
cleanup: Minor adjustments to pyproject.toml
zachlewis Sep 17, 2024
ce5db05
fix(wheels): disable free-threaded support for now
zachlewis Sep 17, 2024
ab7e348
ci(wheel): revert CIBW environment override
zachlewis Sep 17, 2024
ffa522e
deps(PNG): Always disable shared libs
zachlewis Sep 17, 2024
1258db1
ci(wheels): Use macos-14 runners for linux arm builds; use latest cibw
zachlewis Sep 18, 2024
5dc9ceb
ci(wheels): refine process for building Linux aarch64 wheels
zachlewis Sep 18, 2024
2a5e713
ci(wheels): Install Docker to macos-14 runner for cross compile
zachlewis Sep 18, 2024
59787c2
ci(wheels): Use podman instead of Docker for MacOS ARM64 Linux cross
zachlewis Sep 18, 2024
72402d2
ci(wheels): Revert to using a linux runner for building aarch64 wheels
zachlewis Sep 19, 2024
c313ad3
Merge branch 'main' into python_cibuildwheels
zachlewis Sep 19, 2024
36a4d29
deps: Remove yaml-cpp and PNG recipes
zachlewis Sep 23, 2024
f21a834
ci(wheels): Add CPython 3.13, and improve linux ARM builds
zachlewis Sep 23, 2024
18d192f
Merge branch 'main' into python_cibuildwheels
zachlewis Sep 23, 2024
fb677f4
cleanup: reconcile minor differences with main branch
zachlewis Sep 23, 2024
37fbfa3
ci(wheels): Use homebrew to install libpng on MacOS ARM runners
zachlewis Sep 25, 2024
25a6ed7
fix(wheels): Temporarily disable PNG plugin for MacOS ARM64 runners
zachlewis Sep 26, 2024
e9e3197
ci(wheels): install python 3.8 to macos-14 runners
zachlewis Sep 26, 2024
d214039
Merge branch 'main' into python_cibuildwheels
zachlewis Sep 26, 2024
77b7436
cleanup(wheels): make tasks.py a little prettier
zachlewis Sep 27, 2024
25d774c
deps(libdeflate): revert changes to build recipe
zachlewis Sep 27, 2024
7e9e687
Revert "deps(libdeflate): revert changes to build recipe"
zachlewis Sep 27, 2024
e45ca15
fix: test python-colorconfig with the same config for all OCIO vers
zachlewis Sep 27, 2024
5f76706
build(pyproject): bump build-reqs: numpy-2
zachlewis Sep 30, 2024
c6c25a4
ci(wheels): remove unnecessary QEMU setup
zachlewis Sep 30, 2024
3a3deee
fix: typo in pyproject build requires
zachlewis Sep 30, 2024
1e05f5d
Revert "fix: test python-colorconfig with the same config for all OCI…
zachlewis Sep 30, 2024
e6f818b
fix: adjust numpy build requirement
zachlewis Sep 30, 2024
5f4caf5
testing: temporarily disable numpy build requirement
zachlewis Sep 30, 2024
6b2fb9f
ci(wheels): Disable py3.8 builds
zachlewis Sep 30, 2024
af99af9
fix: tiny update to .gitignore
zachlewis Sep 30, 2024
bf451a5
fix: Reenable Python-3 module when using cmake < 3.18
zachlewis Sep 30, 2024
b2a1e4d
ci(wheels): macos_x86: disable WebP, HEIF plugin, use macos-13 runner
zachlewis Sep 30, 2024
31cc8f0
ci(wheels): macos-x86_64: revert to macos-12 runners
zachlewis Sep 30, 2024
9f6aedf
deps(TIFF): turn off support for WebP compression
zachlewis Sep 30, 2024
130a108
testing: Update test ref output for OpenColorIO 2.4 (#4459)
lgritz Sep 27, 2024
3903ef2
fix(wheels): LINKSTATIC=1 to prefer built static libs over sys dylib
zachlewis Sep 30, 2024
a0af477
fix(wheels): macOS: build _all_ deps locally
zachlewis Sep 30, 2024
35b4af6
ci(wheels): MacOS: brew uninstall freetype
zachlewis Sep 30, 2024
bfae087
ci(wheels): MacOS x86_64: reenable WebP
zachlewis Sep 30, 2024
77fcc6b
Merge branch 'main' into python_cibuildwheels
zachlewis Sep 30, 2024
a615763
ci: Remove old MacOS-12 CI test
lgritz Sep 30, 2024
b13a055
Don't exclude MacOS 12, just disable OpenCV and Qt homebrew install f…
lgritz Sep 30, 2024
b4b1269
ci: Streamline the old MacOS-12 CI test (#4465)
lgritz Sep 30, 2024
5bba64d
ci: Test against OpenEXR 3.3 and deal with its 4.0 bump
lgritz Sep 30, 2024
7b37f05
ci:(wheels): macos-x86_64 - move "brew uninstall" cmd to workflow
zachlewis Oct 2, 2024
6f61f63
cleanup: remove unnecessary stuff from pyproject.toml and wheel.yml
zachlewis Oct 2, 2024
d07cbe8
build: Raise CMake minimum to 3.18
lgritz Sep 21, 2024
853952e
Fix prob with cmake 3.18.0..3.18.1
lgritz Oct 2, 2024
cf648f2
cleanup: assume cmake >= 3.18 when building python modules
zachlewis Oct 2, 2024
221e4d8
cleanup: python __init__.py, warn about loading DLLs from PATH on Win
zachlewis Oct 2, 2024
1036870
build: Raise CMake minimum to 3.18
lgritz Sep 21, 2024
a882bcf
Merge branch 'main' into python_cibuildwheels
zachlewis Oct 3, 2024
c5ded6f
Merge remote-tracking branch 'origin/python_cibuildwheels' into pytho…
zachlewis Oct 3, 2024
63c7b56
Merge remote-tracking branch 'lgritz/lg-cmakedep' into python_cibuild…
zachlewis Oct 3, 2024
1fba61d
cleanup(pyproject): Remove numpy dep + MacOS arch CMake defines
zachlewis Oct 3, 2024
f10ecfa
ci(wheels): brew-uninstall freetype for macos-arm64 runs
zachlewis Oct 3, 2024
7a56416
ci(wheels): Adjust Workflow perms, GH pin Action vers, reenable cp38
zachlewis Oct 3, 2024
db440e9
Merge branch 'main' into python_cibuildwheels
zachlewis Oct 11, 2024
978e8f0
Update docs URL in pyproject.toml
zachlewis Oct 14, 2024
d45e634
ci(wheels): Use CMAKE_IGNORE_PREFIX_PATH instead of uninstalling stuff
zachlewis Oct 15, 2024
deeba08
build: Add IGNORE_HOMEBREWED_DEPS CMake option
zachlewis Oct 15, 2024
9fa0a76
ci(wheel): use macos-13 instead of 12 for macos-x86_64 builds
zachlewis Oct 15, 2024
380e8c8
build: make sure IGNORE_HOMEBREWED_DEPS removes paths from system path
zachlewis Oct 15, 2024
34d7e3a
build(wheels): Don't install versioned copies of libraries
zachlewis Oct 15, 2024
494a53c
build(wheels): provide cmake prefix hint for downstream skbuild pkgs
zachlewis Oct 16, 2024
9d0645d
build: add /opt/X11 to prefixes skipped by IGNORE_HOMEBREWED_DEPS
zachlewis Oct 16, 2024
d9b37c0
ci(wheels): disable CIBW repair-wheel step + remove tasks.py
zachlewis Oct 16, 2024
110e69a
build: improve IGNORE_HOMEBREWED_DEPS building
zachlewis Oct 16, 2024
5373e98
Revert "build(wheels): Don't install versioned copies of libraries"
zachlewis Oct 16, 2024
b13051d
Merge branch 'main' into python_cibuildwheels
zachlewis Oct 17, 2024
82053dd
deps(OCIO): disable versioning in shared lib name when building
zachlewis Oct 17, 2024
9437415
build: add "NAMELINK_SKIP" option to install_targets
zachlewis Oct 21, 2024
3e60ade
build(wheels): adjust RPATHs and skip namelinks
zachlewis Oct 21, 2024
a3fd5ea
ci(wheel): re-enable default CIBW repairwheel step
zachlewis Oct 21, 2024
f63dbfb
Merge branch 'main' into python_cibuildwheels
zachlewis Oct 21, 2024
f98635f
python(__init__.py): Set $OpenImageIO_ROOT before importing the module
zachlewis Oct 22, 2024
8fdc0d5
build(wheels): bump MACOSX_DEPLOYMENT_TARGET to 11
zachlewis Oct 29, 2024
3524c4f
Merge branch 'main' into python_cibuildwheels
zachlewis Oct 30, 2024
babfa59
build(wheel): Only install Py module, libs, fonts, oiiotool and maketx
zachlewis Oct 30, 2024
6d8ceb5
cleanup: Refactor DLL loading and remove metadata from __init__.py
zachlewis Oct 30, 2024
2fed38e
cleanup(pyproject): remove CIBW stuff related to incremental building
zachlewis Oct 31, 2024
678f530
cleanup: remove unused logger from python module's init.py
zachlewis Oct 31, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
416 changes: 416 additions & 0 deletions .github/workflows/wheel.yml

Large diffs are not rendered by default.

8 changes: 7 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,17 @@ branches/
build/
dist/
ext/
wheelhouse/
_coverage/
.python-version
.idea
.vscode
.cproject
.project
.DS_Store
*.pyc
_coverage/
/*.lock
gastest.o

# Exclude test files I tend to leave around at the top level. The leading
# slash ensures that files with these extensions within subdirectories are not
Expand All @@ -21,3 +25,5 @@ _coverage/
/*.jxl
/*.tx
/*.log


44 changes: 42 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,8 @@ set (PLUGIN_SEARCH_PATH "" CACHE STRING "Default plugin search path")
file (TO_NATIVE_PATH "${PLUGIN_SEARCH_PATH}" PLUGIN_SEARCH_PATH_NATIVE)
set (CMAKE_DEBUG_POSTFIX "_d" CACHE STRING "Library naming postfix for Debug builds")



if (CMAKE_UNITY_BUILD_BATCH_SIZE)
set (UNITY_SMALL_BATCH_SIZE "${CMAKE_UNITY_BUILD_BATCH_SIZE}" CACHE STRING "Unity batch mode size for expensive files")
else ()
Expand Down Expand Up @@ -169,6 +171,38 @@ include (compiler)
# Dependency finding utilities and all dependency-related options
include (dependency_utils)

option (IGNORE_HOMEBREWED_DEPS "If ON, will ignore homebrew-installed dependencies" OFF)
if (IGNORE_HOMEBREWED_DEPS)
# Define the list of prefixes to ignore
set (HOMEBREW_PREFIXES
/opt/homebrew
/usr/local
/usr/X11
/usr/X11R6
/opt/X11
)
message (STATUS "Ignoring Homebrew dependencies and adjusted environment and CMake variables accordingly.")
foreach (_cmake_var
CMAKE_SYSTEM_INCLUDE_PATH
CMAKE_SYSTEM_LIBRARY_PATH
CMAKE_PREFIX_PATH)
remove_prefixes_from_variable (CMAKE ${_cmake_var} "${HOMEBREW_PREFIXES}")
endforeach ()

# Adjust CMAKE_IGNORE_PATH
foreach (_prefix IN LISTS HOMEBREW_PREFIXES)
list (APPEND CMAKE_IGNORE_PATH
"${_prefix}"
"${_prefix}/lib"
"${_prefix}/bin"
"${_prefix}/include"
)
endforeach ()

message (STATUS "CMAKE_IGNORE_PATH: ${CMAKE_IGNORE_PATH}")
endif ()


# Utilities and options related to finding python and making python bindings
include (pythonutils)

Expand Down Expand Up @@ -246,10 +280,16 @@ if (NOT EMBEDPLUGINS AND NOT BUILD_OIIOUTIL_ONLY)
endforeach ()
endif ()

if (USE_PYTHON AND Python3_Development_FOUND AND NOT BUILD_OIIOUTIL_ONLY)

if (WIN32)
set (_py_dev_found Python3_Development_FOUND)
else ()
set (_py_dev_found Python3_Development.Module_FOUND)
endif ()
if (USE_PYTHON AND ${_py_dev_found} AND NOT BUILD_OIIOUTIL_ONLY)
add_subdirectory (src/python)
else ()
message (STATUS "Not building Python bindings: USE_PYTHON=${USE_PYTHON}, Python3_Development_FOUND=${Python3_Development_FOUND}")
message (STATUS "Not building Python bindings: USE_PYTHON=${USE_PYTHON}, Python3_Development.Module_FOUND=${Python3_Development.Module_FOUND}")
endif ()

add_subdirectory (src/include)
Expand Down
49 changes: 36 additions & 13 deletions INSTALL.md
Original file line number Diff line number Diff line change
Expand Up @@ -230,19 +230,20 @@ Make targets you should know about:

Additionally, a few helpful modifiers alter some build-time options:

| Target | Command |
| ------------------------- | ---------------------------------------------- |
| make VERBOSE=1 ... | Show all compilation commands |
| make STOP_ON_WARNING=0 | Do not stop building if compiler warns |
| make EMBEDPLUGINS=0 ... | Don't compile the plugins into libOpenImageIO |
| make USE_OPENGL=0 ... | Skip anything that needs OpenGL |
| make USE_QT=0 ... | Skip anything that needs Qt |
| make MYCC=xx MYCXX=yy ... | Use custom compilers |
| make USE_PYTHON=0 ... | Don't build the Python binding |
| make BUILD_SHARED_LIBS=0 | Build static library instead of shared |
| make LINKSTATIC=1 ... | Link with static external libraries when possible |
| make SOVERSION=nn ... | Include the specified major version number in the shared object metadata |
| make NAMESPACE=name | Wrap everything in another namespace |
| Target | Command |
| ----------------------------- | ------------------------------------------------------------------------- |
| make VERBOSE=1 ... | Show all compilation commands |
| make STOP_ON_WARNING=0 | Do not stop building if compiler warns |
| make EMBEDPLUGINS=0 ... | Don't compile the plugins into libOpenImageIO |
| make USE_OPENGL=0 ... | Skip anything that needs OpenGL |
| make USE_QT=0 ... | Skip anything that needs Qt |
| make MYCC=xx MYCXX=yy ... | Use custom compilers |
| make USE_PYTHON=0 ... | Don't build the Python binding |
| make BUILD_SHARED_LIBS=0 | Build static library instead of shared |
| make IGNORE_HOMEBREWED_DEPS=1 | Ignore homebrew-managed dependencies |
| make LINKSTATIC=1 ... | Link with static external libraries when possible |
| make SOVERSION=nn ... | Include the specified major version number in the shared object metadata |
| make NAMESPACE=name | Wrap everything in another namespace |

The command 'make help' will list all possible options.

Expand Down Expand Up @@ -357,6 +358,28 @@ produce a dynamic-linked version.

3. Execute the PowerShell command from where vcpkg is located in directory. ``vcpkg install openimageio``


Python-based Builds and Installs
--------------------------------

**Installing from prebuilt binary distributions**

If you're only interested in the Python module and the CLI tools, you can install with `pip` or `uv`:

> ```pip install OpenImageIO```

**Building and installing from source**

If you have a C++ compiler installed, you can also use the Python build-backend to compile and install
from source by navigating to the root of the repository and running: ```pip install .```

This will download and install CMake and Ninja if necessary, and invoke the CMake build system; which,
in turn, will build missing dependencies, compile OIIO, and install the Python module, the libraries,
the headers, and the CLI tools to a platform-specific, Python-specific location.

See the [scikit-build-core docs](https://scikit-build-core.readthedocs.io/en/latest/configuration.html#configuring-cmake-arguments-and-defines)
for more information on customizing and overriding build-tool options and CMake arguments.

Test Images
-----------

Expand Down
1 change: 1 addition & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -378,6 +378,7 @@ help:
@echo " USE_NUKE=0 Don't build Nuke plugins"
@echo " Nuke_ROOT=path Custom Nuke installation"
@echo " NUKE_VERSION=ver Custom Nuke version"
@echo " IGNORE_HOMEBREWED_DEPS=1 Don't use dependencies installed by Homebrew"
@echo " OIIO build-time options:"
@echo " INSTALL_PREFIX=path Set installation prefix (default: ./${INSTALL_PREFIX})"
@echo " NAMESPACE=name Override namespace base name (default: OpenImageIO)"
Expand Down
132 changes: 132 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,132 @@
[project]
name = "OpenImageIO"
# The build backend ascertains the version from the CMakeLists.txt file.
dynamic = ["version"]
description = "Reading, writing, and processing images in a wide variety of file formats, using a format-agnostic API, aimed at VFX applications."
authors = [
{name = "Larry Gritz", email = "[email protected]"},
{name = "OpenImageIO Contributors", email = "[email protected]"}
]
maintainers = [
{name = "OpenImageIO Contributors", email="[email protected]"},
]
readme = "README.md"
license = {text = "Apache-2.0"}
classifiers = [
"Natural Language :: English",
"Operating System :: OS Independent",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Programming Language :: Python :: 3.13",
"License :: OSI Approved :: Apache Software License",
"Topic :: Multimedia :: Graphics",
"Topic :: Multimedia :: Video",
"Topic :: Multimedia :: Video :: Display",
"Topic :: Software Development :: Libraries :: Python Modules",
]
requires-python = ">= 3.8"

[project.urls]
Homepage = "https://openimageio.org/"
Source = "https://github.com/AcademySoftwareFoundation/OpenImageIO"
Documentation = "https://docs.openimageio.org"
Issues = "https://github.com/AcademySoftwareFoundation/OpenImageIO/issues"


[project.scripts]
# Use the convention below to expose CLI tools as Python scripts.
maketx = "OpenImageIO:_command_line"
oiiotool = "OpenImageIO:_command_line"

[build-system]
build-backend = "scikit_build_core.build"
requires = [
"scikit-build-core>=0.10.6,<1",
"pybind11",
]

[tool.scikit-build]
build.verbose = true
# Exclude unnecessary directories from the source distribution.
sdist.exclude = [".github", "testsuite", "ASWF", "docs"]
# Pin minimum scikit-build-core to that specified in build-system.requires.
minimum-version = "build-system.requires"
# Pin minimum CMake version to that specified in CMakeLists.txt.
cmake.version = "CMakeLists.txt"
wheel.license-files = ["LICENSE.md", "THIRD-PARTY.md"]
# Make sure the package is structured as expected.
wheel.install-dir = "OpenImageIO"
# Only install the user and fonts components.
install.components = ["user", "fonts"]

[tool.scikit-build.cmake.define]
# Build missing dependencies. See src/cmake for details.
OpenImageIO_BUILD_MISSING_DEPS = "all"
# Don't build tests. Dramatically improves build time.
OIIO_BUILD_TESTS = "0"
# Prefer linking static dependencies when possible.
LINKSTATIC = "1"
# Standardize the install directory for libraries, as expected by
# other parts of the wheels build process.
CMAKE_INSTALL_LIBDIR = "lib"

# Dynamically set the package version metadata by pasrsing CMakeLists.txt.
[tool.scikit-build.metadata.version]
provider = "scikit_build_core.metadata.regex"
input = "CMakeLists.txt"
regex = 'set \(OpenImageIO_VERSION "(?P<value>[0-9a-z.]+)"\)'


# On macOS, ensure dependencies are only built for the target architecture.
[[tool.scikit-build.overrides]]
if.platform-system = "darwin"
if.platform-machine = "arm64"
inherit.cmake.define = "append"
cmake.define.CMAKE_OSX_ARCHITECTURES = "arm64"

[[tool.scikit-build.overrides]]
if.platform-system = "darwin"
if.platform-machine = "x86_64"
inherit.cmake.define = "append"
cmake.define.CMAKE_OSX_ARCHITECTURES = "x86_64"


[tool.cibuildwheel]
build-verbosity = 1
skip = [
# Skip 32-bit builds
"*-win32",
"*-manylinux_i686",
# Building with musl seems to work, but the repair-wheel step seems to fail...
# This may be a bug in repairwheel (or auditwheel)?
"*musllinux*",
]
test-command = "oiiotool --buildinfo"
# Prevent CIBW's default repair-wheel command from running, because it fails to
zachlewis marked this conversation as resolved.
Show resolved Hide resolved
# recognize that the wheel isn't broken to begin with, and ends up creating
# additional copies of the shared libraries in the wheel.

[tool.cibuildwheel.macos.environment]
# Specify a persistent build directory so the repairwheel command can (re)find
# dependency libraries built by OpenImageIO.
SKBUILD_BUILD_DIR = "/tmp/build_oiio_wheels"
# Always (re)build the TIFF library; see #4439 for more details.
SKBUILD_CMAKE_ARGS = "-DOpenImageIO_BUILD_LOCAL_DEPS=TIFF; -DOpenImageIO_BUILD_MISSING_DEPS=all; -DLINKSTATIC=1; -DIGNORE_HOMEBREWED_DEPS=1; -DCMAKE_INSTALL_LIBDIR=lib"
zachlewis marked this conversation as resolved.
Show resolved Hide resolved
# C++17 - std::filesystem is only available in macOS 10.15 and later.
MACOSX_DEPLOYMENT_TARGET = "11"
# Optimize for size (not speed).
SKBUILD_CMAKE_BUILD_TYPE = "MinSizeRel"

[tool.cibuildwheel.linux.environment]
SKBUILD_BUILD_DIR = "/tmp/build_oiio_wheels"
SKBUILD_CMAKE_ARGS = "-DOpenImageIO_BUILD_LOCAL_DEPS=all; -DOpenImageIO_BUILD_MISSING_DEPS=all; -DLINKSTATIC=1; -DCMAKE_INSTALL_LIBDIR=lib"
SKBUILD_CMAKE_BUILD_TYPE = "MinSizeRel"
# Suppress warnings that cause linux cibuildwheel build to fail
CXXFLAGS = "-Wno-error=stringop-overflow -Wno-pragmas"

[tool.cibuildwheel.windows.environment]
SKBUILD_CMAKE_BUILD_TYPE = "MinSizeRel"
1 change: 1 addition & 0 deletions src/build-scripts/build_libtiff.bash
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ if [[ -z $DEP_DOWNLOAD_ONLY ]]; then
-Dtiff-tests=${LIBTIFF_BUILD_TESTS:-OFF} \
-Dtiff-docs=${LIBTIFF_BUILD_TESTS:-OFF} \
-Dlibdeflate=ON \
-Dwebp=OFF \
${LIBTIFF_BUILDOPTS}
time cmake --build build --target install
fi
Expand Down
2 changes: 2 additions & 0 deletions src/cmake/build_OpenColorIO.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@ build_dependency_with_cmake(OpenColorIO
-D OCIO_BUILD_TESTS=OFF
-D OCIO_USE_OIIO_FOR_APPS=OFF
-D OCIO_INSTALL_DOCS=OFF
# Disable versioning in OCIO shared library name
-D OCIO_USE_SOVERSION=OFF
# Make OCIO build all its dependencies statically
-D OCIO_INSTALL_EXT_PACKAGES=MISSING
# Give the library a custom name and symbol namespace so it can't
Expand Down
4 changes: 3 additions & 1 deletion src/cmake/build_libdeflate.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
set_cache (libdeflate_BUILD_VERSION 1.20 "libdeflate version for local builds")
set (libdeflate_GIT_REPOSITORY "https://github.com/ebiggers/libdeflate")
set (libdeflate_GIT_TAG "v${libdeflate_BUILD_VERSION}")
set_cache (libdeflate_BUILD_SHARED_LIBS ${LOCAL_BUILD_SHARED_LIBS_DEFAULT}
set_cache (libdeflate_BUILD_SHARED_LIBS OFF # ${LOCAL_BUILD_SHARED_LIBS_DEFAULT}
DOC "Should a local libdeflate build, if necessary, build shared libraries" ADVANCED)

string (MAKE_C_IDENTIFIER ${libdeflate_BUILD_VERSION} libdeflate_VERSION_IDENT)
Expand All @@ -20,6 +20,7 @@ build_dependency_with_cmake(libdeflate
GIT_TAG ${libdeflate_GIT_TAG}
CMAKE_ARGS
-D BUILD_SHARED_LIBS=${libdeflate_BUILD_SHARED_LIBS}
-D LIBDEFLATE_BUILD_SHARED_LIB=${libdeflate_BUILD_SHARED_LIBS}
-D CMAKE_POSITION_INDEPENDENT_CODE=ON
-D CMAKE_INSTALL_LIBDIR=lib
-D LIBDEFLATE_BUILD_GZIP=OFF
Expand All @@ -32,6 +33,7 @@ set (libdeflate_ROOT ${libdeflate_LOCAL_INSTALL_DIR})
# Signal to caller that we need to find again at the installed location
set (libdeflate_REFIND TRUE)
set (libdeflate_REFIND_ARGS CONFIG)
set (libdeflate_REFIND_VERSION ${libdeflate_BUILD_VERSION})

if (libdeflate_BUILD_SHARED_LIBS)
install_local_dependency_libs (libdeflate libdeflate)
Expand Down
27 changes: 24 additions & 3 deletions src/cmake/compiler.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -655,7 +655,12 @@ if (CMAKE_SKIP_RPATH)
unset (CMAKE_INSTALL_RPATH)
else ()
if (NOT CMAKE_INSTALL_RPATH)
set (CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_FULL_LIBDIR}")
if(APPLE)
set(BASEPOINT @loader_path)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is kind of reverting what was made before. You could pass -DCMAKE_INSTALL_RPATH on a per platform basis instead.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well, before, I think CMAKE_INSTALL_RPATH was defaulting to an absolute path; whereas now, it uses loader-path-relative defaults. We could still pass the option on a per-platform basis, but I'm not sure how that would be advantageous...?

else()
set(BASEPOINT $ORIGIN)
endif()
set (CMAKE_INSTALL_RPATH ${BASEPOINT} ${BASEPOINT}/${CMAKE_INSTALL_LIBDIR})
endif ()
# add the automatically determined parts of the RPATH that
# point to directories outside the build tree to the install RPATH
Expand All @@ -679,9 +684,25 @@ set (CMAKE_EXPORT_COMPILE_COMMANDS ON)
# install_targets (target1 [target2 ...])
#
macro (install_targets)
install (TARGETS ${ARGN}
# Define options that can be passed to the macro
set(options NAMELINK_SKIP)

# Parse the arguments passed to the macro
cmake_parse_arguments(INSTALL_TARGETS "${options}" "" "" "${ARGN}")

# Check if NAMELINK_SKIP is specified
if (INSTALL_TARGETS_NAMELINK_SKIP)
# Set namelink_option to NAMELINK_SKIP if specified
set(namelink_option NAMELINK_SKIP)
else()
# Leave namelink_option empty if NAMELINK_SKIP is not specified
set(namelink_option)
endif()

# Use the install command with the appropriate options
install (TARGETS ${INSTALL_TARGETS_UNPARSED_ARGUMENTS}
EXPORT ${PROJ_NAME}_EXPORTED_TARGETS
RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}" COMPONENT user
LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}" COMPONENT user
LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}" COMPONENT user ${namelink_option}
ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}" COMPONENT developer)
endmacro()
Loading
Loading