[gimp/alxsa-openmp-dependency: 3/3] build: Add support for OpenMP dependency




commit 79de79973a43e7fe8d767a32a76f6cf6c388a4e1
Author: Alx Sa <cmyk student gmail com>
Date:   Sun Oct 9 22:36:11 2022 +0000

    build: Add support for OpenMP dependency
    
    Enables general support for OpenMP.
    Currently, only the DDS plug-in utilizes it.

 configure.ac                  |  6 ++++++
 meson.build                   | 10 ++++++++++
 plug-ins/file-dds/Makefile.am |  2 +-
 plug-ins/file-dds/meson.build |  1 +
 4 files changed, 18 insertions(+), 1 deletion(-)
---
diff --git a/configure.ac b/configure.ac
index 231f6a173d..a54744dc17 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1371,6 +1371,12 @@ if test "x$enable_mp" != "xno"; then
            [Define to 1 to enable support for multiple processors.])
 fi
 
+AC_ARG_ENABLE(openmp, [  --disable-openmp            disable support for OpenMP])
+
+if test "x$enable_openmp" != "xno"; then
+  AC_DEFINE(ENABLE_OPENMP, 1,
+           [Define to 1 to enable support for OpenMP.])
+fi
 
 ################################
 # Some plug-ins are X11 specific
diff --git a/meson.build b/meson.build
index 149065b6d9..76c9baab20 100644
--- a/meson.build
+++ b/meson.build
@@ -1246,6 +1246,15 @@ conf.set('HAVE_GETTEXT', true)
 # Enable support for multiprocessing
 conf.set10('ENABLE_MP', get_option('enable-multiproc'))
 
+# Enable support for OpenMP
+openmp = dependency('openmp', required : false)
+if openmp.found()
+  have_openmp = true
+else
+  have_openmp = false
+endif
+conf.set('HAVE_OPENMP', have_openmp)
+
 # Check for available functions
 foreach fn : [
     { 'm': 'HAVE_ALLOCA',                   'v': 'alloca', },
@@ -1821,6 +1830,7 @@ final_message = [
 '''  32-bit DLL folder (Win32): @0@'''.format(get_option('win32-32bits-dll-folder')),
 '''  Detailed backtraces:       @0@'''.format(detailed_backtraces),
 '''  Binary symlinks:           @0@'''.format(enable_default_bin),
+'''  OpenMP:                    @0@'''.format(have_openmp),
 '',
 '''Optional Plug-Ins:''',
 '''  Ascii Art:           @0@'''.format(libaa.found()),
diff --git a/plug-ins/file-dds/Makefile.am b/plug-ins/file-dds/Makefile.am
index 3df17b839a..ff578dad37 100644
--- a/plug-ins/file-dds/Makefile.am
+++ b/plug-ins/file-dds/Makefile.am
@@ -20,7 +20,7 @@ file_dds_RC = file-dds.rc.o
 endif
 
 AM_LDFLAGS = $(mwindows)
-AM_CFLAGS = -fno-strict-aliasing
+AM_CFLAGS = -fno-strict-aliasing -fopenmp
 
 libexecdir = $(gimpplugindir)/plug-ins/file-dds
 
diff --git a/plug-ins/file-dds/meson.build b/plug-ins/file-dds/meson.build
index b8a47ee88f..9a2dd8d27f 100644
--- a/plug-ins/file-dds/meson.build
+++ b/plug-ins/file-dds/meson.build
@@ -29,6 +29,7 @@ executable(plugin_name,
   dependencies: [
     libgimpui_dep,
     math,
+    openmp,
   ],
   install: true,
   install_dir: gimpplugindir / 'plug-ins' / plugin_name,


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