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

switched to meson build #8

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open

switched to meson build #8

wants to merge 4 commits into from

Conversation

smiet
Copy link
Collaborator

@smiet smiet commented Jul 8, 2024

Switch to meson for the building of the FORTRAN sources, as distutils is deprecaded in python>3.12.

Have not tested the functionality of the compiled fortran, took me long enough to figure out how to pass compiler flags. @zhisong, could you have a look?

Also could you add your e-mail address to the pyproject.toml if you are happy to share?

Keeping it as a draft until tested.

@smiet smiet marked this pull request as ready for review September 3, 2024 13:39
@mbkumar
Copy link
Contributor

mbkumar commented Sep 3, 2024

Can you guys give scikit-build or scikit-build-core a try? Much simpler in my opinion. I'll take a look at the meson build system sometime this week.

@smiet
Copy link
Collaborator Author

smiet commented Sep 5, 2024

test it's use in https://github.com/hiddenSymmetries/simsopt/tree/cbs/test_pyoculus_meson, it is working, now vmec2000 is failing due to distutils/setuptools issues.

I think meson build is the preferred method and probably more future-proof. Yes it is a new system, but for pyoculus I think it is the right tool. scikit build+setutptools+cmake(+distutils) is a bit more error-prone, and likely a contributing factor to the errors we are seeing.

@smiet
Copy link
Collaborator Author

smiet commented Sep 5, 2024

Do not merge, install is not configured correctly and pyoculus.problems import fails. Let me work on it some more...

@mbkumar
Copy link
Contributor

mbkumar commented Sep 5, 2024

Fair enough. Just read a little about meson. I thought meson was a python packaging tool. I am wrong.

@smiet
Copy link
Collaborator Author

smiet commented Sep 6, 2024

I think I have it fixed now, it is really frustrating how meson only has partial support for numpy.f2py compilation, and I kept getting issues with linking.

Fixed it but had to hack a generator for the .so filename, which is probably not super future-proof, and might lead to frustrations on Windows... will address this together with the updates of @Akitzu.

Currently simsopt is running it's gamut of tests on this, if it works, I will consider merging to fix simsopt CI.

I chose meson because it seemed simplest for the task at hand, and CMAKE can be very hard to read. I think it is a bit cleaner than an equivalent CMAKE solution, but not by much.

@smiet
Copy link
Collaborator Author

smiet commented Sep 6, 2024

@zhisong @mbkumar is this fix 'good enough' to merge and fix simsopt CI? CMAKE/setuptools is not my forte, but the current distutils build is on the verge of being deprecated and has been frustrating for years.

Sorry I cannot dedicate much more time for this. I don't like the .so naming hack, but currently mesons python_extension does not support f2py well and for me it does not link the built libraries correctly. This custom command works, but an output file is required, and this changes depending on architecture and such. For now I hope it will do.

A more hacky way would be to have a script that finds the .so file and hard-copies it, that felt even uglier to me.

@mbkumar
Copy link
Contributor

mbkumar commented Sep 6, 2024 via email

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