summaryrefslogtreecommitdiff
path: root/0001-add-onnxruntime_INSTALL_UNIT_TESTS-option.patch
blob: ee2a723a34d20547a5561cf09d65bd7fa259bf7a (plain)
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
43
44
45
46
47
48
49
From eef8d765c29a2d15fd22dee24a7af1bba42f1a2d Mon Sep 17 00:00:00 2001
From: binsz <274620705z@gmail.com>
Date: Wed, 31 Jan 2024 09:07:22 +0800
Subject: [PATCH] add onnxruntime_INSTALL_UNIT_TESTS option

---
 cmake/CMakeLists.txt              |  1 +
 cmake/onnxruntime_unittests.cmake | 13 +++++++------
 2 files changed, 8 insertions(+), 6 deletions(-)

diff --git a/cmake/CMakeLists.txt b/cmake/CMakeLists.txt
index eaebef8..d3b1448 100644
--- a/cmake/CMakeLists.txt
+++ b/cmake/CMakeLists.txt
@@ -78,6 +78,7 @@ option(onnxruntime_USE_RKNPU "Build with RKNPU support" OFF)
 option(onnxruntime_USE_DNNL "Build with DNNL support" OFF)
 option(onnxruntime_USE_JSEP "Build with JavaScript implemented kernels support" OFF)
 option(onnxruntime_BUILD_UNIT_TESTS "Build ONNXRuntime unit tests" ON)
+option(onnxruntime_INSTALL_UNIT_TESTS "Install ONNXRuntime unit tests" ON)
 option(onnxruntime_BUILD_CSHARP "Build C# library" OFF)
 option(onnxruntime_BUILD_OBJC "Build Objective-C library" OFF)
 option(onnxruntime_USE_PREINSTALLED_EIGEN "Use pre-installed EIGEN. Need to provide eigen_SOURCE_PATH if turn this on." OFF)
diff --git a/cmake/onnxruntime_unittests.cmake b/cmake/onnxruntime_unittests.cmake
index 38f9719..aaa57fc 100644
--- a/cmake/onnxruntime_unittests.cmake
+++ b/cmake/onnxruntime_unittests.cmake
@@ -1059,12 +1059,13 @@ if (onnxruntime_USE_TVM)
     target_link_options(onnx_test_runner PRIVATE "/STACK:4000000")
   endif()
 endif()
-
-install(TARGETS onnx_test_runner
-        ARCHIVE  DESTINATION ${CMAKE_INSTALL_LIBDIR}
-        LIBRARY  DESTINATION ${CMAKE_INSTALL_LIBDIR}
-        BUNDLE   DESTINATION ${CMAKE_INSTALL_LIBDIR}
-        RUNTIME  DESTINATION ${CMAKE_INSTALL_BINDIR})
+if (onnxruntime_INSTALL_UNIT_TESTS)
+  install(TARGETS onnx_test_runner
+          ARCHIVE  DESTINATION ${CMAKE_INSTALL_LIBDIR}
+          LIBRARY  DESTINATION ${CMAKE_INSTALL_LIBDIR}
+          BUNDLE   DESTINATION ${CMAKE_INSTALL_LIBDIR}
+          RUNTIME  DESTINATION ${CMAKE_INSTALL_BINDIR})
+endif()
 
 if (NOT onnxruntime_ENABLE_TRAINING_TORCH_INTEROP)
   if(onnxruntime_BUILD_BENCHMARKS)
-- 
2.41.0