From 63c888994490d3800c73b38ea70a27da1916cd98 Mon Sep 17 00:00:00 2001 From: Justin Stoecker Date: Tue, 7 Dec 2021 12:39:46 -0800 Subject: [PATCH] Restore arm64x onnxruntime binaries (#9950) --- cmake/onnxruntime.cmake | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/cmake/onnxruntime.cmake b/cmake/onnxruntime.cmake index 5b123ed1ff..bcce2cf706 100644 --- a/cmake/onnxruntime.cmake +++ b/cmake/onnxruntime.cmake @@ -215,6 +215,32 @@ if (WINDOWS_STORE) target_link_options(onnxruntime PRIVATE /DELAYLOAD:api-ms-win-core-libraryloader-l1-2-1.dll) endif() +if (winml_is_inbox) + # Apply linking flags required by inbox static analysis tools + target_link_options(onnxruntime PRIVATE ${os_component_link_flags_list}) + # Link *_x64/*_arm64 DLLs for the ARM64X forwarder + function(duplicate_shared_library target new_target) + get_target_property(sources ${target} SOURCES) + get_target_property(compile_definitions ${target} COMPILE_DEFINITIONS) + get_target_property(compile_options ${target} COMPILE_OPTIONS) + get_target_property(include_directories ${target} INCLUDE_DIRECTORIES) + get_target_property(link_libraries ${target} LINK_LIBRARIES) + get_target_property(link_flags ${target} LINK_FLAGS) + get_target_property(link_options ${target} LINK_OPTIONS) + add_library(${new_target} SHARED ${sources}) + add_dependencies(${target} ${new_target}) + target_compile_definitions(${new_target} PRIVATE ${compile_definitions}) + target_compile_options(${new_target} PRIVATE ${compile_options}) + target_include_directories(${new_target} PRIVATE ${include_directories}) + target_link_libraries(${new_target} PRIVATE ${link_libraries}) + set_property(TARGET ${new_target} PROPERTY LINK_FLAGS "${link_flags}") + target_link_options(${new_target} PRIVATE ${link_options}) + endfunction() + if (WAI_ARCH STREQUAL x64 OR WAI_ARCH STREQUAL arm64) + duplicate_shared_library(onnxruntime onnxruntime_${WAI_ARCH}) + endif() +endif() + # Assemble the Apple static framework (iOS and macOS) if(onnxruntime_BUILD_APPLE_FRAMEWORK) set(STATIC_LIB_DIR ${CMAKE_CURRENT_BINARY_DIR}/static_libraries)