NEML2 2.0.0
|
The CMake configure and build commands were introduced in the Installation Guide. The commands were
which uses the CMake preset named "release". The configure and build commands can take other CMake presets in the following form
where {configurePreset}
and {buildPreset}
should be substituted with a configure preset and a build preset, respectively. In addition to the "release" preset, NEML2 offers a few configure and build presets useful for typical development workflows, defined in CMakePresets.json
. Typical workflows and their corresponding presets are listed below.
See also Testing/C++ backend/Setup for how to run tests once the library is built.
Unlike the "release" preset, the "dev" preset builds NEML2 with debug info (i.e., -g
). Debuggers (gdb, lldb, etc.) can be used to step through the execution, set break points, navigate through backtrace, etc.
See also Testing/Python package/Setup for how to run tests once the package is built.
Once the documentation is built, the site can be previewed locally using
Feel free to replace firefox
with other browsers that support rendering of static html pages, e.g., google-chrome
.
The "benchmark" preset builds the core C++ library along with the tests. In addition, it builds a simple runner to parse and run arbitrary input files. All test executables and the runner are linked against gperftools' CPU profiler for profiling purposes.
The unit testing executable is built with coverage flags set. Standard code coverage tools such as gcov
and lcov
can be used to capture and record coverage data.
While the default presets should cover most of the development workflows, it is sometimes necessary to override certain options at various stages. In general, there are three ways of overriding the preset:
All three options are fully supported by the cmake-tools vscode extension.
The C++ source code is formatted using clang-format
. A .clang-format
file is provided at the repository root specifying the formatting requirements. When using an IDE providing plugins or extensions to formatting C++ source code, it is important to
.clang-format
file located at NEML2's repository root..h
and .cxx
with C++.The Python scripts shall be formatted using black
. Formatting requirements are specified under the [black]
section in pyproject.toml
.
All pull requests will be run through clang-format
and black
to ensure formatting consistency.
For linting, a .clang-tidy
file is provided at the repository root to specify expected checks.