dftd3 / simple-dftd3

reimplementation of the DFT-D3 program
https://dftd3.readthedocs.io
GNU Lesser General Public License v3.0
51 stars 26 forks source link

Top-Level Documentation on Building and Linking with CMake #95

Open AlexBuccheri opened 3 weeks ago

AlexBuccheri commented 3 weeks ago

In response to the JOSS review

Configuration Step

It would be useful to inform the user of how to point to preinstalled versions of external dependencies with cmake/meson, particularly as users of the Grimme-lab suite of programs may have some installed already. I.e passing mctc-lib_DIR, mstore_DIR, toml-f_DIR, test-drive_DIR to cmake, or specifying search paths via CMAKE_PREFIX_PATH.

It's a trivial point, but it's also worth noting that the initial configure step will fail if one is offline if cmake has to fall back to Fetch_content. I assume this is also true with meson.

Building from Source

CMAKE tells the user:

-- Performing Test WITH_QP
-- Performing Test WITH_QP - Success
-- Performing Test WITH_XDP
-- Performing Test WITH_XDP - Failed

Although it's guessable that QP is quad precision and XDP is extended double precision, I still have to dig through the source to confirm.

Suggestion: A brief reference to this in the documentation would be informative, and something (either in the configure step or the docs) to indicate that these preprocessor variables belong test drive.

Running the Tests

One could change the command reference from

pushd _build && ctest && popd

to the more idiomatic:

ctest --test-dir ./_build
AlexBuccheri commented 5 days ago

W.r.t. informing the user of which package a specific cmake message comes from, I just found one can do this with CMAKE_MESSAGE_CONTEXT. For example in test_drive CMakeLists.txt, one could bookend with

cmake_minimum_required(VERSION 3.20)
project(test_drive VERSION 1.0.0 LANGUAGES fortran)

list(APPEND CMAKE_MESSAGE_CONTEXT Test Drive)

<File contents>
.
.
.

list(POP_BACK CMAKE_MESSAGE_CONTEXT)