To do an out-of-source build in Meson:
cd /path/to/source/
mkdir ../builddir
Then:
cd /path/to/source/
meson ../builddir
cd ../builddir
ninja
Is it possible to do anything like this (from builddir
):
meson --pathToSource ../source // pseudocode
ninja
I.e. avoid jumping from the source to the build directory and back.
For CMake, this is the default.
Once you've run meson
to create build directory (which meson
can create automatically), there is no need to run it everytime you change meson.build. When you run ninja
, meson can regenerate build configurations itself depending on the changes in the sources.
To run ninja
in other places than build directory, you can you -C
option (from ninja -h
):
-C DIR change to DIR before doing anything else
Given your example, it will be:
$ cd /path/to/source/
$ meson ../builddir
$ ninja -C ../builddir