Enable delay loading hooker for python packages (#23227)

### Description
Enable delay loading hooker for python packages
This commit is contained in:
Changming Sun 2024-12-31 10:12:31 -08:00 committed by GitHub
parent 86870114eb
commit 69bb53db85
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -70,6 +70,9 @@ endif()
onnxruntime_add_shared_library_module(onnxruntime_pybind11_state ${onnxruntime_pybind_srcs})
if(MSVC)
# The following source file is only needed for the EPs that use delayloading. Namely, DML and WebGPU.
target_sources(onnxruntime_pybind11_state PRIVATE "${ONNXRUNTIME_ROOT}/core/dll/delay_load_hook.cc")
target_compile_options(onnxruntime_pybind11_state PRIVATE "$<$<COMPILE_LANGUAGE:CUDA>:SHELL:--compiler-options /utf-8>" "$<$<NOT:$<COMPILE_LANGUAGE:CUDA>>:/utf-8>")
target_compile_options(onnxruntime_pybind11_state PRIVATE "/bigobj")
endif()