FluidityProject / fluidity

Fluidity
http://fluidity-project.org
Other
362 stars 113 forks source link

ENH: Minimal changes for side-by-side CMake build #358

Open Patol75 opened 2 years ago

Patol75 commented 2 years ago

See discussions in #115 and #356.

The present PR offers a minimal changeset to incorporate a CMake build within Fluidity.

The branch passes both building and unit-testing using the CMake approach (Actions run). However, I have not made sure I did not break the Autotools CI, but this is being checked by GitHub.

-> Autotools builds are failing, but I am afraid I do not understand why. From what I see, the relevant part of the log is:

#13 318.7     Congratulations, make makefiles succeeded!
#13 DONE 318.7s
#14 [ 9/13] RUN test -z "$(git status --porcelain */Makefile.dependencies)"
#14 ERROR: executor failed running [/bin/sh -c test -z "$(git status --porcelain */Makefile.dependencies)"]: exit code: 1
------
 > [ 9/13] RUN test -z "$(git status --porcelain */Makefile.dependencies)":
------
error: failed to solve: executor failed running [/bin/sh -c test -z "$(git status --porcelain */Makefile.dependencies)"]: exit code: 1
Error: buildx failed with: error: failed to solve: executor failed running [/bin/sh -c test -z "$(git status --porcelain */Makefile.dependencies)"]: exit code: 1
angus-g commented 2 years ago

Autotools builds are failing, but I am afraid I do not understand why

I think this is because the changes to the imports in:

Patol75 commented 2 years ago

Thanks, @angus-g, that did the trick! From what I now see, Fluidity builds on Bionic, Focal and Impish using Autotools, and it should also build on Jammy using CMake. That is a good start!

Patol75 commented 2 years ago

Thanks for the review, @angus-g! I have addressed quite a few things, but they are still some left. Have a look at the discussions in the unresolved comments.

Regarding the Python packages, I just found it extremely convenient to have these targets included in the main build. What would be the alternative? Maybe @stephankramer has a suggestion?

About the F90 changes, please have a look below: I have gathered all the error messages I get if I keep the original files.

/home/thomas/Softwares/fluidity_minimal/femtools/Sparse_Matrices_Fields.F90:34:5:

   34 | use c_interfaces
      |     1
Fatal Error: Cannot open module file ‘c_interfaces.mod’ for reading at (1): No such file or directory
compilation terminated.
/home/thomas/Softwares/fluidity_minimal/femtools/Sparse_Matrices_Fields.F90:83:8:

   83 |     if (compare_pointers(c_loc(x), c_loc(b))) then
      |        1
Error: Function ‘compare_pointers’ at (1) has no IMPLICIT type
/home/thomas/Softwares/fluidity_minimal/femtools/Diagnostic_variables.F90:1185:80:

 1185 |     call get_environment_variable("HOSTNAME", value_buffer, default = "Unknown")
      |                                                                                1
Error: Cannot find keyword named ‘default’ in call to ‘get_environment_variable’ at (1)
/usr/bin/ld: lib/libfluidity.a(Diagnostic_variables.F90.o): in function `__diagnostic_variables_MOD_write_detectors':
/home/thomas/Softwares/fluidity_minimal/femtools/Diagnostic_variables.F90:2648: undefined reference to `cget_nan_'
/usr/bin/ld: /home/thomas/Softwares/fluidity_minimal/femtools/Diagnostic_variables.F90:2684: undefined reference to `cget_nan_'
collect2: error: ld returned 1 exit status