forked from microsoft/onnxruntime
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Build onnxruntime.dll as arm64x (microsoft#18633)
Build onnxruntime.dll as arm64x Added a .cmake file to generate a link repro of the onnxruntime.dll during arm64 build. This provides us a directory containing all the arm64 objs, def file and libs to link to when it is time to building arm64x onnxruntime.dll during the arm64ec build by passing the /machine:arm64x flag to the linker along with the arm64 artifacts. If other dlls wanted to be built as x, setting the ARM64X_TARGETS variable in the toplevel cmakelists.txt to include these other targets is all that will be needed. Added build_arm64x.bat as a wrapper for the multiple (rm64, then arm64ec) cmake calls needed to build as arm64x. AB#22533
- Loading branch information
Showing
5 changed files
with
61 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -195,3 +195,4 @@ Package.pins | |
Package.resolved | ||
.build/ | ||
.swiftpm/ | ||
repros/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
:: Copyright (c) Microsoft Corporation. All rights reserved. | ||
:: Licensed under the MIT License. | ||
|
||
@echo off | ||
|
||
setlocal | ||
set PATH=C:\Program Files\Git\usr\bin;%PATH% | ||
set LINK_REPRO_NAME=/mylink.rsp | ||
|
||
rem Requires a Python install to be available in your PATH | ||
python "%~dp0\tools\ci_build\build.py" --arm64 --buildasx --build_dir "%~dp0\build\arm64-x" %* | ||
python "%~dp0\tools\ci_build\build.py" --arm64ec --buildasx --build_dir "%~dp0\build\arm64ec-x" %* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
set(arm64ReproDir "${CMAKE_SOURCE_DIR}/repros") | ||
|
||
if("${BUILD_AS_ARM64X}" STREQUAL "ARM64") | ||
foreach (n ${ARM64X_TARGETS}) | ||
add_custom_target(mkdirs_${n} ALL COMMAND cmd /c (if exist \"${arm64ReproDir}/${n}_temp/\" rmdir /s /q \"${arm64ReproDir}/${n}_temp\") && mkdir \"${arm64ReproDir}/${n}_temp\" ) | ||
add_dependencies(${n} mkdirs_${n}) | ||
target_link_options(${n} PRIVATE "/LINKREPRO:${arm64ReproDir}/${n}_temp") | ||
add_custom_target(${n}_checkRepro ALL COMMAND cmd /c if exist \"${n}_temp/*.obj\" if exist \"${n}\" rmdir /s /q \"${n}\" 2>nul && if not exist \"${n}\" ren \"${n}_temp\" \"${n}\" DEPENDS ${n} | ||
WORKING_DIRECTORY ${arm64ReproDir}) | ||
endforeach() | ||
|
||
|
||
elseif("${BUILD_AS_ARM64X}" STREQUAL "ARM64EC") | ||
foreach (n ${ARM64X_TARGETS}) | ||
set(ARM64_LIBS) | ||
set(ARM64_OBJS) | ||
set(ARM64_DEF) | ||
|
||
file(GLOB ARM64_OBJS "${arm64ReproDir}/${n}/*.obj") | ||
file(GLOB ARM64_DEF "${arm64ReproDir}/${n}/*.def") | ||
file(GLOB ARM64_LIBS "${arm64ReproDir}/${n}/*.LIB") | ||
|
||
if(NOT "${ARM64_DEF}" STREQUAL "") | ||
set(ARM64_DEF "/defArm64Native:${ARM64_DEF}") | ||
endif() | ||
target_sources(${n} PRIVATE ${ARM64_OBJS}) | ||
target_link_options(${n} PRIVATE /machine:arm64x "${ARM64_DEF}") | ||
|
||
if(NOT "${ARM64_LIBS}" STREQUAL "") | ||
target_link_libraries(${n} PUBLIC ${ARM64_LIBS}) | ||
endif() | ||
endforeach() | ||
endif() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters