diff --git a/cmake/external/onnxruntime_external_deps.cmake b/cmake/external/onnxruntime_external_deps.cmake index 9effd1a2db..ed15ad31aa 100644 --- a/cmake/external/onnxruntime_external_deps.cmake +++ b/cmake/external/onnxruntime_external_deps.cmake @@ -19,16 +19,16 @@ endforeach() message("Loading Dependencies ...") # ABSL should be included before protobuf because protobuf may use absl -include(external/abseil-cpp.cmake) set(RE2_BUILD_TESTING OFF CACHE BOOL "" FORCE) -FetchContent_Declare( - re2 - URL ${DEP_URL_re2} - URL_HASH SHA1=${DEP_SHA1_re2} - FIND_PACKAGE_ARGS NAMES re2 -) +find_package(absl REQUIRED) +set(ABSEIL_LIBS absl::inlined_vector absl::flat_hash_set + absl::flat_hash_map absl::node_hash_set absl::node_hash_map absl::base absl::throw_delegate absl::raw_hash_set + absl::hash absl::city absl::low_level_hash absl::raw_logging_internal) +find_package(Protobuf REQUIRED) +find_package(re2 REQUIRED) +find_package(nlohmann_json REQUIRED) if (onnxruntime_BUILD_UNIT_TESTS) # WebAssembly threading support in Node.js is still an experimental feature and @@ -199,7 +199,6 @@ if (onnxruntime_DISABLE_RTTI) set(protobuf_DISABLE_RTTI ON CACHE BOOL "Remove runtime type information in the binaries" FORCE) endif() -include(protobuf_function) #protobuf end set(ENABLE_DATE_TESTING OFF CACHE BOOL "" FORCE) @@ -359,7 +359,7 @@ FetchContent_Declare( # protobuf's cmake/utf8_range.cmake has the following line include_directories(${utf8_range_SOURCE_DIR}) -onnxruntime_fetchcontent_makeavailable(Protobuf nlohmann_json mp11 re2 GSL flatbuffers ${ONNXRUNTIME_CPUINFO_PROJ} ${ONNXRUNTIME_CLOG_PROJ}) +onnxruntime_fetchcontent_makeavailable(mp11 GSL flatbuffers ${ONNXRUNTIME_CPUINFO_PROJ} ${ONNXRUNTIME_CLOG_PROJ}) if(NOT flatbuffers_FOUND) if(NOT TARGET flatbuffers::flatbuffers) add_library(flatbuffers::flatbuffers ALIAS flatbuffers) @@ -386,7 +386,7 @@ namespace std { using ::getenv; } endif() if (onnxruntime_BUILD_UNIT_TESTS) - onnxruntime_fetchcontent_makeavailable(googletest) + find_package(GTest REQUIRED) endif() if(Protobuf_FOUND) diff --git a/cmake/onnxruntime_unittests.cmake b/cmake/onnxruntime_unittests.cmake index 9347be180d..8c60ff40f4 100644 --- a/cmake/onnxruntime_unittests.cmake +++ b/cmake/onnxruntime_unittests.cmake @@ -935,6 +935,7 @@ endif() onnxruntime_add_include_to_target(onnx_test_data_proto onnx_proto) target_include_directories(onnx_test_data_proto PRIVATE ${CMAKE_CURRENT_BINARY_DIR}) set_target_properties(onnx_test_data_proto PROPERTIES FOLDER "ONNXRuntimeTest") +include(protobuf_function) onnxruntime_protobuf_generate(APPEND_PATH IMPORT_DIRS ${onnx_SOURCE_DIR} TARGET onnx_test_data_proto) #