about summary refs log tree commit diff
path: root/pkgs/development/compilers/opensycl/default.nix
diff options
context:
space:
mode:
Diffstat (limited to 'pkgs/development/compilers/opensycl/default.nix')
-rw-r--r--pkgs/development/compilers/opensycl/default.nix16
1 files changed, 16 insertions, 0 deletions
diff --git a/pkgs/development/compilers/opensycl/default.nix b/pkgs/development/compilers/opensycl/default.nix
index cdf9a5b9d22c1..bdc36efcd0692 100644
--- a/pkgs/development/compilers/opensycl/default.nix
+++ b/pkgs/development/compilers/opensycl/default.nix
@@ -9,8 +9,13 @@
 , libffi
 , makeWrapper
 , config
+, cudaPackages
 , rocmPackages_5
+, ompSupport ? true
+, openclSupport ? false
 , rocmSupport ? config.rocmSupport
+, cudaSupport ? config.cudaSupport
+, autoAddDriverRunpath
 }:
 let
   inherit (llvmPackages_15) stdenv;
@@ -31,6 +36,9 @@ stdenv.mkDerivation rec {
   nativeBuildInputs = [
     cmake
     makeWrapper
+  ] ++ lib.optionals cudaSupport [
+    autoAddDriverRunpath
+    cudaPackages.cuda_nvcc
   ];
 
   buildInputs = [
@@ -43,11 +51,19 @@ stdenv.mkDerivation rec {
   ] ++ lib.optionals rocmSupport [
     rocmPackages.clr
     rocmPackages.rocm-runtime
+  ] ++ lib.optionals cudaSupport [
+    cudaPackages.cuda_cudart
+    (lib.getOutput "stubs" cudaPackages.cuda_cudart)
   ];
 
   # opensycl makes use of clangs internal headers. Its cmake does not successfully discover them automatically on nixos, so we supply the path manually
   cmakeFlags = [
     "-DCLANG_INCLUDE_PATH=${llvmPackages_15.libclang.dev}/include"
+    (lib.cmakeBool "WITH_CPU_BACKEND" ompSupport)
+    (lib.cmakeBool "WITH_CUDA_BACKEND" cudaSupport)
+    (lib.cmakeBool "WITH_ROCM_BACKEND" rocmSupport)
+  ] ++ lib.optionals (lib.versionAtLeast version "24") [
+    (lib.cmakeBool "WITH_OPENCL_BACKEND" openclSupport)
   ];
 
   postFixup = ''