Skip to content

Commit 25722bb

Browse files
authored
Add CUDA custom op header files to Linux tarball (#21551)
### Description The header files were added in PR #16454. Then, recently I made a PR #21464 that changed how we packed Linux tarballs. The new tarball misses the custom op header files. Therefore I need to make this change. ### Motivation and Context <!-- - Why is this change required? What problem does it solve? - If it fixes an open issue, please link to the issue here. -->
1 parent 4b8f6dc commit 25722bb

File tree

4 files changed

+23
-6
lines changed

4 files changed

+23
-6
lines changed

cmake/onnxruntime.cmake

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -38,10 +38,14 @@ function(get_c_cxx_api_headers HEADERS_VAR)
3838

3939
# need to add header files for enabled EPs
4040
foreach(f ${ONNXRUNTIME_PROVIDER_NAMES})
41-
file(GLOB _provider_headers CONFIGURE_DEPENDS
42-
"${REPO_ROOT}/include/onnxruntime/core/providers/${f}/*.h"
43-
)
44-
list(APPEND _headers ${_provider_headers})
41+
# The header files in include/onnxruntime/core/providers/cuda directory cannot be flattened to the same directory
42+
# with onnxruntime_c_api.h . Most other EPs probably also do not work in this way.
43+
if((NOT f STREQUAL cuda) AND (NOT f STREQUAL rocm))
44+
file(GLOB _provider_headers CONFIGURE_DEPENDS
45+
"${REPO_ROOT}/include/onnxruntime/core/providers/${f}/*.h"
46+
)
47+
list(APPEND _headers ${_provider_headers})
48+
endif()
4549
endforeach()
4650

4751
set(${HEADERS_VAR} ${_headers} PARENT_SCOPE)

cmake/onnxruntime_providers_cpu.cmake

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -219,6 +219,7 @@ if (onnxruntime_ENABLE_TRAINING)
219219
endif()
220220

221221
install(FILES ${PROJECT_SOURCE_DIR}/../include/onnxruntime/core/providers/cpu/cpu_provider_factory.h DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/onnxruntime/)
222+
install(FILES ${PROJECT_SOURCE_DIR}/../include/onnxruntime/core/providers/resource.h ${PROJECT_SOURCE_DIR}/../include/onnxruntime/core/providers/custom_op_context.h DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/onnxruntime/core/providers)
222223
set_target_properties(onnxruntime_providers PROPERTIES LINKER_LANGUAGE CXX)
223224
set_target_properties(onnxruntime_providers PROPERTIES FOLDER "ONNXRuntime")
224225

cmake/onnxruntime_providers_cuda.cmake

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -289,8 +289,15 @@
289289
config_cuda_provider_shared_module(onnxruntime_providers_cuda_obj)
290290
endif()
291291
config_cuda_provider_shared_module(onnxruntime_providers_cuda)
292-
292+
# Cannot use glob because the file cuda_provider_options.h should not be exposed out.
293+
set(ONNXRUNTIME_CUDA_PROVIDER_PUBLIC_HEADERS
294+
"${REPO_ROOT}/include/onnxruntime/core/providers/cuda/cuda_context.h"
295+
"${REPO_ROOT}/include/onnxruntime/core/providers/cuda/cuda_resource.h"
296+
)
297+
set_target_properties(onnxruntime_providers_cuda PROPERTIES
298+
PUBLIC_HEADER "${ONNXRUNTIME_CUDA_PROVIDER_PUBLIC_HEADERS}")
293299
install(TARGETS onnxruntime_providers_cuda
300+
PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/onnxruntime/core/providers/cuda
294301
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
295302
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
296303
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})

cmake/onnxruntime_providers_rocm.cmake

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -223,8 +223,13 @@
223223
if (onnxruntime_ENABLE_ATEN)
224224
target_compile_definitions(onnxruntime_providers_rocm PRIVATE ENABLE_ATEN)
225225
endif()
226-
226+
file(GLOB ONNXRUNTIME_ROCM_PROVIDER_PUBLIC_HEADERS CONFIGURE_DEPENDS
227+
"${REPO_ROOT}/include/onnxruntime/core/providers/rocm/*.h"
228+
)
229+
set_target_properties(onnxruntime_providers_rocm PROPERTIES
230+
PUBLIC_HEADER "${ONNXRUNTIME_ROCM_PROVIDER_PUBLIC_HEADERS}")
227231
install(TARGETS onnxruntime_providers_rocm
232+
PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/onnxruntime/core/providers/rocm
228233
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
229234
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
230235
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})

0 commit comments

Comments
 (0)