@@ -4,9 +4,10 @@ project(
44 license : ' LGPL-2.1-or-later' ,
55 version : ' 1.24.3' ,
66 meson_version : ' >=0.58' ,
7- default_options : [' cpp_std=c++17' , ' c_std=c11' ],
87)
98
9+ cpp_std = ' cpp_std=c++17'
10+
1011cpp = meson .get_compiler(' cpp' )
1112if meson .version().version_compare(' >= 0.62' )
1213 dl_dep = dependency (
1920 required : false ,
2021 )
2122endif
23+
2224fmt_dep = dependency (' fmt' )
23- thread_dep = dependency (' threads' )
25+
26+ if host_machine .system() != ' windows'
27+ thread_dep = dependency (' threads' )
28+ else
29+ thread_dep = declare_dependency ()
30+ endif
31+
2432alsa_dep = dependency (
2533 ' alsa' ,
2634 required : get_option (' alsa' ),
@@ -355,45 +363,39 @@ if cdata.get('HAVE_RTKIT')
355363 alc_sources += files (' core/dbus_wrap.cpp' , ' core/rtkit.cpp' )
356364endif
357365
358- foreach h : [' guiddef.h' , ' pthread_np.h' ]
359- cdata.set(' HAVE_@0@' .format(h.underscorify().to_upper()), cpp.has_header(h))
366+ headers = {
367+ ' dlfcn.h' : dl_dep,
368+ ' guiddef.h' : [],
369+ ' pthread_np.h' : [],
370+ }
371+ foreach h, d : headers
372+ if cpp.has_header(
373+ h,
374+ dependencies : d,
375+ )
376+ cdata.set(' HAVE_@0@' .format(h.underscorify().to_upper()), 1 )
377+ endif
360378endforeach
361379
362- cdata.set(
363- ' HAVE_DLFCN_H' ,
364- cpp.has_header(
365- ' dlfcn.h' ,
366- dependencies : dl_dep,
367- ),
368- )
369-
370380#needs to be check_header for LLVM as well as MinGW
371381cdata.set(' HAVE_CPUID_H' , cpp.check_header(' cpuid.h' ))
372382cdata.set(' HAVE_INTRIN_H' , cpp.check_header(' intrin.h' ))
373383
374- #need to check for non windows because meson wrongly detects its presence under MinGW
375- cdata.set(' HAVE_PROC_PIDPATH' , cpp.has_function(' proc_pidpath' ))
376- cdata.set(
377- ' HAVE_PTHREAD_SETSCHEDPARAM' ,
378- cpp.has_function(
379- ' pthread_setschedparam' ,
380- dependencies : thread_dep,
381- ),
382- )
383- cdata.set(
384- ' HAVE_PTHREAD_SETNAME_NP' ,
385- cpp.has_function(
386- ' pthread_setname_np' ,
387- dependencies : thread_dep,
388- ),
389- )
390- cdata.set(
391- ' HAVE_PTHREAD_SET_NAME_NP' ,
392- cpp.has_function(
393- ' pthread_set_name_np' ,
394- dependencies : thread_dep,
395- ),
396- )
384+ functions = {
385+ #need to check for non windows because meson wrongly detects its presence under MinGW
386+ ' proc_pidpath' : [],
387+ ' pthread_setschedparam' : thread_dep,
388+ ' pthread_setname_np' : thread_dep,
389+ ' pthread_set_name_np' : thread_dep,
390+ }
391+ foreach f, d : functions
392+ if cpp.has_function(
393+ f,
394+ dependencies : d,
395+ )
396+ cdata.set(' HAVE_@0@' .format(f.underscorify().to_upper()), 1 )
397+ endif
398+ endforeach
397399
398400cdata.set(' HAVE_CPUID_INTRINSIC' , cpp.get_argument_syntax() == ' msvc' )
399401cdata.set(
@@ -469,6 +471,7 @@ endif
469471common_lib = static_library (
470472 ' common' ,
471473 common_sources,
474+ override_options : cpp_std,
472475 pic : true ,
473476 dependencies : fmt_dep,
474477)
@@ -490,6 +493,7 @@ openal_lib = library(
490493 alc_sources,
491494 hrtf_h,
492495 cpp_args : openal_args,
496+ override_options : cpp_std,
493497 dependencies : [
494498 common_dep,
495499 dl_dep,
@@ -522,9 +526,7 @@ openal_dep = declare_dependency(
522526 compile_args : get_option (' default_library' ) == ' static' ? ' -DAL_LIBTYPE_STATIC' : [],
523527)
524528
525- if meson .version().version_compare(' >=0.54.0' )
526- meson .override_dependency(' openal' , openal_dep)
527- endif
529+ meson .override_dependency(' openal' , openal_dep)
528530
529531install_headers (
530532 ' include/AL/al.h' ,
0 commit comments