diff --git a/cmake/onnxruntime.cmake b/cmake/onnxruntime.cmake index bdb4b00b02a35..927b4ac84b037 100644 --- a/cmake/onnxruntime.cmake +++ b/cmake/onnxruntime.cmake @@ -38,10 +38,14 @@ function(get_c_cxx_api_headers HEADERS_VAR) # need to add header files for enabled EPs foreach(f ${ONNXRUNTIME_PROVIDER_NAMES}) - file(GLOB _provider_headers CONFIGURE_DEPENDS - "${REPO_ROOT}/include/onnxruntime/core/providers/${f}/*.h" - ) - list(APPEND _headers ${_provider_headers}) + # The header files in include/onnxruntime/core/providers/cuda directory cannot be flattened to the same directory + # with onnxruntime_c_api.h . Most other EPs probably also do not work in this way. + if((NOT f STREQUAL cuda) AND (NOT f STREQUAL rocm)) + file(GLOB _provider_headers CONFIGURE_DEPENDS + "${REPO_ROOT}/include/onnxruntime/core/providers/${f}/*.h" + ) + list(APPEND _headers ${_provider_headers}) + endif() endforeach() set(${HEADERS_VAR} ${_headers} PARENT_SCOPE) diff --git a/cmake/onnxruntime_providers_cpu.cmake b/cmake/onnxruntime_providers_cpu.cmake index d2afe19f36691..bbcc709b144a0 100644 --- a/cmake/onnxruntime_providers_cpu.cmake +++ b/cmake/onnxruntime_providers_cpu.cmake @@ -219,6 +219,7 @@ if (onnxruntime_ENABLE_TRAINING) endif() install(FILES ${PROJECT_SOURCE_DIR}/../include/onnxruntime/core/providers/cpu/cpu_provider_factory.h DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/onnxruntime/) +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) set_target_properties(onnxruntime_providers PROPERTIES LINKER_LANGUAGE CXX) set_target_properties(onnxruntime_providers PROPERTIES FOLDER "ONNXRuntime") diff --git a/cmake/onnxruntime_providers_cuda.cmake b/cmake/onnxruntime_providers_cuda.cmake index 82c31ce6b6b4d..0829be05a3ab0 100644 --- a/cmake/onnxruntime_providers_cuda.cmake +++ b/cmake/onnxruntime_providers_cuda.cmake @@ -289,8 +289,15 @@ config_cuda_provider_shared_module(onnxruntime_providers_cuda_obj) endif() config_cuda_provider_shared_module(onnxruntime_providers_cuda) - + # Cannot use glob because the file cuda_provider_options.h should not be exposed out. + set(ONNXRUNTIME_CUDA_PROVIDER_PUBLIC_HEADERS + "${REPO_ROOT}/include/onnxruntime/core/providers/cuda/cuda_context.h" + "${REPO_ROOT}/include/onnxruntime/core/providers/cuda/cuda_resource.h" + ) + set_target_properties(onnxruntime_providers_cuda PROPERTIES + PUBLIC_HEADER "${ONNXRUNTIME_CUDA_PROVIDER_PUBLIC_HEADERS}") install(TARGETS onnxruntime_providers_cuda + PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/onnxruntime/core/providers/cuda ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}) diff --git a/cmake/onnxruntime_providers_rocm.cmake b/cmake/onnxruntime_providers_rocm.cmake index 71692ddb9391f..559204bd0df88 100644 --- a/cmake/onnxruntime_providers_rocm.cmake +++ b/cmake/onnxruntime_providers_rocm.cmake @@ -223,8 +223,13 @@ if (onnxruntime_ENABLE_ATEN) target_compile_definitions(onnxruntime_providers_rocm PRIVATE ENABLE_ATEN) endif() - + file(GLOB ONNXRUNTIME_ROCM_PROVIDER_PUBLIC_HEADERS CONFIGURE_DEPENDS + "${REPO_ROOT}/include/onnxruntime/core/providers/rocm/*.h" + ) + set_target_properties(onnxruntime_providers_rocm PROPERTIES + PUBLIC_HEADER "${ONNXRUNTIME_ROCM_PROVIDER_PUBLIC_HEADERS}") install(TARGETS onnxruntime_providers_rocm + PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/onnxruntime/core/providers/rocm ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})