From 86c283824f76d849acbe6f97c34250c8c5533499 Mon Sep 17 00:00:00 2001 From: Daniel Zinn Date: Mon, 23 Jun 2014 06:11:34 -0700 Subject: [PATCH] If cuda headers are presented to nix in $out/include they are added to future gcc calls via a -isystem flag. However, cuda does not allow kernel calls from template function if these are located in system-headers. We thus move headers from $out/include to $out/usr_include and add a custom hook to add these headers via -I. --- pkgs/development/compilers/cudatoolkit/5.5.nix | 3 +++ pkgs/development/compilers/cudatoolkit/6.0.nix | 3 +++ pkgs/development/compilers/cudatoolkit/setup-hook.sh | 8 ++++++++ 3 files changed, 14 insertions(+) create mode 100644 pkgs/development/compilers/cudatoolkit/setup-hook.sh diff --git a/pkgs/development/compilers/cudatoolkit/5.5.nix b/pkgs/development/compilers/cudatoolkit/5.5.nix index 99f0828012fa..bf4009f08be3 100644 --- a/pkgs/development/compilers/cudatoolkit/5.5.nix +++ b/pkgs/development/compilers/cudatoolkit/5.5.nix @@ -51,8 +51,11 @@ stdenv.mkDerivation rec { perl ./install-linux.pl --prefix="$out" rm $out/tools/CUDA_Occupancy_Calculator.xls perl ./install-sdk-linux.pl --prefix="$sdk" --cudaprefix="$out" + mv $out/include $out/usr_include ''; + setupHook = ./setup-hook.sh; + meta = { license = [ "nonfree" ]; }; diff --git a/pkgs/development/compilers/cudatoolkit/6.0.nix b/pkgs/development/compilers/cudatoolkit/6.0.nix index 573cc8262216..5da4b3d0a4aa 100644 --- a/pkgs/development/compilers/cudatoolkit/6.0.nix +++ b/pkgs/development/compilers/cudatoolkit/6.0.nix @@ -51,8 +51,11 @@ stdenv.mkDerivation rec { perl ./install-linux.pl --prefix="$out" rm $out/tools/CUDA_Occupancy_Calculator.xls perl ./install-sdk-linux.pl --prefix="$sdk" --cudaprefix="$out" + mv $out/include $out/usr_include ''; + setupHook = ./setup-hook.sh; + meta = { license = [ "nonfree" ]; }; diff --git a/pkgs/development/compilers/cudatoolkit/setup-hook.sh b/pkgs/development/compilers/cudatoolkit/setup-hook.sh new file mode 100644 index 000000000000..1b75a2e91ba2 --- /dev/null +++ b/pkgs/development/compilers/cudatoolkit/setup-hook.sh @@ -0,0 +1,8 @@ +addIncludePath () { + if test -d "$1/usr_include" + then + export NIX_CFLAGS_COMPILE="${NIX_CFLAGS_COMPILE} -I$1/usr_include" + fi +} + +envHooks=(${envHooks[@]} addIncludePath)