From 8562bb304d7ec86201a7c496fae1072e96404351 Mon Sep 17 00:00:00 2001 From: Nirbheek Chauhan Date: Tue, 12 May 2020 05:07:47 +0530 Subject: [PATCH] meson: Pass native: false to add_languages() This is needed for cross-compiling without a build machine compiler available. The option was added in 0.54, but we only need this in Cerbero and it doesn't affect older versions so it should be ok. Will just cause a spurious warning. Part-of: --- ext/sidplay/meson.build | 57 +++++++++++++++++++++++++++++-------------------- meson.build | 2 +- 2 files changed, 35 insertions(+), 24 deletions(-) diff --git a/ext/sidplay/meson.build b/ext/sidplay/meson.build index 12fe4b2..6310652 100644 --- a/ext/sidplay/meson.build +++ b/ext/sidplay/meson.build @@ -1,27 +1,38 @@ +sidplay_option = get_option('sidplay') +if sidplay_option.disabled() + subdir_done() +endif + +if not add_languages('cpp', native: false, required: sidplay_option) + subdir_done() +endif + +if not cxx.has_header('sidplay/player.h', required: sidplay_option) + subdir_done() +endif + +sidplay_dep = cxx.find_library('sidplay', required: sidplay_option) +if not sidplay_dep.found() + subdir_done() +endif + # sidplay plugin works with libsidplay 1.36.x (not 2.x.x) -have_sidplay = false -if have_cxx and not get_option('sidplay').disabled() - if cxx.has_header('sidplay/player.h') - sid_code = '''#include - void somefunc (void) { - sidTune tune = sidTune(0); - }''' - sidplay_dep = cxx.find_library('sidplay', required: get_option('sidplay')) - if sidplay_dep.found() - have_sidplay = cxx.compiles(sid_code, dependencies: sidplay_dep, name : 'sidplay') - endif +sid_code = '''#include + void somefunc (void) { + sidTune tune = sidTune(0); + }''' +if not cxx.compiles(sid_code, dependencies: sidplay_dep, name : 'sidplay usage') + if sidplay_option.enabled() + error('sidplay headers and libraries were found, but were not usable') endif + subdir_done() endif -if have_sidplay - gstsid = library('gstsid', 'gstsiddec.cc', - cpp_args : ugly_args, - include_directories : [configinc], - dependencies : [gstaudio_dep, sidplay_dep], - install : true, - install_dir : plugins_install_dir) - pkgconfig.generate(gstsid, install_dir : plugins_pkgconfig_install_dir) - plugins += [gstsid] -elif get_option('sidplay').enabled() - error('sidplay plugin enabled but dependencies not found') -endif +gstsid = library('gstsid', 'gstsiddec.cc', + cpp_args : ugly_args, + include_directories : [configinc], + dependencies : [gstaudio_dep, sidplay_dep], + install : true, + install_dir : plugins_install_dir) +pkgconfig.generate(gstsid, install_dir : plugins_pkgconfig_install_dir) +plugins += [gstsid] diff --git a/meson.build b/meson.build index edb75e9..a3a78ad 100644 --- a/meson.build +++ b/meson.build @@ -16,7 +16,7 @@ else endif gst_version_is_dev = gst_version_minor % 2 == 1 and gst_version_micro < 90 -have_cxx = add_languages('cpp', required : false) +have_cxx = add_languages('cpp', native: false, required: false) glib_req = '>= 2.44.0' gst_req = '>= @0@.@1@.0'.format(gst_version_major, gst_version_minor) -- 2.7.4