From 013b5201fafa21b40e67bd74e2a06519865929ca Mon Sep 17 00:00:00 2001 From: rachguo Date: Wed, 8 Nov 2023 13:34:10 -0800 Subject: [PATCH] update framework_info.json.template --- cmake/onnxruntime.cmake | 6 +----- .../github/apple/c/assemble_c_pod_package.py | 21 ++++--------------- .../github/apple/framework_info.json.template | 6 ++++++ .../apple/framework_info_ios.json.template | 4 ---- .../apple/framework_info_macos.json.template | 4 ---- 5 files changed, 11 insertions(+), 30 deletions(-) create mode 100644 tools/ci_build/github/apple/framework_info.json.template delete mode 100644 tools/ci_build/github/apple/framework_info_ios.json.template delete mode 100644 tools/ci_build/github/apple/framework_info_macos.json.template diff --git a/cmake/onnxruntime.cmake b/cmake/onnxruntime.cmake index 67681c24ed657..42d728a8897e2 100644 --- a/cmake/onnxruntime.cmake +++ b/cmake/onnxruntime.cmake @@ -90,12 +90,8 @@ elseif(onnxruntime_BUILD_APPLE_FRAMEWORK) configure_file(${REPO_ROOT}/cmake/Info.plist.in ${INFO_PLIST_PATH}) if (${CMAKE_SYSTEM_NAME} STREQUAL "iOS") configure_file( - ${REPO_ROOT}/tools/ci_build/github/apple/framework_info_ios.json.template + ${REPO_ROOT}/tools/ci_build/github/apple/framework_info.json.template ${CMAKE_CURRENT_BINARY_DIR}/framework_info.json) - else() #macos - configure_file( - ${REPO_ROOT}/tools/ci_build/github/apple/framework_info_macos.json.template - ${CMAKE_CURRENT_BINARY_DIR}/framework_info_macos.json) endif() set_target_properties(onnxruntime PROPERTIES FRAMEWORK TRUE diff --git a/tools/ci_build/github/apple/c/assemble_c_pod_package.py b/tools/ci_build/github/apple/c/assemble_c_pod_package.py index 51fa8c7820eaf..0f61479103a6d 100644 --- a/tools/ci_build/github/apple/c/assemble_c_pod_package.py +++ b/tools/ci_build/github/apple/c/assemble_c_pod_package.py @@ -43,7 +43,6 @@ def assemble_c_pod_package( public_headers_dir: pathlib.Path, framework_dir: pathlib.Path, package_variant: PackageVariant, - framework_info_macos_file=None, ): """ Assembles the files for the C/C++ pod package in a staging directory. @@ -63,11 +62,6 @@ def assemble_c_pod_package( framework_dir = framework_dir.resolve(strict=True) framework_info = load_json_config(framework_info_file) - framework_info_macos = None - if framework_info_macos_file is not None: - framework_info_macos_file = framework_info_macos_file.resolve(strict=True) - framework_info_macos = load_json_config(framework_info_macos_file) - pod_config = load_json_config(get_pod_config_file(package_variant)) pod_name = pod_config["name"] @@ -84,15 +78,16 @@ def assemble_c_pod_package( # generate the podspec file from the template variable_substitutions = { "DESCRIPTION": pod_config["description"], - "IOS_DEPLOYMENT_TARGET": framework_info["IOS_DEPLOYMENT_TARGET"], - "MACOSX_DEPLOYMENT_TARGET": framework_info_macos["MACOSX_DEPLOYMENT_TARGET"] if framework_info_macos is not None else "", + # By default, we build both "iphoneos" and "iphonesimulator" architectures, and the deployment target should be the same between these two. + "IOS_DEPLOYMENT_TARGET": framework_info.get("iphoneos", {}).get("APPLE_DEPLOYMENT_TARGET", ""), + "MACOSX_DEPLOYMENT_TARGET": framework_info.get("macosx", {}).get("APPLE_DEPLOYMENT_TARGET", ""), "LICENSE_FILE": "LICENSE", "NAME": pod_name, "ORT_C_FRAMEWORK": framework_dir.name, "ORT_C_HEADERS_DIR": public_headers_dir.name, "SUMMARY": pod_config["summary"], "VERSION": pod_version, - "WEAK_FRAMEWORK": framework_info["WEAK_FRAMEWORK"], + "WEAK_FRAMEWORK": framework_info["macosx"]["WEAK_FRAMEWORK"], } podspec_template = _script_dir / "c.podspec.template" @@ -140,13 +135,6 @@ def parse_args(): parser.add_argument( "--variant", choices=PackageVariant.all_variant_names(), required=True, help="Pod package variant." ) - parser.add_argument( - "--framework-info-macos-file", - type=pathlib.Path, - required=False, - help="Path to the framework_info_macos.json file containing additional values for the podspec.(Optional) " - "This file should be generated by CMake in the build directory.", - ) return parser.parse_args() @@ -161,7 +149,6 @@ def main(): public_headers_dir=args.public_headers_dir, framework_dir=args.framework_dir, package_variant=PackageVariant[args.variant], - framework_info_macos_file=args.framework_info_macos_file if args.framework_info_macos_file is not None else None, ) return 0 diff --git a/tools/ci_build/github/apple/framework_info.json.template b/tools/ci_build/github/apple/framework_info.json.template new file mode 100644 index 0000000000000..b4c4fb8d16ebf --- /dev/null +++ b/tools/ci_build/github/apple/framework_info.json.template @@ -0,0 +1,6 @@ +{ + "@CMAKE_OSX_SYSROOT@": { + "APPLE_DEPLOYMENT_TARGET": "@CMAKE_OSX_DEPLOYMENT_TARGET@", + "WEAK_FRAMEWORK": "@APPLE_WEAK_FRAMEWORK@" + } +} diff --git a/tools/ci_build/github/apple/framework_info_ios.json.template b/tools/ci_build/github/apple/framework_info_ios.json.template deleted file mode 100644 index 788e52302b3f1..0000000000000 --- a/tools/ci_build/github/apple/framework_info_ios.json.template +++ /dev/null @@ -1,4 +0,0 @@ -{ - "IOS_DEPLOYMENT_TARGET": "@CMAKE_OSX_DEPLOYMENT_TARGET@", - "WEAK_FRAMEWORK": "@APPLE_WEAK_FRAMEWORK@" -} \ No newline at end of file diff --git a/tools/ci_build/github/apple/framework_info_macos.json.template b/tools/ci_build/github/apple/framework_info_macos.json.template deleted file mode 100644 index 03d7ad66a7415..0000000000000 --- a/tools/ci_build/github/apple/framework_info_macos.json.template +++ /dev/null @@ -1,4 +0,0 @@ -{ - "MACOSX_DEPLOYMENT_TARGET": "@CMAKE_OSX_DEPLOYMENT_TARGET@", - "WEAK_FRAMEWORK": "@APPLE_WEAK_FRAMEWORK@" -}