mirror of
https://github.com/saymrwulf/onnxruntime.git
synced 2026-05-18 21:21:17 +00:00
### Description 1. Enable VCPKG flag in Windows CPU CI build pipelines. 2. Increased the min supported cmake version from 3.26 to 3.28. Because of it, drop the support for the old way of finding python by "find_package(PythonLibs)". Therefore, in build.py we no longer set "PYTHON_EXECUTABLE" cmake var when doing cmake configure. 3. Added "xnnpack-ep" as a feature for ORT's vcpkg config. 4. Added asset cache support for ORT's vcpkg build 5. Added VCPKG triplet files for Android build. 6. Set VCPKG triplet to "universal2-osx" if CMAKE_OSX_ARCHITECTURES was found in cmake extra defines. 7. Removed a small piece of code in build.py, which was for support CUDA version < 11.8. 8. Fixed an issue that CMAKE_OSX_ARCHITECTURES sometimes got specified twice when build.py invoked cmake. 9. Added more model tests to Android build. After this change, we will test all ONNX versions instead of just the latest one. 10. Fixed issues that are related to build.py's "--build_nuget" parameter. Also, enable the flag in most Windows CPU CI build jobs. 11. Removed a restriction in build.py that disallowed cross-compiling Windows ARM64 nuget package on Windows x86. ### Motivation and Context Adopt vcpkg.
47 lines
2.6 KiB
CMake
47 lines
2.6 KiB
CMake
# This file contains some wrappers for cmake's FetchContent functions. The wrappers added the following functionalities:
|
|
# 1. Group the VC projects into the "external" folder. We can do it at there in a centralized way instead
|
|
# of doing it one by one.
|
|
# 2. Set the cmake property COMPILE_WARNING_AS_ERROR to OFF for these external projects.
|
|
|
|
function(onnxruntime_fetchcontent_declare contentName)
|
|
FetchContent_Declare(${ARGV})
|
|
string(TOLOWER ${contentName} contentNameLower)
|
|
list(FIND ARGN SOURCE_SUBDIR index_SOURCE_SUBDIR)
|
|
if(index_SOURCE_SUBDIR GREATER_EQUAL 0)
|
|
cmake_parse_arguments(PARSE_ARGV 1 ARG "" "SOURCE_SUBDIR" "")
|
|
set(onnxruntime_${contentNameLower}_cmake_src_dir "${ARG_SOURCE_SUBDIR}" PARENT_SCOPE)
|
|
endif()
|
|
endfunction()
|
|
|
|
macro(onnxruntime_fetchcontent_makeavailable)
|
|
set(ONNXRUNTIME_CMAKE_SKIP_INSTALL_RULES_OLD_VALUE
|
|
"${CMAKE_SKIP_INSTALL_RULES}")
|
|
# If we don't skip the install rules we will hit errors from re2 like:
|
|
# CMake Error: install(EXPORT "re2Targets" ...) includes target "re2" which requires target "absl_base" that is not in any export set.
|
|
set(CMAKE_SKIP_INSTALL_RULES TRUE)
|
|
FetchContent_MakeAvailable(${ARGV})
|
|
foreach(contentName IN ITEMS ${ARGV})
|
|
string(TOLOWER ${contentName} contentNameLower)
|
|
set(content_src_dir "${${contentNameLower}_SOURCE_DIR}")
|
|
if(NOT "${onnxruntime_${contentNameLower}_cmake_src_dir}" STREQUAL "")
|
|
string(APPEND content_src_dir "/${onnxruntime_${contentNameLower}_cmake_src_dir}")
|
|
get_property(subdir_import_targets DIRECTORY "${content_src_dir}" PROPERTY BUILDSYSTEM_TARGETS)
|
|
foreach(subdir_target ${subdir_import_targets})
|
|
if(TARGET ${subdir_target})
|
|
get_target_property(subdir_target_type ${subdir_target} TYPE)
|
|
if(subdir_target_type STREQUAL "EXECUTABLE")
|
|
get_target_property(subdir_target_osx_arch ${subdir_target} OSX_ARCHITECTURES)
|
|
if (subdir_target_osx_arch)
|
|
if (NOT ${CMAKE_HOST_SYSTEM_PROCESSOR} IN_LIST subdir_target_osx_arch)
|
|
message("Added an executable target ${subdir_target} but it can not run natively on ${CMAKE_HOST_SYSTEM_PROCESSOR}, we will try to modify it")
|
|
endif()
|
|
endif()
|
|
endif()
|
|
set_target_properties(${subdir_target} PROPERTIES FOLDER "External")
|
|
set_target_properties(${subdir_target} PROPERTIES COMPILE_WARNING_AS_ERROR OFF)
|
|
endif()
|
|
endforeach()
|
|
endif()
|
|
endforeach()
|
|
set(CMAKE_SKIP_INSTALL_RULES ${ONNXRUNTIME_CMAKE_SKIP_INSTALL_RULES_OLD_VALUE})
|
|
endmacro()
|