summarylogtreecommitdiffstats
path: root/build-fixes.patch
blob: 5c4524202885c33245d94212e619f448de1b6294 (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
50
51
52
53
54
55
56
57
58
59
60
61
62
diff --git a/cmake/CMakeLists.txt b/cmake/CMakeLists.txt
index a07893771c..253843fa5b 100644
--- a/cmake/CMakeLists.txt
+++ b/cmake/CMakeLists.txt
@@ -596,7 +596,7 @@ if(Protobuf_FOUND OR Protobuf_FOUND)
     if(NOT Protobuf_USE_STATIC_LIBS)
       #Indeed here should be a warning, not a fatal error. ONNX Runtime itself can work in such a
       #setting but it may cause compatibility issue when ONNX Runtime is integrated with the other ONNX ecosystem softwares.
-      message(FATAL_ERROR "Please enable Protobuf_USE_STATIC_LIBS")
+      message(WARNING "Please enable Protobuf_USE_STATIC_LIBS")
     endif()
   else()
     set(PROTOBUF_LIB protobuf::libprotobuf-lite)
@@ -657,7 +657,8 @@ get_filename_component(ORTTRAINING_ROOT "${ORTTRAINING_ROOT}" ABSOLUTE)
 get_filename_component(REPO_ROOT "${REPO_ROOT}" ABSOLUTE)
 set(ONNXRUNTIME_INCLUDE_DIR ${REPO_ROOT}/include/onnxruntime)
 
-add_subdirectory(external/date EXCLUDE_FROM_ALL)
+find_package(date REQUIRED)
+add_library(date_interface ALIAS date::date)
 
 set(SAFEINT_INCLUDE_DIR ${REPO_ROOT}/cmake/external/SafeInt)
 add_library(safeint_interface INTERFACE)
@@ -668,10 +669,13 @@ if(onnxruntime_DISABLE_EXCEPTIONS)
   add_compile_definitions(optional_CONFIG_NO_EXCEPTIONS=1)
 endif()
 
-add_subdirectory(external/mp11 EXCLUDE_FROM_ALL)
+add_library(boost_mp11 INTERFACE)
+add_library(Boost::mp11 ALIAS boost_mp11)
 
 if(onnxruntime_PREFER_SYSTEM_LIB)
-  find_package(re2)
+  find_package(PkgConfig)
+  pkg_check_modules(RE2 IMPORTED_TARGET re2)
+  add_library(re2::re2 ALIAS PkgConfig::RE2)
 endif()
 if(NOT TARGET re2::re2)
   add_subdirectory(external/re2 EXCLUDE_FROM_ALL)
@@ -947,7 +951,8 @@ set(FLATBUFFERS_BUILD_TESTS OFF CACHE BOOL "FLATBUFFERS_BUILD_TESTS" FORCE)
 set(FLATBUFFERS_INSTALL OFF CACHE BOOL "FLATBUFFERS_INSTALL" FORCE)
 set(FLATBUFFERS_BUILD_FLATHASH OFF CACHE BOOL "FLATBUFFERS_BUILD_FLATHASH" FORCE)
 set(FLATBUFFERS_BUILD_FLATLIB ON CACHE BOOL "FLATBUFFERS_BUILD_FLATLIB" FORCE)
-add_subdirectory(external/flatbuffers EXCLUDE_FROM_ALL)
+find_package(Flatbuffers REQUIRED)
+add_library(flatbuffers ALIAS flatbuffers::flatbuffers_shared)
 list(APPEND onnxruntime_EXTERNAL_DEPENDENCIES flatbuffers)
 list(APPEND onnxruntime_EXTERNAL_LIBRARIES flatbuffers)
 
diff --git a/onnxruntime/core/session/inference_session_utils.h b/onnxruntime/core/session/inference_session_utils.h
index 5899afac8d..2672be649d 100644
--- a/onnxruntime/core/session/inference_session_utils.h
+++ b/onnxruntime/core/session/inference_session_utils.h
@@ -18,7 +18,7 @@
 #pragma warning(push)
 #pragma warning(disable : 28020)
 #endif
-#include "single_include/nlohmann/json.hpp"
+#include <nlohmann/json.hpp>
 #ifdef _WIN32
 #pragma warning(pop)
 #endif