diff options
author | Nirbheek Chauhan <nirbheek@centricular.com> | 2019-12-01 17:04:05 +0530 |
---|---|---|
committer | Tim-Philipp Müller <tim@centricular.com> | 2019-12-02 10:14:52 +0000 |
commit | d3d4228972565018b1488babafe95af0d71f0a84 (patch) | |
tree | 24d70d2d3d8185d09f03accd535b1342dc31f059 /ext | |
parent | d9e6f19026880f1f068aabb50c52b9a4d7b524e5 (diff) | |
download | gstreamer-plugins-bad-d3d4228972565018b1488babafe95af0d71f0a84.tar.gz |
openexr: Fix check for when to pass -std=c++98
commit 6adfb120ab0e1bb0b3439ad725a362cfe4fbe733 added this flag to fix
builds with `-Werror`, and afterwards it was changed to use a version
check when newer versions of openexr moved over to C++11.
However, some distros have backported patches to older openexr
versions which make it require C++11, which makes the version check
incorrect and causes an error because we passed `-Werror -std=c++98`.
Instead, directly check when usage of the header requires `-std=c++98`
with `-Werror` and override the `cpp_std` setting on the target.
Fixes https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/issues/1117
Diffstat (limited to 'ext')
-rw-r--r-- | ext/openexr/meson.build | 23 |
1 files changed, 19 insertions, 4 deletions
diff --git a/ext/openexr/meson.build b/ext/openexr/meson.build index 8fac33042..2bd5fb09c 100644 --- a/ext/openexr/meson.build +++ b/ext/openexr/meson.build @@ -1,19 +1,34 @@ openexr_dep = dependency('OpenEXR', required: get_option('openexr')) if openexr_dep.found() - openexr_cppargs = [] - + openexr_override_options = [] + # Older versions of openexr fail to build with -Werror when using GCC >= 9.2 + # and Clang >= 6 because it uses deprecated C++98 syntax. Explicitly pass + # -std=c++98 in those cases. Just checking the openexr version is not enough + # because distros (such as Ubuntu 18.04) have backported patches due to which + # older openexr versions now require C++11. if openexr_dep.version().version_compare('< 2.4.0') - openexr_cppargs += cxx.get_supported_arguments(['-std=c++98']) + # Check whether using the openexr headers with -Werror causes an error + if cxx.has_argument('-Werror') and cxx.check_header('ImfRgbaFile.h', dependencies: openexr_dep) + if not cxx.check_header('ImfRgbaFile.h', dependencies: openexr_dep, args: '-Werror') + # If setting -std to c++98 fixes it, use that! Else, warn. + if cxx.check_header('ImfRgbaFile.h', dependencies: openexr_dep, args: ['-Werror', '-std=c++98']) + openexr_override_options = ['cpp_std=c++98'] + else + warning('openexr headers can\'t be included with \'-Werror\', and no workaround found') + endif + endif + endif endif gstopenexr = library('gstopenexr', 'gstopenexr.c', 'gstopenexrdec.cpp', c_args: gst_plugins_bad_args, - cpp_args: gst_plugins_bad_args + openexr_cppargs, + cpp_args: gst_plugins_bad_args, link_args: noseh_link_args, include_directories: [configinc, libsinc], dependencies: [gstvideo_dep, openexr_dep], + override_options: openexr_override_options, install: true, install_dir: plugins_install_dir, ) |