about summary refs log tree commit diff
path: root/pkgs/development/compilers/cudatoolkit
diff options
context:
space:
mode:
authorDaniel Zinn <q@qew.dynalias.org>2014-06-23 06:11:34 -0700
committerDaniel Zinn <q@qew.dynalias.org>2014-06-23 06:11:34 -0700
commit86c283824f76d849acbe6f97c34250c8c5533499 (patch)
treeeb6bd4fce97d0c17d887b59accb605822eab02dd /pkgs/development/compilers/cudatoolkit
parent01bbc613648008b2b54b9405b6c159cfac42f815 (diff)
downloadnixlib-86c283824f76d849acbe6f97c34250c8c5533499.tar
nixlib-86c283824f76d849acbe6f97c34250c8c5533499.tar.gz
nixlib-86c283824f76d849acbe6f97c34250c8c5533499.tar.bz2
nixlib-86c283824f76d849acbe6f97c34250c8c5533499.tar.lz
nixlib-86c283824f76d849acbe6f97c34250c8c5533499.tar.xz
nixlib-86c283824f76d849acbe6f97c34250c8c5533499.tar.zst
nixlib-86c283824f76d849acbe6f97c34250c8c5533499.zip
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.
Diffstat (limited to 'pkgs/development/compilers/cudatoolkit')
-rw-r--r--pkgs/development/compilers/cudatoolkit/5.5.nix3
-rw-r--r--pkgs/development/compilers/cudatoolkit/6.0.nix3
-rw-r--r--pkgs/development/compilers/cudatoolkit/setup-hook.sh8
3 files changed, 14 insertions, 0 deletions
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)