Merge from branch libatomic-check

This commit is contained in:
Chris Cannam
2023-05-19 12:38:39 +01:00
3 changed files with 27 additions and 3 deletions

View File

@@ -320,7 +320,7 @@ pitch-shifting, and CPU usage.
Library Build option CPP define Notes Library Build option CPP define Notes
------- ------------ ---------- ----- ------- ------------ ---------- -----
Built-in -Dfft=builtin -DUSE_BQRESAMPLER Default. Built-in -Dresampler=builtin -DUSE_BQRESAMPLER Default.
Intended to give high quality Intended to give high quality
for time-varying pitch shifts for time-varying pitch shifts
in real-time mode. in real-time mode.

View File

@@ -131,6 +131,24 @@ have_sincos = cpp.has_function('sincos',
args: '-lm') args: '-lm')
# Do we need libatomic?
#
libatomic_dep = dependency('', required : false)
libatomic_test_program = '''
#include <atomic>
int main() {
std::atomic<int> i;
std::atomic<double> d;
return int(i.is_lock_free() && d.is_lock_free());
}
'''
if cpp.compiles(libatomic_test_program, name : 'test program using std::atomic')
if (not cpp.links(libatomic_test_program, name : 'test program using std::atomic requires -latomic'))
libatomic_dep = cpp.find_library('atomic', required : true)
endif
endif
# Find out whether we can build the optional JNI target. Thanks to Eli # Find out whether we can build the optional JNI target. Thanks to Eli
# Schwartz for the fix here; this has been through a few previous # Schwartz for the fix here; this has been through a few previous
# iterations. Initially we just looked for jni.h, but it's often in an # iterations. Initially we just looked for jni.h, but it's often in an
@@ -150,6 +168,11 @@ have_sincos = cpp.has_function('sincos',
have_jni = false have_jni = false
have_java = add_languages('java', required: get_option('jni')) have_java = add_languages('java', required: get_option('jni'))
if have_java if have_java
# At the time of writing this causes a spurious Meson warning:
# "Project targets '>= 0.53.0' but uses feature introduced in
# '0.62.0': dep 'jni' custom lookup." It's spurious because this
# syntax worked before 0.62 as well, it just didn't invoke the
# custom lookup
jni_dep = dependency('jni', required: false) jni_dep = dependency('jni', required: false)
have_jni = cpp.has_header('jni.h', dependencies: jni_dep, args: extra_include_args) have_jni = cpp.has_header('jni.h', dependencies: jni_dep, args: extra_include_args)
endif endif
@@ -489,7 +512,7 @@ endif # system
general_include_dirs += get_option('extra_include_dirs') general_include_dirs += get_option('extra_include_dirs')
general_compile_args = [ arch_flags, feature_defines ] general_compile_args = [ arch_flags, feature_defines ]
general_dependencies = [ feature_dependencies, thread_dep ] general_dependencies = [ feature_dependencies, thread_dep, libatomic_dep ]
rubberband_additional_static_lib = '' rubberband_additional_static_lib = ''
@@ -776,7 +799,7 @@ if have_sndfile
dependencies: [ dependencies: [
rubberband_objlib_dep, rubberband_objlib_dep,
general_dependencies, general_dependencies,
sndfile_dep, sndfile_dep
], ],
install: true, install: true,
) )

View File

@@ -42,6 +42,7 @@
#include <map> #include <map>
#include <memory> #include <memory>
#include <atomic>
namespace RubberBand namespace RubberBand
{ {