Addition of FPM Support#176
Conversation
|
@robin-dahl you can give a look to my changes, if you are fine with them, I will merge this. |
|
@mnottoli I see that you removed the fpm test targets that require command-line arguments from So the wrapper needs fixing if we want to use it. What is your preference for how these tests should be treated? Do you like the idea of the Python wrapper (then I would correct the bug of course), or are you okay with the command-line-argument tests genuinely not being runnable through fpm? In case of the latter, that should be noted in the documentation (together with the removal of the Python wrapper explanation) |
|
Thanks for noticing. I think it is fair to put fpm in a state that "fpm test" doesn't fail by definition, which means removing the tests with command line arguments. If they then merge this fortran-lang/fpm#1276, we can put back those tests. In the meanwhile, I will translate the wrapper in fortran, and add another test for fpm which goes through it. Maybe I will also add a subset of fpm tests in the github CI - just to make sure that we don't mess up with fpm in any further development. |
|
That sound like a good idea! I was not aware of this fpm issue, seems promising |
|
Hi @robin-dahl, I made a few modifications:
I would ask you to see if these modifications do not ruin the cross compilation with tblite. |
|
Everything seems to work, @mnottoli, thank you! |
|
Good to hear, I am now on this: #165 |
Summary
This PR adds support for building ddX with the Fortran Package Manager. It includes changes required to build & compile the project with FPM, run the standalone executable, and use the test suite. The documentation has also been updated with instructions for using FPM with ddX.
Key Changes
Adding FPM support typically requires only limited changes, provided that the repository structure is broadly compatible with FPM's conventions.
fpm.tomlmanifest file, which enables compilation of the source code viafpm build.To avoid compilation issues,#ifdef BUILD_PYBIND11and#endifguards were added to non-Fortran source files in thesrcdirectory. Without these guards, FPM attempts to compile the C++ and Python-related files as part of the build, which leads to errors. These preprocessor guards, however, should not affect the behavior of these files in any other build configuration.fpm run [path/to/input].txt(for instance,fpm run tests/Input-example.txt). As usual for FPM, this command also compiles the project prior to execution, so an explicitfpm buildstep is optional.fpm test. For ddX, however, this is currently not possible because several tests require individual command-line arguments. While FPM allows arguments to be passed to specific target tests, for examplefpm test --target ddlpb_esolv -- tests/data/ddlpb_force.txt, a generalfpm testcommand would only work for test suites with a uniform execution structure. To address this, this PR adds a Python wrapper in thetestsdirectory. The wrapper runs all unit and standalone tests, analyzes the output, and provides a summary. The full test suite can therefore be run in one go withpython tests/fpm_tester.py.