From 4f5d6a0e4dbf5565f83bfebfcc028b5aedb4290b Mon Sep 17 00:00:00 2001 From: Tiago Koji Castro Shibata Date: Tue, 16 Mar 2021 19:06:40 -0700 Subject: [PATCH] Add ARM64X forwarder libs --- cmake/winml.cmake | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/cmake/winml.cmake b/cmake/winml.cmake index 436ef5ca45..2429aefa2c 100644 --- a/cmake/winml.cmake +++ b/cmake/winml.cmake @@ -828,3 +828,31 @@ endif() # However, there are no cuda imports in winml_dll, and the linker throws the 4199 warning. # This is needed to allow winml_dll build with cuda enabled. target_link_options(winml_dll PRIVATE /ignore:4199) + +if (winml_is_inbox) + # 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) + + 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}) + endfunction() + if (WAI_ARCH STREQUAL x64 OR WAI_ARCH STREQUAL arm64) + if (TARGET winml_dll) + duplicate_shared_library(winml_dll Windows_ai_machinelearning_${WAI_ARCH}) + target_compile_features(Windows_ai_machinelearning_${WAI_ARCH} PRIVATE cxx_std_17) + target_precompiled_header(Windows_ai_machinelearning_${WAI_ARCH} pch.h) + endif() + if (TARGET onnxruntime) + duplicate_shared_library(onnxruntime onnxruntime_${WAI_ARCH}) + endif() + endif() +endif()