Skip to content

Commit

Permalink
Meson: Set unity builds by default
Browse files Browse the repository at this point in the history
  • Loading branch information
meator committed Jun 2, 2024
1 parent bc62333 commit 1bbdaed
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 7 deletions.
8 changes: 4 additions & 4 deletions BUILDING.md
Original file line number Diff line number Diff line change
Expand Up @@ -64,10 +64,10 @@ Although it is recommended to use `meson-setup.sh`, you can completely ignore
its flags and invoke meson manually.

### Unity builds in Meson
Unity builds can't be set by default without disrupting developer workflow. The
`meson-setup.sh` script uses unity builds for release build style (which is the
default). This is also the recommended setup in
[README.md](README.md#build-requirements).
Unity builds are fully configurable in Meson. They are enabled by default.
The `meson-setup.sh` script disables unity builds for `debug` and `sanitize`
build styles. You can use Meson's `--unity=off` flag to turn off unity builds
when configuring the project manually.

## Support
J4-dmenu-desktop has been tested on glibc and musl, cross compilation has been
Expand Down
6 changes: 3 additions & 3 deletions meson-setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -52,14 +52,14 @@ fi

case $build_type in
release)
exec $DRYRUN meson setup --buildtype=release -Db_lto=true --unity on --unity-size 9999 "$1"
exec $DRYRUN meson setup --buildtype=release -Db_lto=true "$1"
;;
debug)
exec $DRYRUN meson setup -Dsplit-source=true "$1"
exec $DRYRUN meson setup -Dsplit-source=true --unity=off "$1"
;;
sanitize)
# See https://github.com/catchorg/Catch2/issues/2811 for explanation of forcefallback
exec $DRYRUN meson setup -Dsplit-source=true -Db_sanitize=address,undefined -Dcpp_debugstl=true -Db_lundef=false --wrap-mode forcefallback "$1"
exec $DRYRUN meson setup -Dsplit-source=true -Db_sanitize=address,undefined -Dcpp_debugstl=true -Db_lundef=false --wrap-mode forcefallback --unity=off "$1"
;;
*)
echo "Unknown build style $build_type!" 1>&2
Expand Down
2 changes: 2 additions & 0 deletions meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ project(
default_options: [
'warning_level=3',
'cpp_std=c++17',
'unity=on',
'unity_size=9999'
],
license: 'GPL-3.0-or-later',
license_files: 'LICENSE',
Expand Down

0 comments on commit 1bbdaed

Please sign in to comment.