Code runs when built with CMake but not Meson

I have a program which runs perfectly fine when built with CMake, but the same program built w/ meson, I get the following errors when trying to use copyTo (cpu to gpu) and updateGPUfromCPU()

in sl::ERROR_CODE sl::Mat::copyTo(sl::Mat&, sl::COPY_TYPE) const : cuda error [30]: unknown error.
in sl::ERROR_CODE sl::Mat::updateGPUfromCPU() : cuda error [30]: unknown error.
in sl::ERROR_CODE sl::Mat::updateGPUfromCPU() : cuda error [30]: unknown error.

Its pretty weird because it builds and links just fine, but then has a runtime error even though the change is in how its compiled. Relevant parts of my meson.build and CMakeLists shown below. Any idea how to fix this?
Meson.build

zed_include_dirs = include_directories(’/usr/local/zed/include’, ‘/usr/local/cuda/include’)
zed = declare_dependency(
include_directories : zed_include_dirs,
link_args : [
# ZED SDK
‘-L/usr/local/zed/lib’,
‘-lsl_zed’,
# CUDA
‘-L/usr/local/cuda/lib64’,
‘-lcuda’, ‘-lnppial’, ‘-lnppisu’, ‘-lnppicc’,
‘-lnppicom’, ‘-lnppidei’, ‘-lnppif’, ‘-lnppig’,
‘-lnppim’, ‘-lnppist’, ‘-lnppitc’, ‘-lnppc’
])
all_deps = [zed]

CMakeLists.txt

cmake_minimum_required(VERSION 3.8 FATAL_ERROR)
SET(CMAKE_CUDA_COMPILER_ENV_VAR /usr/local/cuda-10.0/bin/nvcc)
SET(CMAKE_CUDA_COMPILER /usr/local/cuda-10.0/bin/nvcc)
enable_language(CUDA)
project(obs_detection)

find_package(ZED 3 REQUIRED)
include_directories(${ZED_INCLUDE_DIRS})
include_directories(${CUDA_INCLUDE_DIRS})
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/include)

link_directories(${ZED_LIBRARY_DIR})
link_directories(${CUDA_LIBRARY_DIRS})


add_executable (driver src/test-filter.cu src/obs-detector.cpp src/GLViewer.cpp src/common.cu src/plane-ransac.cu src/pcl.cpp src/euclidean-cluster.cu src/pass-through.cu src/find-clear.cu)
target_link_libraries (driver ${ZED_LIBRARIES})
target_link_libraries(driver
${SPECIAL_OS_LIBS}
${ZED_LIBS} )
target_compile_options(driver PRIVATE $<$<COMPILE_LANGUAGE:CUDA>:
-res-usage
–use_fast_math
>)

Hi,
If you add *.cu files to your executable, you probably need to setup cuda arch/options in meson build file since cu files must be compiled with nvcc.
You can check the link here :
https://mesonbuild.com/Cuda-module.html

hope this helps