-
Notifications
You must be signed in to change notification settings - Fork 359
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Use scikit-build-core to create a PyPI package (wheels + sdist)
Signed-off-by: Jean-Christophe Morin <[email protected]>
- Loading branch information
1 parent
83f9380
commit 37d9190
Showing
32 changed files
with
316 additions
and
213 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,2 @@ | ||
build | ||
/dist |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,78 @@ | ||
[build-system] | ||
requires = ["scikit-build-core"] | ||
build-backend = "scikit_build_core.build" | ||
|
||
[project] | ||
name = "MaterialX" | ||
version = "0.0.0.dev1" # TODO: Change version | ||
authors = [ | ||
{ name="Contributors to the MaterialX project", email="[email protected]" }, | ||
] | ||
readme = "README.md" | ||
|
||
# TODO: Should it also support Python 2? | ||
requires-python = ">=3.7" | ||
|
||
# OCIO is not required. But if you want to eventually add it, | ||
# uncomment this, bundle the OCIO config and python/MaterialX/colorspace.py | ||
# will just work. | ||
# dependencies = [ | ||
# "opencolorio" | ||
# ] | ||
|
||
# TODO: Add more classifier. | ||
classifiers = [ | ||
"Programming Language :: Python :: 3", | ||
"License :: OSI Approved :: Apache Software License", | ||
"Operating System :: OS Independent", | ||
] | ||
|
||
[project.urls] | ||
"Homepage" = "https://materialx.org" | ||
"Source" = "https://github.com/AcademySoftwareFoundation/MaterialX" | ||
"Bug Tracker" = "https://github.com/AcademySoftwareFoundation/MaterialX/issues" | ||
|
||
[project.scripts] | ||
baketextures = "MaterialX._scripts.baketextures:main" | ||
generateshader = "MaterialX._scripts.generateshader:main" | ||
genmdl = "MaterialX._scripts.genmdl:main" | ||
mxdoc = "MaterialX._scripts.mxdoc:main" | ||
mxupdate = "MaterialX._scripts.mxupdate:main" | ||
mxvalidate = "MaterialX._scripts.mxvalidate:main" | ||
translateshader = "MaterialX._scripts.translateshader:main" | ||
writenodegraphs = "MaterialX._scripts.writenodegraphs:main" | ||
|
||
[tool.scikit-build] | ||
cmake.minimum-version = "3.18" | ||
cmake.verbose = false | ||
cmake.build-type = "Release" | ||
|
||
# Uncoment when developing locally to enable inplace builds. | ||
# build-dir = "build/" | ||
|
||
logging.level = "INFO" | ||
|
||
# Since the python package doesn't live in a standard directory | ||
# in the source (i.e ./src or ./), we need to manually specify | ||
# where the package is. | ||
wheel.packages = ["python/MaterialX"] | ||
|
||
sdist.exclude = [ | ||
"/build", | ||
"/dist", | ||
"/resources", | ||
"/javascript", | ||
"/documents", | ||
"/.github", | ||
"MANIFEST.in" | ||
|
||
] | ||
|
||
[tool.scikit-build.cmake.define] | ||
MATERIALX_BUILD_SHARED_LIBS = 'OFF' # Be explicit | ||
MATERIALX_BUILD_PYTHON = 'ON' | ||
MATERIALX_TEST_RENDER = 'OFF' | ||
MATERIALX_WARNINGS_AS_ERRORS = 'ON' | ||
|
||
# TODO: How could we harmonize this variable with SKBUILD? | ||
MATERIALX_INSTALL_PYTHON = 'OFF' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,25 @@ | ||
set(SETUP_PY_IN "${CMAKE_CURRENT_SOURCE_DIR}/setup.py.in") | ||
set(SETUP_PY "${CMAKE_INSTALL_PREFIX}/python/setup.py") | ||
|
||
configure_file(${SETUP_PY_IN} ${SETUP_PY}) | ||
if(NOT SKBUILD) | ||
install(DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/MaterialX" DESTINATION "python" MESSAGE_NEVER) | ||
install(DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/Scripts" DESTINATION "python" MESSAGE_NEVER) | ||
endif() | ||
|
||
install(DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/MaterialX" DESTINATION "python" MESSAGE_NEVER) | ||
install(DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/Scripts" DESTINATION "python" MESSAGE_NEVER) | ||
if(SKBUILD) | ||
install( | ||
DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/Scripts/" | ||
DESTINATION "${MATERIALX_PYTHON_FOLDER_NAME}/_scripts" | ||
PATTERN "README.md" EXCLUDE | ||
) | ||
endif() | ||
|
||
if(MATERIALX_PYTHON_OCIO_DIR) | ||
if(NOT EXISTS "${MATERIALX_PYTHON_OCIO_DIR}/config.ocio") | ||
message(WARNING "No file named config.ocio was found in the given OCIO directory.") | ||
endif() | ||
install(DIRECTORY "${MATERIALX_PYTHON_OCIO_DIR}/" DESTINATION "python/MaterialX/config/" MESSAGE_NEVER) | ||
install(DIRECTORY "${MATERIALX_PYTHON_OCIO_DIR}/" DESTINATION "${MATERIALX_PYTHON_FOLDER_NAME}/config/" MESSAGE_NEVER) | ||
endif() | ||
|
||
if(MATERIALX_INSTALL_PYTHON AND PYTHON_EXECUTABLE) | ||
install(CODE "execute_process(COMMAND ${PYTHON_EXECUTABLE} ${SETUP_PY} install clean --all)" MESSAGE_NEVER) | ||
if(MATERIALX_INSTALL_PYTHON AND PYTHON_EXECUTABLE AND NOT SKBUILD) | ||
set(SETUP_PY "${CMAKE_INSTALL_PREFIX}/python/setup.py") | ||
configure_file("${CMAKE_CURRENT_SOURCE_DIR}/setup.py.in" "${SETUP_PY}") | ||
install(CODE "execute_process(COMMAND ${PYTHON_EXECUTABLE} ${SETUP_PY} install clean --all)") | ||
endif() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
This directory is empty buit it's used when packaging the Python library. | ||
the files in ../../Scripts will be copied inside. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
# Only required for entry-points. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,4 @@ | ||
install(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/ | ||
DESTINATION "resources" MESSAGE_NEVER) | ||
if(NOT SKBUILD) | ||
install(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/ | ||
DESTINATION "resources" MESSAGE_NEVER) | ||
endif() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.