Subject: [bug#59607] [PATCH 1/8] gnu: Add ncnn.

From: Liliana Marie Prikler <[email-masked]>
Date: Sun, 20 Nov 2022 00:14:40 +0100

* gnu/packages/machine-learning.scm (ncnn): New variable.
---
 gnu/packages/machine-learning.scm | 32 +++++++++++++++++++++++++++++++
 1 file changed, 32 insertions(+)

diff --git a/gnu/packages/machine-learning.scm b/gnu/packages/machine-learning.scm
index fbc06f96b6..e984e3004b 100644
--- a/gnu/packages/machine-learning.scm
+++ b/gnu/packages/machine-learning.scm
@@ -102,6 +102,7 @@ (define-module (gnu packages machine-learning)
   #:use-module (gnu packages swig)
   #:use-module (gnu packages tls)
   #:use-module (gnu packages video)
+  #:use-module (gnu packages vulkan)
   #:use-module (gnu packages web)
   #:use-module (gnu packages xml)
   #:use-module (gnu packages xdisorg)
@@ -749,6 +750,37 @@ (define (delete-ifdefs file)
 in terms of new algorithms.")
     (license license:gpl3+)))
 
+(define-public ncnn
+  (package
+    (name "ncnn")
+    (version "20220729")
+    (source (origin
+              (method git-fetch)
+              (uri (git-reference
+                    (url "https://github.com/Tencent/ncnn")
+                    (commit version)))
+              (file-name (git-file-name name version))
+              (sha256
+               (base32 "02na1crxph8m3sqb1c32v83ppxjcmaxyncql89q5mf9ggddmx5c5"))))
+    (build-system cmake-build-system)
+    (arguments
+     (list #:configure-flags
+           #~(list "-DNCNN_AVX=OFF"
+                   "-DNCNN_BUILD_TESTS=TRUE"
+                   "-DNCNN_SYSTEM_GLSLANG=ON"
+                   (string-append "-DGLSLANG_TARGET_DIR="
+                                  #$(this-package-input "glslang")
+                                  "/lib/cmake")
+                   "-DNCNN_VULKAN=ON")
+           #:tests? #f))                ; XXX: half of the tests fail
+    (inputs (list glslang vulkan-headers vulkan-loader))
+    (native-inputs (list protobuf))
+    (home-page "https://github.com/Tencent/ncnn")
+    (synopsis "Neural network for mobile platforms")
+    (description "NCNN is a framework for building neural networks written in
+C++.  It supports parallel computing as well as GPU acceleration via Vulkan.")
+    (license license:bsd-3)))
+
 (define-public onnx
   (package
     (name "onnx")
-- 
2.38.1