@@ -24,13 +24,23 @@ let package = Package(
2424 . library( name: " onnxruntime " ,
2525 type: . static,
2626 targets: [ " OnnxRuntimeBindings " ] ) ,
27+ . library( name: " onnxruntime_extensions " ,
28+ type: . static,
29+ targets: [ " OnnxRuntimeExtensions " ] ) ,
2730 ] ,
2831 dependencies: [ ] ,
2932 targets: [
3033 . target( name: " OnnxRuntimeBindings " ,
3134 dependencies: [ " onnxruntime " ] ,
3235 path: " objectivec " ,
33- exclude: [ " ReadMe.md " , " format_objc.sh " ] ,
36+ exclude: [ " ReadMe.md " , " format_objc.sh " , " test " ,
37+ " ort_checkpoint.mm " ,
38+ " ort_checkpoint_internal.h " ,
39+ " ort_training_session_internal.h " ,
40+ " ort_training_session.mm " ,
41+ " include/ort_checkpoint.h " ,
42+ " include/ort_training_session.h " ,
43+ " include/onnxruntime_training.h " ] ,
3444 cxxSettings: [
3545 . define( " SPM_BUILD " ) ,
3646 . unsafeFlags( [ " -std=c++17 " ,
@@ -45,6 +55,23 @@ let package = Package(
4555 resources: [
4656 . copy( " Resources/single_add.basic.ort " )
4757 ] ) ,
58+ . target( name: " OnnxRuntimeExtensions " ,
59+ dependencies: [ " onnxruntime_extensions " , " onnxruntime " ] ,
60+ path: " extensions " ,
61+ cxxSettings: [
62+ . define( " ORT_SWIFT_PACKAGE_MANAGER_BUILD " ) ,
63+ . unsafeFlags( [ " -std=c++17 " ,
64+ " -fobjc-arc-exceptions "
65+ ] ) ,
66+ ] , linkerSettings: [
67+ . unsafeFlags( [ " -ObjC " ] ) ,
68+ ] ) ,
69+ . testTarget( name: " OnnxRuntimeExtensionsTests " ,
70+ dependencies: [ " OnnxRuntimeExtensions " , " OnnxRuntimeBindings " ] ,
71+ path: " swift/OnnxRuntimeExtensionsTests " ,
72+ resources: [
73+ . copy( " Resources/decode_image.onnx " )
74+ ] ) ,
4875 ]
4976)
5077
@@ -83,3 +110,18 @@ if let pod_archive_path = ProcessInfo.processInfo.environment["ORT_IOS_POD_LOCAL
83110 checksum: " 9b41412329a73d7d298b1d94ab40ae9adb65cb84f132054073bc82515b4f5f82 " )
84111 )
85112}
113+
114+ if let ext_pod_archive_path = ProcessInfo . processInfo. environment [ " ORT_EXTENSIONS_IOS_POD_LOCAL_PATH " ] {
115+ package . targets. append ( Target . binaryTarget ( name: " onnxruntime_extensions " , path: ext_pod_archive_path) )
116+ }
117+ // Note: ORT Extensions 0.8.0 release version pod (Currently not working - it gives a header path not found error.)
118+ else {
119+ // package.targets.append(
120+ // Target.binaryTarget(name: "onnxruntime_extensions",
121+ // url: "https://onnxruntimepackages.z14.web.core.windows.net/pod-archive-onnxruntime-extensions-c-0.8.0.zip",
122+ // checksum: "1d003770c9a6d0ead92c04ed40d5083e8f4f55ea985750c3efab91489be15512")
123+ // )
124+ fatalError ( " It is not valid to use a release version extensions c pod for now. \n " +
125+ " Please set ORT_EXTENSIONS_IOS_POD_LOCAL_PATH environment variable to specify a location for local dev version pod. \n " +
126+ " See Package.swift for more information on using a local pod archive. " )
127+ }
0 commit comments