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 155 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 143 commits
Commits
Show all changes
155 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
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
415 changes: 415 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


10 changes: 8 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -248,10 +248,16 @@ if (NOT EMBEDPLUGINS AND NOT BUILD_OIIOUTIL_ONLY)
endforeach ()
endif ()

if (USE_PYTHON AND Python3_Development_FOUND AND NOT BUILD_OIIOUTIL_ONLY)

if (${CMAKE_VERSION} VERSION_GREATER_EQUAL "3.18.0" AND NOT WIN32)
set (_py_dev_found Python3_Development.Module_FOUND)
else ()
set (_py_dev_found Python3_Development_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
22 changes: 22 additions & 0 deletions INSTALL.md
Original file line number Diff line number Diff line change
Expand Up @@ -357,6 +357,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
170 changes: 170 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,170 @@
[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 = "lg@larrygritz.com"},
{name = "OpenImageIO Contributors", email = "oiio-dev@lists.aswf.io"}
]
maintainers = [
{name = "OpenImageIO Contributors", email="oiio-dev@lists.aswf.io"},
]
readme = "README.md"
license = {text = "Apache-2.0"}
keywords = [""]
classifiers = [
"Development Status :: 4 - Beta",
"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",
]
dependencies = ["numpy"]
requires-python = ">= 3.8"

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


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

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

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


[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"


# 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, make sure dependencies are built for the correct 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.scikit-build.overrides]]
if.platform-system = "linux"
inherit.cmake.define = "append"
cmake.define.CMAKE_CXX_FLAGS = "-Wno-error=stringop-overflow -Wno-pragmas"

[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*",
]
# If the following command returns code 0, we know the CLI Python scripts
# are able to import the OpenImageIO module, which is able to invoke the
# CLI binary executables and find and load all shared libraries. The
# '--help' flag outputs a list of dependencies with which OIIO was compiled.
test-command = "oiiotool --help"
# Enable free-threaded support
#free-threaded-support = true
# Default images to use when building manylinux wheels locally.
manylinux-x86_64-image = "manylinux_2_28"
manylinux-aarch64-image = "manylinux_2_28"
manylinux-pypy_x86_64-image = "manylinux_2_28"
manylinux-pypy_aarch64-image = "manylinux_2_28"
musllinux-x86_64-image = "musllinux_1_2"
musllinux-aarch64-image = "musllinux_1_2"

[tool.cibuildwheel.macos.environment]
# Specify a 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; otherwise, OIIO has trouble
# with libdeflate during successive incremental builds.
SKBUILD_CMAKE_ARGS = "-DOpenImageIO_BUILD_LOCAL_DEPS=TIFF; -DOpenImageIO_BUILD_MISSING_DEPS=all"
# std::filesystem is only available in macOS 10.15 and later.
MACOSX_DEPLOYMENT_TARGET = "10.15"
# 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"
# Suppress warnings that cause linux cibuildwheel build to fail
CXXFLAGS = "-Wno-error=stringop-overflow -Wno-pragmas"
SKBUILD_CMAKE_BUILD_TYPE = "MinSizeRel"

[tool.cibuildwheel.windows.environment]
SKBUILD_CMAKE_BUILD_TYPE = "MinSizeRel"


# On macOS and Linux, run a custom repair-wheel-command after the build.
# See tasks.py for more details.
[tool.cibuildwheel.macos]
before-build = "pip install 'repairwheel' && pip install invoke && brew uninstall --ignore-dependencies harfbuzz fontconfig cairo freetype"
repair-wheel-command = "invoke wheel-repair --build-dir ${SKBUILD_BUILD_DIR} --wheel-path {wheel} --output-dir {dest_dir}"

[tool.cibuildwheel.linux]
before-build = "pip install repairwheel && pip install invoke"
repair-wheel-command = "invoke wheel-repair --build-dir ${SKBUILD_BUILD_DIR} --wheel-path {wheel} --output-dir {dest_dir}"


[[tool.cibuildwheel.overrides]]
select = "{c,p}p3{7,8}-*"
manylinux-x86_64-image = "manylinux2014"
manylinux-aarch64-image = "manylinux2014"
manylinux-pypy_x86_64-image = "manylinux2014"
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
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
11 changes: 11 additions & 0 deletions src/cmake/fancy_add_executable.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,17 @@ macro (fancy_add_executable)
target_link_libraries (${_target_NAME} PRIVATE ${_target_LINK_LIBRARIES})
target_link_libraries (${_target_NAME} PRIVATE ${PROFILER_LIBRARIES})
set_target_properties (${_target_NAME} PROPERTIES FOLDER ${_target_FOLDER})
if (SKBUILD)
# When building cli tools with scikit-build, set RPATH
# to a relative path to the distribution's lib directory.
if (APPLE)
set_target_properties (${_target_NAME} PROPERTIES
INSTALL_RPATH "@loader_path/../${CMAKE_INSTALL_LIBDIR}")
elseif (LINUX)
set_target_properties (${_target_NAME} PROPERTIES
INSTALL_RPATH "$ORIGIN/../${CMAKE_INSTALL_LIBDIR}")
endif ()
endif ()
check_is_enabled (INSTALL_${_target_NAME} _target_NAME_INSTALL_enabled)
if (CMAKE_UNITY_BUILD AND UNITY_BUILD_MODE STREQUAL GROUP)
set_source_files_properties(${_target_SRC} PROPERTIES
Expand Down
26 changes: 25 additions & 1 deletion src/cmake/pythonutils.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -32,13 +32,24 @@ macro (find_python)
list (APPEND _req EXACT)
endif ()
endif ()

# Support building on manylinux docker images, which do not contain
# the Development.Embedded component.
# https://pybind11.readthedocs.io/en/stable/compiling.html#findpython-mode
if (${CMAKE_VERSION} VERSION_GREATER_EQUAL "3.18.0" AND NOT WIN32)
set (_py_components Interpreter Development.Module)
else ()
set (_py_components Interpreter Development)
endif ()

checked_find_package (Python3 ${PYTHON_VERSION}
${_req}
VERSION_MIN 3.7
COMPONENTS Interpreter Development
COMPONENTS ${_py_components}
PRINT Python3_VERSION Python3_EXECUTABLE
Python3_LIBRARIES
Python3_Development_FOUND
Python3_Development.Module_FOUND
Python3_Interpreter_FOUND )

# The version that was found may not be the default or user
Expand Down Expand Up @@ -129,6 +140,19 @@ macro (setup_python_module)
# SUFFIX ".pyd")
# endif()

if (SKBUILD)
set (PYTHON_SITE_DIR .)
# When building python wheels, set RPATH to a relative path to
# the distribution's lib directory.
if (APPLE)
set_target_properties (${target_name} PROPERTIES
INSTALL_RPATH "@loader_path/${CMAKE_INSTALL_LIBDIR}")
elseif (LINUX)
set_target_properties (${target_name} PROPERTIES
INSTALL_RPATH "$ORIGIN/${CMAKE_INSTALL_LIBDIR}")
endif ()
endif ()

# In the build area, put it in lib/python so it doesn't clash with the
# non-python libraries of the same name (which aren't prefixed by "lib"
# on Windows).
Expand Down
Loading
Loading