mirror of
https://github.com/saymrwulf/onnxruntime.git
synced 2026-05-23 22:13:38 +00:00
### Description 1. Move C/C++ deps' URLs to deps.txt, and download the dependencies from Azure Devops Artifacts instead of github. 2. Add "EXCLUDE_FROM_ALL" keyword to the cmake external projects, so that we only build the parts we need and avoid installing the 3rd-party dependencies when people run `make install` in ORT's build directory. However, at this moment cmake itself doesn't have the feature. So I copied their code to cmake/external/helper_functions.cmake and modified it. This PR is split from #13523, to make that one smaller. ### Motivation and Context 1. Secure the supply chain 2. Make it be possible to automatically detect if ORT has an old dependency that hasn't been updated from a long time.
40 lines
1.6 KiB
CMake
40 lines
1.6 KiB
CMake
# Copyright (c) Microsoft Corporation. All rights reserved.
|
|
# Licensed under the MIT License.
|
|
|
|
include(FetchContent)
|
|
|
|
# Pass to build
|
|
set(ABSL_PROPAGATE_CXX_STD 1)
|
|
set(BUILD_TESTING 0)
|
|
|
|
if(Patch_FOUND)
|
|
set(ABSL_PATCH_COMMAND ${Patch_EXECUTABLE} --binary --ignore-whitespace -p1 < ${PROJECT_SOURCE_DIR}/patches/abseil/Fix_Nvidia_Build_Break.patch)
|
|
else()
|
|
set(ABSL_PATCH_COMMAND git apply --ignore-space-change --ignore-whitespace ${PROJECT_SOURCE_DIR}/patches/abseil/Fix_Nvidia_Build_Break.patch)
|
|
endif()
|
|
|
|
# NB! Advancing Abseil version changes its internal namespace,
|
|
# currently absl::lts_20211102 which affects abseil-cpp.natvis debugger
|
|
# visualization file, that must be adjusted accordingly, unless we eliminate
|
|
# that namespace at build time.
|
|
FetchContent_Declare(
|
|
abseil_cpp
|
|
PREFIX "${CMAKE_CURRENT_BINARY_DIR}/abseil-cpp"
|
|
BINARY_DIR "${CMAKE_CURRENT_BINARY_DIR}/external/abseil-cpp"
|
|
URL ${DEP_URL_abseil_cpp}
|
|
URL_HASH SHA1=${DEP_SHA1_abseil_cpp}
|
|
PATCH_COMMAND ${ABSL_PATCH_COMMAND}
|
|
)
|
|
|
|
onnxruntime_fetchcontent_makeavailable(abseil_cpp)
|
|
FetchContent_GetProperties(abseil_cpp)
|
|
set(ABSEIL_SOURCE_DIR ${abseil_cpp_SOURCE_DIR})
|
|
message(STATUS "Abseil source dir:" ${ABSEIL_SOURCE_DIR})
|
|
|
|
if (GDK_PLATFORM)
|
|
# Abseil considers any partition that is NOT in the WINAPI_PARTITION_APP a viable platform
|
|
# for Win32 symbolize code (which depends on dbghelp.lib); this logic should really be flipped
|
|
# to only include partitions that are known to support it (e.g. DESKTOP). As a workaround we
|
|
# tell Abseil to pretend we're building an APP.
|
|
target_compile_definitions(absl_symbolize PRIVATE WINAPI_FAMILY=WINAPI_FAMILY_DESKTOP_APP)
|
|
endif()
|