mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-18 22:36:33 +00:00
meson: Improve NVMM CUDA detection
1. Add some comments explaining what headers and libs are expected on what systems 2. Only look in default incdirs if no incdir is specified 3. Require libnvbufsurface.so on Jetson when cuda-nvmm=enabled 4. Require libatomic on Jetson when cuda-nvmm=enabled Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/8021>
This commit is contained in:
parent
8e0f0c5ae3
commit
0c17efafa3
1 changed files with 39 additions and 30 deletions
|
@ -40,8 +40,8 @@ if host_system not in ['windows', 'linux']
|
||||||
endif
|
endif
|
||||||
|
|
||||||
# Linux ARM would need -latomic for std::atomic<int64_t>
|
# Linux ARM would need -latomic for std::atomic<int64_t>
|
||||||
if host_system == 'linux' and host_machine.cpu_family() not in ['x86', 'x86_64']
|
if host_system == 'linux' and host_machine.cpu_family() in ['aarch64', 'arm']
|
||||||
libatomic_dep = cxx.find_library('atomic', required: false)
|
libatomic_dep = cxx.find_library('atomic', required: get_option('cuda-nvmm'))
|
||||||
if not libatomic_dep.found()
|
if not libatomic_dep.found()
|
||||||
subdir_done()
|
subdir_done()
|
||||||
endif
|
endif
|
||||||
|
@ -89,43 +89,52 @@ if host_system == 'windows'
|
||||||
])
|
])
|
||||||
endif
|
endif
|
||||||
else
|
else
|
||||||
|
# We have NVMM with nvbufsurface.h on both Linux x86 and Jetson (aarch64)
|
||||||
nvmm_opt = get_option('cuda-nvmm')
|
nvmm_opt = get_option('cuda-nvmm')
|
||||||
if not nvmm_opt.disabled()
|
fsmod = import('fs')
|
||||||
|
if nvmm_opt.allowed()
|
||||||
|
incdir_candidates = []
|
||||||
|
|
||||||
nvmm_inc_opt = get_option('cuda-nvmm-include-path')
|
nvmm_inc_opt = get_option('cuda-nvmm-include-path')
|
||||||
if nvmm_inc_opt != ''
|
if nvmm_inc_opt != ''
|
||||||
gstcuda_nvmm_inc = [include_directories(nvmm_inc_opt)]
|
incdir_candidates += [nvmm_inc_opt]
|
||||||
|
else
|
||||||
|
# try some other default locations
|
||||||
|
incdir_candidates = [
|
||||||
|
'/usr/src/jetson_multimedia_api/include',
|
||||||
|
'/opt/nvidia/deepstream/deepstream/sources/includes',
|
||||||
|
]
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
foreach incdir: incdir_candidates
|
||||||
|
if fsmod.is_dir(incdir)
|
||||||
|
incdir = include_directories(incdir)
|
||||||
if cc.has_header('nvbufsurface.h',
|
if cc.has_header('nvbufsurface.h',
|
||||||
include_directories: gstcuda_nvmm_inc,
|
include_directories: incdir,
|
||||||
required: false)
|
required: false)
|
||||||
have_nvbufsurface_h = true
|
have_nvbufsurface_h = true
|
||||||
# try some other default locations
|
gstcuda_nvmm_inc = incdir
|
||||||
elif cc.has_header('/usr/src/jetson_multimedia_api/include/nvbufsurface.h',
|
break
|
||||||
required: false)
|
|
||||||
have_nvbufsurface_h = true
|
|
||||||
gstcuda_nvmm_inc = [include_directories('/usr/src/jetson_multimedia_api/include')]
|
|
||||||
elif cc.has_header('/opt/nvidia/deepstream/deepstream/sources/includes/nvbufsurface.h',
|
|
||||||
required: false)
|
|
||||||
have_nvbufsurface_h = true
|
|
||||||
gstcuda_nvmm_inc = [include_directories('/opt/nvidia/deepstream/deepstream/sources/includes')]
|
|
||||||
endif
|
|
||||||
if nvmm_opt.enabled() and not have_nvbufsurface_h
|
|
||||||
error('Could not find required header: "nvbufsurface.h"')
|
|
||||||
subdir_done()
|
|
||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
|
endforeach
|
||||||
|
|
||||||
if have_nvbufsurface_h
|
if have_nvbufsurface_h
|
||||||
extra_args += ['-DHAVE_CUDA_NVMM']
|
extra_args += ['-DHAVE_CUDA_NVMM']
|
||||||
|
# On Tegra, we also have libnvbufsurface.so, which is not present on x86
|
||||||
|
if host_machine.cpu_family() == 'aarch64'
|
||||||
# check if we have a tegra based system (jetson)
|
# check if we have a tegra based system (jetson)
|
||||||
nvbuf_dep = cc.find_library('nvbufsurface', dirs: '/usr/lib/aarch64-linux-gnu/tegra/', required: false)
|
nvbuf_dep = cc.find_library('nvbufsurface', dirs: '/usr/lib/aarch64-linux-gnu/tegra/', required: nvmm_opt)
|
||||||
if nvbuf_dep.found()
|
if nvbuf_dep.found()
|
||||||
extra_deps += [nvbuf_dep]
|
extra_deps += [nvbuf_dep]
|
||||||
extra_args += ['-DHAVE_CUDA_NVMM_JETSON']
|
extra_args += ['-DHAVE_CUDA_NVMM_JETSON']
|
||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
|
elif nvmm_opt.enabled()
|
||||||
|
error('Could not find required header: "nvbufsurface.h"')
|
||||||
|
subdir_done()
|
||||||
|
endif
|
||||||
|
endif
|
||||||
endif
|
endif
|
||||||
|
|
||||||
pkg_name = 'gstreamer-cuda-' + api_version
|
pkg_name = 'gstreamer-cuda-' + api_version
|
||||||
|
|
Loading…
Reference in a new issue