Skip to content

Fix CMake installs for C++-only builds - #519

Open
jeongseok-meta wants to merge 1 commit into
mitsuba-renderer:masterfrom
jeongseok-meta:improve-packager-cmake-options
Open

Fix CMake installs for C++-only builds#519
jeongseok-meta wants to merge 1 commit into
mitsuba-renderer:masterfrom
jeongseok-meta:improve-packager-cmake-options

Conversation

@jeongseok-meta

@jeongseok-meta jeongseok-meta commented Jun 27, 2026

Copy link
Copy Markdown
Contributor

Motivation

C++-only and header-only builds should install a conventional CMake package:

  • With every JIT backend disabled, install rules must not reference JIT targets that were never created.
  • With JIT enabled and Python disabled, libraries belong in the standard CMake runtime and library directories rather than the Python package directory.

Installing public drjit-core headers without JIT is intentionally handled separately in #527. This PR corresponds to conda-forge's 0002-Fix-install-destination-paths.patch. Once this change is included in an upstream release, the feedstock can remove that patch.

Changes

  • Guard drjit-core, drjit-extra, and nanothread target installation with DRJIT_ENABLE_JIT.
  • Use CMAKE_INSTALL_BINDIR and CMAKE_INSTALL_LIBDIR when Python is disabled.
  • Preserve the existing drjit/ library layout when Python is enabled.

This PR does not move public headers or change Python stub generation or installation.

Testing

  • git diff --check
  • No-JIT/no-Python configure, build, and install passed.
  • LLVM 21 C++ configure, build, and install placed drjit-core, drjit-extra, and nanothread under lib/, not drjit/.
  • An external find_package(drjit) consumer built successfully; the installed-header smoke test and live LLVM test both passed.
  • Python 3.13 + LLVM 21 configure, build, and install; drjit and drjit.auto imported, a live LLVM calculation passed, all generated stubs were installed, and libraries remained under drjit/.

@wjakob

wjakob commented Jul 19, 2026

Copy link
Copy Markdown
Member

Hi @jeongseok-meta,

I don't think it would be a good idea to release "inferior" packages without stubs that are produced by cross-compiling. The stub generation process fundamentally requires the ability to build on the platform that can import the compiled wheels.

I think that fixing this by building on a wider set of platforms will address most of the issues you are pursuing here.

@jeongseok-meta
jeongseok-meta force-pushed the improve-packager-cmake-options branch from 866f794 to f532b51 Compare July 21, 2026 09:25
@jeongseok-meta jeongseok-meta changed the title Improve CMake packaging options Fix CMake installs for C++-only builds Jul 21, 2026
@jeongseok-meta

jeongseok-meta commented Jul 21, 2026

Copy link
Copy Markdown
Contributor Author

Thanks for the feedback. I moved the stub issue out of this PR. conda-forge/drjit-cpp-feedstock#49 now builds macOS ARM packages natively, and CI confirmed that the Python 3.10–3.13 packages include the generated stubs.

I've narrowed this PR to the C++ install fixes: handling no-JIT builds, using standard library destinations when Python is disabled, preserving the existing Python package layout, and installing the required drjit-core headers.

I tested no-JIT and LLVM C++ installs with external find_package(drjit) consumers, plus a Python build to confirm that imports, stubs, and the existing library layout remain unchanged.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants