Skip to content

Support developer builds of CppInterOp/LLVM, add project verification and robust fallbacks - #18

Merged
aaronj0 merged 3 commits into
mainfrom
cmake-devmodule-and-source-dir
Aug 15, 2026
Merged

Support developer builds of CppInterOp/LLVM, add project verification and robust fallbacks#18
aaronj0 merged 3 commits into
mainfrom
cmake-devmodule-and-source-dir

Conversation

@aaronj0

@aaronj0 aaronj0 commented Aug 14, 2026

Copy link
Copy Markdown
Collaborator

Developing CppInterOp or LLVM against cppjit requires building from local trees instead of the pinned clone. CPPINTEROP_SOURCE_DIR now builds CppInterOp from a local checkout with incremental rebuilds, and a post-config check rejects source trees that are not CppInterOp. Validated against a fetch of ci-workflows LLVM 22 and an uninstalled LLVM 21.1.8 build tree. This change also improves how robust the build system is with various permutations of developer setups (custom CppInterOp/LLVM development)

The behavior of cppjit's build system with this change is:

pip install . --config-settings=cmake.define.<...> CppInterOp LLVM
none (basic install) clones and builds the pinned CPPINTEROP_GIT_TAG find_package(LLVM): $CONDA_PREFIX hint, then the system search
LLVM_DIR=<dir> clones and builds the pin uses provided install prefix or build tree only, no fallback as this is a developer override
CPPINTEROP_GIT_REPOSITORY=<url> / CPPINTEROP_GIT_TAG=<ref> clones the given remote/ref and builds it per the rows above
CPPINTEROP_SOURCE_DIR=<dir> builds the local tree in place with incremental rebuilds (output is streamed) per the rows above

Priority:

  • CPPINTEROP_SOURCE_DIR over CPPINTEROP_GIT_REPOSITORY/CPPINTEROP_GIT_TAG
  • LLVM_DIR over the $CONDA_PREFIX hint over the system search.

The two axes combine freely, and the selected LLVM is forwarded to the CppInterOp sub-build.

The negative cases each fail at config time with actionable feedback:

Case Result
no LLVM found No LLVM CMake package found. Install LLVM 20-22 development packages (apt: llvm-22-dev libclang-22-dev; conda: llvmdev clangdev), or point cppjit at your own LLVM build with -DLLVM_DIR=...
LLVM_DIR invalid No LLVMConfig.cmake under LLVM_DIR (<path>); expected <install prefix or build tree>/lib/cmake/llvm
Clang_DIR invalid No ClangConfig.cmake under Clang_DIR (<path>)
LLVM outside 20-22 LLVM <version> is unsupported: the currently supported CppInterOp version (CPPINTEROP_GIT_TAG) only supports LLVM 20-22
CPPINTEROP_SOURCE_DIR is not a CMake tree the sub-configure reports the missing CMakeLists.txt
the source or ref is not CppInterOp pre-build, post scikit-build-core config: The provided source path override declares project '<name>', not CppInterOp

The supported range is defined once next to the pin (CPPJIT_LLVM_VERSION_MIN/MAX, updated together with the supported CppInterOp version), and the Clang lookup is now confined to the discovered LLVM's own package dir, preventing a mismatched system clang from breaking the config on a machine with several toolchains installed.

@github-actions

github-actions Bot commented Aug 15, 2026

Copy link
Copy Markdown

Test Results

Configuration Result
macos-26-intel-llvm21-py3.14-cxx20 = 438 passed, 44 skipped, 85 xfailed, 32 xpassed, 100 warnings in 109.62s (0:01:49) =
macos-26-llvm21-py3.14-cxx20 ==== 439 passed, 37 skipped, 93 xfailed, 30 xpassed, 100 warnings in 45.14s ====
ubuntu-24.04-llvm21-py3.14-cxx20-vg ====== 554 passed, 25 skipped, 18 xfailed, 2 xpassed in 96.31s (0:01:36) =======
ubuntu-24.04-llvm22-py3.14-cxx20 ====== 554 passed, 25 skipped, 19 xfailed, 1 xpassed in 117.43s (0:01:57) ======
ubuntu-24.04-llvm22-py3.14-cxx20-cling ====== 544 passed, 25 skipped, 27 xfailed, 3 xpassed in 87.92s (0:01:27) =======

Comment thread CMakeLists.txt Outdated

@guitargeek guitargeek left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! Consider CMake 3.20 compatibility if possible, but if it can't be done so be it. LLVM will also require CMake 3.31, starting from LLVM 24.

@aaronj0
aaronj0 force-pushed the cmake-devmodule-and-source-dir branch from f4e4787 to 93546f6 Compare August 15, 2026 09:46
@aaronj0
aaronj0 merged commit 0f057bb into main Aug 15, 2026
11 of 12 checks passed
@aaronj0
aaronj0 deleted the cmake-devmodule-and-source-dir branch August 15, 2026 13:07
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