Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support cmake presets #790

Open
henryiii opened this issue Jul 1, 2024 · 10 comments
Open

Support cmake presets #790

henryiii opened this issue Jul 1, 2024 · 10 comments

Comments

@henryiii
Copy link
Collaborator

henryiii commented Jul 1, 2024

Example: https://github.com/1yefuwang1/vectorlite/blob/main/setup.py

We should add a preset option, maybe cmake.preset, and then we can try to read the values from here that affect us, like binaryDir.

@LecrisUT
Copy link
Collaborator

LecrisUT commented Jul 1, 2024

It just occurred to me that you can just overwrite binaryDir, e.g.:

$ cmake --preset default -B /path/to/scikit-build-build

Heck, you can even do this:

$ cmake -S .. --preset=default -B other-build

It would not work for build/test/workflow presets though, but should those even be supported right now?

What about for first pass to add cmake.preset and just have the -D, -C take care of the overwrite initially?

@henryiii
Copy link
Collaborator Author

henryiii commented Jul 1, 2024

I think overriding the binaryDir probably makes sense; in which case, is there anything that we could provide that would be better than doing cmake.args = ["--preset=default"] now? Build presents do require a build.preset setting since we don't provide arbitrary args to build, but IMO that's fine.

I think we should make a new configure / config section instead of continuing to put everything in cmake.

@LecrisUT
Copy link
Collaborator

LecrisUT commented Jul 1, 2024

I think we should make a new configure /config section instead of continuing to put everything in cmake.

Agree, that would make more sense. Maybe even install, but that might clash with wheel-* stuff which would be better to have on top level so that it follows hatchling configuration?

I think overriding the binaryDir probably makes sense; in which case, is there anything that we could provide that would be better than doing cmake.args = ["--preset=default"] now?

Effectively it should be cmake.args = ["--preset=default"] , but having a dedicated option would make it more intuitive and easy to expand later on. Also good to fix the config API for the eventual 1.0.

Build presents do require a build.preset setting since we don't provide arbitrary args to build, but IMO that's fine.

I mean we can't override the binaryDir like we do for the configurePreset (not sure why it doesn't allow the override TBH, maybe it needs a PR to fix that).

@starball5
Copy link

Duplicate of #515?

@LecrisUT
Copy link
Collaborator

LecrisUT commented Jul 2, 2024

Yes, there are actually 3+ such issues :). But occasionally inspiration strikes

@henryiii
Copy link
Collaborator Author

henryiii commented Aug 29, 2024

Another thing that would be nice if we supported presets explicitly: https://github.com/orgs/scikit-build/discussions/1115#discussioncomment-10488748

@LecrisUT
Copy link
Collaborator

You mean reading the generator from the preset? Well that's an equally difficult issue to the binary-dir if we don't parse the Presets.json. Maybe we could just add a parser, but it's annoying that many variables like include supports macro expansions

@starball5
Copy link

Why is parsing needed? Can you not just generate the buildsystem and then use the file API or something?

@henryiii
Copy link
Collaborator Author

We need to know what build system is expected before we declare cmake is required because we need to declare ninja at the same time if it's required. We also need to know if we need to pass build-type Release/Debug, etc. flags when generating the build system. So basically we have to be able to parse quite a bit of this to support it (in a more integrated manner, that is - you can do it today by just manually overriding with the correct generator and build-type).

@starball5
Copy link

starball5 commented Aug 30, 2024

I just found #515 (comment)... would be nice if this wasn't scattered across multiple issue tickets.

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

No branches or pull requests

3 participants