File: system-re2.patch

package info (click to toggle)
onnxruntime 1.21.0%2Bdfsg-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 333,864 kB
  • sloc: cpp: 3,153,080; python: 179,219; ansic: 109,131; asm: 37,791; cs: 34,424; perl: 13,070; java: 11,047; javascript: 6,330; pascal: 4,126; sh: 3,277; xml: 598; objc: 281; makefile: 63
file content (41 lines) | stat: -rw-r--r-- 1,340 bytes parent folder | download | duplicates (2)
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
Description: Use system re2 lib (libre2-dev)
Forwarded: not-needed
Author: Dylan Aïssi <daissi@debian.org>

--- a/cmake/external/onnxruntime_external_deps.cmake
+++ b/cmake/external/onnxruntime_external_deps.cmake
@@ -42,7 +42,7 @@
     EXCLUDE_FROM_ALL
     FIND_PACKAGE_ARGS NAMES re2
 )
-onnxruntime_fetchcontent_makeavailable(re2)
+#onnxruntime_fetchcontent_makeavailable(re2)
 
 if (onnxruntime_BUILD_UNIT_TESTS)
   # WebAssembly threading support in Node.js is still an experimental feature and
@@ -399,6 +399,25 @@
     EXCLUDE_FROM_ALL
     FIND_PACKAGE_ARGS 23.5.9 NAMES Flatbuffers flatbuffers FlatBuffers
 )
+find_package(PkgConfig REQUIRED)
+pkg_check_modules(RE2 re2)
+if(RE2_FOUND)
+  set(re2_FOUND "${RE2_FOUND}")
+  add_library(re2::re2 INTERFACE IMPORTED)
+  if(RE2_INCLUDE_DIRS)
+    set_property(TARGET re2::re2 PROPERTY
+                 INTERFACE_INCLUDE_DIRECTORIES "${RE2_INCLUDE_DIRS}")
+  endif()
+  if(RE2_CFLAGS_OTHER)
+    set_property(TARGET re2::re2 PROPERTY
+                 INTERFACE_COMPILE_OPTIONS "${RE2_CFLAGS_OTHER}")
+  endif()
+  if(RE2_LDFLAGS)
+    set_property(TARGET re2::re2 PROPERTY
+                 INTERFACE_LINK_LIBRARIES "${RE2_LDFLAGS}")
+  endif()
+  message(STATUS "Found RE2 via pkg-config.")
+endif()
 
 onnxruntime_fetchcontent_makeavailable(flatbuffers)
 if(NOT flatbuffers_FOUND)