diff --git a/mesonbuild/compilers/cuda.py b/mesonbuild/compilers/cuda.py index a8cd7bce4..7beecf9ea 100644 --- a/mesonbuild/compilers/cuda.py +++ b/mesonbuild/compilers/cuda.py @@ -188,3 +188,6 @@ __global__ void kernel (void) { def linker_to_compiler_args(self, args): return ['/link'] + args + + def get_pic_args(self): + return [] diff --git a/run_project_tests.py b/run_project_tests.py index 02897cecd..4c6ca3b01 100755 --- a/run_project_tests.py +++ b/run_project_tests.py @@ -542,6 +542,7 @@ def detect_tests_to_run(): ('objective c++', 'objcpp', backend not in (Backend.ninja, Backend.xcode) or mesonlib.is_windows() or not have_objcpp_compiler()), ('fortran', 'fortran', backend is not Backend.ninja or not shutil.which('gfortran')), ('swift', 'swift', backend not in (Backend.ninja, Backend.xcode) or not shutil.which('swiftc')), + ('cuda', 'cuda', backend not in (Backend.ninja, Backend.xcode) or not shutil.which('nvcc')), ('python3', 'python3', backend is not Backend.ninja), ('python', 'python', backend is not Backend.ninja), ('fpga', 'fpga', shutil.which('yosys') is None), diff --git a/test cases/cuda/2 split/lib.cu b/test cases/cuda/2 split/lib.cu new file mode 100644 index 000000000..c0471d048 --- /dev/null +++ b/test cases/cuda/2 split/lib.cu @@ -0,0 +1,13 @@ +#include +#include + +__global__ void kernel (void){ +} + +int do_cuda_stuff() { + kernel<<<1,1>>>(); + + printf("Hello, World!\n"); + return 0; +} + diff --git a/test cases/cuda/2 split/main.cpp b/test cases/cuda/2 split/main.cpp new file mode 100644 index 000000000..e5e6bda06 --- /dev/null +++ b/test cases/cuda/2 split/main.cpp @@ -0,0 +1,7 @@ +#include + +int do_cuda_stuff(); + +int main(int argc, char **argv) { + return do_cuda_stuff(); +} diff --git a/test cases/cuda/2 split/meson.build b/test cases/cuda/2 split/meson.build new file mode 100644 index 000000000..51bf6ce23 --- /dev/null +++ b/test cases/cuda/2 split/meson.build @@ -0,0 +1,7 @@ +project('simple', 'cuda', 'cpp') + +exe = executable('prog', 'main.cpp', 'lib.cu') +test('cudatest', exe) + +subdir('static') + diff --git a/test cases/cuda/2 split/static/lib.cu b/test cases/cuda/2 split/static/lib.cu new file mode 100644 index 000000000..c0471d048 --- /dev/null +++ b/test cases/cuda/2 split/static/lib.cu @@ -0,0 +1,13 @@ +#include +#include + +__global__ void kernel (void){ +} + +int do_cuda_stuff() { + kernel<<<1,1>>>(); + + printf("Hello, World!\n"); + return 0; +} + diff --git a/test cases/cuda/2 split/static/libsta.cu b/test cases/cuda/2 split/static/libsta.cu new file mode 100644 index 000000000..c0471d048 --- /dev/null +++ b/test cases/cuda/2 split/static/libsta.cu @@ -0,0 +1,13 @@ +#include +#include + +__global__ void kernel (void){ +} + +int do_cuda_stuff() { + kernel<<<1,1>>>(); + + printf("Hello, World!\n"); + return 0; +} + diff --git a/test cases/cuda/2 split/static/main_static.cpp b/test cases/cuda/2 split/static/main_static.cpp new file mode 100644 index 000000000..e5e6bda06 --- /dev/null +++ b/test cases/cuda/2 split/static/main_static.cpp @@ -0,0 +1,7 @@ +#include + +int do_cuda_stuff(); + +int main(int argc, char **argv) { + return do_cuda_stuff(); +} diff --git a/test cases/cuda/2 split/static/meson.build b/test cases/cuda/2 split/static/meson.build new file mode 100644 index 000000000..9078198d5 --- /dev/null +++ b/test cases/cuda/2 split/static/meson.build @@ -0,0 +1,4 @@ +l = static_library('clib', 'lib.cu') +exe = executable('staexe', 'main_static.cpp', + link_with : l) +test('static Cuda test', exe)