Skip to content

Commit

Permalink
Use component for python (AcademySoftwareFoundation#1643)
Browse files Browse the repository at this point in the history
* Add "COMPONENT python" to install() the python bindings and tell scikit-build-core to only install the python component

Signed-off-by: Jean-Christophe Morin <jean_christophe_morin@hotmail.com>

* Update scikit-build-core to 0.8.1

Signed-off-by: Jean-Christophe Morin <jean_christophe_morin@hotmail.com>

* Fix typo

Signed-off-by: Jean-Christophe Morin <jean_christophe_morin@hotmail.com>

---------

Signed-off-by: Jean-Christophe Morin <jean_christophe_morin@hotmail.com>
  • Loading branch information
JeanChristopheMorinPerso authored and cary-ilm committed Mar 3, 2024
1 parent 270e836 commit d039b6b
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
9 changes: 8 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# Copyright (c) Contributors to the OpenEXR Project.

[build-system]
requires = ["scikit-build-core==0.8.0"]
requires = ["scikit-build-core==0.8.1"]
build-backend = "scikit_build_core.build"

[project]
Expand All @@ -27,14 +27,21 @@ test = ["pytest"]
[tool.scikit-build]
wheel.expand-macos-universal-tags = true
sdist.exclude = [".github", "src/test", "src/examples", "website", "ASWF", "bazel", "share"]

# Only build the PyOpenEXR (cmake --build --target PyOpenEXR).
cmake.targets = ["PyOpenEXR"]
# Only install the "python" component (cmake --install --component python).
# This makes sure that only files marked as "python" component are installed.
install.components = ["python"]

# Enable experimental features if any are available
# In this case we need custom local plugin to get
# the project version from cmake.
experimental = true
metadata.version.provider = "openexr_skbuild_plugin"
metadata.version.provider-path = "./src/wrappers/python"


[tool.scikit-build.cmake.define]
OPENEXR_INSTALL = 'OFF'
OPENEXR_BUILD_PYTHON = 'ON'
Expand Down
4 changes: 2 additions & 2 deletions src/wrappers/python/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@ if(SKBUILD)
set(PYTHON_INSTALL_DIR ${SKBUILD_PLATLIB_DIR})
endif()

install(TARGETS PyOpenEXR DESTINATION ${PYTHON_INSTALL_DIR})
install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/Imath.py DESTINATION ${PYTHON_INSTALL_DIR})
install(TARGETS PyOpenEXR DESTINATION ${PYTHON_INSTALL_DIR} COMPONENT python)
install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/Imath.py DESTINATION ${PYTHON_INSTALL_DIR} COMPONENT python)

if(BUILD_TESTING AND OPENEXR_TEST_PYTHON)

Expand Down

0 comments on commit d039b6b

Please sign in to comment.