scikit-build-core icon indicating copy to clipboard operation
scikit-build-core copied to clipboard

Initial support for `cmake.preset`

Open LecrisUT opened this issue 1 year ago • 3 comments

Back in #790 I commented that we could support configurePresets if we overwrite the binarydir. It seems to work fine, but I realized we still have an issue to discuss how to deal with the generator. My thinking is that depending on make-fallback value and if preset is present we deffer to the value of preset and let it handle the rest. Although not sure how to detect/handle multi-config then, but wouldn't it build all configs if it wasn't specified explicitly? The documentation of make-fallback is also confusing me a bit.

PS: it took me way too long to figure out nox -t gen was a thing :facepalm:

LecrisUT avatar Feb 17 '25 18:02 LecrisUT

This would be really useful as I could replace my [cmake.define] table with a {wheel_tag} preset. I'd like to help. What's the blocker here?

alexreinking avatar Aug 07 '25 12:08 alexreinking

This would be really useful as I could replace my [cmake.define] table with a {wheel_tag} preset. I'd like to help. What's the blocker here?

I need to rebase this and run the CI again. Iirc the issue was something to do with windows even when we overwrote the generator. I will not have a pc to work for about 1 week, but could you try a simple rebase and opening a PR in your fork to check the failure again?

LecrisUT avatar Aug 07 '25 12:08 LecrisUT

Got to rebasing this, and here is the main issue that we encounter in this PR

>           raise FailedLiveProcessError(msg) from None
E           scikit_build_core.errors.FailedLiveProcessError: CMake configuration failed

_cmake_args = <generator object CMaker._compute_cmake_args at 0x000001981C3B3970>
all_args   = ['-SD:\\a\\scikit-build-core\\scikit-build-core\\tests\\packages\\cmake_defines', '-BC:\\Users\\runneradmin\\AppData\\...istEntryThatWouldOverflowTheLine;Baz', '-DNESTED_LIST=Apple;Lemon\\;Lime;Banana', '-DOVERWRITTEN_VAR=overwritten', ...]
cmake_args = []
defines    = {'NESTED_LIST': 'Apple;Lemon\\;Lime;Banana', 'ONE_LEVEL_LIST': 'Foo;Bar;ExceptionallyLargeListEntryThatWouldOverflowTheLine;Baz', 'OVERWRITTEN_VAR': 'overwritten'}
gen        = 'Visual Studio 17 2022'
msg        = 'CMake configuration failed'
preset     = 'scikit'
self       = CMaker(cmake=CMake(version=<Version('4.1.0')>, cmake_path=WindowsPath('C:/hostedtoolcache/windows/Python/3.12.10/x64/L...dmin/AppData/Local/Temp/pytest-of-runneradmin/pytest-0/popen-gw3/test_cmake_defines_True_0/build/.cmake/api/v1/reply'))

src\scikit_build_core\cmake.py:275: FailedLiveProcessError
---------------------------- Captured stdout call -----------------------------
loading initial cache file C:\Users\runneradmin\AppData\Local\Temp\pytest-of-runneradmin\pytest-0\popen-gw3\test_cmake_defines_True_0\build\CMakeInit.txt
-- Configuring incomplete, errors occurred!
---------------------------- Captured stderr call -----------------------------
CMake Error at CMakeLists.txt:2 (project):
  Generator

    Ninja

  does not support platform specification, but platform

    x64

  was specified.

I believe that we are trying to pass the msvc generator here for which we also pass --config flags, but CMake is then failing when trying to run with the preset generator even though we are overwriting it. Or could be an even simpler issue. I don't have a windows machine to live-test this though, so best I could do is print-debug this

LecrisUT avatar Sep 19 '25 17:09 LecrisUT