Skip to content

Commit

Permalink
Enable VCPKG in CI build
Browse files Browse the repository at this point in the history
  • Loading branch information
snnn committed Jan 18, 2025
1 parent 7c90a9b commit 93bde28
Show file tree
Hide file tree
Showing 193 changed files with 996 additions and 1,487 deletions.
6 changes: 0 additions & 6 deletions .github/workflows/sca.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,6 @@ jobs:
run: azcopy.exe cp --recursive "https://lotusscus.blob.core.windows.net/models/cuda_sdk/v11.8" cuda_sdk


- name: Install ONNX
run: |
&tools\ci_build\github\windows\install_third_party_deps.ps1 -cpu_arch x64 -install_prefix D:\b\Debug\installed -build_config Debug
# The build machine doesn't have a GPU. So the value of CMAKE_CUDA_ARCHITECTURES doesn't matter.
- name: Build code
env:
Expand Down Expand Up @@ -117,7 +113,6 @@ jobs:
- name: Delete build folder
run: |
if (Test-Path D:\b) { Remove-Item -Recurse -Force D:\b }
&tools\ci_build\github\windows\install_third_party_deps.ps1 -cpu_arch x64 -install_prefix D:\b\Debug\installed -build_config Debug
# The build machine doesn't have a GPU. So the value of CMAKE_CUDA_ARCHITECTURES doesn't matter.
- name: Build code
Expand Down Expand Up @@ -157,7 +152,6 @@ jobs:
- name: Delete build folder
run: |
if (Test-Path D:\b) { Remove-Item -Recurse -Force D:\b }
&tools\ci_build\github\windows\install_third_party_deps.ps1 -cpu_arch x86 -install_prefix D:\b\Debug\installed -build_config Debug
# The build machine doesn't have a GPU. So the value of CMAKE_CUDA_ARCHITECTURES doesn't matter.
- name: Build code
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ jobs:
- name: Delete build folder
run: |
if (Test-Path D:\b) { Remove-Item -Recurse -Force D:\b }
&tools\ci_build\github\windows\install_third_party_deps.ps1 -cpu_arch x64 -install_prefix D:\b\Debug\installed -build_config Debug
# The build machine doesn't have a GPU. So the value of CMAKE_CUDA_ARCHITECTURES doesn't matter.
- name: Build code
Expand Down
14 changes: 11 additions & 3 deletions cmake/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -958,7 +958,7 @@ if (onnxruntime_USE_QNN)

if (MSVC OR ${CMAKE_SYSTEM_NAME} STREQUAL "Linux")
file(GLOB QNN_LIB_FILES LIST_DIRECTORIES false "${onnxruntime_QNN_HOME}/lib/${QNN_ARCH_ABI}/libQnn*.so"
"${onnxruntime_QNN_HOME}/lib/${QNN_ARCH_ABI}/Qnn*.dll"
"${onnxruntime_QNN_HOME}/lib/${QNN_ARCH_ABI}/Qnn*.dll"
"${onnxruntime_QNN_HOME}/lib/${QNN_ARCH_ABI}/libHtpPrepare.so"
"${onnxruntime_QNN_HOME}/lib/${QNN_ARCH_ABI}/HtpPrepare.dll")
if (${QNN_ARCH_ABI} STREQUAL "aarch64-windows-msvc" OR ${QNN_ARCH_ABI} STREQUAL "arm64x-windows-msvc")
Expand Down Expand Up @@ -1122,7 +1122,10 @@ function(onnxruntime_set_compile_flags target_name)
foreach(CMAKE_CUDA_TOOLKIT_INCLUDE_DIRECTORY ${CMAKE_CUDA_TOOLKIT_INCLUDE_DIRECTORIES})
target_compile_options(${target_name} PRIVATE "$<$<COMPILE_LANGUAGE:CXX,C>:/external:I${CMAKE_CUDA_TOOLKIT_INCLUDE_DIRECTORY}>")
endforeach()

if(VCPKG_INSTALLED_DIR)
cmake_path(NATIVE_PATH VCPKG_INSTALLED_DIR NORMALIZE VCPKG_INSTALLED_DIR_native)
target_compile_options(${target_name} PRIVATE "$<$<COMPILE_LANGUAGE:CXX,C>:SHELL:/external:I ${VCPKG_INSTALLED_DIR}>")
endif()
foreach(onnxruntime_external_lib IN LISTS onnxruntime_EXTERNAL_LIBRARIES)
#TODO: the list contains cmake keywords like "debug". We should exclude them.
if(TARGET ${onnxruntime_external_lib})
Expand Down Expand Up @@ -1152,7 +1155,9 @@ function(onnxruntime_set_compile_flags target_name)
# We do not treat warnings from 3rd-party libraries as errors. In order to do that, we need to add their header files locations to /external:I.
target_compile_options(${target_name} PRIVATE "$<$<COMPILE_LANGUAGE:CXX,C>:/experimental:external>" "$<$<COMPILE_LANGUAGE:CUDA>:SHELL:--compiler-options /experimental:external>")
target_compile_options(${target_name} PRIVATE "$<$<COMPILE_LANGUAGE:CXX,C>:/external:W0>" "$<$<COMPILE_LANGUAGE:CUDA>:SHELL:--compiler-options /external:W0>")
target_compile_options(${target_name} PRIVATE "$<$<COMPILE_LANGUAGE:CXX,C>:/external:templates->" "$<$<COMPILE_LANGUAGE:CUDA>:SHELL:--compiler-options /external:templates->")
#if(NOT onnxruntime_USE_VCPKG)
# target_compile_options(${target_name} PRIVATE "$<$<COMPILE_LANGUAGE:CXX,C>:/external:templates->" "$<$<COMPILE_LANGUAGE:CUDA>:SHELL:--compiler-options /external:templates->")
#endif()
target_compile_options(${target_name} PRIVATE "$<$<COMPILE_LANGUAGE:CXX,C>:/external:I${CMAKE_CURRENT_SOURCE_DIR}>" "$<$<COMPILE_LANGUAGE:CUDA>:SHELL:--compiler-options /external:I${CMAKE_CURRENT_SOURCE_DIR}>")
target_compile_options(${target_name} PRIVATE "$<$<COMPILE_LANGUAGE:CXX,C>:/external:I${CMAKE_CURRENT_BINARY_DIR}>" "$<$<COMPILE_LANGUAGE:CUDA>:SHELL:--compiler-options /external:I${CMAKE_CURRENT_BINARY_DIR}>")
if (onnxruntime_ENABLE_STATIC_ANALYSIS)
Expand Down Expand Up @@ -1713,6 +1718,9 @@ endif()


if (WIN32)
if (onnxruntime_USE_MIMALLOC)
list(APPEND onnxruntime_EXTERNAL_LIBRARIES mimalloc-static)
endif()
list(APPEND onnxruntime_EXTERNAL_LIBRARIES ${SYS_PATH_LIB})
list(APPEND onnxruntime_EXTERNAL_LIBRARIES debug Dbghelp)
# In a onecore build the umbrella libs already contains references to the APIs in advapi32, so in onecore build we do not need to link to advapi32
Expand Down
3 changes: 2 additions & 1 deletion cmake/external/abseil-cpp.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,13 @@ endif()
# currently absl::lts_20240116 which affects abseil-cpp.natvis debugger
# visualization file, that must be adjusted accordingly, unless we eliminate
# that namespace at build time.
FetchContent_Declare(
onnxruntime_fetchcontent_declare(
abseil_cpp
URL ${DEP_URL_abseil_cpp}
URL_HASH SHA1=${DEP_SHA1_abseil_cpp}
PATCH_COMMAND ${ABSL_PATCH_COMMAND}
FIND_PACKAGE_ARGS 20240722 NAMES absl
EXCLUDE_FROM_ALL
)

onnxruntime_fetchcontent_makeavailable(abseil_cpp)
Expand Down
3 changes: 2 additions & 1 deletion cmake/external/composable_kernel.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,12 @@ set(PATCH_CLANG ${PROJECT_SOURCE_DIR}/patches/composable_kernel/Fix_Clang_Build.
set(PATCH_GFX12X ${PROJECT_SOURCE_DIR}/patches/composable_kernel/Add_gfx12x_support.patch)

include(FetchContent)
FetchContent_Declare(composable_kernel
onnxruntime_fetchcontent_declare(composable_kernel
URL ${DEP_URL_composable_kernel}
URL_HASH SHA1=${DEP_SHA1_composable_kernel}
PATCH_COMMAND ${Patch_EXECUTABLE} --binary --ignore-whitespace -p1 < ${PATCH_CLANG} &&
${Patch_EXECUTABLE} --binary --ignore-whitespace -p1 < ${PATCH_GFX12X}
EXCLUDE_FROM_ALL
)

FetchContent_GetProperties(composable_kernel)
Expand Down
13 changes: 7 additions & 6 deletions cmake/external/cudnn_frontend.cmake
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
include(FetchContent)
FetchContent_Declare(

onnxruntime_fetchcontent_declare(
cudnn_frontend
URL ${DEP_URL_cudnn_frontend}
URL_HASH SHA1=${DEP_SHA1_cudnn_frontend}
EXCLUDE_FROM_ALL
)

set(CUDNN_FRONTEND_BUILD_SAMPLES OFF)
set(CUDNN_FRONTEND_BUILD_UNIT_TESTS OFF)
set(CUDNN_FRONTEND_BUILD_PYTHON_BINDINGS OFF)
set(CUDNN_FRONTEND_BUILD_SAMPLES OFF CACHE BOOL "" FORCE)
set(CUDNN_FRONTEND_BUILD_UNIT_TESTS OFF CACHE BOOL "" FORCE)
set(CUDNN_FRONTEND_BUILD_PYTHON_BINDINGS OFF CACHE BOOL "" FORCE)
set(CUDNN_PATH ${onnxruntime_CUDNN_HOME})
FetchContent_MakeAvailable(cudnn_frontend)
onnxruntime_fetchcontent_makeavailable(cudnn_frontend)
3 changes: 2 additions & 1 deletion cmake/external/cutlass.cmake
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
include(FetchContent)
FetchContent_Declare(
onnxruntime_fetchcontent_declare(
cutlass
URL ${DEP_URL_cutlass}
URL_HASH SHA1=${DEP_SHA1_cutlass}
EXCLUDE_FROM_ALL
)

FetchContent_GetProperties(cutlass)
Expand Down
3 changes: 2 additions & 1 deletion cmake/external/dml.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -100,10 +100,11 @@ else()
endif()
endif()

FetchContent_Declare(
onnxruntime_fetchcontent_declare(
directx_headers
URL ${DEP_URL_directx_headers}
URL_HASH SHA1=${DEP_SHA1_directx_headers}
EXCLUDE_FROM_ALL
)

FetchContent_Populate(directx_headers)
Expand Down
13 changes: 5 additions & 8 deletions cmake/external/eigen.cmake
Original file line number Diff line number Diff line change
@@ -1,24 +1,21 @@
if (onnxruntime_USE_PREINSTALLED_EIGEN)
add_library(eigen INTERFACE)
file(TO_CMAKE_PATH ${eigen_SOURCE_PATH} eigen_INCLUDE_DIRS)
target_include_directories(eigen INTERFACE ${eigen_INCLUDE_DIRS})
else ()
if(CMAKE_SYSTEM_NAME MATCHES "AIX")
FetchContent_Declare(
onnxruntime_fetchcontent_declare(
eigen
URL ${DEP_URL_eigen}
URL_HASH SHA1=${DEP_SHA1_eigen}
PATCH_COMMAND ${Patch_EXECUTABLE} --binary --ignore-whitespace -p1 < ${PROJECT_SOURCE_DIR}/patches/eigen/eigen-aix.patch
EXCLUDE_FROM_ALL
)
else()
FetchContent_Declare(
onnxruntime_fetchcontent_declare(
eigen
URL ${DEP_URL_eigen}
URL_HASH SHA1=${DEP_SHA1_eigen}
PATCH_COMMAND ${Patch_EXECUTABLE} --binary --ignore-whitespace -p1 < ${PROJECT_SOURCE_DIR}/patches/eigen/eigen-edge.patch
EXCLUDE_FROM_ALL
)
endif()

FetchContent_Populate(eigen)
set(eigen_INCLUDE_DIRS "${eigen_SOURCE_DIR}")
endif()

3 changes: 2 additions & 1 deletion cmake/external/extensions.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,11 @@ endif()

# onnxruntime-extensions
if (NOT onnxruntime_EXTENSIONS_OVERRIDDEN)
FetchContent_Declare(
onnxruntime_fetchcontent_declare(
extensions
URL ${DEP_URL_extensions}
URL_HASH SHA1=${DEP_SHA1_extensions}
EXCLUDE_FROM_ALL
)
onnxruntime_fetchcontent_makeavailable(extensions)
else()
Expand Down
Loading

0 comments on commit 93bde28

Please sign in to comment.