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.

This commit is contained in:
Daniel Zinn 2014-06-23 06:11:34 -07:00
parent 01bbc61364
commit 86c283824f
3 changed files with 14 additions and 0 deletions

View File

@ -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" ];
};

View File

@ -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" ];
};

View File

@ -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)