File: cmake-Add-option-to-install-tests.patch

package info (click to toggle)
ggml 0.9.4-1
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 17,128 kB
  • sloc: cpp: 107,161; ansic: 36,329; lisp: 9,094; python: 1,558; objc: 1,045; sh: 773; makefile: 59
file content (42 lines) | stat: -rw-r--r-- 1,384 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
From: Christian Kastner <ckk@debian.org>
Date: Sun, 18 May 2025 12:16:06 +0200
Subject: cmake: Add option to install tests

Forwarded: not-needed
---
 CMakeLists.txt       |  1 +
 tests/CMakeLists.txt | 12 ++++++++++++
 2 files changed, 13 insertions(+)

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 9ca3e7c..9f71c93 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -256,6 +256,7 @@ set   (GGML_VULKAN_SHADERS_GEN_TOOLCHAIN "" CACHE FILEPATH "ggml: toolchain file
 
 # extra artifacts
 option(GGML_BUILD_TESTS    "ggml: build tests"    ${GGML_STANDALONE})
+option(GGML_INSTALL_TESTS  "ggml: install tests"  OFF)
 option(GGML_BUILD_EXAMPLES "ggml: build examples" ${GGML_STANDALONE})
 
 #
diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt
index 7c28e34..7a69ea8 100644
--- a/tests/CMakeLists.txt
+++ b/tests/CMakeLists.txt
@@ -354,3 +354,15 @@ if (NOT GGML_BACKEND_DL)
     add_test(NAME ${TEST_TARGET} COMMAND $<TARGET_FILE:${TEST_TARGET}>)
     set_property(TEST ${TEST_TARGET} PROPERTY ENVIRONMENT "LLVM_PROFILE_FILE=${TEST_TARGET}.profraw")
 endif()
+
+
+#
+# Optional: install tests
+if (GGML_INSTALL_TESTS)
+    get_property(ALL_TEST_TARGETS DIRECTORY PROPERTY TESTS)
+    message(WARNING "All tests: ${ALL_TEST_TARGETS}")
+
+    foreach(TEST_TARGET ${ALL_TEST_TARGETS})
+        install(TARGETS ${TEST_TARGET} RUNTIME DESTINATION bin)
+    endforeach()
+endif()