File size: 2,420 Bytes
40ed781
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
#!/usr/bin/env bash
# Copyright (c)  2023  Xiaomi Corporation (authors: Fangjun Kuang)


for arch in simulator/os64 simulator/arm64 arm64; do
libtool -static -o build-ios/$arch/onnxruntime.a \
  build-ios/$arch/Release/static_libraries/libabsl_base.a \
  build-ios/$arch/Release/static_libraries/libabsl_city.a \
  build-ios/$arch/Release/static_libraries/libabsl_hash.a \
  build-ios/$arch/Release/static_libraries/libabsl_low_level_hash.a \
  build-ios/$arch/Release/static_libraries/libabsl_raw_hash_set.a \
  build-ios/$arch/Release/static_libraries/libabsl_raw_logging_internal.a \
  build-ios/$arch/Release/static_libraries/libabsl_throw_delegate.a \
  build-ios/$arch/Release/static_libraries/libclog.a \
  build-ios/$arch/Release/static_libraries/libcpuinfo.a \
  build-ios/$arch/Release/static_libraries/libflatbuffers.a \
  build-ios/$arch/Release/static_libraries/libnsync_cpp.a \
  build-ios/$arch/Release/static_libraries/libonnx.a \
  build-ios/$arch/Release/static_libraries/libonnx_proto.a \
  build-ios/$arch/Release/static_libraries/libonnxruntime_common.a \
  build-ios/$arch/Release/static_libraries/libonnxruntime_coreml_proto.a \
  build-ios/$arch/Release/static_libraries/libonnxruntime_flatbuffers.a \
  build-ios/$arch/Release/static_libraries/libonnxruntime_framework.a \
  build-ios/$arch/Release/static_libraries/libonnxruntime_graph.a \
  build-ios/$arch/Release/static_libraries/libonnxruntime_mlas.a \
  build-ios/$arch/Release/static_libraries/libonnxruntime_optimizer.a \
  build-ios/$arch/Release/static_libraries/libonnxruntime_providers.a \
  build-ios/$arch/Release/static_libraries/libonnxruntime_providers_coreml.a \
  build-ios/$arch/Release/static_libraries/libonnxruntime_session.a \
  build-ios/$arch/Release/static_libraries/libonnxruntime_util.a \
  build-ios/$arch/Release/static_libraries/libprotobuf-lite.a \
  build-ios/$arch/Release/static_libraries/libre2.a
done

lipo -create build-ios/simulator/os64/onnxruntime.a \
             build-ios/simulator/arm64/onnxruntime.a \
     -output build-ios/simulator/onnxruntime.a

rm -rf  onnxruntime.xcframework
xcodebuild -create-xcframework \
    -library build-ios/arm64/onnxruntime.a \
    -library build-ios/simulator/onnxruntime.a \
    -output onnxruntime.xcframework

mkdir -p onnxruntime.xcframework/Headers
cp -v ./build-ios/simulator/os64/install/bin/onnxruntime.framework/Headers/*.h onnxruntime.xcframework/Headers