[gegl] meson, operations: missing OpenMP as an optional dependency.



commit d54fc3ccd37f9d769c9a55bd8ec065330e9654f5
Author: Jehan <jehan girinstud io>
Date:   Thu Aug 18 18:38:02 2022 +0200

    meson, operations: missing OpenMP as an optional dependency.
    
    OpenMP is currently only used for the gegl:mantiuk06 operation ("Mantiuk
    2006 Tone Mapping"), though it was always disabled since HAVE_OPENMP was
    never set.
    These meson rules will detect if OpenMP is available, print the result
    in the configure output, then use OpenMP if available. Testing in GIMP,
    the operation still works similarly with or without OpenMP (some random
    pixels have very slight value differences, off-by-ones, but nothing
    visible by the eye and probably not a problem for this type of filter;
    global render looks the same).
    
    This missing dependency test was detected by the MSYS2 project in this
    report: https://github.com/msys2/MINGW-packages/pull/12607
    
    The "openmp" dependency check was added in meson 0.46.0:
    https://mesonbuild.com/Release-notes-for-0-46-0.html#addition-of-openmp-dependency

 meson.build                   | 10 ++++++++--
 meson_options.txt             |  1 +
 operations/common/meson.build |  7 ++++---
 3 files changed, 13 insertions(+), 5 deletions(-)
---
diff --git a/meson.build b/meson.build
index db2759667..31da40120 100644
--- a/meson.build
+++ b/meson.build
@@ -388,6 +388,10 @@ openexr   = dependency('OpenEXR',
   version: dep_ver.get('openexr'),
   required: get_option('openexr')
 )
+openmp    = dependency('openmp',
+  required: get_option('openmp')
+)
+config.set('HAVE_OPENMP', openmp.found())
 poppler = dependency('poppler-glib',
   version: dep_ver.get('poppler'),
   required: get_option('poppler')
@@ -619,11 +623,12 @@ if meson.version().version_compare('>=0.53.0')
       'Luajit'            : lua.found(),
       'maxflow'           : maxflow.found(),
       'mrg'               : mrg.found(),
+      'OpenEXR'           : openexr.found(),
+      'openMP'            : openmp.found(),
       'Pango'             : pango.found(),
       'pangocairo'        : pangocairo.found(),
       'poly2tri-c'        : poly2tri_c.found(),
       'poppler'           : poppler.found(),
-      'OpenEXR'           : openexr.found(),
       'rsvg'              : librsvg.found(),
       'SDL1'              : sdl1.found(),
       'SDL2'              : sdl2.found(),
@@ -667,11 +672,12 @@ else
   '  Luajit:            @0@'.format(lua.found()),
   '  maxflow:           @0@'.format(maxflow.found()),
   '  mrg:               @0@'.format(mrg.found()),
+  '  OpenEXR:           @0@'.format(openexr.found()),
+  '  openMP:            @0@'.format(openmp.found()),
   '  Pango:             @0@'.format(pango.found()),
   '  pangocairo:        @0@'.format(pangocairo.found()),
   '  poly2tri-c:        @0@ (@1@)'.format(poly2tri_c.found(),poly2tri_c.type_name()),
   '  poppler:           @0@'.format(poppler.found()),
-  '  OpenEXR:           @0@'.format(openexr.found()),
   '  rsvg:              @0@'.format(librsvg.found()),
   '  SDL1:              @0@'.format(sdl1.found()),
   '  SDL2:              @0@'.format(sdl2.found()),
diff --git a/meson_options.txt b/meson_options.txt
index e8cb37d61..e139ce462 100644
--- a/meson_options.txt
+++ b/meson_options.txt
@@ -57,6 +57,7 @@ option('lua',           type: 'feature', value: 'auto')
 option('mrg',           type: 'feature', value: 'auto')
 option('maxflow',       type: 'feature', value: 'auto')
 option('openexr',       type: 'feature', value: 'auto')
+option('openmp',        type: 'feature', value: 'auto')
 option('cairo',         type: 'feature', value: 'auto')
 option('pango',         type: 'feature', value: 'auto')
 option('pangocairo',    type: 'feature', value: 'auto')
diff --git a/operations/common/meson.build b/operations/common/meson.build
index 120af48de..af3054cdc 100644
--- a/operations/common/meson.build
+++ b/operations/common/meson.build
@@ -140,6 +140,7 @@ gegl_common = shared_library('gegl-common',
     glib,
     json_glib,
     math,
+    openmp,
   ],
   link_with: [
     gegl_lib,
@@ -159,7 +160,7 @@ if host_cpu_family == 'x86_64'
   gegl_common_x86_64_v2 = shared_library('gegl-common-x86_64-v2',
     gegl_common_sources, opencl_headers,
     include_directories: [ rootInclude, geglInclude, ],
-    dependencies: [ babl, glib, json_glib, math, ],
+    dependencies: [ babl, glib, json_glib, math, openmp, ],
     link_with: [ gegl_lib, ],
     c_args: [ '-DGEGL_OP_BUNDLE' ] + x86_64_v2_flags,
     name_prefix: '',
@@ -171,7 +172,7 @@ if host_cpu_family == 'x86_64'
   gegl_common_x86_64_v3 = shared_library('gegl-common-x86_64-v3',
     gegl_common_sources, opencl_headers,
     include_directories: [ rootInclude, geglInclude, ],
-    dependencies: [ babl, glib, json_glib, math, ],
+    dependencies: [ babl, glib, json_glib, math, openmp, ],
     link_with: [ gegl_lib, ],
     c_args: [ '-DGEGL_OP_BUNDLE' ] + x86_64_v3_flags,
     name_prefix: '',
@@ -185,7 +186,7 @@ elif host_cpu_family == 'arm'
   gegl_common_arm_neon = shared_library('gegl-common-arm-neon',
     gegl_common_sources, opencl_headers,
     include_directories: [ rootInclude, geglInclude, ],
-    dependencies: [ babl, glib, json_glib, math, ],
+    dependencies: [ babl, glib, json_glib, math, openmp, ],
     link_with: [ gegl_lib, ],
     c_args: [ '-DGEGL_OP_BUNDLE' ] + arm_neon_flags,
     name_prefix: '',


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]