From ee59564d5c2f9941ae947e3a3fa81f385c90e239 Mon Sep 17 00:00:00 2001 From: Seungha Yang Date: Thu, 8 May 2025 19:23:54 +0900 Subject: [PATCH] examples: cuda: Fix build with old CUDA SDK Some symbols are not available in old cuda headers. Use our stub headers instead Part-of: --- .../tests/examples/cuda/cudamemory-sync.c | 2 +- .../tests/examples/cuda/meson.build | 58 ++----------------- 2 files changed, 5 insertions(+), 55 deletions(-) diff --git a/subprojects/gst-plugins-bad/tests/examples/cuda/cudamemory-sync.c b/subprojects/gst-plugins-bad/tests/examples/cuda/cudamemory-sync.c index 82abd26608..0a50bba629 100644 --- a/subprojects/gst-plugins-bad/tests/examples/cuda/cudamemory-sync.c +++ b/subprojects/gst-plugins-bad/tests/examples/cuda/cudamemory-sync.c @@ -391,7 +391,7 @@ main (gint argc, gchar ** argv) resource_desc.res.pitch2D.devPtr = (CUdeviceptr) src_map.data; texture_desc.filterMode = CU_TR_FILTER_MODE_LINEAR; - texture_desc.flags = CU_TRSF_NORMALIZED_COORDINATES; + texture_desc.flags = 0x02; // CU_TRSF_NORMALIZED_COORDINATES texture_desc.addressMode[0] = CU_TR_ADDRESS_MODE_CLAMP; texture_desc.addressMode[1] = CU_TR_ADDRESS_MODE_CLAMP; texture_desc.addressMode[2] = CU_TR_ADDRESS_MODE_CLAMP; diff --git a/subprojects/gst-plugins-bad/tests/examples/cuda/meson.build b/subprojects/gst-plugins-bad/tests/examples/cuda/meson.build index b2fc2a54cd..94ddaf86fa 100644 --- a/subprojects/gst-plugins-bad/tests/examples/cuda/meson.build +++ b/subprojects/gst-plugins-bad/tests/examples/cuda/meson.build @@ -2,56 +2,6 @@ if not gstcuda_dep.found() subdir_done() endif -cuda_deps = [] -cuda_inc_dir = [] -if host_system == 'windows' - cuda_path = run_command(python3, '-c', 'import os; print(os.environ.get("CUDA_PATH"))', check: false).stdout().strip() - if cuda_path in ['', 'None'] - subdir_done() - endif - - cuda_inc_dir = include_directories(join_paths(cuda_path, 'include')) - if not cc.has_header('cuda.h', include_directories: cuda_inc_dir) - subdir_done() - endif -else - # NOTE: meson dependency('cuda', version: '>=10'...) will return CUDA runtime - # library but we want to use CUDA driver API. Iterates - cuda_versions = [ - '12.4', - '12.3', - '12.2', - '12.1', - '12.0', - '11.8', - '11.8', - '11.7', - '11.6', - '11.5', - '11.4', - '11.2', - '11.1', - '11.0', - '10.2', - '10.1', - '10.0', - ] - - cuda_dep = dependency('', required: false) - foreach ver : cuda_versions - cuda_dep = dependency('cuda-@0@'.format(ver), required: false) - if cuda_dep.found() - break - endif - endforeach - - if not cuda_dep.found() - subdir_done() - endif - - cuda_deps = [cuda_dep.partial_dependency(includes : true, compile_args: true)] -endif - gl_header_dep = dependency('', fallback : ['gl-headers', 'gl_headers_dummy_dep'], required : false) if gl_header_dep.type_name() == 'internal' @@ -62,8 +12,8 @@ else endif executable('cudamemory-sync', 'cudamemory-sync.c', - include_directories : [configinc] + compat_includes + cuda_inc_dir, - dependencies: [gst_dep, gstvideo_dep, gstcuda_dep, gl_header_dep] + cuda_deps, + include_directories : [configinc, cuda_stubinc] + compat_includes, + dependencies: [gst_dep, gstvideo_dep, gstcuda_dep, gl_header_dep], c_args : gst_plugins_bad_args + ['-DGST_USE_UNSTABLE_API'], install: false) @@ -74,8 +24,8 @@ executable('cuda-template', 'template-plugin/cuda-transform-ip-template.c', 'template-plugin/plugin.c', ], - include_directories : [configinc] + compat_includes + cuda_inc_dir, - dependencies: [gst_dep, gstvideo_dep, gstcuda_dep, gl_header_dep] + cuda_deps, + include_directories : [configinc, cuda_stubinc] + compat_includes, + dependencies: [gst_dep, gstvideo_dep, gstcuda_dep, gl_header_dep], c_args : gst_plugins_bad_args + ['-DGST_USE_UNSTABLE_API'], install: false)