meson: use pkg-config to detect libatomic_ops

Signed-off-by: Eric Engestrom <eric.engestrom@imgtec.com>
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
main
Eric Engestrom 2018-02-07 14:20:52 +00:00
parent a5329cd990
commit 5236de6cc1
9 changed files with 11 additions and 9 deletions

View File

@ -37,7 +37,7 @@ libdrm_amdgpu = shared_library(
], ],
include_directories : [inc_root, inc_drm], include_directories : [inc_root, inc_drm],
link_with : libdrm, link_with : libdrm,
dependencies : dep_pthread_stubs, dependencies : [dep_pthread_stubs, dep_atomic_ops],
version : '1.0.0', version : '1.0.0',
install : true, install : true,
) )

View File

@ -31,7 +31,7 @@ libdrm_etnaviv = shared_library(
include_directories : [inc_root, inc_drm], include_directories : [inc_root, inc_drm],
link_with : libdrm, link_with : libdrm,
c_args : warn_c_args, c_args : warn_c_args,
dependencies : [dep_pthread_stubs, dep_rt], dependencies : [dep_pthread_stubs, dep_rt, dep_atomic_ops],
version : '1.0.0', version : '1.0.0',
install : true, install : true,
) )

View File

@ -44,7 +44,7 @@ libdrm_freedreno = shared_library(
[files_freedreno, config_file], [files_freedreno, config_file],
c_args : warn_c_args, c_args : warn_c_args,
include_directories : [inc_root, inc_drm], include_directories : [inc_root, inc_drm],
dependencies : [dep_valgrind, dep_pthread_stubs, dep_rt], dependencies : [dep_valgrind, dep_pthread_stubs, dep_rt, dep_atomic_ops],
link_with : libdrm, link_with : libdrm,
version : '1.0.0', version : '1.0.0',
install : true, install : true,

View File

@ -29,7 +29,7 @@ libdrm_intel = shared_library(
], ],
include_directories : [inc_root, inc_drm], include_directories : [inc_root, inc_drm],
link_with : libdrm, link_with : libdrm,
dependencies : [dep_pciaccess, dep_pthread_stubs, dep_rt, dep_valgrind], dependencies : [dep_pciaccess, dep_pthread_stubs, dep_rt, dep_valgrind, dep_atomic_ops],
c_args : warn_c_args, c_args : warn_c_args,
version : '1.0.0', version : '1.0.0',
install : true, install : true,

View File

@ -48,6 +48,7 @@ cc = meson.get_compiler('c')
intel_atomics = false intel_atomics = false
lib_atomics = false lib_atomics = false
dep_atomic_ops = dependency('atomic_ops', required : false)
if cc.compiles(''' if cc.compiles('''
int atomic_add(int *i) { return __sync_add_and_fetch (i, 1); } int atomic_add(int *i) { return __sync_add_and_fetch (i, 1); }
int atomic_cmpxchg(int *i, int j, int k) { return __sync_val_compare_and_swap (i, j, k); } int atomic_cmpxchg(int *i, int j, int k) { return __sync_val_compare_and_swap (i, j, k); }
@ -55,7 +56,8 @@ if cc.compiles('''
name : 'Intel Atomics') name : 'Intel Atomics')
intel_atomics = true intel_atomics = true
with_atomics = true with_atomics = true
elif cc.has_header('atomic_ops.h') dep_atomic_ops = []
elif dep_atomic_ops.found()
lib_atomics = true lib_atomics = true
with_atomics = true with_atomics = true
elif cc.has_function('atomic_cas_uint') elif cc.has_function('atomic_cas_uint')

View File

@ -25,7 +25,7 @@ libdrm_nouveau = shared_library(
c_args : warn_c_args, c_args : warn_c_args,
include_directories : [inc_root, inc_drm], include_directories : [inc_root, inc_drm],
link_with : libdrm, link_with : libdrm,
dependencies : dep_threads, dependencies : [dep_threads, dep_atomic_ops],
version : '2.0.0', version : '2.0.0',
install : true, install : true,
) )

View File

@ -24,7 +24,7 @@ libdrm_omap = shared_library(
include_directories : [inc_root, inc_drm], include_directories : [inc_root, inc_drm],
c_args : warn_c_args, c_args : warn_c_args,
link_with : libdrm, link_with : libdrm,
dependencies : [dep_pthread_stubs], dependencies : [dep_pthread_stubs, dep_atomic_ops],
version : '1.0.0', version : '1.0.0',
install : true, install : true,
) )

View File

@ -31,7 +31,7 @@ libdrm_radeon = shared_library(
c_args : warn_c_args, c_args : warn_c_args,
include_directories : [inc_root, inc_drm], include_directories : [inc_root, inc_drm],
link_with : libdrm, link_with : libdrm,
dependencies : [dep_pthread_stubs], dependencies : [dep_pthread_stubs, dep_atomic_ops],
version : '1.0.1', version : '1.0.1',
install : true, install : true,
) )

View File

@ -23,7 +23,7 @@ libdrm_tegra = shared_library(
[files('tegra.c'), config_file], [files('tegra.c'), config_file],
include_directories : [inc_root, inc_drm], include_directories : [inc_root, inc_drm],
link_with : libdrm, link_with : libdrm,
dependencies : [dep_pthread_stubs], dependencies : [dep_pthread_stubs, dep_atomic_ops],
c_args : warn_c_args, c_args : warn_c_args,
version : '0.0.0', version : '0.0.0',
install : true, install : true,