@@ -2,8 +2,8 @@ class Onnxruntime < Formula
2
2
desc "Cross-platform, high performance scoring engine for ML models"
3
3
homepage "https://github.com/microsoft/onnxruntime"
4
4
url "https://github.com/microsoft/onnxruntime.git" ,
5
- tag : "v1.17.1 " ,
6
- revision : "8f5c79cb63f09ef1302e85081093a3fe4da1bc7d "
5
+ tag : "v1.20.0 " ,
6
+ revision : "c4fb724e810bb496165b9015c77f402727392933 "
7
7
license "MIT"
8
8
9
9
livecheck do
@@ -21,21 +21,74 @@ class Onnxruntime < Formula
21
21
sha256 cellar : :any_skip_relocation , x86_64_linux : "dde778dd1564940af7b2116cba7d4c8b45b4d6e335c78620cf97b1e1e6a688b1"
22
22
end
23
23
24
+ depends_on "boost" => :build
24
25
depends_on "cmake" => :build
25
- depends_on "[email protected] " => :build
26
+ depends_on "cpp-gsl" => :build
27
+ depends_on "flatbuffers" => :build # NOTE: links to static library
28
+ depends_on "howard-hinnant-date" => :build
29
+ depends_on "nlohmann-json" => :build
30
+ depends_on "nsync" => :build # NOTE: links to static library
31
+ depends_on "[email protected] " => :build
32
+ depends_on "safeint" => :build
33
+ depends_on "abseil"
34
+ depends_on "protobuf@21" # https://github.com/microsoft/onnxruntime/issues/21308
35
+ depends_on "re2"
26
36
27
- fails_with gcc : "5" # GCC version < 7 is no longer supported
37
+ # Need newer than stable `eigen` after https://github.com/microsoft/onnxruntime/pull/21492
38
+ # element_wise_ops.cc:708:32: error: no matching member function for call to 'min'
39
+ #
40
+ # https://github.com/microsoft/onnxruntime/blob/v#{version}/cmake/deps.txt#L25
41
+ resource "eigen" do
42
+ url "https://gitlab.com/libeigen/eigen/-/archive/e7248b26a1ed53fa030c5c459f7ea095dfd276ac/eigen-e7248b26a1ed53fa030c5c459f7ea095dfd276ac.tar.bz2"
43
+ sha256 "a3f1724de1dc7e7f74fbcc206ffcaeba27fd89b37dc71f9c31e505634d0c1634"
44
+ end
45
+
46
+ # https://github.com/microsoft/onnxruntime/blob/v#{version}/cmake/deps.txt#L52
47
+ resource "pytorch_cpuinfo" do
48
+ url "https://github.com/pytorch/cpuinfo/archive/ca678952a9a8eaa6de112d154e8e104b22f9ab3f.tar.gz"
49
+ sha256 "c8f43b307fa7d911d88fec05448161eb1949c3fc0cb62f3a7a2c61928cdf2e9b"
50
+ end
51
+
52
+ # TODO: Consider making separate formula
53
+ resource "onnx" do
54
+ url "https://github.com/onnx/onnx/archive/refs/tags/v1.17.0.tar.gz"
55
+ sha256 "8d5e983c36037003615e5a02d36b18fc286541bf52de1a78f6cf9f32005a820e"
56
+ end
28
57
29
58
def install
30
- cmake_args = %W[
31
- -Donnxruntime_RUN_ONNX_TESTS=OFF
32
- -Donnxruntime_GENERATE_TEST_REPORTS=OFF
33
- -DPYTHON_EXECUTABLE=#{ which ( "python3.12" ) }
59
+ python3 = which ( "python3.13" )
60
+
61
+ # Workaround to use brew `nsync`. Remove in future release with
62
+ # https://github.com/microsoft/onnxruntime/commit/88676e62b966add2cc144a4e7d8ae1dbda1148e8
63
+ inreplace "cmake/external/onnxruntime_external_deps.cmake" do |s |
64
+ s . gsub! ( / NAMES nsync unofficial-nsync$/ , " NAMES nsync_cpp" )
65
+ s . gsub! ( /\b unofficial::nsync::nsync_cpp\b / , "nsync_cpp" )
66
+ end
67
+
68
+ resources . each do |r |
69
+ ( buildpath /"build/_deps/#{ r . name } -src" ) . install r
70
+ end
71
+
72
+ args = %W[
73
+ -DHOMEBREW_ALLOW_FETCHCONTENT=ON
74
+ -DFETCHCONTENT_FULLY_DISCONNECTED=ON
75
+ -DFETCHCONTENT_SOURCE_DIR_PYTORCH_CLOG=#{ buildpath } /build/_deps/pytorch_cpuinfo-src
76
+ -DFETCHCONTENT_TRY_FIND_PACKAGE_MODE=ALWAYS
77
+ -DPYTHON_EXECUTABLE=#{ python3 }
78
+ -DONNX_CUSTOM_PROTOC_EXECUTABLE=#{ Formula [ "protobuf@21" ] . opt_bin } /protoc
34
79
-Donnxruntime_BUILD_SHARED_LIB=ON
35
80
-Donnxruntime_BUILD_UNIT_TESTS=OFF
81
+ -Donnxruntime_GENERATE_TEST_REPORTS=OFF
82
+ -Donnxruntime_RUN_ONNX_TESTS=OFF
83
+ -Donnxruntime_USE_FULL_PROTOBUF=ON
36
84
]
37
85
38
- system "cmake" , "-S" , "cmake" , "-B" , "build" , *cmake_args , *std_cmake_args
86
+ # Regenerate C++ bindings to use newer `flatbuffers`
87
+ flatc = Formula [ "flatbuffers" ] . opt_bin /"flatc"
88
+ system python3 , "onnxruntime/core/flatbuffers/schema/compile_schema.py" , "--flatc" , flatc
89
+ system python3 , "onnxruntime/lora/adapter_format/compile_schema.py" , "--flatc" , flatc
90
+
91
+ system "cmake" , "-S" , "cmake" , "-B" , "build" , *args , *std_cmake_args
39
92
system "cmake" , "--build" , "build"
40
93
system "cmake" , "--install" , "build"
41
94
end
@@ -50,8 +103,7 @@ def install
50
103
return 0;
51
104
}
52
105
C
53
- system ENV . cc , "-I#{ include } " , testpath /"test.c" ,
54
- "-L#{ lib } " , "-lonnxruntime" , "-o" , testpath /"test"
106
+ system ENV . cc , "-I#{ include } " , "test.c" , "-L#{ lib } " , "-lonnxruntime" , "-o" , "test"
55
107
assert_equal version , shell_output ( "./test" ) . strip
56
108
end
57
109
end
0 commit comments