Skip to content

Commit 168103a

Browse files
committed
update
1 parent 5aa33bb commit 168103a

File tree

4 files changed

+62
-55
lines changed

4 files changed

+62
-55
lines changed

include/onnxruntime/core/common/eigen_common_wrapper.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
#pragma GCC diagnostic ignored "-Wignored-attributes"
1515
#endif
1616
#pragma GCC diagnostic ignored "-Wunused-parameter"
17-
#pragma GCC diagnostic ignored "-Wno-unused-result"
17+
#pragma GCC diagnostic ignored "-Wunused-result"
1818
#ifdef HAS_DEPRECATED_COPY
1919
#pragma GCC diagnostic ignored "-Wdeprecated-copy"
2020
#endif

onnxruntime/test/util/compare_ortvalue.cc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
#pragma GCC diagnostic push
1010
#pragma GCC diagnostic ignored "-Wignored-qualifiers"
1111
#pragma GCC diagnostic ignored "-Wunused-parameter"
12+
#pragma GCC diagnostic ignored "-Wunused-result"
1213
#endif
1314
#include <google/protobuf/message_lite.h>
1415
#include <Eigen/Core>

tools/ci_build/build.py

Lines changed: 58 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44

55
import argparse
66
import contextlib
7-
import glob
87
import os
98
import re
109
import shlex
@@ -279,15 +278,15 @@ def parse_arguments():
279278
"CMake setup. Delete CMakeCache.txt if needed")
280279
parser.add_argument(
281280
"--arm", action='store_true',
282-
help="[cross-compiling] Create ARM makefiles. Requires --update and no existing cache "
281+
help="[cross-compiling] Create Windows ARM makefiles. Requires --update and no existing cache "
283282
"CMake setup. Delete CMakeCache.txt if needed")
284283
parser.add_argument(
285284
"--arm64", action='store_true',
286-
help="[cross-compiling] Create ARM64 makefiles. Requires --update and no existing cache "
285+
help="[cross-compiling] Create Windows ARM64 makefiles. Requires --update and no existing cache "
287286
"CMake setup. Delete CMakeCache.txt if needed")
288287
parser.add_argument(
289288
"--arm64ec", action='store_true',
290-
help="[cross-compiling] Create ARM64EC makefiles. Requires --update and no existing cache "
289+
help="[cross-compiling] Create Windows ARM64EC makefiles. Requires --update and no existing cache "
291290
"CMake setup. Delete CMakeCache.txt if needed")
292291
parser.add_argument(
293292
"--msvc_toolset", help="MSVC toolset to use. e.g. 14.11")
@@ -311,7 +310,7 @@ def parse_arguments():
311310
parser.add_argument("--ios", action='store_true', help="build for ios")
312311
parser.add_argument(
313312
"--ios_sysroot", default="",
314-
help="Specify the location name of the macOS platform SDK to be used")
313+
help="Specify the location name of the macOS platform SDK to be used")
315314
parser.add_argument(
316315
"--xcode_code_signing_team_id", default="",
317316
help="The development team ID used for code signing in Xcode")
@@ -321,11 +320,6 @@ def parse_arguments():
321320
parser.add_argument(
322321
"--use_xcode", action='store_true',
323322
help="Use Xcode as cmake generator, this is only supported on MacOS.")
324-
parser.add_argument(
325-
"--osx_arch",
326-
default="arm64" if platform.machine() == "arm64" else "x86_64",
327-
choices=["arm64", "arm64e", "x86_64"],
328-
help="Specify the Target specific architectures for macOS and iOS, This is only supported on MacOS")
329323

330324
# WebAssembly build
331325
parser.add_argument("--build_wasm", action='store_true', help="Build for WebAssembly")
@@ -775,8 +769,34 @@ def generate_build_tree(cmake_path, source_dir, build_dir, cuda_home, cudnn_home
775769
# It should be default ON in CI build pipelines, and OFF in packaging pipelines.
776770
# And OFF for the people who are not actively developing onnx runtime.
777771
add_cmake_define_without_override(cmake_extra_defines, "onnxruntime_DEV_MODE", use_dev_mode(args))
778-
779-
if args.arm64 or args.arm64ec or args.arm:
772+
if is_macOS:
773+
ARCHFLAGS = os.environ.get('ARCHFLAGS', None)
774+
OSX_ARCHS = []
775+
if ARCHFLAGS:
776+
ARCHFLAGS = shlex.split(ARCHFLAGS)
777+
for i in range(0, len(ARCHFLAGS)-1):
778+
if ARCHFLAGS[i] == '-arch':
779+
OSX_ARCHS.append(ARCHFLAGS[i+1])
780+
781+
if len(OSX_ARCHS) == 1 and OSX_ARCHS[0] == platform.machine():
782+
# We have use the default value
783+
OSX_ARCHS = None
784+
785+
is_cmake_osx_architectures_set = False
786+
if OSX_ARCHS:
787+
is_cmake_osx_architectures_set = True
788+
add_cmake_define_without_override(cmake_extra_defines, "CMAKE_OSX_ARCHITECTURES", ";".join(OSX_ARCHS))
789+
else:
790+
for x in cmake_extra_defines:
791+
if x.startswith("CMAKE_OSX_ARCHITECTURES="):
792+
is_cmake_osx_architectures_set = True
793+
break
794+
795+
if is_cmake_osx_architectures_set:
796+
print("CMAKE_OSX_ARCHITECTURES is set")
797+
else:
798+
print("CMAKE_OSX_ARCHITECTURES is not set")
799+
elif args.arm64 or args.arm64ec or args.arm:
780800
# In most cases, we don't need to manually set this variable.
781801
# Please refer https://cmake.org/cmake/help/latest/manual/cmake-toolchains.7.html
782802
add_cmake_define_without_override(cmake_extra_defines, "CMAKE_CROSSCOMPILING", "ON")
@@ -900,30 +920,30 @@ def generate_build_tree(cmake_path, source_dir, build_dir, cuda_home, cudnn_home
900920
cmake_args += ["-Donnxruntime_USE_COREML=ON"]
901921

902922
if args.ios:
903-
needed_args = [
904-
args.use_xcode,
905-
args.ios_sysroot,
906-
]
907-
arg_names = [
908-
"--use_xcode " +
909-
"<need use xcode to cross build iOS on MacOS>",
910-
"--ios_sysroot " +
911-
"<the location or name of the macOS platform SDK>",
912-
]
913-
if not all(needed_args):
914-
raise BuildError(
915-
"iOS build on MacOS canceled due to missing arguments: " +
916-
', '.join(
917-
val for val, cond in zip(arg_names, needed_args)
918-
if not cond))
919-
cmake_args += [
920-
"-DCMAKE_SYSTEM_NAME=iOS",
921-
"-Donnxruntime_BUILD_SHARED_LIB=ON",
922-
"-DCMAKE_OSX_SYSROOT=" + args.ios_sysroot,
923-
# we do not need protoc binary for ios cross build
924-
"-Dprotobuf_BUILD_PROTOC_BINARIES=OFF",
925-
"-DCMAKE_TOOLCHAIN_FILE=../cmake/onnxruntime_ios.toolchain.cmake"
926-
]
923+
needed_args = [
924+
args.use_xcode,
925+
args.ios_sysroot,
926+
]
927+
arg_names = [
928+
"--use_xcode " +
929+
"<need use xcode to cross build iOS on MacOS>",
930+
"--ios_sysroot " +
931+
"<the location or name of the macOS platform SDK>",
932+
]
933+
if not all(needed_args):
934+
raise BuildError(
935+
"iOS build on MacOS canceled due to missing arguments: " +
936+
', '.join(
937+
val for val, cond in zip(arg_names, needed_args)
938+
if not cond))
939+
cmake_args += [
940+
"-DCMAKE_SYSTEM_NAME=iOS",
941+
"-Donnxruntime_BUILD_SHARED_LIB=ON",
942+
"-DCMAKE_OSX_SYSROOT=" + args.ios_sysroot,
943+
# we do not need protoc binary for ios cross build
944+
"-Dprotobuf_BUILD_PROTOC_BINARIES=OFF",
945+
"-DCMAKE_TOOLCHAIN_FILE=../cmake/onnxruntime_ios.toolchain.cmake"
946+
]
927947

928948
if args.build_wasm:
929949
emsdk_dir = os.path.join(cmake_dir, "external", "emsdk")
@@ -1725,7 +1745,6 @@ def run_csharp_tests(source_dir, build_dir, use_cuda, use_openvino, use_tensorrt
17251745
run_subprocess(cmd_args, cwd=csharp_source_dir)
17261746

17271747

1728-
17291748
def build_protoc_for_host(cmake_path, source_dir, build_dir, args):
17301749
if (args.arm or args.arm64 or args.arm64ec or args.enable_windows_store) and \
17311750
not (is_windows()):
@@ -2004,12 +2023,6 @@ def main():
20042023
elif is_macOS():
20052024
if args.use_xcode:
20062025
cmake_extra_args += ['-G', 'Xcode']
2007-
if not args.ios and not args.android and \
2008-
args.osx_arch == 'arm64' and platform.machine() == 'x86_64':
2009-
if args.test:
2010-
log.warning(
2011-
"Cannot test ARM64 build on X86_64. Will skip test running after build.")
2012-
args.test = False
20132026

20142027
if args.build_wasm:
20152028
emsdk_version = args.emsdk_version
@@ -2043,19 +2056,12 @@ def main():
20432056
os.path.join(SCRIPT_DIR, "wasm", "file_packager.py.patch"),
20442057
os.path.join(emsdk_dir, "upstream", "emscripten", "tools", "file_packager.py"))
20452058

2046-
if (args.android or args.ios or args.enable_windows_store or args.build_wasm) and args.path_to_protoc_exe is None:
2059+
path_to_protoc_exe = args.path_to_protoc_exe
2060+
if (args.android or args.ios or args.enable_windows_store or args.build_wasm) and path_to_protoc_exe is None:
20472061
# Cross-compiling for Android, iOS, and WebAssembly
20482062
path_to_protoc_exe = build_protoc_for_host(
20492063
cmake_path, source_dir, build_dir, args)
20502064

2051-
if is_ubuntu_1604():
2052-
if (args.arm or args.arm64):
2053-
raise BuildError(
2054-
"Only Windows ARM(64) cross-compiled builds supported "
2055-
"currently through this script")
2056-
if not is_docker() and not args.use_acl and not args.use_armnn:
2057-
install_python_deps()
2058-
20592065
if args.enable_pybind and is_windows():
20602066
install_python_deps(args.numpy_version)
20612067

tools/ci_build/github/azure-pipelines/templates/py-packaging-stage.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -917,10 +917,10 @@ stages:
917917
pool:
918918
vmImage: 'macOS-10.15'
919919
variables:
920-
CIBW_ARCHS_MACOS: universal2
920+
CIBW_ARCHS_MACOS: x86_64 universal2
921921
MACOSX_DEPLOYMENT_TARGET: '10.14'
922922
CIBW_PROJECT_REQUIRES_PYTHON: ">=3.6, <3.10"
923-
CIBW_ENVIRONMENT: NIGHTLY_BUILD='$(NIGHTLY_BUILD)' BUILD_BUILDNUMBER='$(Build.BuildId)' ONNXRUNTIME_BUILD_CMD='--enable_pybind --cmake_extra_defines CMAKE_OSX_ARCHITECTURES="arm64;x86_64"'
923+
CIBW_ENVIRONMENT: NIGHTLY_BUILD='$(NIGHTLY_BUILD)' BUILD_BUILDNUMBER='$(Build.BuildId)' ONNXRUNTIME_BUILD_CMD='--enable_pybind'
924924
CIBW_BEFORE_BUILD: python3 -m pip install numpy==1.16.6
925925
steps:
926926
- checkout: self

0 commit comments

Comments
 (0)