scikit-build/scikit-build-core

Question: Is it possible to change pyproject.toml configuration depending on the operating system in which the module will run?

davidelahoz opened this issue · 2 comments

I'm building a python binding of a C++ library that ses conan for managing its dependencies. Conan uses different preset names for windows and linux, which forces to change its invocation parameters depending on the operating system. Right now, I'm solving that using the following configuration in pyproject.toml when compiling in windows:

[tool.scikit-build]
sdist.cmake = true
cmake.version = ">=3.23"
cmake.build-type = "Release"
cmake.args = ["--preset conan-default", "-DLF=...Windows.locks", "-DOpenCV-SWIG_ROOT=./extlibs/opencv-swig/install"]

And this one in linux:

[tool.scikit-build]
sdist.cmake = true
cmake.version = ">=3.23"
cmake.build-type = "Release"
cmake.args = ["--preset conan-release", "-G Ninja", "-DOpenCV-SWIG_ROOT=./extlibs/opencv-swig/install"]

Is there a way to specify in a single pyproject.toml which configuration it should use depending on the operating system of the host? If that's not the case, is it possible to specify the pyproject.toml file that shold be used when building? (for example having pyproject_linux.toml and pyproject_windows.toml)

Kinda: https://scikit-build-core.readthedocs.io/en/latest/configuration.html#overrides. Haven't tested it myself, but don't see why it shouldn't work. Looking at the tests it seems your use-case should be covered.

Thanks, I hadn't been able to find that, but it seems what I was looking for. I'll test it