Allow compiling GROMACS without C compiler
Primary reason: Would simplify cmake.
Required subtask: Make TNG compile with C++ compiler. Requires explicit cast for all malloc calls and renaming of "private" variable (2nd is simple sed). Maybe a few other things. Adding cast could be automatized but I can't find existing tooling. Might be pretty easy to create.
Alternative: Remove the included TNG version and require external TNG or no-TNG.
Option: Modify cmake before TNG issue is resolved. Don't require C compiler if the user chooses no or external TNG.
#2 Updated by Roland Schulz about 1 year ago
(copying some discussion from https://gerrit.gromacs.org/#/c/9058/ to have everything here)
fftw is build using ExternalProject. It has its own configure and looks for its own compiler.
If we want to keep the option to build TNG as part of the GROMACS and keep TNG as C and remove C from GROMACS we have two options:
- Either use ExternalProject for TNG (same as fftw). Note that ExternalProject support a local path/file. So the decision of whether we want to include the TNG source in the GROMACS source (rather than downloading it on demand as with fftw) is independent of the decision of how we build it.
- Or enable the C language as part of the TNG build (e.g. in gmxManageTNG.cmake). That way it is still part of the same cmake process but the c compiler is only needed if internal TNG is chosen by the user. With this approach it is a bit unclear where to set the required cflags. If we remove C from GROMACS we'll want to remove setting of c flags from gmxCFlags.cmake. It'll either has to be set in gmxManageTNG.cmake or in src/external/tng_io somewhere.
Szilard has pointed out: If TNG is to be kept portable, it's perhaps best to keep it C?
My reply: I assume we'll want to keep a C interface so it is usable by non C++ code. But that doesn't require the code to be C++. Do we need more than that?