feat(pixi-build-cmake): Extract compilers from CMake project and use toolchain file to set compilers - #6782
Open
hunger wants to merge 3 commits into
Open
feat(pixi-build-cmake): Extract compilers from CMake project and use toolchain file to set compilers#6782hunger wants to merge 3 commits into
hunger wants to merge 3 commits into
Conversation
The build script created and entered `build` by writing the name out, next to a template variable holding the same name and the NINJA_BUILD_DIR constant that the input tracking uses to find the tree again afterwards. Three spellings of one name, and the two in the template were already out of step: the Windows branch used the variable, while the Unix branch and the shared `pushd` did not. Nothing misbehaves today, as all three say `build`. Changing one of them is what breaks: the input tracking would go looking for a tree the script no longer creates, and no test would notice. The constant is now the single definition and reaches the template through the context, the way the source directory already does. The rendered scripts are unchanged.
hunger
force-pushed
the
push-rzkystvtpnws
branch
from
August 6, 2026 15:01
27dcccb to
610862d
Compare
added 2 commits
August 6, 2026 17:41
The backend requested a C++ compiler for every package and left the package
metadata to the manifest. CMake requires the top level CMakeLists.txt to call
project(), which declares the languages the build enables along with its
version, description and homepage.
Parse that call and use it for both: request exactly the compilers the
declared languages need, and fill in metadata the pixi.toml leaves out. A
command name inside a quoted argument, such as a help text that mentions
project(...), is text rather than a call and is skipped.
Anything the manifest declares still wins, as it does for the Cargo.toml and
pyproject.toml of the other backends. When the languages cannot be determined
the backend assumes C and CXX, the same default CMake applies to a project()
call that names none. Values CMake only expands while configuring, such as
VERSION ${DEMO_VERSION}, cannot be resolved here and are skipped.
…file The conda compiler packages only export their compiler through CC, CXX and friends, leaving the choice to CMake's own detection. Write a toolchain file that names those compilers explicitly and pass it to the configure step, so the choice is visible in the build directory and propagates to sub-builds that inherit CMAKE_TOOLCHAIN_FILE. Every entry is guarded on its environment variable, so a compiler the build environment does not export keeps CMake's detection. A user supplied toolchain file in extra-args still wins, as CMake honors the last one.
hunger
force-pushed
the
push-rzkystvtpnws
branch
from
August 6, 2026 18:25
610862d to
a6740d4
Compare
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Extract the languages the CMAke project uses from the CMakeLists.txt file. Ask Conda to install those compilers and use a toolchain file to set up CMake to use the compilers.
This change is a bit bigger than I wanted it to be, but it is mostly pretty straight forward code to parse the
projectstatement that should be in any top level CMakeLists.txt.How Has This Been Tested?
Manually + generated unit tests
AI Disclosure
Tools: Claude
Checklist:
schema/model.py.