onnxruntime

Форк
0
/
onnxruntime_python.cmake 
1040 строк · 50.2 Кб
1
# Copyright (c) Microsoft Corporation. All rights reserved.
2
# Licensed under the MIT License.
3

4
include(pybind11)
5

6
# ---[ Python + Numpy
7
set(onnxruntime_pybind_srcs_pattern
8
    "${ONNXRUNTIME_ROOT}/python/*.cc"
9
    "${ONNXRUNTIME_ROOT}/python/*.h"
10
)
11

12
if (onnxruntime_ENABLE_TRAINING)
13
  list(APPEND onnxruntime_pybind_srcs_pattern
14
    "${ORTTRAINING_ROOT}/orttraining/python/*.cc"
15
    "${ORTTRAINING_ROOT}/orttraining/python/*.h"
16
  )
17
endif()
18

19
file(GLOB onnxruntime_pybind_srcs CONFIGURE_DEPENDS
20
  ${onnxruntime_pybind_srcs_pattern}
21
  )
22

23
if(onnxruntime_ENABLE_TRAINING)
24
  list(REMOVE_ITEM onnxruntime_pybind_srcs  ${ONNXRUNTIME_ROOT}/python/onnxruntime_pybind_module.cc)
25
endif()
26

27
# Add Pytorch as a library.
28
if (onnxruntime_ENABLE_LAZY_TENSOR)
29
  # Lazy Tensor requires Pytorch as a library.
30
  list(APPEND CMAKE_PREFIX_PATH ${onnxruntime_PREBUILT_PYTORCH_PATH})
31
  # The following line may change ${CUDA_NVCC_FLAGS} and ${CMAKE_CUDA_FLAGS},
32
  # if Pytorch is built from source.
33
  # For example, pytorch/cmake/public/cuda.cmake and
34
  # pytorch/torch/share/cmake/Caffe2/public/cuda.cmake both defines
35
  # ONNX_NAMESPACE for both CUDA_NVCC_FLAGS and CMAKE_CUDA_FLAGS.
36
  # Later, this ONNX_NAMESPACE may conflicts with ONNX_NAMESPACE set by ORT.
37
  find_package(Torch REQUIRED)
38
  # Let's remove ONNX_NAMESPACE from Torch.
39
  list(FILTER CUDA_NVCC_FLAGS EXCLUDE REGEX "-DONNX_NAMESPACE=.+")
40
  string(REGEX REPLACE "-DONNX_NAMESPACE=.+ " " " CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS}")
41
endif()
42

43
# Support ORT as a backend in Pytorch's LazyTensor.
44
if (onnxruntime_ENABLE_LAZY_TENSOR)
45
  file(GLOB onnxruntime_lazy_tensor_extension_srcs CONFIGURE_DEPENDS
46
    "${ORTTRAINING_ROOT}/orttraining/lazy_tensor/*.cc")
47
  file(GLOB onnxruntime_lazy_tensor_extension_headers CONFIGURE_DEPENDS
48
    "${ORTTRAINING_ROOT}/orttraining/lazy_tensor/*.h")
49

50
  if(NOT MSVC)
51
    set_source_files_properties(${onnxruntime_lazy_tensor_extension_srcs} PROPERTIES COMPILE_FLAGS -Wno-unused-parameter)
52
    set_source_files_properties(${onnxruntime_lazy_tensor_extension_headers} PROPERTIES COMPILE_FLAGS -Wno-unused-parameter)
53
  endif()
54

55
  list(APPEND onnxruntime_pybind_srcs
56
              ${onnxruntime_lazy_tensor_extension_srcs})
57
endif()
58

59
# onnxruntime_ENABLE_LAZY_TENSOR and onnxruntime_ENABLE_EAGER_MODE
60
# need DLPack code to pass tensors cross ORT and Pytorch boundary.
61
# TODO: consider making DLPack code a standalone library.
62
if (onnxruntime_ENABLE_LAZY_TENSOR)
63
  # If DLPack code is not built, add it to ORT's pybind target.
64
  if (NOT onnxruntime_ENABLE_TRAINING_TORCH_INTEROP)
65
    list(APPEND onnxruntime_pybind_srcs
66
              "${ORTTRAINING_ROOT}/orttraining/core/framework/torch/dlpack_python.cc")
67
  endif()
68
endif()
69

70
onnxruntime_add_shared_library_module(onnxruntime_pybind11_state ${onnxruntime_pybind_srcs})
71

72
if(MSVC)
73
  target_compile_options(onnxruntime_pybind11_state PRIVATE "$<$<COMPILE_LANGUAGE:CUDA>:SHELL:--compiler-options /utf-8>" "$<$<NOT:$<COMPILE_LANGUAGE:CUDA>>:/utf-8>")
74
  if(onnxruntime_ENABLE_TRAINING)
75
    target_compile_options(onnxruntime_pybind11_state PRIVATE "/bigobj")
76
  endif()
77
endif()
78
if(HAS_CAST_FUNCTION_TYPE)
79
  target_compile_options(onnxruntime_pybind11_state PRIVATE "-Wno-cast-function-type")
80
endif()
81

82
# We export symbols using linker and the compiler does not know anything about it
83
# There is a problem with classes that have pybind types as members.
84
# See https://pybind11.readthedocs.io/en/stable/faq.html#someclass-declared-with-greater-visibility-than-the-type-of-its-field-someclass-member-wattributes
85
if (NOT MSVC)
86
  target_compile_options(onnxruntime_pybind11_state PRIVATE "-fvisibility=hidden")
87
endif()
88

89
if(onnxruntime_PYBIND_EXPORT_OPSCHEMA)
90
  target_compile_definitions(onnxruntime_pybind11_state PRIVATE onnxruntime_PYBIND_EXPORT_OPSCHEMA)
91
endif()
92

93
if (MSVC AND NOT CMAKE_SIZEOF_VOID_P EQUAL 8)
94
    #TODO: fix the warnings
95
    target_compile_options(onnxruntime_pybind11_state PRIVATE "/wd4244")
96
endif()
97

98
onnxruntime_add_include_to_target(onnxruntime_pybind11_state Python::Module Python::NumPy)
99
target_include_directories(onnxruntime_pybind11_state PRIVATE ${ONNXRUNTIME_ROOT} ${pybind11_INCLUDE_DIRS})
100
if(onnxruntime_USE_CUDA)
101
    target_include_directories(onnxruntime_pybind11_state PRIVATE ${CMAKE_CUDA_TOOLKIT_INCLUDE_DIRECTORIES} ${CUDNN_INCLUDE_DIR})
102
endif()
103
if(onnxruntime_USE_CANN)
104
    target_include_directories(onnxruntime_pybind11_state PRIVATE ${onnxruntime_CANN_HOME}/include)
105
endif()
106
if(onnxruntime_USE_ROCM)
107
  target_compile_options(onnxruntime_pybind11_state PUBLIC -D__HIP_PLATFORM_AMD__=1 -D__HIP_PLATFORM_HCC__=1)
108
  target_include_directories(onnxruntime_pybind11_state PRIVATE ${onnxruntime_ROCM_HOME}/hipfft/include ${onnxruntime_ROCM_HOME}/include ${onnxruntime_ROCM_HOME}/hiprand/include ${onnxruntime_ROCM_HOME}/rocrand/include ${CMAKE_CURRENT_BINARY_DIR}/amdgpu/onnxruntime ${CMAKE_CURRENT_BINARY_DIR}/amdgpu/orttraining)
109
endif()
110
if (onnxruntime_USE_NCCL)
111
  target_include_directories(onnxruntime_pybind11_state PRIVATE ${NCCL_INCLUDE_DIRS})
112
endif()
113

114
if(APPLE)
115
  set(ONNXRUNTIME_SO_LINK_FLAG "-Xlinker -exported_symbols_list -Xlinker ${ONNXRUNTIME_ROOT}/python/exported_symbols.lst")
116
elseif(UNIX)
117
  if (onnxruntime_ENABLE_EXTERNAL_CUSTOM_OP_SCHEMAS)
118
    set(ONNXRUNTIME_SO_LINK_FLAG "-Xlinker --version-script=${ONNXRUNTIME_ROOT}/python/version_script_expose_onnx_protobuf.lds -Xlinker --gc-sections")
119
  else()
120
    if (NOT CMAKE_SYSTEM_NAME MATCHES "AIX")
121
      set(ONNXRUNTIME_SO_LINK_FLAG "-Xlinker --version-script=${ONNXRUNTIME_ROOT}/python/version_script.lds -Xlinker --gc-sections")
122
    endif()
123
  endif()
124
else()
125
  set(ONNXRUNTIME_SO_LINK_FLAG "-DEF:${ONNXRUNTIME_ROOT}/python/pybind.def")
126
endif()
127

128
if (onnxruntime_ENABLE_ATEN)
129
  target_compile_definitions(onnxruntime_pybind11_state PRIVATE ENABLE_ATEN)
130
  target_include_directories(onnxruntime_pybind11_state PRIVATE ${dlpack_SOURCE_DIR}/include)
131
endif()
132

133
if (onnxruntime_ENABLE_TRAINING)
134
  target_include_directories(onnxruntime_pybind11_state PRIVATE ${ORTTRAINING_ROOT})
135
  target_link_libraries(onnxruntime_pybind11_state PRIVATE onnxruntime_training)
136
endif()
137

138
# Eager mode and LazyTensor are both Pytorch's backends, so their
139
# dependencies are set together below.
140
if (onnxruntime_ENABLE_LAZY_TENSOR)
141
  # Set library dependencies shared by aforementioned backends.
142

143
  # todo: this is because the prebuild pytorch may use a different version of protobuf headers.
144
  # force the build to find the protobuf headers ort using.
145
  target_include_directories(onnxruntime_pybind11_state PRIVATE
146
    "${REPO_ROOT}/cmake/external/protobuf/src"
147
    ${TORCH_INCLUDE_DIRS})
148

149
  # For eager mode, torch build has a mkl dependency from torch's cmake config,
150
  # Linking to torch libraries to avoid this unnecessary mkl dependency.
151
  target_include_directories(onnxruntime_pybind11_state PRIVATE "${TORCH_INSTALL_PREFIX}/include" "${TORCH_INSTALL_PREFIX}/include/torch/csrc/api/include")
152
  find_library(LIBTORCH_LIBRARY torch PATHS "${TORCH_INSTALL_PREFIX}/lib")
153
  find_library(LIBTORCH_CPU_LIBRARY torch_cpu PATHS "${TORCH_INSTALL_PREFIX}/lib")
154
  find_library(LIBC10_LIBRARY c10 PATHS "${TORCH_INSTALL_PREFIX}/lib")
155
  # Explicitly link torch_python to workaround https://github.com/pytorch/pytorch/issues/38122#issuecomment-694203281
156
  find_library(TORCH_PYTHON_LIBRARY torch_python PATHS "${TORCH_INSTALL_PREFIX}/lib")
157
  target_link_libraries(onnxruntime_pybind11_state PRIVATE  ${LIBTORCH_LIBRARY} ${LIBTORCH_CPU_LIBRARY} ${LIBC10_LIBRARY} ${TORCH_PYTHON_LIBRARY})
158
  if (onnxruntime_USE_CUDA)
159
    find_library(LIBTORCH_CUDA_LIBRARY torch_cuda PATHS "${TORCH_INSTALL_PREFIX}/lib")
160
    find_library(LIBC10_CUDA_LIBRARY c10_cuda PATHS "${TORCH_INSTALL_PREFIX}/lib")
161
    target_link_libraries(onnxruntime_pybind11_state PRIVATE ${LIBTORCH_CUDA_LIBRARY} ${LIBC10_CUDA_LIBRARY})
162
  endif()
163

164

165
  if (MSVC)
166
    target_compile_options(onnxruntime_pybind11_state PRIVATE "/wd4100" "/wd4324" "/wd4458" "/wd4127" "/wd4193" "/wd4624" "/wd4702")
167
    target_compile_options(onnxruntime_pybind11_state PRIVATE "/bigobj" "/wd4275" "/wd4244" "/wd4267" "/wd4067")
168
  endif()
169
endif()
170

171
target_link_libraries(onnxruntime_pybind11_state PRIVATE
172
    onnxruntime_session
173
    ${onnxruntime_libs}
174
    ${PROVIDERS_TVM}
175
    ${PROVIDERS_NNAPI}
176
    ${PROVIDERS_XNNPACK}
177
    ${PROVIDERS_COREML}
178
    ${PROVIDERS_RKNPU}
179
    ${PROVIDERS_DML}
180
    ${PROVIDERS_ACL}
181
    ${PROVIDERS_ARMNN}
182
    ${PROVIDERS_XNNPACK}
183
    ${PROVIDERS_AZURE}
184
    ${PROVIDERS_QNN}
185
    onnxruntime_optimizer
186
    onnxruntime_providers
187
    onnxruntime_util
188
    ${onnxruntime_tvm_libs}
189
    onnxruntime_framework
190
    onnxruntime_util
191
    onnxruntime_graph
192
    ${ONNXRUNTIME_MLAS_LIBS}
193
    onnxruntime_common
194
    onnxruntime_flatbuffers
195
    ${pybind11_lib}
196
)
197

198
set(onnxruntime_pybind11_state_dependencies
199
    ${onnxruntime_EXTERNAL_DEPENDENCIES}
200
    ${pybind11_dep}
201
)
202
set_property(TARGET onnxruntime_pybind11_state APPEND_STRING PROPERTY LINK_FLAGS ${ONNXRUNTIME_SO_LINK_FLAG} ${onnxruntime_DELAYLOAD_FLAGS})
203
add_dependencies(onnxruntime_pybind11_state ${onnxruntime_pybind11_state_dependencies})
204

205
if (MSVC)
206
  set_target_properties(onnxruntime_pybind11_state PROPERTIES LINK_FLAGS "${ONNXRUNTIME_SO_LINK_FLAG}")
207
  # if MSVC, pybind11 undefines _DEBUG in pybind11/detail/common.h, which causes the pragma in pyconfig.h
208
  # from the python installation to require the release version of the lib
209
  # e.g. from a python 3.10 install:
210
  #                       if defined(_DEBUG)
211
  #                               pragma comment(lib,"python310_d.lib")
212
  #                       elif defined(Py_LIMITED_API)
213
  #                               pragma comment(lib,"python3.lib")
214
  #                       else
215
  #                               pragma comment(lib,"python310.lib")
216
  #                       endif /* _DEBUG */
217
  #
218
  # See https://github.com/pybind/pybind11/issues/3403 for more background info.
219
  #
220
  # Explicitly use the release version of the python library to make the project file consistent with this.
221
  target_link_libraries(onnxruntime_pybind11_state PRIVATE ${Python_LIBRARY_RELEASE})
222
elseif (APPLE)
223
  set_target_properties(onnxruntime_pybind11_state PROPERTIES LINK_FLAGS "${ONNXRUNTIME_SO_LINK_FLAG} -Xlinker -undefined -Xlinker dynamic_lookup")
224
  set_target_properties(onnxruntime_pybind11_state PROPERTIES
225
    INSTALL_RPATH "@loader_path"
226
    BUILD_WITH_INSTALL_RPATH TRUE
227
    INSTALL_RPATH_USE_LINK_PATH FALSE)
228
else()
229
  if (NOT CMAKE_SYSTEM_NAME MATCHES "AIX")
230
     set_property(TARGET onnxruntime_pybind11_state APPEND_STRING PROPERTY LINK_FLAGS " -Xlinker -rpath=\\$ORIGIN")
231
  endif()
232
endif()
233

234
if (onnxruntime_ENABLE_EXTERNAL_CUSTOM_OP_SCHEMAS)
235
  set(onnxruntime_CUSTOM_EXTERNAL_LIBRARIES "${onnxruntime_EXTERNAL_LIBRARIES}")
236
  list(FIND  onnxruntime_CUSTOM_EXTERNAL_LIBRARIES onnx ONNX_INDEX)
237
  list(FIND onnxruntime_CUSTOM_EXTERNAL_LIBRARIES ${PROTOBUF_LIB} PROTOBUF_INDEX)
238
  MATH(EXPR PROTOBUF_INDEX_NEXT "${PROTOBUF_INDEX} + 1")
239
  if (ONNX_INDEX GREATER_EQUAL 0 AND PROTOBUF_INDEX GREATER_EQUAL 0)
240
    # Expect protobuf to follow onnx due to dependence
241
    list(INSERT  onnxruntime_CUSTOM_EXTERNAL_LIBRARIES ${ONNX_INDEX} "-Wl,--no-as-needed")
242
    list(INSERT onnxruntime_CUSTOM_EXTERNAL_LIBRARIES ${PROTOBUF_INDEX_NEXT} "-Wl,--as-needed")
243
  else()
244
    message(FATAL_ERROR "Required external libraries onnx and protobuf are not found in onnxruntime_EXTERNAL_LIBRARIES")
245
  endif()
246
  target_link_libraries(onnxruntime_pybind11_state PRIVATE ${onnxruntime_CUSTOM_EXTERNAL_LIBRARIES})
247
else()
248
  target_link_libraries(onnxruntime_pybind11_state PRIVATE ${onnxruntime_EXTERNAL_LIBRARIES})
249
endif()
250

251
set_target_properties(onnxruntime_pybind11_state PROPERTIES PREFIX "")
252
set_target_properties(onnxruntime_pybind11_state PROPERTIES FOLDER "ONNXRuntime")
253
if(onnxruntime_ENABLE_LTO)
254
  set_target_properties(onnxruntime_pybind11_state PROPERTIES INTERPROCEDURAL_OPTIMIZATION_RELEASE TRUE)
255
  set_target_properties(onnxruntime_pybind11_state PROPERTIES INTERPROCEDURAL_OPTIMIZATION_RELWITHDEBINFO TRUE)
256
  set_target_properties(onnxruntime_pybind11_state PROPERTIES INTERPROCEDURAL_OPTIMIZATION_MINSIZEREL TRUE)
257
endif()
258
if (MSVC)
259
  set_target_properties(onnxruntime_pybind11_state PROPERTIES SUFFIX ".pyd")
260
else()
261
  set_target_properties(onnxruntime_pybind11_state PROPERTIES SUFFIX ".so")
262
endif()
263

264
# Generate version_info.py in Windows build.
265
# Has to be done before onnxruntime_python_srcs is set.
266
if (WIN32)
267
  set(VERSION_INFO_FILE "${ONNXRUNTIME_ROOT}/python/version_info.py")
268

269
  if (onnxruntime_USE_CUDA)
270
    file(WRITE "${VERSION_INFO_FILE}" "use_cuda = True\n")
271
    if(onnxruntime_CUDNN_HOME)
272
      file(GLOB CUDNN_DLL_PATH "${onnxruntime_CUDNN_HOME}/bin/cudnn64_*.dll")
273
      if (NOT CUDNN_DLL_PATH)
274
        message(FATAL_ERROR "cuDNN not found in ${onnxruntime_CUDNN_HOME}")
275
      endif()
276
    else()
277
      file(GLOB CUDNN_DLL_PATH "${onnxruntime_CUDA_HOME}/bin/cudnn64_*.dll")
278
      if (NOT CUDNN_DLL_PATH)
279
        message(FATAL_ERROR "cuDNN not found in ${onnxruntime_CUDA_HOME}")
280
      endif()
281
    endif()
282
    get_filename_component(CUDNN_DLL_NAME ${CUDNN_DLL_PATH} NAME_WE)
283
    string(REPLACE "cudnn64_" "" CUDNN_VERSION "${CUDNN_DLL_NAME}")
284
    if(NOT onnxruntime_CUDA_VERSION)
285
      set(onnxruntime_CUDA_VERSION ${CUDAToolkit_VERSION})
286
      message("onnxruntime_CUDA_VERSION=${onnxruntime_CUDA_VERSION}")
287
    endif()
288
    file(APPEND "${VERSION_INFO_FILE}"
289
      "cuda_version = \"${onnxruntime_CUDA_VERSION}\"\n"
290
      "cudnn_version = \"${CUDNN_VERSION}\"\n"
291
    )
292
  else()
293
    file(WRITE "${VERSION_INFO_FILE}" "use_cuda = False\n")
294
  endif()
295

296
  if ("${MSVC_TOOLSET_VERSION}" STREQUAL "142")
297
    file(APPEND "${VERSION_INFO_FILE}" "vs2019 = True\n")
298
  else()
299
    file(APPEND "${VERSION_INFO_FILE}" "vs2019 = False\n")
300
  endif()
301
endif()
302

303
file(GLOB onnxruntime_backend_srcs CONFIGURE_DEPENDS
304
    "${ONNXRUNTIME_ROOT}/python/backend/*.py"
305
)
306

307
if (onnxruntime_ENABLE_TRAINING)
308
  file(GLOB onnxruntime_python_srcs CONFIGURE_DEPENDS
309
    "${ONNXRUNTIME_ROOT}/python/*.py"
310
    "${ORTTRAINING_SOURCE_DIR}/python/*.py"
311
  )
312
else()
313
  file(GLOB onnxruntime_python_srcs CONFIGURE_DEPENDS
314
    "${ONNXRUNTIME_ROOT}/python/*.py"
315
  )
316
endif()
317

318
# Generate _pybind_state.py from _pybind_state.py.in replacing macros with either setdlopenflags or ""
319
if (onnxruntime_ENABLE_EXTERNAL_CUSTOM_OP_SCHEMAS)
320
  set(ONNXRUNTIME_SETDLOPENFLAGS_GLOBAL "sys.setdlopenflags(os.RTLD_GLOBAL|os.RTLD_NOW|os.RTLD_DEEPBIND)")
321
  set(ONNXRUNTIME_SETDLOPENFLAGS_LOCAL  "sys.setdlopenflags(os.RTLD_LOCAL|os.RTLD_NOW|os.RTLD_DEEPBIND)")
322
else()
323
  set(ONNXRUNTIME_SETDLOPENFLAGS_GLOBAL "")
324
  set(ONNXRUNTIME_SETDLOPENFLAGS_LOCAL  "")
325
endif()
326

327
if (onnxruntime_ENABLE_LAZY_TENSOR)
328
  # Import torch so that onnxruntime's pybind can see its DLLs.
329
  set(ONNXRUNTIME_IMPORT_PYTORCH_TO_RESOLVE_DLLS "import torch")
330
else()
331
  set(ONNXRUNTIME_IMPORT_PYTORCH_TO_RESOLVE_DLLS "")
332
endif()
333

334
configure_file(${ONNXRUNTIME_ROOT}/python/_pybind_state.py.in
335
               ${CMAKE_BINARY_DIR}/onnxruntime/capi/_pybind_state.py)
336

337
if (onnxruntime_ENABLE_TRAINING)
338
  file(GLOB onnxruntime_python_root_srcs CONFIGURE_DEPENDS
339
    "${ORTTRAINING_SOURCE_DIR}/python/training/*.py"
340
  )
341
  file(GLOB onnxruntime_python_amp_srcs CONFIGURE_DEPENDS
342
    "${ORTTRAINING_SOURCE_DIR}/python/training/amp/*.py"
343
  )
344
  file(GLOB onnxruntime_python_experimental_srcs CONFIGURE_DEPENDS
345
    "${ORTTRAINING_SOURCE_DIR}/python/training/experimental/*.py"
346
  )
347
  file(GLOB onnxruntime_python_gradient_graph_srcs CONFIGURE_DEPENDS
348
    "${ORTTRAINING_SOURCE_DIR}/python/training/experimental/gradient_graph/*.py"
349
  )
350
  file(GLOB onnxruntime_python_optim_srcs CONFIGURE_DEPENDS
351
    "${ORTTRAINING_SOURCE_DIR}/python/training/optim/*.py"
352
  )
353
  file(GLOB onnxruntime_python_ortmodule_srcs CONFIGURE_DEPENDS
354
    "${ORTTRAINING_SOURCE_DIR}/python/training/ortmodule/*.py"
355
  )
356
  file(GLOB onnxruntime_python_ortmodule_experimental_srcs CONFIGURE_DEPENDS
357
    "${ORTTRAINING_SOURCE_DIR}/python/training/ortmodule/experimental/*.py"
358
  )
359
  file(GLOB onnxruntime_python_ortmodule_experimental_json_config_srcs CONFIGURE_DEPENDS
360
    "${ORTTRAINING_SOURCE_DIR}/python/training/ortmodule/experimental/json_config/*.py"
361
  )
362
  file(GLOB onnxruntime_python_ortmodule_experimental_hierarchical_srcs CONFIGURE_DEPENDS
363
    "${ORTTRAINING_SOURCE_DIR}/python/training/ortmodule/experimental/hierarchical_ortmodule/*.py"
364
  )
365
  file(GLOB onnxruntime_python_ortmodule_torch_cpp_ext_srcs CONFIGURE_DEPENDS
366
    "${ORTTRAINING_SOURCE_DIR}/python/training/ortmodule/torch_cpp_extensions/*.py"
367
  )
368
  file(GLOB onnxruntime_python_ortmodule_torch_cpp_ext_aten_op_executor_srcs CONFIGURE_DEPENDS
369
    "${ONNXRUNTIME_ROOT}/python/torch_cpp_extensions/aten_op_executor/*"
370
  )
371
  file(GLOB onnxruntime_python_ortmodule_torch_cpp_ext_torch_interop_utils_srcs CONFIGURE_DEPENDS
372
    "${ORTTRAINING_SOURCE_DIR}/python/training/ortmodule/torch_cpp_extensions/cpu/torch_interop_utils/*"
373
  )
374
  file(GLOB onnxruntime_python_ortmodule_torch_cpp_ext_torch_gpu_allocator_srcs CONFIGURE_DEPENDS
375
    "${ORTTRAINING_SOURCE_DIR}/python/training/ortmodule/torch_cpp_extensions/cuda/torch_gpu_allocator/*"
376
  )
377
  file(GLOB onnxruntime_python_ortmodule_torch_cpp_ext_fused_ops_srcs CONFIGURE_DEPENDS
378
    "${ORTTRAINING_SOURCE_DIR}/python/training/ortmodule/torch_cpp_extensions/cuda/fused_ops/*"
379
  )
380
  file(GLOB onnxruntime_python_ortmodule_graph_optimizers_srcs CONFIGURE_DEPENDS
381
    "${ORTTRAINING_SOURCE_DIR}/python/training/ortmodule/graph_optimizers/*"
382
  )
383
  file(GLOB onnxruntime_python_ortmodule_pipe_srcs CONFIGURE_DEPENDS
384
    "${ORTTRAINING_SOURCE_DIR}/python/training/ortmodule/experimental/pipe/*"
385
  )
386
  file(GLOB onnxruntime_python_ort_triton_srcs CONFIGURE_DEPENDS
387
    "${ORTTRAINING_SOURCE_DIR}/python/training/ort_triton/*.py"
388
  )
389
  file(GLOB onnxruntime_python_ort_triton_kernel_srcs CONFIGURE_DEPENDS
390
    "${ORTTRAINING_SOURCE_DIR}/python/training/ort_triton/kernel/*.py"
391
  )
392
  file(GLOB onnxruntime_python_utils_srcs CONFIGURE_DEPENDS
393
    "${ORTTRAINING_SOURCE_DIR}/python/training/utils/*.py"
394
  )
395
  file(GLOB onnxruntime_python_utils_data_srcs CONFIGURE_DEPENDS
396
    "${ORTTRAINING_SOURCE_DIR}/python/training/utils/data/*"
397
  )
398
  file(GLOB onnxruntime_python_utils_hooks_srcs CONFIGURE_DEPENDS
399
  "${ORTTRAINING_SOURCE_DIR}/python/training/utils/hooks/*"
400
  )
401
  if (onnxruntime_ENABLE_TRAINING_APIS)
402
    file(GLOB onnxruntime_python_onnxblock_srcs CONFIGURE_DEPENDS
403
    "${ORTTRAINING_SOURCE_DIR}/python/training/onnxblock/*"
404
    )
405
    file(GLOB onnxruntime_python_onnxblock_loss_srcs CONFIGURE_DEPENDS
406
    "${ORTTRAINING_SOURCE_DIR}/python/training/onnxblock/loss/*"
407
    )
408
    file(GLOB onnxruntime_python_api_srcs CONFIGURE_DEPENDS
409
    "${ORTTRAINING_SOURCE_DIR}/python/training/api/*"
410
    )
411
    file(GLOB onnxruntime_python_onnxblock_optim_srcs CONFIGURE_DEPENDS
412
    "${ORTTRAINING_SOURCE_DIR}/python/training/onnxblock/optim/*"
413
    )
414
  endif()
415
endif()
416

417
if (onnxruntime_BUILD_UNIT_TESTS)
418
  file(GLOB onnxruntime_python_test_srcs CONFIGURE_DEPENDS
419
      "${ONNXRUNTIME_ROOT}/test/python/*.py"
420
      "${ORTTRAINING_SOURCE_DIR}/test/python/*.py"
421
      "${ORTTRAINING_SOURCE_DIR}/test/python/*.json"
422
  )
423
  file(GLOB onnxruntime_python_quantization_test_srcs CONFIGURE_DEPENDS
424
      "${ONNXRUNTIME_ROOT}/test/python/quantization/*.py"
425
  )
426
  file(GLOB onnxruntime_python_transformers_test_srcs CONFIGURE_DEPENDS
427
      "${ONNXRUNTIME_ROOT}/test/python/transformers/*.py"
428
  )
429
  file(GLOB onnxruntime_python_transformers_testdata_srcs CONFIGURE_DEPENDS
430
      "${ONNXRUNTIME_ROOT}/test/python/transformers/test_data/models/*.onnx"
431
  )
432
  file(GLOB onnxruntime_python_transformers_testdata_whisper CONFIGURE_DEPENDS
433
      "${ONNXRUNTIME_ROOT}/test/python/transformers/test_data/models/whisper/*.onnx"
434
  )
435
  file(GLOB onnxruntime_python_transformers_testdata_conformer CONFIGURE_DEPENDS
436
      "${ONNXRUNTIME_ROOT}/test/python/transformers/test_data/models/conformer/*.onnx"
437
  )
438
endif()
439

440
file(GLOB onnxruntime_python_tools_srcs CONFIGURE_DEPENDS
441
    "${ONNXRUNTIME_ROOT}/python/tools/*.py"
442
)
443
file(GLOB onnxruntime_python_quantization_src CONFIGURE_DEPENDS
444
    "${ONNXRUNTIME_ROOT}/python/tools/quantization/*.py"
445
)
446
file(GLOB onnxruntime_python_quantization_operators_src CONFIGURE_DEPENDS
447
    "${ONNXRUNTIME_ROOT}/python/tools/quantization/operators/*.py"
448
)
449
file(GLOB onnxruntime_python_quantization_cal_table_flatbuffers_src CONFIGURE_DEPENDS
450
    "${ONNXRUNTIME_ROOT}/python/tools/quantization/CalTableFlatBuffers/*.py"
451
)
452
file(GLOB onnxruntime_python_quantization_fusions_src CONFIGURE_DEPENDS
453
    "${ONNXRUNTIME_ROOT}/python/tools/quantization/fusions/*.py"
454
)
455
file(GLOB onnxruntime_python_quantization_ep_qnn_src CONFIGURE_DEPENDS
456
    "${ONNXRUNTIME_ROOT}/python/tools/quantization/execution_providers/qnn/*.py"
457
)
458
file(GLOB onnxruntime_python_transformers_src CONFIGURE_DEPENDS
459
    "${ONNXRUNTIME_ROOT}/python/tools/transformers/*.py"
460
)
461
file(GLOB onnxruntime_python_transformers_models_bart_src CONFIGURE_DEPENDS
462
    "${ONNXRUNTIME_ROOT}/python/tools/transformers/models/bart/*.py"
463
)
464
file(GLOB onnxruntime_python_transformers_models_bert_src CONFIGURE_DEPENDS
465
    "${ONNXRUNTIME_ROOT}/python/tools/transformers/models/bert/*.py"
466
)
467
file(GLOB onnxruntime_python_transformers_models_gpt2_src CONFIGURE_DEPENDS
468
    "${ONNXRUNTIME_ROOT}/python/tools/transformers/models/gpt2/*.py"
469
)
470
file(GLOB onnxruntime_python_transformers_models_llama_src CONFIGURE_DEPENDS
471
    "${ONNXRUNTIME_ROOT}/python/tools/transformers/models/llama/*.py"
472
)
473
file(GLOB onnxruntime_python_transformers_models_longformer_src CONFIGURE_DEPENDS
474
    "${ONNXRUNTIME_ROOT}/python/tools/transformers/models/longformer/*.py"
475
)
476
file(GLOB onnxruntime_python_transformers_models_phi2_src CONFIGURE_DEPENDS
477
    "${ONNXRUNTIME_ROOT}/python/tools/transformers/models/phi2/*.py"
478
)
479
file(GLOB onnxruntime_python_transformers_models_stable_diffusion_src CONFIGURE_DEPENDS
480
    "${ONNXRUNTIME_ROOT}/python/tools/transformers/models/stable_diffusion/*.py"
481
)
482
file(GLOB onnxruntime_python_transformers_models_t5_src CONFIGURE_DEPENDS
483
    "${ONNXRUNTIME_ROOT}/python/tools/transformers/models/t5/*.py"
484
)
485
file(GLOB onnxruntime_python_transformers_models_whisper_src CONFIGURE_DEPENDS
486
    "${ONNXRUNTIME_ROOT}/python/tools/transformers/models/whisper/*.py"
487
)
488
file(GLOB onnxruntime_python_datasets_srcs CONFIGURE_DEPENDS
489
    "${ONNXRUNTIME_ROOT}/python/datasets/*.py"
490
)
491
file(GLOB onnxruntime_python_datasets_data CONFIGURE_DEPENDS
492
    "${ONNXRUNTIME_ROOT}/python/datasets/*.pb"
493
    "${ONNXRUNTIME_ROOT}/python/datasets/*.onnx"
494
)
495

496
# ORT Mobile helpers to convert ONNX model to ORT format, analyze model for suitability in mobile scenarios,
497
# and assist with export from PyTorch.
498
set(onnxruntime_mobile_util_srcs
499
    ${REPO_ROOT}/tools/python/util/check_onnx_model_mobile_usability.py
500
    ${REPO_ROOT}/tools/python/util/convert_onnx_models_to_ort.py
501
    ${REPO_ROOT}/tools/python/util/file_utils.py
502
    ${REPO_ROOT}/tools/python/util/logger.py
503
    ${REPO_ROOT}/tools/python/util/make_dynamic_shape_fixed.py
504
    ${REPO_ROOT}/tools/python/util/onnx_model_utils.py
505
    ${REPO_ROOT}/tools/python/util/optimize_onnx_model.py
506
    ${REPO_ROOT}/tools/python/util/pytorch_export_helpers.py
507
    ${REPO_ROOT}/tools/python/util/reduced_build_config_parser.py
508
    ${REPO_ROOT}/tools/python/util/update_onnx_opset.py
509
)
510
file(GLOB onnxruntime_ort_format_model_srcs CONFIGURE_DEPENDS
511
    ${REPO_ROOT}/tools/python/util/ort_format_model/*.py
512
)
513
file(GLOB onnxruntime_mobile_helpers_srcs CONFIGURE_DEPENDS
514
    ${REPO_ROOT}/tools/python/util/mobile_helpers/*.py
515
    ${REPO_ROOT}/tools/ci_build/github/android/nnapi_supported_ops.md
516
    ${REPO_ROOT}/tools/ci_build/github/apple/coreml_supported_mlprogram_ops.md
517
    ${REPO_ROOT}/tools/ci_build/github/apple/coreml_supported_neuralnetwork_ops.md
518
)
519
file(GLOB onnxruntime_qdq_helper_srcs CONFIGURE_DEPENDS
520
    ${REPO_ROOT}/tools/python/util/qdq_helpers/*.py
521
)
522

523
if (onnxruntime_USE_OPENVINO)
524
  file(GLOB onnxruntime_python_openvino_python_srcs CONFIGURE_DEPENDS
525
    ${REPO_ROOT}/tools/python/util/add_openvino_win_libs.py
526
  )
527
endif()
528

529
set(build_output_target onnxruntime_common)
530
if(NOT onnxruntime_ENABLE_STATIC_ANALYSIS)
531
add_custom_command(
532
  TARGET onnxruntime_pybind11_state POST_BUILD
533
  COMMAND ${CMAKE_COMMAND} -E make_directory $<TARGET_FILE_DIR:${build_output_target}>/onnxruntime/backend
534
  COMMAND ${CMAKE_COMMAND} -E make_directory $<TARGET_FILE_DIR:${build_output_target}>/onnxruntime/capi
535
  COMMAND ${CMAKE_COMMAND} -E make_directory $<TARGET_FILE_DIR:${build_output_target}>/onnxruntime/capi/training
536
  COMMAND ${CMAKE_COMMAND} -E make_directory $<TARGET_FILE_DIR:${build_output_target}>/onnxruntime/datasets
537
  COMMAND ${CMAKE_COMMAND} -E make_directory $<TARGET_FILE_DIR:${build_output_target}>/onnxruntime/tools
538
  COMMAND ${CMAKE_COMMAND} -E make_directory $<TARGET_FILE_DIR:${build_output_target}>/onnxruntime/tools/mobile_helpers
539
  COMMAND ${CMAKE_COMMAND} -E make_directory $<TARGET_FILE_DIR:${build_output_target}>/onnxruntime/tools/qdq_helpers
540
  COMMAND ${CMAKE_COMMAND} -E make_directory $<TARGET_FILE_DIR:${build_output_target}>/onnxruntime/tools/ort_format_model
541
  COMMAND ${CMAKE_COMMAND} -E make_directory $<TARGET_FILE_DIR:${build_output_target}>/onnxruntime/tools/ort_format_model/ort_flatbuffers_py
542
  COMMAND ${CMAKE_COMMAND} -E make_directory $<TARGET_FILE_DIR:${build_output_target}>/onnxruntime/transformers
543
  COMMAND ${CMAKE_COMMAND} -E make_directory $<TARGET_FILE_DIR:${build_output_target}>/onnxruntime/transformers/models
544
  COMMAND ${CMAKE_COMMAND} -E make_directory $<TARGET_FILE_DIR:${build_output_target}>/onnxruntime/transformers/models/bart
545
  COMMAND ${CMAKE_COMMAND} -E make_directory $<TARGET_FILE_DIR:${build_output_target}>/onnxruntime/transformers/models/bert
546
  COMMAND ${CMAKE_COMMAND} -E make_directory $<TARGET_FILE_DIR:${build_output_target}>/onnxruntime/transformers/models/gpt2
547
  COMMAND ${CMAKE_COMMAND} -E make_directory $<TARGET_FILE_DIR:${build_output_target}>/onnxruntime/transformers/models/llama
548
  COMMAND ${CMAKE_COMMAND} -E make_directory $<TARGET_FILE_DIR:${build_output_target}>/onnxruntime/transformers/models/longformer
549
  COMMAND ${CMAKE_COMMAND} -E make_directory $<TARGET_FILE_DIR:${build_output_target}>/onnxruntime/transformers/models/phi2
550
  COMMAND ${CMAKE_COMMAND} -E make_directory $<TARGET_FILE_DIR:${build_output_target}>/onnxruntime/transformers/models/stable_diffusion
551
  COMMAND ${CMAKE_COMMAND} -E make_directory $<TARGET_FILE_DIR:${build_output_target}>/onnxruntime/transformers/models/t5
552
  COMMAND ${CMAKE_COMMAND} -E make_directory $<TARGET_FILE_DIR:${build_output_target}>/onnxruntime/transformers/models/whisper
553
  COMMAND ${CMAKE_COMMAND} -E make_directory $<TARGET_FILE_DIR:${build_output_target}>/onnxruntime/quantization
554
  COMMAND ${CMAKE_COMMAND} -E make_directory $<TARGET_FILE_DIR:${build_output_target}>/onnxruntime/quantization/operators
555
  COMMAND ${CMAKE_COMMAND} -E make_directory $<TARGET_FILE_DIR:${build_output_target}>/onnxruntime/quantization/CalTableFlatBuffers
556
  COMMAND ${CMAKE_COMMAND} -E make_directory $<TARGET_FILE_DIR:${build_output_target}>/onnxruntime/quantization/fusions
557
  COMMAND ${CMAKE_COMMAND} -E make_directory $<TARGET_FILE_DIR:${build_output_target}>/onnxruntime/quantization/execution_providers
558
  COMMAND ${CMAKE_COMMAND} -E make_directory $<TARGET_FILE_DIR:${build_output_target}>/onnxruntime/quantization/execution_providers/qnn
559
  COMMAND ${CMAKE_COMMAND} -E make_directory $<TARGET_FILE_DIR:${build_output_target}>/quantization
560
  COMMAND ${CMAKE_COMMAND} -E make_directory $<TARGET_FILE_DIR:${build_output_target}>/transformers
561
  COMMAND ${CMAKE_COMMAND} -E make_directory $<TARGET_FILE_DIR:${build_output_target}>/transformers/test_data/models
562
  COMMAND ${CMAKE_COMMAND} -E make_directory $<TARGET_FILE_DIR:${build_output_target}>/transformers/test_data/models/whisper
563
  COMMAND ${CMAKE_COMMAND} -E make_directory $<TARGET_FILE_DIR:${build_output_target}>/eager_test
564
  COMMAND ${CMAKE_COMMAND} -E make_directory $<TARGET_FILE_DIR:${build_output_target}>/transformers/test_data/models/conformer
565
  COMMAND ${CMAKE_COMMAND} -E copy
566
      ${ONNXRUNTIME_ROOT}/__init__.py
567
      $<TARGET_FILE_DIR:${build_output_target}>/onnxruntime/
568
  COMMAND ${CMAKE_COMMAND} -E copy
569
      ${REPO_ROOT}/requirements.txt
570
      $<TARGET_FILE_DIR:${build_output_target}>
571
  COMMAND ${CMAKE_COMMAND} -E copy
572
      ${REPO_ROOT}/ThirdPartyNotices.txt
573
      $<TARGET_FILE_DIR:${build_output_target}>/onnxruntime/
574
  COMMAND ${CMAKE_COMMAND} -E copy
575
      ${REPO_ROOT}/docs/Privacy.md
576
      $<TARGET_FILE_DIR:${build_output_target}>/onnxruntime/
577
  COMMAND ${CMAKE_COMMAND} -E copy
578
      ${REPO_ROOT}/LICENSE
579
      $<TARGET_FILE_DIR:${build_output_target}>/onnxruntime/
580
  COMMAND ${CMAKE_COMMAND} -E copy
581
      ${onnxruntime_backend_srcs}
582
      $<TARGET_FILE_DIR:${build_output_target}>/onnxruntime/backend/
583
  COMMAND ${CMAKE_COMMAND} -E copy
584
      ${onnxruntime_python_srcs}
585
      $<TARGET_FILE_DIR:${build_output_target}>/onnxruntime/capi/
586
  COMMAND ${CMAKE_COMMAND} -E copy_if_different
587
      ${CMAKE_BINARY_DIR}/onnxruntime/capi/_pybind_state.py
588
      $<TARGET_FILE_DIR:${build_output_target}>/onnxruntime/capi/
589
  COMMAND ${CMAKE_COMMAND} -E copy
590
      $<TARGET_FILE:onnxruntime_pybind11_state>
591
      $<TARGET_FILE_DIR:${build_output_target}>/onnxruntime/capi/
592
  COMMAND ${CMAKE_COMMAND} -E copy
593
      ${onnxruntime_python_datasets_srcs}
594
      $<TARGET_FILE_DIR:${build_output_target}>/onnxruntime/datasets/
595
  COMMAND ${CMAKE_COMMAND} -E copy
596
      ${onnxruntime_python_datasets_data}
597
      $<TARGET_FILE_DIR:${build_output_target}>/onnxruntime/datasets/
598
  COMMAND ${CMAKE_COMMAND} -E copy
599
      ${onnxruntime_python_tools_srcs}
600
      $<TARGET_FILE_DIR:${build_output_target}>/onnxruntime/tools/
601
  COMMAND ${CMAKE_COMMAND} -E copy
602
      ${onnxruntime_mobile_util_srcs}
603
      $<TARGET_FILE_DIR:${build_output_target}>/onnxruntime/tools/
604
  # append the /tools/python/utils imports to the __init__.py that came from /onnxruntime/tools.
605
  # we're aggregating scripts from two different locations, and only include selected functionality from
606
  # /tools/python/util. due to that we take the full __init__.py from /onnxruntime/tools and append
607
  # the required content from /tools/python/util/__init__append.py.
608
  COMMAND ${CMAKE_COMMAND} -E cat
609
      ${REPO_ROOT}/tools/python/util/__init__append.py >>
610
      $<TARGET_FILE_DIR:${build_output_target}>/onnxruntime/tools/__init__.py
611
  COMMAND ${CMAKE_COMMAND} -E copy
612
      ${onnxruntime_qdq_helper_srcs}
613
      $<TARGET_FILE_DIR:${build_output_target}>/onnxruntime/tools/qdq_helpers/
614
  COMMAND ${CMAKE_COMMAND} -E copy
615
      ${onnxruntime_mobile_helpers_srcs}
616
      $<TARGET_FILE_DIR:${build_output_target}>/onnxruntime/tools/mobile_helpers/
617
  COMMAND ${CMAKE_COMMAND} -E copy
618
      ${onnxruntime_ort_format_model_srcs}
619
      $<TARGET_FILE_DIR:${build_output_target}>/onnxruntime/tools/ort_format_model/
620
  COMMAND ${CMAKE_COMMAND} -E copy_directory
621
      ${ONNXRUNTIME_ROOT}/core/flatbuffers/ort_flatbuffers_py
622
      $<TARGET_FILE_DIR:${build_output_target}>/onnxruntime/tools/ort_format_model/ort_flatbuffers_py
623
  COMMAND ${CMAKE_COMMAND} -E copy
624
      ${onnxruntime_python_quantization_src}
625
      $<TARGET_FILE_DIR:${build_output_target}>/onnxruntime/quantization/
626
  COMMAND ${CMAKE_COMMAND} -E copy
627
      ${onnxruntime_python_quantization_operators_src}
628
      $<TARGET_FILE_DIR:${build_output_target}>/onnxruntime/quantization/operators/
629
  COMMAND ${CMAKE_COMMAND} -E copy
630
      ${onnxruntime_python_quantization_cal_table_flatbuffers_src}
631
      $<TARGET_FILE_DIR:${build_output_target}>/onnxruntime/quantization/CalTableFlatBuffers/
632
  COMMAND ${CMAKE_COMMAND} -E copy
633
      ${onnxruntime_python_quantization_fusions_src}
634
      $<TARGET_FILE_DIR:${build_output_target}>/onnxruntime/quantization/fusions/
635
  COMMAND ${CMAKE_COMMAND} -E copy
636
      ${onnxruntime_python_quantization_ep_qnn_src}
637
      $<TARGET_FILE_DIR:${build_output_target}>/onnxruntime/quantization/execution_providers/qnn/
638
  COMMAND ${CMAKE_COMMAND} -E copy
639
      ${onnxruntime_python_transformers_src}
640
      $<TARGET_FILE_DIR:${build_output_target}>/onnxruntime/transformers/
641
  COMMAND ${CMAKE_COMMAND} -E copy
642
      ${onnxruntime_python_transformers_models_bart_src}
643
      $<TARGET_FILE_DIR:${build_output_target}>/onnxruntime/transformers/models/bart/
644
  COMMAND ${CMAKE_COMMAND} -E copy
645
      ${onnxruntime_python_transformers_models_bert_src}
646
      $<TARGET_FILE_DIR:${build_output_target}>/onnxruntime/transformers/models/bert/
647
  COMMAND ${CMAKE_COMMAND} -E copy
648
      ${onnxruntime_python_transformers_models_gpt2_src}
649
      $<TARGET_FILE_DIR:${build_output_target}>/onnxruntime/transformers/models/gpt2/
650
  COMMAND ${CMAKE_COMMAND} -E copy
651
      ${onnxruntime_python_transformers_models_llama_src}
652
      $<TARGET_FILE_DIR:${build_output_target}>/onnxruntime/transformers/models/llama/
653
  COMMAND ${CMAKE_COMMAND} -E copy
654
      ${onnxruntime_python_transformers_models_longformer_src}
655
      $<TARGET_FILE_DIR:${build_output_target}>/onnxruntime/transformers/models/longformer/
656
  COMMAND ${CMAKE_COMMAND} -E copy
657
      ${onnxruntime_python_transformers_models_phi2_src}
658
      $<TARGET_FILE_DIR:${build_output_target}>/onnxruntime/transformers/models/phi2/
659
  COMMAND ${CMAKE_COMMAND} -E copy
660
      ${onnxruntime_python_transformers_models_stable_diffusion_src}
661
      $<TARGET_FILE_DIR:${build_output_target}>/onnxruntime/transformers/models/stable_diffusion/
662
  COMMAND ${CMAKE_COMMAND} -E copy
663
      ${onnxruntime_python_transformers_models_t5_src}
664
      $<TARGET_FILE_DIR:${build_output_target}>/onnxruntime/transformers/models/t5/
665
  COMMAND ${CMAKE_COMMAND} -E copy
666
      ${onnxruntime_python_transformers_models_whisper_src}
667
      $<TARGET_FILE_DIR:${build_output_target}>/onnxruntime/transformers/models/whisper/
668
  COMMAND ${CMAKE_COMMAND} -E copy
669
      ${REPO_ROOT}/VERSION_NUMBER
670
      $<TARGET_FILE_DIR:${build_output_target}>
671
)
672

673
if (onnxruntime_BUILD_SHARED_LIB)
674
  add_custom_command(
675
    TARGET onnxruntime_pybind11_state POST_BUILD
676
    COMMAND ${CMAKE_COMMAND} -E copy
677
        $<TARGET_FILE:onnxruntime>
678
        $<TARGET_FILE_DIR:${build_output_target}>/onnxruntime/capi/
679
  )
680
endif()
681

682
if (onnxruntime_USE_OPENVINO)
683
  add_custom_command(
684
    TARGET onnxruntime_pybind11_state POST_BUILD
685
    COMMAND ${CMAKE_COMMAND} -E copy
686
        ${onnxruntime_python_openvino_python_srcs}
687
        $<TARGET_FILE_DIR:${build_output_target}>/onnxruntime/tools/
688
  )
689
endif()
690

691
if (onnxruntime_ENABLE_EXTERNAL_CUSTOM_OP_SCHEMAS)
692
  add_custom_command(
693
    TARGET onnxruntime_pybind11_state POST_BUILD
694
    COMMAND ${CMAKE_COMMAND} -E make_directory $<TARGET_FILE_DIR:${build_output_target}>/onnxruntime/external/include/
695
    COMMAND ${CMAKE_COMMAND} -E create_symlink
696
        $<TARGET_FILE_DIR:${build_output_target}>/include/google
697
        $<TARGET_FILE_DIR:${build_output_target}>/onnxruntime/external/include/google
698
    COMMAND ${CMAKE_COMMAND} -E create_symlink
699
        $<TARGET_FILE_DIR:${build_output_target}>/external/onnx/onnx
700
        $<TARGET_FILE_DIR:${build_output_target}>/onnxruntime/external/include/onnx
701
    COMMAND ${CMAKE_COMMAND} -E copy_directory
702
        ${ORTTRAINING_ROOT}/orttraining/test/external_custom_ops
703
        $<TARGET_FILE_DIR:${build_output_target}>/external_custom_ops
704
    )
705
endif()
706

707
if (NOT onnxruntime_MINIMAL_BUILD AND NOT onnxruntime_EXTENDED_MINIMAL_BUILD
708
                                  AND NOT ${CMAKE_SYSTEM_NAME} MATCHES "Darwin|iOS|visionOS"
709
                                  AND NOT CMAKE_SYSTEM_NAME STREQUAL "Android"
710
                                  AND NOT onnxruntime_USE_ROCM
711
                                  AND NOT CMAKE_SYSTEM_NAME STREQUAL "Emscripten")
712
  add_custom_command(
713
    TARGET onnxruntime_pybind11_state POST_BUILD
714
    COMMAND ${CMAKE_COMMAND} -E copy
715
      $<TARGET_FILE:onnxruntime_providers_shared>
716
      $<TARGET_FILE_DIR:${build_output_target}>/onnxruntime/capi/
717
  )
718
endif()
719

720
if (onnxruntime_BUILD_UNIT_TESTS)
721
  add_custom_command(
722
    TARGET onnxruntime_pybind11_state POST_BUILD
723
    COMMAND ${CMAKE_COMMAND} -E copy
724
        ${onnxruntime_python_test_srcs}
725
        $<TARGET_FILE_DIR:${build_output_target}>
726
    COMMAND ${CMAKE_COMMAND} -E copy
727
        ${onnxruntime_python_quantization_test_srcs}
728
        $<TARGET_FILE_DIR:${build_output_target}>/quantization/
729
    COMMAND ${CMAKE_COMMAND} -E copy
730
        ${onnxruntime_python_transformers_test_srcs}
731
        $<TARGET_FILE_DIR:${build_output_target}>/transformers/
732
    COMMAND ${CMAKE_COMMAND} -E copy
733
        ${onnxruntime_python_transformers_testdata_srcs}
734
        $<TARGET_FILE_DIR:${build_output_target}>/transformers/test_data/models/
735
    COMMAND ${CMAKE_COMMAND} -E copy
736
        ${onnxruntime_python_transformers_testdata_whisper}
737
        $<TARGET_FILE_DIR:${build_output_target}>/transformers/test_data/models/whisper/
738
    COMMAND ${CMAKE_COMMAND} -E copy
739
        ${onnxruntime_python_transformers_testdata_conformer}
740
        $<TARGET_FILE_DIR:${build_output_target}>/transformers/test_data/models/conformer/
741
  )
742
endif()
743

744
if (onnxruntime_BUILD_UNIT_TESTS AND onnxruntime_ENABLE_EAGER_MODE)
745
  file(GLOB onnxruntime_eager_test_srcs CONFIGURE_DEPENDS
746
      "${ORTTRAINING_ROOT}/orttraining/eager/test/*.py"
747
  )
748
  add_custom_command(
749
    TARGET onnxruntime_pybind11_state POST_BUILD
750
    COMMAND ${CMAKE_COMMAND} -E copy
751
        ${onnxruntime_eager_test_srcs}
752
        $<TARGET_FILE_DIR:${build_output_target}>/eager_test/
753
  )
754
endif()
755

756
if (onnxruntime_ENABLE_TRAINING)
757
  add_custom_command(
758
    TARGET onnxruntime_pybind11_state POST_BUILD
759
    COMMAND ${CMAKE_COMMAND} -E make_directory $<TARGET_FILE_DIR:${build_output_target}>/onnxruntime/training
760
    COMMAND ${CMAKE_COMMAND} -E make_directory $<TARGET_FILE_DIR:${build_output_target}>/onnxruntime/training/amp
761
    COMMAND ${CMAKE_COMMAND} -E make_directory $<TARGET_FILE_DIR:${build_output_target}>/onnxruntime/training/experimental
762
    COMMAND ${CMAKE_COMMAND} -E make_directory $<TARGET_FILE_DIR:${build_output_target}>/onnxruntime/training/experimental/gradient_graph
763
    COMMAND ${CMAKE_COMMAND} -E make_directory $<TARGET_FILE_DIR:${build_output_target}>/onnxruntime/training/optim
764
    COMMAND ${CMAKE_COMMAND} -E make_directory $<TARGET_FILE_DIR:${build_output_target}>/onnxruntime/training/ortmodule
765
    COMMAND ${CMAKE_COMMAND} -E make_directory $<TARGET_FILE_DIR:${build_output_target}>/onnxruntime/training/ortmodule/experimental
766
    COMMAND ${CMAKE_COMMAND} -E make_directory $<TARGET_FILE_DIR:${build_output_target}>/onnxruntime/training/ortmodule/experimental/json_config
767
    COMMAND ${CMAKE_COMMAND} -E make_directory $<TARGET_FILE_DIR:${build_output_target}>/onnxruntime/training/ortmodule/experimental/hierarchical_ortmodule
768
    COMMAND ${CMAKE_COMMAND} -E make_directory $<TARGET_FILE_DIR:${build_output_target}>/onnxruntime/training/ortmodule/torch_cpp_extensions
769
    COMMAND ${CMAKE_COMMAND} -E make_directory $<TARGET_FILE_DIR:${build_output_target}>/onnxruntime/training/ortmodule/torch_cpp_extensions/cpu/aten_op_executor
770
    COMMAND ${CMAKE_COMMAND} -E make_directory $<TARGET_FILE_DIR:${build_output_target}>/onnxruntime/training/ortmodule/torch_cpp_extensions/cpu/torch_interop_utils
771
    COMMAND ${CMAKE_COMMAND} -E make_directory $<TARGET_FILE_DIR:${build_output_target}>/onnxruntime/training/ortmodule/torch_cpp_extensions/cuda/torch_gpu_allocator
772
    COMMAND ${CMAKE_COMMAND} -E make_directory $<TARGET_FILE_DIR:${build_output_target}>/onnxruntime/training/ortmodule/torch_cpp_extensions/cuda/fused_ops
773
    COMMAND ${CMAKE_COMMAND} -E make_directory $<TARGET_FILE_DIR:${build_output_target}>/onnxruntime/training/ortmodule/graph_optimizers
774
    COMMAND ${CMAKE_COMMAND} -E make_directory $<TARGET_FILE_DIR:${build_output_target}>/onnxruntime/training/ortmodule/experimental/pipe
775
    COMMAND ${CMAKE_COMMAND} -E make_directory $<TARGET_FILE_DIR:${build_output_target}>/onnxruntime/training/ort_triton
776
    COMMAND ${CMAKE_COMMAND} -E make_directory $<TARGET_FILE_DIR:${build_output_target}>/onnxruntime/training/ort_triton/kernel
777
    COMMAND ${CMAKE_COMMAND} -E make_directory $<TARGET_FILE_DIR:${build_output_target}>/onnxruntime/training/utils
778
    COMMAND ${CMAKE_COMMAND} -E make_directory $<TARGET_FILE_DIR:${build_output_target}>/onnxruntime/training/utils/data/
779
    COMMAND ${CMAKE_COMMAND} -E make_directory $<TARGET_FILE_DIR:${build_output_target}>/onnxruntime/training/utils/hooks/
780
    COMMAND ${CMAKE_COMMAND} -E copy
781
        ${onnxruntime_python_root_srcs}
782
        $<TARGET_FILE_DIR:${build_output_target}>/onnxruntime/training/
783
    COMMAND ${CMAKE_COMMAND} -E copy
784
        ${onnxruntime_python_amp_srcs}
785
        $<TARGET_FILE_DIR:${build_output_target}>/onnxruntime/training/amp/
786
    COMMAND ${CMAKE_COMMAND} -E copy
787
        ${onnxruntime_python_experimental_srcs}
788
        $<TARGET_FILE_DIR:${build_output_target}>/onnxruntime/training/experimental/
789
    COMMAND ${CMAKE_COMMAND} -E copy
790
        ${onnxruntime_python_gradient_graph_srcs}
791
        $<TARGET_FILE_DIR:${build_output_target}>/onnxruntime/training/experimental/gradient_graph/
792
    COMMAND ${CMAKE_COMMAND} -E copy
793
        ${onnxruntime_python_optim_srcs}
794
        $<TARGET_FILE_DIR:${build_output_target}>/onnxruntime/training/optim/
795
    COMMAND ${CMAKE_COMMAND} -E copy
796
        ${onnxruntime_python_ortmodule_srcs}
797
        $<TARGET_FILE_DIR:${build_output_target}>/onnxruntime/training/ortmodule/
798
    COMMAND ${CMAKE_COMMAND} -E copy
799
        ${onnxruntime_python_ortmodule_experimental_srcs}
800
        $<TARGET_FILE_DIR:${build_output_target}>/onnxruntime/training/ortmodule/experimental/
801
    COMMAND ${CMAKE_COMMAND} -E copy
802
        ${onnxruntime_python_ortmodule_experimental_json_config_srcs}
803
        $<TARGET_FILE_DIR:${build_output_target}>/onnxruntime/training/ortmodule/experimental/json_config/
804
    COMMAND ${CMAKE_COMMAND} -E copy
805
        ${onnxruntime_python_ortmodule_experimental_hierarchical_srcs}
806
        $<TARGET_FILE_DIR:${build_output_target}>/onnxruntime/training/ortmodule/experimental/hierarchical_ortmodule/
807
    COMMAND ${CMAKE_COMMAND} -E copy
808
        ${onnxruntime_python_ortmodule_torch_cpp_ext_srcs}
809
        $<TARGET_FILE_DIR:${build_output_target}>/onnxruntime/training/ortmodule/torch_cpp_extensions/
810
    COMMAND ${CMAKE_COMMAND} -E copy
811
        ${onnxruntime_python_ortmodule_torch_cpp_ext_aten_op_executor_srcs}
812
        $<TARGET_FILE_DIR:${build_output_target}>/onnxruntime/training/ortmodule/torch_cpp_extensions/cpu/aten_op_executor/
813
    COMMAND ${CMAKE_COMMAND} -E copy
814
        ${onnxruntime_python_ortmodule_torch_cpp_ext_torch_interop_utils_srcs}
815
        $<TARGET_FILE_DIR:${build_output_target}>/onnxruntime/training/ortmodule/torch_cpp_extensions/cpu/torch_interop_utils/
816
    COMMAND ${CMAKE_COMMAND} -E copy
817
        ${onnxruntime_python_ortmodule_torch_cpp_ext_torch_gpu_allocator_srcs}
818
        $<TARGET_FILE_DIR:${build_output_target}>/onnxruntime/training/ortmodule/torch_cpp_extensions/cuda/torch_gpu_allocator/
819
    COMMAND ${CMAKE_COMMAND} -E copy
820
        ${onnxruntime_python_ortmodule_torch_cpp_ext_fused_ops_srcs}
821
        $<TARGET_FILE_DIR:${build_output_target}>/onnxruntime/training/ortmodule/torch_cpp_extensions/cuda/fused_ops/
822
    COMMAND ${CMAKE_COMMAND} -E copy
823
        ${onnxruntime_python_ortmodule_graph_optimizers_srcs}
824
        $<TARGET_FILE_DIR:${build_output_target}>/onnxruntime/training/ortmodule/graph_optimizers/
825
    COMMAND ${CMAKE_COMMAND} -E copy
826
        ${onnxruntime_python_ortmodule_pipe_srcs}
827
        $<TARGET_FILE_DIR:${build_output_target}>/onnxruntime/training/ortmodule/experimental/pipe/
828
    COMMAND ${CMAKE_COMMAND} -E copy
829
        ${onnxruntime_python_ort_triton_srcs}
830
        $<TARGET_FILE_DIR:${build_output_target}>/onnxruntime/training/ort_triton/
831
    COMMAND ${CMAKE_COMMAND} -E copy
832
        ${onnxruntime_python_ort_triton_kernel_srcs}
833
        $<TARGET_FILE_DIR:${build_output_target}>/onnxruntime/training/ort_triton/kernel/
834
    COMMAND ${CMAKE_COMMAND} -E copy
835
        ${onnxruntime_python_utils_srcs}
836
        $<TARGET_FILE_DIR:${build_output_target}>/onnxruntime/training/utils/
837
    COMMAND ${CMAKE_COMMAND} -E copy
838
        ${onnxruntime_python_utils_data_srcs}
839
        $<TARGET_FILE_DIR:${build_output_target}>/onnxruntime/training/utils/data/
840
    COMMAND ${CMAKE_COMMAND} -E copy
841
        ${onnxruntime_python_utils_hooks_srcs}
842
        $<TARGET_FILE_DIR:${build_output_target}>/onnxruntime/training/utils/hooks/
843
  )
844
  if (onnxruntime_ENABLE_TRAINING_APIS)
845
    add_custom_command(
846
      TARGET onnxruntime_pybind11_state POST_BUILD
847
      COMMAND ${CMAKE_COMMAND} -E make_directory $<TARGET_FILE_DIR:${build_output_target}>/onnxruntime/training/onnxblock
848
      COMMAND ${CMAKE_COMMAND} -E make_directory $<TARGET_FILE_DIR:${build_output_target}>/onnxruntime/training/onnxblock/loss
849
      COMMAND ${CMAKE_COMMAND} -E make_directory $<TARGET_FILE_DIR:${build_output_target}>/onnxruntime/training/onnxblock/optim
850
      COMMAND ${CMAKE_COMMAND} -E make_directory $<TARGET_FILE_DIR:${build_output_target}>/onnxruntime/training/api
851
      COMMAND ${CMAKE_COMMAND} -E copy
852
        ${onnxruntime_python_onnxblock_srcs}
853
        $<TARGET_FILE_DIR:${build_output_target}>/onnxruntime/training/onnxblock/
854
      COMMAND ${CMAKE_COMMAND} -E copy
855
        ${onnxruntime_python_onnxblock_loss_srcs}
856
        $<TARGET_FILE_DIR:${build_output_target}>/onnxruntime/training/onnxblock/loss/
857
      COMMAND ${CMAKE_COMMAND} -E copy
858
        ${onnxruntime_python_onnxblock_optim_srcs}
859
        $<TARGET_FILE_DIR:${build_output_target}>/onnxruntime/training/onnxblock/optim/
860
      COMMAND ${CMAKE_COMMAND} -E copy
861
        ${onnxruntime_python_api_srcs}
862
        $<TARGET_FILE_DIR:${build_output_target}>/onnxruntime/training/api/
863
    )
864
  endif()
865
endif()
866

867
if (onnxruntime_USE_DNNL)
868
  add_custom_command(
869
    TARGET onnxruntime_pybind11_state POST_BUILD
870
    COMMAND ${CMAKE_COMMAND} -E copy
871
        ${DNNL_DLL_PATH} $<TARGET_FILE:onnxruntime_providers_dnnl>
872
        $<TARGET_FILE:onnxruntime_providers_shared>
873
        $<TARGET_FILE_DIR:${build_output_target}>/onnxruntime/capi/
874
  )
875
endif()
876

877
if (onnxruntime_USE_VITISAI)
878
  add_custom_command(
879
    TARGET onnxruntime_pybind11_state POST_BUILD
880
    COMMAND ${CMAKE_COMMAND} -E copy
881
        ${DNNL_DLL_PATH} $<TARGET_FILE:onnxruntime_providers_vitisai>
882
        $<TARGET_FILE:onnxruntime_providers_shared>
883
        $<TARGET_FILE_DIR:${build_output_target}>/onnxruntime/capi/
884
  )
885
endif()
886

887
if (onnxruntime_USE_TENSORRT)
888
  add_custom_command(
889
    TARGET onnxruntime_pybind11_state POST_BUILD
890
    COMMAND ${CMAKE_COMMAND} -E copy
891
        $<TARGET_FILE:onnxruntime_providers_tensorrt>
892
        $<TARGET_FILE:onnxruntime_providers_shared>
893
        $<TARGET_FILE_DIR:${build_output_target}>/onnxruntime/capi/
894
  )
895
endif()
896

897
if (onnxruntime_USE_MIGRAPHX)
898
  add_custom_command(
899
    TARGET onnxruntime_pybind11_state POST_BUILD
900
    COMMAND ${CMAKE_COMMAND} -E copy
901
        $<TARGET_FILE:onnxruntime_providers_migraphx>
902
        $<TARGET_FILE:onnxruntime_providers_shared>
903
        $<TARGET_FILE_DIR:${build_output_target}>/onnxruntime/capi/
904
  )
905
endif()
906

907
if (onnxruntime_USE_OPENVINO)
908
    add_custom_command(
909
      TARGET onnxruntime_pybind11_state POST_BUILD
910
      COMMAND ${CMAKE_COMMAND} -E copy
911
          $<TARGET_FILE:onnxruntime_providers_openvino>
912
          $<TARGET_FILE:onnxruntime_providers_shared>
913
          $<TARGET_FILE_DIR:${build_output_target}>/onnxruntime/capi/
914
    )
915
endif()
916

917
if (DEFINED ENV{OPENVINO_MANYLINUX})
918
    file(GLOB onnxruntime_python_openvino_python_srcs CONFIGURE_DEPENDS
919
        "${ONNXRUNTIME_ROOT}/core/providers/openvino/scripts/*"
920
    )
921

922
    add_custom_command(
923
      TARGET onnxruntime_pybind11_state POST_BUILD
924
      COMMAND ${CMAKE_COMMAND} -E copy
925
          ${onnxruntime_python_openvino_python_srcs}
926
          $<TARGET_FILE_DIR:${build_output_target}>/onnxruntime/capi/
927
    )
928
endif()
929

930
if (onnxruntime_USE_CUDA)
931
    add_custom_command(
932
      TARGET onnxruntime_pybind11_state POST_BUILD
933
      COMMAND ${CMAKE_COMMAND} -E copy
934
          $<TARGET_FILE:onnxruntime_providers_cuda>
935
          $<TARGET_FILE:onnxruntime_providers_shared>
936
          $<TARGET_FILE_DIR:${build_output_target}>/onnxruntime/capi/
937
    )
938
endif()
939

940
if (onnxruntime_USE_CANN)
941
    add_custom_command(
942
      TARGET onnxruntime_pybind11_state POST_BUILD
943
      COMMAND ${CMAKE_COMMAND} -E copy
944
          $<TARGET_FILE:onnxruntime_providers_cann>
945
          $<TARGET_FILE:onnxruntime_providers_shared>
946
          $<TARGET_FILE_DIR:${build_output_target}>/onnxruntime/capi/
947
    )
948
endif()
949

950
if (onnxruntime_USE_ROCM)
951
    add_custom_command(
952
      TARGET onnxruntime_pybind11_state POST_BUILD
953
      COMMAND ${CMAKE_COMMAND} -E copy
954
          $<TARGET_FILE:onnxruntime_providers_rocm>
955
          $<TARGET_FILE:onnxruntime_providers_shared>
956
          $<TARGET_FILE_DIR:${build_output_target}>/onnxruntime/capi/
957
    )
958
endif()
959

960
if (onnxruntime_USE_TVM)
961
  file(GLOB onnxruntime_python_providers_tvm_srcs CONFIGURE_DEPENDS
962
    "${ONNXRUNTIME_ROOT}/python/providers/tvm/*.py"
963
  )
964
  add_custom_command(
965
    TARGET onnxruntime_pybind11_state POST_BUILD
966
    COMMAND ${CMAKE_COMMAND} -E make_directory $<TARGET_FILE_DIR:${build_output_target}>/onnxruntime/providers
967
    COMMAND ${CMAKE_COMMAND} -E make_directory $<TARGET_FILE_DIR:${build_output_target}>/onnxruntime/providers/tvm
968
    COMMAND ${CMAKE_COMMAND} -E copy
969
        ${onnxruntime_python_providers_tvm_srcs}
970
        $<TARGET_FILE_DIR:${build_output_target}>/onnxruntime/providers/tvm
971
    COMMAND ${CMAKE_COMMAND} -E copy
972
        $<TARGET_FILE:onnxruntime_providers_tvm>
973
        $<TARGET_FILE_DIR:${build_output_target}>/onnxruntime/capi/
974
  )
975

976
  add_custom_command(
977
    TARGET onnxruntime_pybind11_state POST_BUILD
978
      WORKING_DIRECTORY ${tvm_SOURCE_DIR}/python
979
      COMMAND ${Python_EXECUTABLE} setup.py bdist_wheel
980
    )
981

982
  add_custom_command(
983
    TARGET onnxruntime_pybind11_state POST_BUILD
984
    COMMAND ${Python_EXECUTABLE}
985
          $<TARGET_FILE_DIR:${build_output_target}>/onnxruntime/providers/tvm/extend_python_file.py
986
          --target_file $<TARGET_FILE_DIR:${build_output_target}>/onnxruntime/capi/_ld_preload.py
987
  )
988

989
endif()
990

991
if (onnxruntime_USE_DML)
992
  if (NOT onnxruntime_USE_CUSTOM_DIRECTML)
993
    set(dml_shared_lib_path ${DML_PACKAGE_DIR}/bin/${onnxruntime_target_platform}-win/${DML_SHARED_LIB})
994
  else()
995
    set(dml_shared_lib_path ${DML_PACKAGE_DIR}/bin/${DML_SHARED_LIB})
996
  endif()
997
  add_custom_command(
998
    TARGET onnxruntime_pybind11_state POST_BUILD
999
    COMMAND ${CMAKE_COMMAND} -E copy
1000
        ${dml_shared_lib_path}
1001
        $<TARGET_FILE_DIR:${build_output_target}>/onnxruntime/capi/
1002
  )
1003
endif()
1004

1005
if (onnxruntime_USE_NNAPI_BUILTIN)
1006
  add_custom_command(
1007
    TARGET onnxruntime_pybind11_state POST_BUILD
1008
    COMMAND ${CMAKE_COMMAND} -E copy
1009
        $<TARGET_FILE:onnxruntime_providers_nnapi>
1010
        $<TARGET_FILE_DIR:${build_output_target}>/onnxruntime/capi/
1011
  )
1012
endif()
1013

1014
if (onnxruntime_USE_COREML)
1015
  add_custom_command(
1016
    TARGET onnxruntime_pybind11_state POST_BUILD
1017
    COMMAND ${CMAKE_COMMAND} -E copy
1018
        $<TARGET_FILE:onnxruntime_providers_coreml>
1019
        $<TARGET_FILE_DIR:${build_output_target}>/onnxruntime/capi/
1020
  )
1021
endif()
1022

1023
if (onnxruntime_USE_QNN)
1024
  add_custom_command(
1025
    TARGET onnxruntime_pybind11_state POST_BUILD
1026
    COMMAND ${CMAKE_COMMAND} -E copy
1027
        ${QNN_LIB_FILES}
1028
        $<TARGET_FILE_DIR:${build_output_target}>/onnxruntime/capi/
1029
  )
1030
  if (EXISTS "${onnxruntime_QNN_HOME}/Qualcomm AI Hub Proprietary License.pdf")
1031
    add_custom_command(
1032
      TARGET onnxruntime_pybind11_state POST_BUILD
1033
      COMMAND ${CMAKE_COMMAND} -E copy
1034
          "${onnxruntime_QNN_HOME}/Qualcomm AI Hub Proprietary License.pdf"
1035
          $<TARGET_FILE_DIR:${build_output_target}>/onnxruntime/
1036
    )
1037
  endif()
1038
endif()
1039

1040
endif()
1041

Использование cookies

Мы используем файлы cookie в соответствии с Политикой конфиденциальности и Политикой использования cookies.

Нажимая кнопку «Принимаю», Вы даете АО «СберТех» согласие на обработку Ваших персональных данных в целях совершенствования нашего веб-сайта и Сервиса GitVerse, а также повышения удобства их использования.

Запретить использование cookies Вы можете самостоятельно в настройках Вашего браузера.