mirror of
https://github.com/saymrwulf/onnxruntime.git
synced 2026-07-21 19:18:55 +00:00
* Add test for iOS package (#7816) * Add test for iOS package * Add readme * fix pep8 warning * Addressed CR comments, fixed CI failure * Address CR comments * Update readme.md * Update package name and readme, added comments to the podspec * Add podspec template for ios package, update build settings (#7907) * Add podspec template for ios package * minor formatting update * Add spec.source_files for header files * Update spec.public_header_files to spec.source_files * minor update * Add iOS packaging pipeline (#8264) Create a pipeline to produce the iOS package artifacts. * [iOS] Packaging pipeline improvements. (#8324) Updates to the iOS packaging pipeline: - Make it harder to overwrite package archives accidentally when uploading (fails if the archive already exists) - Only upload package archives for release builds - Some clean up * Add metadata_props to ORT model (#8340) * Add metadata_props to ORT model * Minor update * Update python binding, and increase the minimal pipeline size threshold * Fixed a small bug in serializing ir_version * Remove temp ort.py.fbs and add it to .gitignore * Add iOS/macOS static framework (#8357) * Add ability to generate ios static framework * Fix typos * Add pod cache clean, update some comments of previous commit * Fix CI failure with newly added cpuinfo library * Update test model (CoreML requires node has a name) * Addressed CR comments * Fix iOS packaging pipeline failure (#8433) * Fix optimizer crash (#8274) * Update iOS packaging script to default build static framework, disable bitcode (#8533) * default package build to static, disable bitcode * fix pipeline failure * Address CR comments * Add HardSigmoid to mobile packages. Used by PyTorch MobileNet v3 (#8552) * bump the version number to 1.8.2 * Change Windows GPU machine pool to onnxruntime-win-cuda11-0 * [Objective-C API] Fix ORTIsCoreMLExecutionProviderAvailable link error when used from Swift. (#8350) Co-authored-by: Edward Chen <18449977+edgchen1@users.noreply.github.com> Co-authored-by: RandySheriffH <48490400+RandySheriffH@users.noreply.github.com> Co-authored-by: Scott McKay <skottmckay@gmail.com> Co-authored-by: Changming Sun <chasun@microsoft.com>
69 lines
2.4 KiB
Python
69 lines
2.4 KiB
Python
# Copyright (c) Microsoft Corporation. All rights reserved.
|
|
# Licensed under the MIT License.
|
|
|
|
import json
|
|
import os
|
|
import pathlib
|
|
import re
|
|
import shutil
|
|
|
|
from typing import Dict, List
|
|
|
|
_script_dir = pathlib.Path(__file__).parent.resolve(strict=True)
|
|
repo_root = _script_dir.parents[3]
|
|
|
|
_template_variable_pattern = re.compile(r"@(\w+)@") # match "@var@"
|
|
|
|
|
|
def gen_file_from_template(template_file: pathlib.Path, output_file: pathlib.Path,
|
|
variable_substitutions: Dict[str, str]):
|
|
'''
|
|
Generates a file from a template file.
|
|
The template file may contain template variables that will be substituted
|
|
with the provided values in the generated output file.
|
|
In the template file, template variable names are delimited by "@"'s,
|
|
e.g., "@var@".
|
|
|
|
:param template_file The template file path.
|
|
:param output_file The generated output file path.
|
|
:param variable_substitutions The mapping from template variable name to value.
|
|
'''
|
|
with open(template_file, mode="r") as template:
|
|
content = template.read()
|
|
|
|
def replace_template_variable(match):
|
|
variable_name = match.group(1)
|
|
return variable_substitutions.get(variable_name, match.group(0))
|
|
|
|
content = _template_variable_pattern.sub(replace_template_variable, content)
|
|
|
|
with open(output_file, mode="w") as output:
|
|
output.write(content)
|
|
|
|
|
|
def copy_repo_relative_to_dir(patterns: List[str], dest_dir: pathlib.Path):
|
|
'''
|
|
Copies file paths relative to the repo root to a directory.
|
|
The given paths or path patterns are relative to the repo root, and the
|
|
repo root-relative intermediate directory structure is maintained.
|
|
|
|
:param patterns The paths or path patterns relative to the repo root.
|
|
:param dest_dir The destination directory.
|
|
'''
|
|
paths = [path for pattern in patterns for path in repo_root.glob(pattern)]
|
|
for path in paths:
|
|
repo_relative_path = path.relative_to(repo_root)
|
|
dst_path = dest_dir / repo_relative_path
|
|
os.makedirs(dst_path.parent, exist_ok=True)
|
|
shutil.copy(path, dst_path)
|
|
|
|
|
|
def load_framework_info(framework_info_file: pathlib.Path):
|
|
'''
|
|
Loads framework info from a file.
|
|
|
|
:param framework_info_file The framework info file path.
|
|
:return The framework info values.
|
|
'''
|
|
with open(framework_info_file, mode="r") as framework_info:
|
|
return json.load(framework_info)
|