diff --git a/.github/workflows/wheels.yml b/.github/workflows/wheels.yml index 372013e3f..3005a6148 100644 --- a/.github/workflows/wheels.yml +++ b/.github/workflows/wheels.yml @@ -10,6 +10,9 @@ on: env: CIBW_TEST_COMMAND: "python -c \"import mitsuba\"" CIBW_TEST_REQUIRES: "" + CIBW_REPAIR_WHEEL_COMMAND_LINUX: "python .github/workflows/tag_wheel_manylinux.py {wheel} {dest_dir}" + CIBW_REPAIR_WHEEL_COMMAND_MACOS: "delocate-wheel --require-archs {delocate_archs} -w {dest_dir} --ignore-missing-dependencies {wheel}" + jobs: build_wheels: @@ -45,6 +48,11 @@ jobs: with: python-version: '3.10' + - name: Install LLVM and Clang + uses: KyleMayes/install-llvm-action@v2 + with: + version: "11.0" + - name: Prepare compiler environment for Windows if: runner.os == 'Windows' uses: ilammy/msvc-dev-cmd@v1 diff --git a/ext/drjit b/ext/drjit index 1ac3b5234..d13565c99 160000 --- a/ext/drjit +++ b/ext/drjit @@ -1 +1 @@ -Subproject commit 1ac3b5234fbf2d4a597941a1f34927b9c18ca8de +Subproject commit d13565c992a6dd9ca3be4541d38931c2227fa926 diff --git a/pyproject.toml b/pyproject.toml index 8994ba56b..77e714159 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,7 +1,7 @@ [build-system] requires = [ "scikit-build-core", - "nanobind @ git+https://github.com/wjakob/nanobind@master", + "nanobind @ git+https://github.com/wjakob/nanobind@8ce0dee7f62add575f85c0de386a9c819e4d50af", "drjit @ git+https://github.com/njroussel/drjit-fork@rami", "typing_extensions", "hatch-fancy-pypi-readme" diff --git a/src/python/CMakeLists.txt b/src/python/CMakeLists.txt index bcb224e64..be647deb3 100644 --- a/src/python/CMakeLists.txt +++ b/src/python/CMakeLists.txt @@ -205,6 +205,67 @@ endif() # Generate type information stubs (mitsuba) # ---------------------------------------------------------- +set(STUB_ARGS + PYTHON_PATH ${MI_BINARY_DIR}/python + PATTERN_FILE ${CMAKE_CURRENT_SOURCE_DIR}/stubs.pat + DEPENDS ${MI_STUB_DEPENDS} +) + +# The sanitizers require preloading shared libraries into Python, and that +# doesn't play well with stub generation. Disable stubs if sanitizers are +# enabled. +if (NOT (MI_SANITIZE_ADDRESS OR MI_SANITIZE_MEMORY)) + + set(MI_STUB_SUBMODULES "math" "quad" "spline" "mueller" "warp" "misc" + "python.ad" "python.chi2" "python.math_py" "python.util" "python.xml") + + nanobind_add_stub( + mitsuba-stub + MODULE mitsuba.mitsuba_stubs + OUTPUT ${MI_BINARY_DIR}/python/mitsuba/stubs.pyi + MARKER_FILE ${MI_BINARY_DIR}/python/mitsuba/py.typed + ${STUB_ARGS} + ) + + add_custom_command( + OUTPUT ${MI_BINARY_DIR}/python/mitsuba/__init__.pyi + DEPENDS ${MI_BINARY_DIR}/python/mitsuba/stubs.pyi + COMMAND cmake -P ${CMAKE_CURRENT_SOURCE_DIR}/../../resources/variant-stub.cmake + ${MI_BINARY_DIR}/python/mitsuba/stubs.pyi + ${MI_BINARY_DIR}/python/mitsuba/__init__.pyi + ) + + set(MI_STUB_TARGET_DEPS + ${MI_BINARY_DIR}/python/mitsuba/__init__.pyi + ${MI_BINARY_DIR}/python/mitsuba/py.typed) + + foreach (value ${MI_STUB_SUBMODULES}) + string(REPLACE "." "/" value_path ${value}) + nanobind_add_stub( + mitsuba-stub-${value} + MODULE mitsuba.mitsuba_stubs.${value} + OUTPUT ${MI_BINARY_DIR}/python/mitsuba/${value_path}_stubs.pyi + ${STUB_ARGS} + ) + + add_custom_command( + OUTPUT ${MI_BINARY_DIR}/python/mitsuba/${value_path}.pyi + DEPENDS ${MI_BINARY_DIR}/python/mitsuba/${value_path}_stubs.pyi + COMMAND cmake -P ${CMAKE_CURRENT_SOURCE_DIR}/../../resources/variant-stub.cmake + ${MI_BINARY_DIR}/python/mitsuba/${value_path}_stubs.pyi + ${MI_BINARY_DIR}/python/mitsuba/${value_path}.pyi + ) + + list(APPEND MI_STUB_TARGET_DEPS ${MI_BINARY_DIR}/python/mitsuba/${value_path}.pyi) + endforeach() + + add_custom_target( + mitsuba-stubs + ALL + DEPENDS ${MI_STUB_TARGET_DEPS} + ) + +endif() # ----------------------------------------------------------