Skip to content

Development: Building

Matt Young edited this page Feb 15, 2024 · 7 revisions

Basics of compiling and running the code

The recommended way to build is with Meson. However, we do also support CMake (see below).

Building with Meson

Assuming you are in the top-level directory, run the following commands to build and install locally:

$ cd mbuild
$ meson compile
...
$ sudo meson install

Every once in a while, you may see the following error when running meson compile:

ninja: build stopped: Error writing to build log: Permission denied.

The fix is simple:

rm .ninja_*

Then run the meson compile command again.

Building with CMake

CMake generates a Makefile (created in the build directory by the configure script), so you normally use make to invoke the build:

$ cd build
$ make
...
$ sudo make install

However, on Windows, we still have some glitches to iron out, so you need to call CMake directly:

$ cd build
$ cmake --build .
...
$ cmake --build . --target install

In all cases, the build is largely controlled by two files:

You can find out what other things you can build by running $ make help

Automated Tests

There are a few automated tests you can run with $ make test (or cmake --build . --target test on Windows). See Automated Tests for more details.

Doxygen

You can build the source code documentation using Doxygen with the following command: $ make source_doc ... You can then open brewken/build/doc/html/index.html in a web browser. The settings for Doxygen are in brewken/doc/Doxyfile.in