Skip to content

Commit

Permalink
add build instructions for Meson
Browse files Browse the repository at this point in the history
  • Loading branch information
jason committed Jul 26, 2024
1 parent 02af9ca commit 5a2e0f9
Showing 1 changed file with 38 additions and 11 deletions.
49 changes: 38 additions & 11 deletions docs/content/build-instructions.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,36 +21,43 @@ release or the latest `master`, we recommend referring to the copy of this
document (`docs/content/build-instructions.md`) found in your source
distribution.

## CMake Overview
## Overview

These instructions assume that you will build in a directory named `build` as
a direct subdirectory of the source directory, and that you will use the
default generator. CMake permits the build directory to be almost anywhere
(although in-source builds are strongly discouraged), and supports multiple
generators. To users familiar with CMake, we recommend using
[Ninja](https://ninja-build.org/).
default generator. CMake and Meson support multiple generators and permit the
build directory to be almost anywhere (although in-source builds are strongly
discouraged for both and are prohibited in Meson). To users familiar with
CMake, we recommend using [Ninja](https://ninja-build.org/).

A detailed description of how to use CMake is not specific to LCM and is beyond
the scope of these instructions.

By default CMake is configured to produce a release build. To build with debug symbols instead, use:
By default CMake and Meson are configured to produce a release build. To build with debug symbols instead, use:

```shell
cmake .. -DCMAKE_BUILD_TYPE=Debug
```

when configuring a build directory in the following sections.
for CMake, and use:

```shell
meson setup build -Dbuildtype=debug
```

for Meson when configuring a build directory in the following sections.

## Ubuntu and Debian

Required packages:
- build-essential
- cmake
- cmake # note: if using CMake
- meson # note: if using Meson
- libglib2.0-dev

Optional packages (e.g., for language-specific support or building documentation):
- default-jdk
- libjchart2d-java # note: if not installed, jchart2d will be built from source
- libjchart2d-java # note: if not installed, jchart2d will be built from source in CMake
- doxygen
- liblua5.3-dev
- lua5.3
Expand All @@ -61,7 +68,7 @@ Python packages needed for building documentation:
- myst-parser
- sphinx-rtd-theme

From a terminal, run the following commands.
From a terminal, run the following commands for CMake:

```shell
mkdir build
Expand All @@ -71,14 +78,23 @@ make
sudo make install
```

or run the following commands for Meson:

```shell
meson setup build
cd build
meson compile
sudo meson install
```

## OS X

There are several ways to build LCM on OS X, none of which are necessarily
better than the others.

### Homebrew

Install Homebrew packages
Install Homebrew packages (swap `cmake` for `meson` if building with Meson)

```shell
brew install glib pkg-config cmake
Expand All @@ -88,6 +104,8 @@ Install Java. Type `javac` in a terminal, then follow the instructions.

Download and build LCM.

For CMake, run:

```shell
mkdir build
cd build
Expand All @@ -96,6 +114,15 @@ make
make install
```

For Meson, run:

```shell
meson setup build
cd build
meson compile
meson install
```

## Windows

LCM is officially supported on MSYS2. There is some residual support for Visual Studio that is
Expand Down

0 comments on commit 5a2e0f9

Please sign in to comment.