Include check for existence of xvfb in meson.build
[geeqie.git] / meson.build
index c2a58ce..660aa62 100644 (file)
@@ -44,7 +44,7 @@ project(
     'cpp',
     version : run_command('./version.sh', check : true).stdout().strip(),
     license : ['GPL-2.0-or-later'],
-    meson_version : '>=0.53.0',
+    meson_version : '>=0.56.2',
     default_options : ['warning_level=3', 'buildtype=debugoptimized', 'cpp_link_args=-rdynamic']
 )
 
@@ -52,7 +52,6 @@ project(
 add_global_arguments('-Wno-overlength-strings', language : 'c')
 
 # To compile originally-C files as C++
-add_global_arguments('-fpermissive', language : 'cpp')
 add_global_arguments('-Wno-error=deprecated-declarations', language : 'cpp')
 add_global_arguments('-Wno-error=sign-compare', language : 'cpp')
 add_global_arguments('-Wno-error=return-type', language : 'cpp')
@@ -141,7 +140,8 @@ htmldir = join_paths(prefix, gq_htmldir)
 icondir = join_paths(datadir, 'pixmaps')
 mandir1 = join_paths(datadir, 'man', 'man1')
 
-podir = join_paths(meson.source_root(), 'po')
+podir = join_paths(meson.project_source_root(), 'po')
+scriptsdir = join_paths(meson.project_source_root(), 'scripts')
 
 summary({'gq_appdir': gq_appdir,
         'gq_bindir': gq_helpdir,
@@ -155,7 +155,13 @@ conf_data = configuration_data()
 conf_data.set_quoted('VERSION', meson.project_version())
 conf_data.set('DEBUG', debug)
 
-gtk_dep = dependency('gtk+-3.0', version : '>=3.22', required: true)
+option = get_option('gtk4')
+if option.enabled()
+    gtk_dep = dependency('gtk4', required: true)
+    conf_data.set('HAVE_GTK4', 1)
+else
+    gtk_dep = dependency('gtk+-3.0', version : '>=3.24', required: true)
+endif
 glib_dep = dependency('glib-2.0', version : '>=2.52', required: true)
 
 # Required only when backward-cpp is used
@@ -439,7 +445,7 @@ if not option.disabled()
     else
         summary({'README' : ['pandoc not found - README.html created:', false]}, section : 'Documentation', bool_yn : true)
     endif
-    install_data('README.md', 'COPYING', 'TODO', 'AUTHORS', install_dir : helpdir)
+    install_data('README.md', 'COPYING', 'TODO', install_dir : helpdir)
 else
     summary({'pandoc' : ['disabled - README.html created:', false]}, section : 'Documentation', bool_yn : true)
 endif
@@ -530,13 +536,17 @@ endif
 
 # libpixbufloader-webp is not loaded as part of libgdk-pixbuf. Just issue
 # a warning if not installed
-libwebp_dir = dependency('gdk-pixbuf-2.0', method: 'pkg-config').get_variable('gdk_pixbuf_moduledir')
-libwebp_dep = cc.find_library('libpixbufloader-webp', dirs : libwebp_dir, required : false)
+libwebp_dir = dependency('gdk-pixbuf-2.0', method: 'pkg-config').get_variable(pkgconfig: 'gdk_pixbuf_moduledir', internal: 'gdk_pixbuf_moduledir')
 
-if libwebp_dep.found()
-       summary({'webp' : ['webp files supported:', true]}, section : 'Configuration', bool_yn : true)
+if libwebp_dir.contains('loaders')
+    libwebp_dep = cc.find_library('pixbufloader-webp', dirs : libwebp_dir, required : false)
+    if libwebp_dep.found()
+        summary({'webp' : ['webp files supported:', true]}, section : 'Configuration', bool_yn : true)
+    else
+        summary({'webp' : ['webp-pixbuf-loader not installed - webp files supported:', false]}, section : 'Configuration', bool_yn : true)
+    endif
 else
-       summary({'webp' : ['webp-pixbuf-loader not installed - webp files supported:', false]}, section : 'Configuration', bool_yn : true)
+    summary({'webp' : ['webp-pixbuf-loader not installed - webp files supported:', false]}, section : 'Configuration', bool_yn : true)
 endif
 
 # Check for nl_langinfo and _NL_TIME_FIRST_WEEKDAY
@@ -620,3 +630,13 @@ i18n.merge_file(
     install_dir : appdatadir)
 
 configure_file(input: 'geeqie.spec.in', output: 'geeqie.spec', configuration: conf_data)
+
+# Basic test of the executable
+xvfb = find_program('xvfb-run', required : false)
+if xvfb.found()
+    test('Basic test', xvfb, args: ['--auto-servernum', geeqie_exe, '--version'], timeout: 100)
+    summary({'xvfb' : ['Test runs:', true]}, section : 'Debugging', bool_yn : true)
+else
+    summary({'xvfb' : ['Test runs:', false]}, section : 'Debugging', bool_yn : true)
+
+endif