Enable VCPKG in more pipelines (#23590)

### Description
Enable VCPKG in more pipelines
This commit is contained in:
Changming Sun 2025-02-06 10:10:31 -08:00 committed by GitHub
parent 6728d6085d
commit 328a13c06d
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
26 changed files with 37 additions and 52 deletions

View file

@ -600,6 +600,7 @@ endif()
if(onnxruntime_ENABLE_DLPACK)
message(STATUS "dlpack is enabled.")
onnxruntime_fetchcontent_declare(
dlpack
URL ${DEP_URL_dlpack}
@ -607,9 +608,7 @@ if(onnxruntime_ENABLE_DLPACK)
EXCLUDE_FROM_ALL
FIND_PACKAGE_ARGS NAMES dlpack
)
# We can't use onnxruntime_fetchcontent_makeavailable since some part of the the dlpack code is Linux only.
# For example, dlpackcpp.h uses posix_memalign.
FetchContent_Populate(dlpack)
onnxruntime_fetchcontent_makeavailable(dlpack)
endif()
if(onnxruntime_ENABLE_TRAINING OR (onnxruntime_ENABLE_TRAINING_APIS AND onnxruntime_BUILD_UNIT_TESTS))

View file

@ -77,8 +77,7 @@ endif()
if (onnxruntime_ENABLE_TRAINING_OPS)
target_include_directories(onnxruntime_framework PRIVATE ${ORTTRAINING_ROOT})
if (onnxruntime_ENABLE_TRAINING_TORCH_INTEROP OR onnxruntime_ENABLE_TRITON)
onnxruntime_add_include_to_target(onnxruntime_framework Python::Module)
target_include_directories(onnxruntime_framework PRIVATE ${dlpack_SOURCE_DIR}/include)
onnxruntime_add_include_to_target(onnxruntime_framework Python::Module dlpack::dlpack)
endif()
endif()
if (onnxruntime_USE_MPI)
@ -86,9 +85,7 @@ if (onnxruntime_USE_MPI)
endif()
if (onnxruntime_ENABLE_ATEN)
# DLPack is a header-only dependency
set(DLPACK_INCLUDE_DIR ${dlpack_SOURCE_DIR}/include)
target_include_directories(onnxruntime_framework PRIVATE ${DLPACK_INCLUDE_DIR})
onnxruntime_add_include_to_target(onnxruntime_framework dlpack::dlpack)
endif()
onnxruntime_add_include_to_target(onnxruntime_framework onnxruntime_common onnx onnx_proto ${PROTOBUF_LIB} flatbuffers::flatbuffers safeint_interface Boost::mp11 nlohmann_json::nlohmann_json)

View file

@ -196,8 +196,7 @@ endif()
if (onnxruntime_ENABLE_DLPACK)
target_compile_definitions(onnxruntime_providers PRIVATE ENABLE_DLPACK)
# DLPack is a header-only dependency
set(DLPACK_INCLUDE_DIR ${dlpack_SOURCE_DIR}/include)
target_include_directories(onnxruntime_providers PRIVATE ${DLPACK_INCLUDE_DIR})
onnxruntime_add_include_to_target(onnxruntime_providers dlpack::dlpack)
endif()
if (onnxruntime_ENABLE_TRAINING)

View file

@ -131,7 +131,7 @@ if (onnxruntime_ENABLE_ATEN)
endif()
if (onnxruntime_ENABLE_DLPACK)
target_include_directories(onnxruntime_pybind11_state PRIVATE ${dlpack_SOURCE_DIR}/include)
target_link_libraries(onnxruntime_pybind11_state PRIVATE dlpack::dlpack)
endif()
if (onnxruntime_ENABLE_TRAINING)

View file

@ -93,7 +93,9 @@ def _build_aar(args):
aar_dir = os.path.join(intermediates_dir, "aar", build_config)
jnilibs_dir = os.path.join(intermediates_dir, "jnilibs", build_config)
exe_dir = os.path.join(intermediates_dir, "executables", build_config)
base_build_command = [sys.executable, BUILD_PY] + build_settings["build_params"] + ["--config=" + build_config]
base_build_command = (
[sys.executable, BUILD_PY] + build_settings["build_params"] + ["--config=" + build_config, "--use_vcpkg"]
)
header_files_path = ""
if qnn_android_build:

View file

@ -71,7 +71,7 @@ jobs:
--android_ndk_path $ANDROID_NDK_HOME \
--android_abi=x86_64 \
--android_api=31 \
--parallel \
--parallel --use_vcpkg \
--build_shared_lib \
--use_qnn static_lib \
--qnn_home $(QnnSDKRootDir) \

View file

@ -97,7 +97,7 @@ stages:
--android_abi=x86_64 \
--android_api=30 \
--skip_submodule_sync \
--parallel \
--parallel --use_vcpkg \
--cmake_generator=Ninja \
--build_java
displayName: CPU EP, Build and Test
@ -158,7 +158,7 @@ stages:
--android_abi=x86_64 \
--android_api=29 \
--skip_submodule_sync \
--parallel \
--parallel --use_vcpkg \
--use_nnapi \
--build_shared_lib \
--cmake_generator=Ninja \
@ -218,7 +218,7 @@ stages:
--android_abi=x86_64 \
--android_api=29 \
--skip_submodule_sync \
--parallel \
--parallel --use_vcpkg \
--use_nnapi \
--build_shared_lib \
--cmake_generator=Ninja \

View file

@ -98,7 +98,7 @@ stages:
--config Release --update --build \
--skip_submodule_sync \
--build_shared_lib \
--parallel \
--parallel --use_vcpkg \
--build_wheel \
--enable_onnx_tests --use_cuda --cuda_version=11.8 --cuda_home=/usr/local/cuda-11.8 --cudnn_home=/usr/local/cuda-11.8 \
--enable_cuda_profiling \

View file

@ -83,7 +83,7 @@ stages:
--config Debug \
--skip_submodule_sync \
--build_shared_lib \
--parallel \
--parallel --use_vcpkg \
--enable_onnx_tests --enable_address_sanitizer \
--update --build;
python3 /onnxruntime_src/tools/ci_build/build.py \
@ -91,7 +91,7 @@ stages:
--config Debug \
--skip_submodule_sync \
--build_shared_lib \
--parallel \
--parallel --use_vcpkg \
--enable_onnx_tests --enable_address_sanitizer \
--test;
'
@ -199,7 +199,7 @@ stages:
--config Release \
--skip_submodule_sync \
--build_shared_lib \
--parallel --use_binskim_compliant_compile_flags \
--parallel --use_vcpkg --use_binskim_compliant_compile_flags \
--build_wheel \
--build_csharp \
--enable_onnx_tests \

View file

@ -67,7 +67,7 @@ jobs:
--config Debug Release \
--skip_submodule_sync \
--build_shared_lib \
--parallel \
--parallel --use_vcpkg \
--enable_pybind \
--enable_onnx_tests \
--build_java \

View file

@ -209,7 +209,7 @@ stages:
cd /onnxruntime_src/java && /onnxruntime_src/java/gradlew cmakeCheck -DcmakeBuildDir=/build/Release -DUSE_CUDA=1; \
cd /tmp; \
python3 /onnxruntime_src/tools/ci_build/build.py \
--build_dir /build --config Release --test --skip_submodule_sync --build_shared_lib --parallel --use_binskim_compliant_compile_flags --build_wheel --enable_onnx_tests \
--build_dir /build --config Release --test --skip_submodule_sync --build_shared_lib --parallel --use_vcpkg --use_binskim_compliant_compile_flags --build_wheel --enable_onnx_tests \
--enable_transformers_tool_test --use_cuda --cuda_version=${{parameters.CudaVersion}} --cuda_home=/usr/local/cuda --cudnn_home=/usr/local/cuda \
--enable_pybind --build_java --ctest_path "" ; \
'

View file

@ -74,7 +74,7 @@ jobs:
--use_qnn $(QnnLibKind) \
--qnn_home $(QnnSDKRootDir) \
--cmake_generator=Ninja \
--update --build --parallel
--update --build --parallel --use_vcpkg
displayName: Build QNN EP
- script: |
@ -87,7 +87,7 @@ jobs:
--use_qnn $(QnnLibKind) \
--qnn_home $(QnnSDKRootDir) \
--cmake_generator=Ninja \
--test
--test --use_vcpkg
displayName: Run unit tests
- task: CmdLine@2

View file

@ -197,7 +197,7 @@ jobs:
--enable_nccl \
--build_dir /build \
--build_shared_lib \
--parallel \
--parallel --use_vcpkg \
--build_wheel \
--skip_submodule_sync \
--test --enable_onnx_tests --enable_transformers_tool_test \

View file

@ -58,7 +58,7 @@ jobs:
--build_dir build \
--skip_submodule_sync \
--cmake_generator=Ninja \
--parallel --use_binskim_compliant_compile_flags \
--parallel --use_vcpkg --use_binskim_compliant_compile_flags \
--build_shared_lib \
--config Debug \
--use_cache \

View file

@ -98,7 +98,7 @@ stages:
- ${{ else }}:
- powershell: |
python tools\ci_build\build.py ${{ parameters.BuildCommand }} --use_binskim_compliant_compile_flags --parallel --build_csharp --build --update --config $(BuildConfig) --build_nuget --msbuild_extra_options IncludeMobileTargets=false ${{ variables.build_py_lto_flag }}
python tools\ci_build\build.py ${{ parameters.BuildCommand }} --use_binskim_compliant_compile_flags --parallel --use_vcpkg --build_csharp --build --update --config $(BuildConfig) --build_nuget --msbuild_extra_options IncludeMobileTargets=false ${{ variables.build_py_lto_flag }}
- ${{ if notIn(parameters['sln_platform'], 'Win32', 'x64') }}:
# Use cross-compiled protoc

View file

@ -229,7 +229,7 @@ stages:
set -e -x
export _PYTHON_HOST_PLATFORM=macosx-${{variables.MACOSX_DEPLOYMENT_TARGET}}-universal2
python3 -m pip install -r '$(Build.SourcesDirectory)/tools/ci_build/github/linux/docker/scripts/requirements.txt'
python3 $(Build.SourcesDirectory)/tools/ci_build/build.py --build_dir $(Build.BinariesDirectory) --use_coreml --skip_submodule_sync --parallel --use_binskim_compliant_compile_flags --config Release --build_wheel ${{ parameters.build_py_parameters }} --use_coreml --cmake_extra_defines CMAKE_OSX_ARCHITECTURES="arm64;x86_64" --update --build
python3 $(Build.SourcesDirectory)/tools/ci_build/build.py --build_dir $(Build.BinariesDirectory) --use_coreml --skip_submodule_sync --parallel --use_vcpkg --use_binskim_compliant_compile_flags --config Release --build_wheel ${{ parameters.build_py_parameters }} --use_coreml --cmake_extra_defines CMAKE_OSX_ARCHITECTURES="arm64;x86_64" --update --build
displayName: 'Command Line Script'
- script: |

View file

@ -125,7 +125,7 @@ stages:
--cmake_generator "$(VSGenerator)"
--enable_pybind
--enable_onnx_tests
--parallel 8 --use_binskim_compliant_compile_flags --update --build --msvc_toolset 14.40
--parallel 8 --use_vcpkg --use_binskim_compliant_compile_flags --update --build --msvc_toolset 14.40
$(TelemetryOption) ${{ parameters.BUILD_PY_PARAMETERS }} ${{ parameters.EP_BUILD_FLAGS }} ${{ variables.trt_build_flag }}
workingDirectory: '$(Build.BinariesDirectory)'

View file

@ -66,7 +66,7 @@ jobs:
docker run --rm --volume /data/onnx:/data/onnx:ro --volume $(Build.SourcesDirectory):/onnxruntime_src --volume $(Build.BinariesDirectory):/build \
--volume $HOME/.onnx:/home/onnxruntimedev/.onnx -e NIGHTLY_BUILD onnxruntimecpubuildcentos8${{parameters.OnnxruntimeArch}}_packaging /bin/bash -c "python3 \
/onnxruntime_src/tools/ci_build/build.py --enable_lto --build_java --build_nodejs --build_dir /build --config Release \
--skip_submodule_sync --parallel --use_binskim_compliant_compile_flags --use_vcpkg --build_shared_lib ${{ parameters.AdditionalBuildFlags }} && cd /build/Release && make install DESTDIR=/build/installed"
--skip_submodule_sync --parallel --use_vcpkg --use_binskim_compliant_compile_flags --use_vcpkg --build_shared_lib ${{ parameters.AdditionalBuildFlags }} && cd /build/Release && make install DESTDIR=/build/installed"
mkdir $(Build.ArtifactStagingDirectory)/testdata
cp $(Build.BinariesDirectory)/Release/libcustom_op_library.so* $(Build.ArtifactStagingDirectory)/testdata
ls -al $(Build.ArtifactStagingDirectory)

View file

@ -48,7 +48,7 @@ steps:
- script: |
set -e -x
rm -rf $(Build.BinariesDirectory)/Release
python3 $(Build.SourcesDirectory)/tools/ci_build/build.py --update --build ${{ parameters.AdditionalBuildFlags }} --build_dir $(Build.BinariesDirectory) --skip_submodule_sync --parallel --use_binskim_compliant_compile_flags --build_shared_lib --config Release --use_vcpkg
python3 $(Build.SourcesDirectory)/tools/ci_build/build.py --update --build ${{ parameters.AdditionalBuildFlags }} --build_dir $(Build.BinariesDirectory) --skip_submodule_sync --parallel --use_vcpkg --use_binskim_compliant_compile_flags --build_shared_lib --config Release --use_vcpkg
cd $(Build.BinariesDirectory)/Release
make install DESTDIR=$(Build.BinariesDirectory)/installed
displayName: 'Build ${{ parameters.MacosArch }}'

View file

@ -98,7 +98,7 @@ jobs:
--use_qnn
--qnn_home $(QnnSDKRootDir)
--enable_pybind
--parallel --update
--parallel --use_vcpkg --update
$(TelemetryOption) ${{ parameters.BUILD_PY_PARAMETERS }}
workingDirectory: '$(Build.BinariesDirectory)'

View file

@ -83,7 +83,7 @@ jobs:
--use_qnn
--qnn_home $(QnnSDKRootDir)
--enable_pybind
--parallel --update --arm64ec
--parallel --use_vcpkg --update --arm64ec
$(TelemetryOption) ${{ parameters.BUILD_PY_PARAMETERS }}
workingDirectory: '$(Build.BinariesDirectory)'

View file

@ -76,7 +76,7 @@ jobs:
--use_qnn
--qnn_home $(QnnSDKRootDir)
--enable_pybind
--parallel --update
--parallel --use_vcpkg --update
$(TelemetryOption) ${{ parameters.BUILD_PY_PARAMETERS }}
workingDirectory: '$(Build.BinariesDirectory)'

View file

@ -89,7 +89,7 @@ jobs:
--rocm_home=/opt/rocm \
--nccl_home=/opt/rocm \
--update \
--parallel \
--parallel --use_vcpkg \
--build_dir /build \
--build \
--build_wheel \

View file

@ -161,22 +161,10 @@ stages:
displayName: 'Generate cmake config'
inputs:
scriptPath: '$(Build.SourcesDirectory)\tools\ci_build\build.py'
arguments: '--config RelWithDebInfo --use_binskim_compliant_compile_flags --enable_lto --disable_rtti --build_dir $(Build.BinariesDirectory) --skip_submodule_sync --build_shared_lib --update --cmake_generator "$(VSGenerator)" --enable_onnx_tests $(TelemetryOption) ${{ parameters.buildparameter }} $(timeoutParameter) $(buildJavaParameter)'
arguments: '--config RelWithDebInfo --use_binskim_compliant_compile_flags --enable_lto --disable_rtti --build_dir $(Build.BinariesDirectory) --skip_submodule_sync --build_shared_lib --update --build --use_vcpkg --cmake_generator "$(VSGenerator)" --enable_onnx_tests $(TelemetryOption) ${{ parameters.buildparameter }} $(timeoutParameter) $(buildJavaParameter)'
workingDirectory: '$(Build.BinariesDirectory)'
- task: VSBuild@1
displayName: 'Build'
inputs:
solution: '$(Build.BinariesDirectory)\RelWithDebInfo\onnxruntime.sln'
platform: ${{ parameters.msbuildPlatform }}
configuration: RelWithDebInfo
msbuildArchitecture: ${{ parameters.buildArch }}
maximumCpuCount: true # default is num logical cores worth of projects building concurrently
logProjectEvents: true
workingFolder: '$(Build.BinariesDirectory)\RelWithDebInfo'
createLogFile: true
# For CPU job, tests are run in the same machine as building
- ${{ if eq(parameters.buildJava, 'true') }}:
- template: make_java_win_binaries.yml

View file

@ -106,7 +106,7 @@ stages:
parameters:
BuildConfig: 'RelWithDebInfo'
buildArch: x64
additionalBuildFlags: --build_wheel --use_dnnl
additionalBuildFlags: --build_wheel --use_dnnl --use_vcpkg
msbuildPlatform: x64
isX86: false
job_name_suffix: x64_release

View file

@ -12,7 +12,7 @@ RUN echo "$APT_PREF" > /etc/apt/preferences.d/rocm-pin-600
ENV DEBIAN_FRONTEND noninteractive
RUN apt-get update && \
apt-get install -y --no-install-recommends ca-certificates curl libnuma-dev gnupg && \
apt-get install -y --no-install-recommends ca-certificates ninja-build git zip curl libnuma-dev gnupg && \
curl -sL https://repo.radeon.com/rocm/rocm.gpg.key | apt-key add - &&\
printf "deb [arch=amd64] https://repo.radeon.com/rocm/apt/$ROCM_VERSION/ jammy main" | tee /etc/apt/sources.list.d/rocm.list && \
printf "deb [arch=amd64] https://repo.radeon.com/amdgpu/$AMDGPU_VERSION/ubuntu jammy main" | tee /etc/apt/sources.list.d/amdgpu.list && \
@ -45,10 +45,10 @@ ENV LANG C.UTF-8
WORKDIR /stage
# Cmake
ENV CMAKE_VERSION=3.30.1
ENV CMAKE_VERSION=3.31.5
RUN cd /usr/local && \
wget -q https://github.com/Kitware/CMake/releases/download/v${CMAKE_VERSION}/cmake-${CMAKE_VERSION}-Linux-x86_64.tar.gz && \
tar -zxf /usr/local/cmake-3.30.1-Linux-x86_64.tar.gz --strip=1 -C /usr
tar -zxf /usr/local/cmake-3.31.5-Linux-x86_64.tar.gz --strip=1 -C /usr
# ccache
RUN mkdir -p /tmp/ccache && \