2022-09-01 14:28:13 +00:00
|
|
|
cuda_sources = files([
|
2023-02-05 10:50:36 +00:00
|
|
|
'gstcudabufferpool.cpp',
|
|
|
|
'gstcudacontext.cpp',
|
|
|
|
'gstcudaloader.cpp',
|
|
|
|
'gstcudamemory.cpp',
|
|
|
|
'gstcudanvrtc.cpp',
|
|
|
|
'gstcudastream.cpp',
|
|
|
|
'gstcudautils.cpp',
|
2022-09-01 14:28:13 +00:00
|
|
|
])
|
2021-12-08 11:48:08 +00:00
|
|
|
|
2022-09-01 14:28:13 +00:00
|
|
|
cuda_headers = files([
|
2022-12-21 14:57:15 +00:00
|
|
|
'cuda-prelude.h',
|
|
|
|
'gstcuda.h',
|
|
|
|
'gstcudabufferpool.h',
|
|
|
|
'gstcudacontext.h',
|
|
|
|
'gstcudaloader.h',
|
|
|
|
'gstcudamemory.h',
|
|
|
|
'gstcudanvrtc.h',
|
2022-12-19 11:57:30 +00:00
|
|
|
'gstcudastream.h',
|
2022-12-21 14:57:15 +00:00
|
|
|
'gstcudautils.h',
|
2022-09-01 14:28:13 +00:00
|
|
|
])
|
2021-12-08 11:48:08 +00:00
|
|
|
|
2022-04-23 15:37:40 +00:00
|
|
|
gstcuda_dep = dependency('', required : false)
|
2023-01-12 12:45:58 +00:00
|
|
|
cuda_stubinc = include_directories('./stub')
|
|
|
|
gstcuda_stub_dep = declare_dependency(
|
|
|
|
include_directories: cuda_stubinc
|
|
|
|
)
|
2022-04-23 15:37:40 +00:00
|
|
|
|
2023-02-19 11:51:37 +00:00
|
|
|
gstcuda_platform_dep = []
|
2022-04-23 15:37:40 +00:00
|
|
|
if host_system not in ['windows', 'linux']
|
|
|
|
subdir_done()
|
|
|
|
endif
|
|
|
|
|
2023-02-19 11:51:37 +00:00
|
|
|
# Linux ARM would need -latomic for std::atomic<int64_t>
|
|
|
|
if host_system == 'linux' and host_machine.cpu_family() not in ['x86', 'x86_64']
|
|
|
|
libatomic_dep = cxx.find_library('atomic', required: false)
|
|
|
|
if not libatomic_dep.found()
|
|
|
|
subdir_done()
|
|
|
|
endif
|
|
|
|
|
|
|
|
gstcuda_platform_dep += [libatomic_dep]
|
|
|
|
endif
|
|
|
|
|
2022-09-12 16:02:50 +00:00
|
|
|
cuda_win32_headers = [
|
|
|
|
'initguid.h',
|
|
|
|
'd3d11.h',
|
|
|
|
'dxgi.h',
|
|
|
|
]
|
|
|
|
|
2023-02-05 10:50:36 +00:00
|
|
|
extra_args = ['-DGST_USE_UNSTABLE_API',
|
|
|
|
'-DBUILDING_GST_CUDA',
|
|
|
|
'-DG_LOG_DOMAIN="GStreamer-Cuda"']
|
2021-12-08 11:48:08 +00:00
|
|
|
|
|
|
|
if gstgl_dep.found()
|
2023-02-17 15:36:29 +00:00
|
|
|
extra_args += ['-DHAVE_CUDA_GST_GL']
|
2021-12-08 11:48:08 +00:00
|
|
|
endif
|
|
|
|
|
2023-02-05 17:41:57 +00:00
|
|
|
if host_system == 'windows'
|
|
|
|
foreach h : cuda_win32_headers
|
|
|
|
if not cc.has_header(h)
|
|
|
|
subdir_done()
|
|
|
|
endif
|
|
|
|
endforeach
|
|
|
|
|
|
|
|
if not gstd3d11_dep.found()
|
|
|
|
subdir_done()
|
|
|
|
endif
|
|
|
|
|
|
|
|
# MinGW 32bits build workaround
|
|
|
|
if cc.get_id() != 'msvc'
|
|
|
|
extra_args += cc.get_supported_arguments([
|
|
|
|
'-Wno-redundant-decls',
|
|
|
|
])
|
|
|
|
endif
|
2021-12-08 11:48:08 +00:00
|
|
|
endif
|
|
|
|
|
|
|
|
pkg_name = 'gstreamer-cuda-' + api_version
|
|
|
|
gstcuda= library('gstcuda-' + api_version,
|
|
|
|
cuda_sources,
|
2023-02-05 10:50:36 +00:00
|
|
|
c_args : gst_plugins_bad_args + extra_args,
|
|
|
|
cpp_args : gst_plugins_bad_args + extra_args,
|
2021-12-08 11:48:08 +00:00
|
|
|
include_directories : [configinc, libsinc, cuda_stubinc],
|
|
|
|
version : libversion,
|
|
|
|
soversion : soversion,
|
|
|
|
install : true,
|
2023-02-19 11:51:37 +00:00
|
|
|
dependencies : [gstbase_dep, gmodule_dep, gstvideo_dep, gstglproto_dep, gstd3d11_dep, gstcuda_platform_dep]
|
2021-12-08 11:48:08 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
gen_sources = []
|
|
|
|
library_def = {'lib': gstcuda}
|
|
|
|
if build_gir
|
|
|
|
gir_includes = ['Gst-1.0', 'GstBase-1.0', 'GstVideo-1.0', 'CudaGst-1.0']
|
|
|
|
if gstglproto_dep.found()
|
|
|
|
gir_includes += ['GstGL-1.0']
|
|
|
|
endif
|
|
|
|
cuda_gir = {
|
|
|
|
'sources' : files('stub/cuda.h', 'stub/cudaGL.h'),
|
|
|
|
'namespace' : 'CudaGst',
|
|
|
|
'nsversion' : api_version,
|
|
|
|
'identifier_prefix' : 'CU',
|
2022-05-02 15:46:59 +00:00
|
|
|
'symbol_prefix' : ['cu', 'cuda'],
|
2021-12-08 11:48:08 +00:00
|
|
|
'includes' : [],
|
|
|
|
'install' : true,
|
|
|
|
'extra_args' : [],
|
|
|
|
'dependencies' : [],
|
|
|
|
}
|
|
|
|
gir = {
|
|
|
|
'sources' : cuda_sources + cuda_headers,
|
|
|
|
'namespace' : 'GstCuda',
|
|
|
|
'nsversion' : api_version,
|
|
|
|
'identifier_prefix' : 'Gst',
|
|
|
|
'symbol_prefix' : 'gst',
|
|
|
|
'export_packages' : pkg_name,
|
|
|
|
'includes' : gir_includes,
|
|
|
|
'install' : true,
|
2022-09-01 14:28:13 +00:00
|
|
|
'extra_args' : gir_init_section + ['-DGST_USE_UNSTABLE_API', '-I' + meson.current_source_dir() / 'stub'],
|
2021-12-08 11:48:08 +00:00
|
|
|
'dependencies' : [gstbase_dep, gstvideo_dep, gstglproto_dep],
|
|
|
|
}
|
|
|
|
if not static_build
|
|
|
|
cudagst_gir = gnome.generate_gir(gstcuda, kwargs: cuda_gir)
|
|
|
|
|
|
|
|
gir += {'includes': gir['includes'] + [cudagst_gir[0]]}
|
|
|
|
gst_cuda_gir = gnome.generate_gir(gstcuda, kwargs: gir)
|
|
|
|
gen_sources += gst_cuda_gir
|
|
|
|
endif
|
|
|
|
|
|
|
|
library_def += {'gir': [gir, cuda_gir]}
|
|
|
|
endif
|
2022-09-01 15:51:48 +00:00
|
|
|
gst_libraries += [[pkg_name, library_def]]
|
2021-12-08 11:48:08 +00:00
|
|
|
|
|
|
|
pkgconfig.generate(gstcuda,
|
2023-02-19 11:51:37 +00:00
|
|
|
libraries : [gstbase_dep, gmodule_dep, gstvideo_dep, gstglproto_dep, gstcuda_platform_dep],
|
2021-12-08 11:48:08 +00:00
|
|
|
variables : pkgconfig_variables,
|
|
|
|
subdirs : pkgconfig_subdirs,
|
|
|
|
name : pkg_name,
|
|
|
|
description : 'Unstable library to work with CUDA inside GStreamer',
|
|
|
|
)
|
|
|
|
|
2022-12-21 14:57:15 +00:00
|
|
|
install_headers(cuda_headers + ['cuda-gst.h', 'gstcuda.h'], subdir : 'gstreamer-1.0/gst/cuda')
|
2021-12-08 11:48:08 +00:00
|
|
|
gstcuda_dep = declare_dependency(link_with : gstcuda,
|
|
|
|
include_directories : [libsinc],
|
2023-02-19 11:51:37 +00:00
|
|
|
dependencies : [gstbase_dep, gmodule_dep, gstvideo_dep, gstglproto_dep, gstcuda_platform_dep],
|
2021-12-08 11:48:08 +00:00
|
|
|
sources: gen_sources)
|
2022-06-01 17:22:19 +00:00
|
|
|
|
|
|
|
meson.override_dependency(pkg_name, gstcuda_dep)
|