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

package info (click to toggle)
ggml 0.0~git20250712.d62df60-5
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 15,396 kB
  • sloc: cpp: 88,695; ansic: 36,758; objc: 6,050; lisp: 5,741; python: 1,465; sh: 626; 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 f89271a..fd14a2e 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -212,6 +212,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 9877156..f84fb91 100644
--- a/tests/CMakeLists.txt
+++ b/tests/CMakeLists.txt
@@ -434,3 +434,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()