Skip to content
  • Iñigo Martínez's avatar
    meson: Improve compiler flags and debugging options · 5691ce60
    Iñigo Martínez authored
    meson provides two options related to debug options. The first one
    is the build type, which among others, can be `debug` build or
    `debugoptimized`. The second option which is called `b_ndebug` can
    be used to enable or disable assertions.
    
    The meson guidelines[0] recommends the use of options present in
    meson, so the combination of these two options has been used to
    replace the `debug` option.
    
    - `debug` build sets the `LIBGIT2_GLIB_ENABLE_DEBUG` macro, which
      is equivalent to `debug=yes`.
    - `debugoptimized` build sets the same macros as `debug`, but also
      set `G_DISABLE_CAST_CHECKS`, which is equivalent to
      `debug=minimum`.
    - If build is not a `debug*` build it sets `G_DISABLE_CAST_CHECKS`
      and `-G_DISABLE_CHECKS`.
    - If `b_ndebug` is true it sets `G_DISABLE_ASSERT`.
    
    To ease the compiler flags checking the `get_supported_arguments`
    helper function is also used, which implies bumping meson version to
    0.43.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=792699
    
    [0] https://wiki.gnome.org/Initiatives/GnomeGoals/MesonPorting
    5691ce60