From c7d5aaa2b978f6a9c4c6ff47f218ff2077a4487b Mon Sep 17 00:00:00 2001
From: Ribbon <ribbon_45@proton.me>
Date: Mon, 15 Jul 2024 18:31:39 +0000
Subject: [PATCH] Add a recipe

---
 recipes/wip/libs/ml/libtorch/recipe.toml | 25 ++++++++++++++++++++++++
 1 file changed, 25 insertions(+)
 create mode 100644 recipes/wip/libs/ml/libtorch/recipe.toml

diff --git a/recipes/wip/libs/ml/libtorch/recipe.toml b/recipes/wip/libs/ml/libtorch/recipe.toml
new file mode 100644
index 000000000..eceb2687d
--- /dev/null
+++ b/recipes/wip/libs/ml/libtorch/recipe.toml
@@ -0,0 +1,25 @@
+#TODO maybe incomplete script, see https://github.com/pytorch/pytorch/blob/main/docs/libtorch.rst#building-libtorch-using-cmake
+[source]
+git = "https://github.com/pytorch/pytorch"
+branch = "release/2.3"
+[build]
+template = "custom"
+script = """
+mkdir pytorch-build
+cd pytorch-build
+COOKBOOK_CONFIGURE="cmake"
+COOKBOOK_CONFIGURE_FLAGS=(
+    -DCMAKE_BUILD_TYPE=Release
+    -DCMAKE_CROSSCOMPILING=True
+    -DCMAKE_EXE_LINKER_FLAGS="-static"
+    -DCMAKE_INSTALL_PREFIX="/"
+    -DCMAKE_PREFIX_PATH="${COOKBOOK_SYSROOT}"
+    -DCMAKE_SYSTEM_NAME=Generic
+    -DCMAKE_SYSTEM_PROCESSOR="$(echo "${TARGET}" | cut -d - -f1)"
+    -DCMAKE_VERBOSE_MAKEFILE=On
+    -DBUILD_SHARED_LIBS:BOOL=OFF
+    -DCMAKE_BUILD_TYPE:STRING=Release -DPYTHON_EXECUTABLE:PATH=`which python3` -DCMAKE_INSTALL_PREFIX:PATH=../pytorch-install ../pytorch
+"${COOKBOOK_SOURCE}"
+)
+cookbook_configure
+"""
-- 
GitLab