A user came to #darktable with a lensfun building issue.
It turned out to be old glib version - <2.40 - no g_assert_nonnull()

Also, to prevent that from happening, and make detection of cases
when requirement bumping is needed, automatically define 2 glib macros
in config.h: GLIB_VERSION_MIN_REQUIRED and GLIB_VERSION_MAX_ALLOWED

Signed-off-by: Roman Lebedev <[email protected]>
---
 CMakeLists.txt                    | 5 ++++-
 include/lensfun/config.h.in.cmake | 6 ++++++
 2 files changed, 10 insertions(+), 1 deletion(-)

diff --git a/CMakeLists.txt b/CMakeLists.txt
index df0e16a..161ea6b 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -106,7 +106,10 @@ IF(WIN32)
 ENDIF()
 
 # find dependencies
-FIND_PACKAGE(GLIB2 REQUIRED)
+# NOTE: must be one of the macros listed in 
https://developer.gnome.org/glib/stable/glib-Version-Information.html
+SET(LENSFUN_GLIB_REQUIREMENT_MACRO "GLIB_VERSION_2_44")
+FIND_PACKAGE(GLIB2 REQUIRED 2.44)
+
 INCLUDE_DIRECTORIES(${GLIB2_INCLUDE_DIRS})
 # install glib dll on windows next to lensfun.dll
 IF (GLIB2_DLL)
diff --git a/include/lensfun/config.h.in.cmake 
b/include/lensfun/config.h.in.cmake
index bbe40bf..b0afa38 100644
--- a/include/lensfun/config.h.in.cmake
+++ b/include/lensfun/config.h.in.cmake
@@ -33,3 +33,9 @@
 #ifdef _MSC_VER
 #define _USE_MATH_DEFINES
 #endif
+
+#define GLIB_VERSION_MIN_REQUIRED      (${LENSFUN_GLIB_REQUIREMENT_MACRO})
+
+// to avoid usage of API that is not in GLIB_VERSION_MIN_REQUIRED version
+// and make it easy to detect when to bump requirements:
+#define GLIB_VERSION_MAX_ALLOWED      (GLIB_VERSION_MIN_REQUIRED)
-- 
2.6.1


------------------------------------------------------------------------------
Full-scale, agent-less Infrastructure Monitoring from a single dashboard
Integrate with 40+ ManageEngine ITSM Solutions for complete visibility
Physical-Virtual-Cloud Infrastructure monitoring from one console
Real user monitoring with APM Insights and performance trend reports 
Learn More http://pubads.g.doubleclick.net/gampad/clk?id=247754911&iu=/4140
_______________________________________________
Lensfun-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/lensfun-users

Reply via email to