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



commit 41e4c4478b83f0477ca99527c3c36a6c97a91cd1
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                   | 9 +++++++++
 meson_options.txt             | 1 +
 plug-ins/file-dds/Makefile.am | 2 +-
 plug-ins/file-dds/meson.build | 1 +
 5 files changed, 18 insertions(+), 1 deletion(-)
---
diff --git a/configure.ac b/configure.ac
index 713feb0b0b..e7bd60038d 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..32aaea2b31 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()
+  openmp_enabled = true
+else
+  openmp_enabled = true
+endif
+conf.set('ENABLE_OPENMP', openmp_enabled)
+
 # Check for available functions
 foreach fn : [
     { 'm': 'HAVE_ALLOCA',                   'v': 'alloca', },
diff --git a/meson_options.txt b/meson_options.txt
index 1d7194c847..6ef0ca6381 100644
--- a/meson_options.txt
+++ b/meson_options.txt
@@ -4,6 +4,7 @@ option('enable-console-bin',type: 'boolean', value: true,   description: 'Build
 option('win32-debug-console',type:'boolean', value: true,   description: 'Open a console when starting the 
program')
 option('enable-default-bin',type: 'boolean', value: true,   description: 'Install unversioned symlinks 
pointing to versioned executables')
 option('enable-multiproc',  type: 'boolean', value: true,   description: 'Support for multiple processors')
+option('openmp',            type: 'boolean', value: true,   description: 'Enable OpenMP')
 option('profiling',         type: 'boolean', value: false,  description: 'Enable profiling')
 option('windows-installer', type: 'boolean', value: false,  description: 'Generate files needed for the 
Windows installer')
 
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]