mirror of
https://github.com/saymrwulf/onnxruntime.git
synced 2026-07-30 20:18:08 +00:00
Dev/mookerem/arm64x update (#20536)
Made some changes to the arm64x.cmake script to: - handle edge case - Enable Projects that include onnxruntime as submodule and build it, to be able to build as x without causing onnxruntime build_as_x to fail.
This commit is contained in:
parent
d121a1f906
commit
aff04ba08a
2 changed files with 24 additions and 21 deletions
|
|
@ -1829,5 +1829,5 @@ endif()
|
|||
|
||||
if(DEFINED BUILD_AS_ARM64X)
|
||||
set(ARM64X_TARGETS onnxruntime)
|
||||
include("${CMAKE_SOURCE_DIR}/arm64x.cmake")
|
||||
include("${CMAKE_CURRENT_SOURCE_DIR}/arm64x.cmake")
|
||||
endif()
|
||||
|
|
|
|||
|
|
@ -1,33 +1,36 @@
|
|||
set(arm64ReproDir "${CMAKE_SOURCE_DIR}/repros")
|
||||
set(arm64ReproDir "${CMAKE_CURRENT_SOURCE_DIR}/repros")
|
||||
|
||||
function(set_arm64_dependencies n)
|
||||
set(ARM64_LIBS)
|
||||
set(ARM64_OBJS)
|
||||
set(ARM64_DEF)
|
||||
set(REPRO_PATH "${arm64ReproDir}/${n}")
|
||||
if(NOT EXISTS "${REPRO_PATH}")
|
||||
set(REPRO_PATH "${arm64ReproDir}/${n}_temp")
|
||||
endif()
|
||||
file(GLOB ARM64_OBJS "${REPRO_PATH}/*.obj")
|
||||
file(GLOB ARM64_DEF "${REPRO_PATH}/*.def")
|
||||
file(GLOB ARM64_LIBS "${REPRO_PATH}/*.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}" "${ARM64_LIBS}")
|
||||
endfunction()
|
||||
|
||||
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})
|
||||
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}\" WORKING_DIRECTORY ${arm64ReproDir})
|
||||
add_dependencies(${n}_checkRepro ${n})
|
||||
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()
|
||||
set_arm64_dependencies(${n})
|
||||
endforeach()
|
||||
endif()
|
||||
|
|
|
|||
Loading…
Reference in a new issue