From 7c0b70ce257702a68f9b03d49a39f69611579d59 Mon Sep 17 00:00:00 2001 From: augustin64 Date: Wed, 1 Jun 2022 17:13:03 +0200 Subject: [PATCH] Fix compilation with nvcc --- make.sh | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/make.sh b/make.sh index 3440173..ba41e3a 100755 --- a/make.sh +++ b/make.sh @@ -4,6 +4,14 @@ OUT="out" set -e +compile_cuda () { + # nvcc will compile .c files as if they did not have + # CUDA program parts so we need to copy them to .cu + cp $1 "$1"u + nvcc "$1"u ${*:1} + rm "$1"u +} + build () { mkdir -p "$OUT" [[ $1 ]] || set "main" @@ -146,6 +154,7 @@ usage () { if [[ "$CC" == "gcc" ]]; then FLAGS="-std=c99 -lm -lpthread" # GCC flags elif [[ "$CC" == "nvcc" ]]; then + CC=compile_cuda FLAGS="" # NVCC flags else FLAGS=""