Add compatibility for glib>=2.62 (replace GTimeVal by GDateTime) - #123
Add compatibility for glib>=2.62 (replace GTimeVal by GDateTime)#123amotl wants to merge 1 commit into
Conversation
When building on macOS Catalina with glib installed through Homebrew, there is already glib 2.66.7. However, GTimeVal has been deprecated since glib 2.62 and should be replaced by GDateTime [1]. [1] https://developer.gnome.org/glib/stable/glib-Date-and-Time-Functions.html#GTimeVal
| SR_PKG_CHECK([glibmm], [SR_PKGLIBS_CXX], [glibmm-2.4 >= 2.32.0]) | ||
| AM_COND_IF([MACOS], | ||
| [SR_PKG_CHECK([glibmm], [SR_PKGLIBS_CXX], [glibmm-2.68 >= 2.32.0])], | ||
| [SR_PKG_CHECK([glibmm], [SR_PKGLIBS_CXX], [glibmm-2.4 >= 2.32.0])]) |
There was a problem hiding this comment.
On macOS/Homebrew, glibmm is named differently.
$ pkg-config --list-all | grep glib
gio-unix-2.0 GIO unix specific APIs - unix specific headers for glib I/O library
gio-2.0 GIO - glib I/O library
glib-2.0 GLib - C Utility Library
glibmm-2.68 glibmm - C++ wrapper for GLib
While the current implementation within this patch works for me, I am not sure if it will produce a memleak.
On the other hand, when already refactoring something related to timekeeping, using the monotonic clock might also be an option [3,4]? [1] https://developer.gnome.org/glib/stable/glib-GDateTime.html |
Hi again,
while working on sigrokproject/sigrok-meter#1, when building on macOS Catalina with glib installed through Homebrew, there is already glib 2.66.7.
However,
GTimeValhas been deprecated since glib 2.62 and should be replaced byGDateTime[1], see also [2].So, this is just a humble attempt to make things work again on this end. As I told you in #122, I am not deeply involved into C/C++, but this update makes things work for us so you might want to build upon it in one of the future iterations.
With kind regards,
Andreas.
[1] https://developer.gnome.org/glib/stable/glib-Date-and-Time-Functions.html#GTimeVal
[2] https://tecnocode.co.uk/2019/08/24/gtimeval-deprecation-in-glib-2-61-2/