summary refs log tree commit diff
diff options
context:
space:
mode:
authorLeo Prikler <leo.prikler@student.tugraz.at>2020-06-29 12:06:49 +0200
committerNicolas Goaziou <mail@nicolasgoaziou.fr>2020-06-30 16:47:58 +0200
commit0bc6a5796ab75183f658cf4b216b43c33a7801f3 (patch)
tree09516bee9b8cc9d1f737b4e0c1d0330baf75fbd1
parent68a671abc8ec91e2f656b858edf0f29af8f8932d (diff)
downloadguix-0bc6a5796ab75183f658cf4b216b43c33a7801f3.tar.gz
gnu: add spirv-cross.
* gnu/packages/vulkan.scm (spirv-cross): New variable.

Signed-off-by: Nicolas Goaziou <mail@nicolasgoaziou.fr>
-rw-r--r--gnu/packages/vulkan.scm51
1 files changed, 51 insertions, 0 deletions
diff --git a/gnu/packages/vulkan.scm b/gnu/packages/vulkan.scm
index d5f5be6816..2e640f502c 100644
--- a/gnu/packages/vulkan.scm
+++ b/gnu/packages/vulkan.scm
@@ -102,6 +102,57 @@ SPIR-V modules.  The project includes an assembler, binary module
 parser,disassembler, validator, and optimizer for SPIR-V.")
     (license license:asl2.0)))
 
+(define-public spirv-cross
+  (package
+    (name "spirv-cross")
+    (version "2020-05-19")
+    (source
+     (origin
+       (method git-fetch)
+       (uri (git-reference
+             (url "https://github.com/KhronosGroup/SPIRV-Cross")
+             (commit version)))
+       (sha256
+        (base32 "0zyijp9zx9wbd4i5lwjap7n793iz6yjkf27la60dsffxl75yy9pd"))
+       (file-name (git-file-name name version))))
+    (build-system cmake-build-system)
+    (arguments
+     `(#:configure-flags
+       (list "-DSPIRV_CROSS_SHARED=YES")
+       ;; FIXME: The following tests fail:
+       ;;   15 - spirv-cross-test-opt
+       ;;   16 - spirv-cross-test-metal-opt
+       ;;   17 - spirv-cross-test-hlsl-opt
+       #:tests? #f
+       #:phases
+       (modify-phases %standard-phases
+         (add-after 'unpack 'fix-tests-to-find-deps
+           (lambda* (#:key inputs #:allow-other-keys)
+             (substitute* "CMakeLists.txt"
+               (("\\$\\{CMAKE_(.*)_DIR\\}/external/glslang(.*)/bin")
+                (string-append (assoc-ref inputs "glslang") "/bin")))
+             (substitute* "CMakeLists.txt"
+               (("\\$\\{CMAKE_(.*)_DIR\\}/external/spirv-tools(.*)/bin")
+                (string-append (assoc-ref inputs "spirv-tools") "/bin")))
+             #t)))))
+    (inputs
+     `(("glslang" ,glslang)
+       ("spirv-headers" ,spirv-headers)
+       ("spirv-tools" ,spirv-tools)))
+    (native-inputs `(("python" ,python)))
+    (home-page "https://github.com/KhronosGroup/SPIRV-Cross")
+    (synopsis "Parser for and converter of SPIR-V to other shader languages")
+    (description
+     "SPIRV-Cross tries hard to emit readable and clean output from the
+SPIR-V.  The goal is to emit GLSL or MSL that looks like it was written by
+a human and not awkward IR/assembly-like code.
+
+NOTE: Individual features are expected to be mostly complete, but it is
+possible that certain obscure GLSL features are not yet supported.  However,
+most missing features are expected to be ``trivial'' improvements at this
+stage.")
+    (license license:asl2.0)))
+
 (define-public glslang
   (package
     (name "glslang")