Skip to content

Newb question: how to manage debug/release build types in a single meson project in practice? #14064

Closed Answered by dcbaker
metaleap asked this question in Q&A
Discussion options

You must be logged in to vote

Generally Meson steers you to have two build directories configured differently, so you'd have:

project('myapp', 'c')  # debug is already the default build type

executable('myapp', 'main.c', dependencies : [dependency('sdl2')])

Then you'd configure two separate build directories in your project:

meson setup builddir/debug
ninja -C builddir/debug
meson setup builddir/release -Dbuildtype=release -Dprefer_static=true
ninja -C builddir/release

This is advantageous because you probably don't want to ship both a debug and a release build, and you don't end up compiling the same files twice when you probably are only going to test one binary.

edit: Eli's suggestion to use prefer_static is the c…

Replies: 4 comments

Comment options

You must be logged in to vote
0 replies
Answer selected by metaleap
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants