Skip to content

Commit

Permalink
Merge pull request #14 from GoodNotes/paco/cleanup_develop
Browse files Browse the repository at this point in the history
[NOTICK] Remove unused macabi build pipeline
  • Loading branch information
pacowong authored Oct 15, 2024
2 parents 295d492 + 8d9a5cc commit bed11ca
Show file tree
Hide file tree
Showing 9 changed files with 36 additions and 349 deletions.
15 changes: 1 addition & 14 deletions cmake/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -50,17 +50,6 @@ set_property(GLOBAL PROPERTY USE_FOLDERS ON)
# NOTE: POSITION INDEPENDENT CODE hurts performance, and it only make sense on POSIX systems
set(CMAKE_POSITION_INDEPENDENT_CODE ON)

#set(CMAKE_CXX_COMPILER "/usr/bin/clang++ --target=arm64-apple-macos14.0-macabi" ) #Paco
#set(CMAKE_C_COMPILER "/usr/bin/clang --target=arm64-apple-macos14.0-macabi" )

#set(CMAKE_CXX_FLAGS "--target=arm64-apple-macos14.0-macabi" ) #Paco
#set(CMAKE_C_FLAGS "--target=arm64-apple-macos14.0-macabi" )

# Suggested by https://gitlab.kitware.com/cmake/cmake/-/issues/20132
# Because MacCatalyst does not support well in CMake
add_compile_options(-Wno-overriding-t-option)
add_link_options(-Wno-overriding-t-option)

# Enable CTest
enable_testing()
include(Dart)
Expand Down Expand Up @@ -130,7 +119,7 @@ option(onnxruntime_DONT_VECTORIZE "Do not vectorize operations in Eigen" OFF)

option(onnxruntime_USE_FULL_PROTOBUF "Link to libprotobuf instead of libprotobuf-lite when this option is ON" OFF)
option(onnxruntime_ENABLE_LANGUAGE_INTEROP_OPS "Enable operator implemented in language other than cpp" OFF)
option(onnxruntime_DEBUG_NODE_INPUTS_OUTPUTS "Dump debug information about node inputs and outputs when executing the model." ON)
option(onnxruntime_DEBUG_NODE_INPUTS_OUTPUTS "Dump debug information about node inputs and outputs when executing the model." OFF)
cmake_dependent_option(onnxruntime_DEBUG_NODE_INPUTS_OUTPUTS_ENABLE_DUMP_TO_SQLDB "Build dump debug information about node inputs and outputs with support for sql database." OFF "onnxruntime_DEBUG_NODE_INPUTS_OUTPUTS" OFF)
option(onnxruntime_USE_DML "Build with DirectML support" OFF)
option(onnxruntime_USE_MIGRAPHX "Build with AMDMIGraphX support" OFF)
Expand Down Expand Up @@ -1661,8 +1650,6 @@ endif()
#Now the 'onnxruntime_EXTERNAL_LIBRARIES' variable should be sealed. It will be used in onnxruntime.cmake which will be included in the next.
#The order of the following targets matters. Right depends on left. If target A appears before target B. Then A.cmake can not use variables defined in B.cmake.
set(ONNXRUNTIME_CMAKE_FILES onnxruntime_flatbuffers onnxruntime_common onnxruntime_mlas onnxruntime_graph onnxruntime_framework onnxruntime_util onnxruntime_providers onnxruntime_optimizer onnxruntime_session ${ONNXRUNTIME_EAGER_CMAKE_FILE_NAME})
# set(ONNXRUNTIME_CMAKE_FILES onnxruntime_flatbuffers onnxruntime_common onnxruntime_mlas) #Paco to be disable
# set(ONNXRUNTIME_CMAKE_FILES onnxruntime_mlas) #Paco to be disable

if (onnxruntime_USE_WINML)
# WINML uses and depends on the shared lib. Note: You can build WINML without DML and you will get a
Expand Down
9 changes: 4 additions & 5 deletions cmake/adjust_global_compile_flags.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,10 @@ endif()

# Enable space optimization for gcc/clang
# Cannot use "-ffunction-sections -fdata-sections" if we enable bitcode (iOS)
#TODO: Paco: need to find out onnxruntime_ENABLE_BITCODE turns ON even it is set to OFF
#if (NOT MSVC AND NOT onnxruntime_ENABLE_BITCODE)
# string(APPEND CMAKE_CXX_FLAGS " -ffunction-sections -fdata-sections")
# string(APPEND CMAKE_C_FLAGS " -ffunction-sections -fdata-sections")
#endif()
if (NOT MSVC AND NOT onnxruntime_ENABLE_BITCODE)
string(APPEND CMAKE_CXX_FLAGS " -ffunction-sections -fdata-sections")
string(APPEND CMAKE_C_FLAGS " -ffunction-sections -fdata-sections")
endif()

if (CMAKE_SYSTEM_NAME STREQUAL "Emscripten")
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -s ALLOW_UNIMPLEMENTED_SYSCALLS=1 -s DEFAULT_TO_CXX=1")
Expand Down
2 changes: 0 additions & 2 deletions cmake/deps.txt
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,6 @@ coremltools;https://github.com/apple/coremltools/archive/refs/tags/7.1.zip;f1bab
cxxopts;https://github.com/jarro2783/cxxopts/archive/3c73d91c0b04e2b59462f0a741be8c07024c1bc0.zip;6c6ca7f8480b26c8d00476e0e24b7184717fe4f0
date;https://github.com/HowardHinnant/date/archive/refs/tags/v3.0.1.zip;2dac0c81dc54ebdd8f8d073a75c053b04b56e159
dlpack;https://github.com/dmlc/dlpack/archive/refs/tags/v0.6.zip;4d565dd2e5b31321e5549591d78aa7f377173445
#flatbuffers;https://github.com/google/flatbuffers/archive/refs/tags/v1.12.0.zip;ba0a75fd12dbef8f6557a74e611b7a3d0c5fe7bf
#flatbuffers;https://github.com/google/flatbuffers/archive/refs/tags/v22.12.6.zip;d01b5232ee52ed5ed05e84f4de01118d5ff8730d
# This Eigen commit id matches the eigen archive being consumed from https://gitlab.com/libeigen/eigen/-/archive/3.4/eigen-3.4.zip
# prior to the 3.4.1 RC changing the bits and invalidating the hash.
# it contains changes on top of 3.4.0 which are required to fix build issues.
Expand Down
31 changes: 31 additions & 0 deletions cmake/patches/protobuf/protobuf_cmake.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 04cb3303a..4025805cf 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -249,9 +249,7 @@ if (MSVC)
# MSVC warning suppressions
add_definitions(
/wd4065 # switch statement contains 'default' but no 'case' labels
- /wd4244 # 'conversion' conversion from 'type1' to 'type2', possible loss of data
/wd4251 # 'identifier' : class 'type' needs to have dll-interface to be used by clients of class 'type2'
- /wd4267 # 'var' : conversion from 'size_t' to 'type', possible loss of data
/wd4305 # 'identifier' : truncation from 'type1' to 'type2'
/wd4307 # 'operator' : integral constant overflow
/wd4309 # 'conversion' : truncation of constant value
@@ -259,7 +257,6 @@ if (MSVC)
/wd4355 # 'this' : used in base member initializer list
/wd4506 # no definition for inline function 'function'
/wd4800 # 'type' : forcing value to bool 'true' or 'false' (performance warning)
- /wd4996 # The compiler encountered a deprecated declaration.
)
# Allow big object
add_definitions(/bigobj)
@@ -289,7 +286,7 @@ if (MSVC)
else (MSVC)
# No version.rc file.
set(protobuf_version_rc_file)
-
+ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-unused-parameter")
# When building with "make", "lib" prefix will be added automatically by
# the build tool.
set(LIB_PREFIX)
6 changes: 0 additions & 6 deletions onnxruntime/core/flatbuffers/schema/ort.fbs.h
Original file line number Diff line number Diff line change
Expand Up @@ -1568,15 +1568,9 @@ struct Attribute FLATBUFFERS_FINAL_CLASS : private flatbuffers::Table {
verifier.VerifyString(name()) &&
VerifyOffset(verifier, VT_DOC_STRING) &&
verifier.VerifyString(doc_string()) &&
<<<<<<< HEAD
VerifyField<int32_t>(verifier, VT_TYPE, sizeof(int32_t)) &&
VerifyField<float>(verifier, VT_F, sizeof(float)) &&
VerifyField<int64_t>(verifier, VT_I, sizeof(int64_t)) &&
=======
VerifyField<int32_t>(verifier, VT_TYPE, 4) &&
VerifyField<float>(verifier, VT_F, 4) &&
VerifyField<int64_t>(verifier, VT_I, 8) &&
>>>>>>> main
VerifyOffset(verifier, VT_S) &&
verifier.VerifyString(s()) &&
VerifyOffset(verifier, VT_T) &&
Expand Down
69 changes: 0 additions & 69 deletions tools/ci_build/build.py
Original file line number Diff line number Diff line change
Expand Up @@ -415,11 +415,6 @@ def convert_arg_line_to_args(self, arg_line):
default="",
help="Path to ios toolchain file, or cmake/onnxruntime_ios.toolchain.cmake will be used",
)
parser.add_argument(
"--macabi_toolchain_file",
default="",
help="Path to macabi toolchain file, " "or cmake/onnxruntime_macabi.toolchain.cmake will be used",
)
parser.add_argument(
"--xcode_code_signing_team_id", default="", help="The development team ID used for code signing in Xcode"
)
Expand All @@ -446,7 +441,6 @@ def convert_arg_line_to_args(self, arg_line):
"(e.g. macOS or iOS)"
"This is only supported on MacOS",
)
parser.add_argument("--macabi", action="store_true", help="Build for macabi")
# A 32-bit progress doesn't have enough memory to run all the tests in onnxruntime_test_all.
# Mimalloc is incompatible with address sanitizer.
# Address sanitizer itself is also a memory leak checker, so when it is enabled we should disable_memleak_checker.
Expand Down Expand Up @@ -1019,7 +1013,6 @@ def generate_build_tree(
"-Donnxruntime_BUILD_OBJC=" + ("ON" if args.build_objc else "OFF"),
"-Donnxruntime_BUILD_SHARED_LIB=" + ("ON" if args.build_shared_lib else "OFF"),
"-Donnxruntime_BUILD_APPLE_FRAMEWORK=" + ("ON" if args.build_apple_framework else "OFF"),
"-DFETCHCONTENT_TRY_FIND_PACKAGE_MODE=NEVER", #PACO
"-Donnxruntime_USE_DNNL=" + ("ON" if args.use_dnnl else "OFF"),
"-Donnxruntime_USE_NNAPI_BUILTIN=" + ("ON" if args.use_nnapi else "OFF"),
"-Donnxruntime_USE_RKNPU=" + ("ON" if args.use_rknpu else "OFF"),
Expand Down Expand Up @@ -1394,65 +1387,6 @@ def generate_build_tree(
f"-DCMAKE_CC_FLAGS_RELEASE=-O3 -DNDEBUG --target={macabi_target}",
]

if args.macabi:
needed_args = [
#args.use_xcode,
args.ios_sysroot,
args.apple_deploy_target,
]
arg_names = [
#"--use_xcode " + "<need use xcode to cross build iOS on MacOS>",
"--ios_sysroot " + "<the location or name of the macOS platform SDK>",
"--apple_deploy_target " + "<the minimum version of the target platform>",
]
if not all(needed_args):
raise BuildError(
"iOS build on MacOS canceled due to missing arguments: "
+ ", ".join(val for val, cond in zip(arg_names, needed_args) if not cond)
)
cmake_args += [
"-DCMAKE_SYSTEM_NAME=Darwin",
"-Donnxruntime_BUILD_SHARED_LIB=ON",
"-DCMAKE_OSX_SYSROOT=" + args.ios_sysroot,
"-DCMAKE_OSX_DEPLOYMENT_TARGET=11.0", # + args.apple_deploy_target,
"-DCMAKE_CXX_OSX_DEPLOYMENT_TARGET_FLAG=" + args.apple_deploy_target,
"-DCMAKE_C_OSX_DEPLOYMENT_TARGET_FLAG=" + args.apple_deploy_target,
"-DCMAKE_CC_OSX_DEPLOYMENT_TARGET_FLAG=" + args.apple_deploy_target,
"-DCMAKE_CXX_COMPILER_TARGET=" + f"{args.osx_arch}-apple-ios{args.apple_deploy_target}-macabi",
"-DCMAKE_C_COMPILER_TARGET=" + f"{args.osx_arch}-apple-ios{args.apple_deploy_target}-macabi",
"-DCMAKE_CC_COMPILER_TARGET=" + f"{args.osx_arch}-apple-ios{args.apple_deploy_target}-macabi",
"-DCMAKE_CXX_FLAGS=" + f"--target={args.osx_arch}-apple-ios{args.apple_deploy_target}-macabi",
"-DCMAKE_CXX_FLAGS_RELEASE=" + f"-O3 -DNDEBUG --target={args.osx_arch}-apple-ios{args.apple_deploy_target}-macabi",
"-DCMAKE_C_FLAGS=" + f"--target={args.osx_arch}-apple-ios{args.apple_deploy_target}-macabi",
"-DCMAKE_C_FLAGS_RELEASE=" + f"-O3 -DNDEBUG --target={args.osx_arch}-apple-ios{args.apple_deploy_target}-macabi",
"-DCMAKE_CC_FLAGS=" + f"--target={args.osx_arch}-apple-ios{args.apple_deploy_target}-macabi",
"-DCMAKE_CC_FLAGS_RELEASE=" + f"-O3 -DNDEBUG --target={args.osx_arch}-apple-ios{args.apple_deploy_target}-macabi",
"-DCMAKE_OSX_SYSROOT=" + "/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk",
"-DCMAKE_THREAD_LIBS_INIT=" + "-lpthread",
"-DCMAKE_HAVE_THREADS_LIBRARY=" + "1",
"-DCMAKE_USE_PTHREADS_INIT=1",
"-DTHREADS_PREFER_PTHREAD_FLAG=ON",
"-Donnxruntime_ENABLE_BITCODE=OFF",
"-DCMAKE_COMPILE_WARNING_AS_ERROR=OFF",
"-DCMAKE_OSX_ARCHITECTURES=" + f"{args.osx_arch}",
"-DCMAKE_CXX_OSX_DEPLOYMENT_TARGET_FLAG=",
# we do not need protoc binary for ios cross build
"-Dprotobuf_BUILD_PROTOC_BINARIES=OFF",
]

if args.osx_arch == "arm64":
cmake_args += ["-DPLATFORM=MAC_CATALYST_ARM64"]
elif args.osx_arch == "x86_64":
cmake_args += ["-DPLATFORM=MAC_CATALYST"]
#"-DPLATFORM=" + "MAC_CATALYST_ARM64" if args.osx_arch == "arm64" else "MAC_CATALYST",
#f"-DCMAKE_C_FLAGS={args.osx_arch}-apple-ios{args.apple_deploy_target}-macabi",
#"-DCMAKE_TOOLCHAIN_FILE="
#+ (args.macabi_toolchain_file if args.macabi_toolchain_file else "../cmake/onnxruntime_macabi.toolchain.cmake.v1"),
print("args.macabi cmake config")
print(cmake_args)
#exit(-1)


if args.build_wasm:
emsdk_dir = os.path.join(cmake_dir, "external", "emsdk")
emscripten_cmake_toolchain_file = os.path.join(
Expand Down Expand Up @@ -1793,9 +1727,6 @@ def build_targets(args, cmake_path, build_dir, configs, num_parallel_jobs, targe
if args.android:
env["ANDROID_SDK_ROOT"] = args.android_sdk_path
env["ANDROID_NDK_HOME"] = args.android_ndk_path
#cmd_args += ['--verbose']
print(cmd_args)
print(env)
run_subprocess(cmd_args, env=env)


Expand Down
Loading

0 comments on commit bed11ca

Please sign in to comment.