diff --git a/BUILD.md b/BUILD.md index 4f886c39c4b32..703a4b1f64afa 100644 --- a/BUILD.md +++ b/BUILD.md @@ -326,13 +326,13 @@ The basic build commands are below. There are also some other parameters for bui ##### Cross compiling on Windows ```bash -./build.bat --android --android_sdk_path --android_ndk_path --dnnlibrary +./build.bat --android --android_sdk_path --android_ndk_path --use_dnnlibrary ``` ##### Cross compiling on Linux ```bash -./build.sh --android --android_sdk_path --android_ndk_path --dnnlibrary +./build.sh --android --android_sdk_path --android_ndk_path --use_dnnlibrary ``` --- diff --git a/cmake/CMakeLists.txt b/cmake/CMakeLists.txt index 0daa23235c724..af8aa1f976d9c 100644 --- a/cmake/CMakeLists.txt +++ b/cmake/CMakeLists.txt @@ -47,7 +47,7 @@ option(onnxruntime_ENABLE_MEMLEAK_CHECKER "Experimental: Enable memory leak chec option(onnxruntime_USE_CUDA "Build with CUDA support" OFF) option(onnxruntime_USE_OPENVINO "Build with OpenVINO support" OFF) option(onnxruntime_USE_EIGEN_FOR_BLAS "Use eign for blas" ON) -option(onnxruntime_USE_NNAPI "Build with DNNLibrary for Android NNAPI support" OFF) +option(onnxruntime_USE_NNAPI_DNNLIBRARY "Build with DNNLibrary for Android NNAPI support" OFF) option(onnxruntime_USE_RKNPU "Build with RKNPU support" OFF) option(onnxruntime_USE_DNNL "Build with DNNL support" OFF) option(onnxruntime_USE_MKLML "Build the default cpu provider with MKL-ML binary dependency" OFF) @@ -880,7 +880,7 @@ if (onnxruntime_ENABLE_TRAINING) add_subdirectory(horovod EXCLUDE_FROM_ALL) # use external/horovod/third_party/gloo/cmake/Modules/Findnccl.cmake to locate nccl lib path list(APPEND CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/external/horovod/third_party/gloo/cmake/Modules/) - find_package(nccl REQUIRED) + find_package(nccl REQUIRED) list(APPEND onnxruntime_EXTERNAL_LIBRARIES horovod ${NCCL_LIBRARIES} ${MPI_CXX_LIBRARIES} ${MPI_CXX_LINK_FLAGS}) endif() endif() diff --git a/cmake/onnxruntime_java.cmake b/cmake/onnxruntime_java.cmake index 0c4338fc93413..7139bf215fce2 100644 --- a/cmake/onnxruntime_java.cmake +++ b/cmake/onnxruntime_java.cmake @@ -48,7 +48,7 @@ set_source_files_properties(${JAVA_OUTPUT_JAR} PROPERTIES GENERATED TRUE) set_property(TARGET onnxruntime4j APPEND PROPERTY ADDITIONAL_CLEAN_FILES "${JAVA_OUTPUT_DIR}") # Specify the native sources -file(GLOB onnxruntime4j_native_src +file(GLOB onnxruntime4j_native_src "${JAVA_ROOT}/src/main/native/*.c" "${JAVA_ROOT}/src/main/native/*.h" "${REPO_ROOT}/include/onnxruntime/core/session/*.h" @@ -73,7 +73,7 @@ endif() if (onnxruntime_USE_TENSORRT) target_compile_definitions(onnxruntime4j_jni PRIVATE USE_TENSORRT=1) endif() -if (onnxruntime_USE_NNAPI) +if (onnxruntime_USE_NNAPI_DNNLIBRARY) target_compile_definitions(onnxruntime4j_jni PRIVATE USE_NNAPI=1) endif() if (onnxruntime_USE_NUPHAR) diff --git a/cmake/onnxruntime_providers.cmake b/cmake/onnxruntime_providers.cmake index aea9dc31a04aa..e9f5eb6bd1f58 100644 --- a/cmake/onnxruntime_providers.cmake +++ b/cmake/onnxruntime_providers.cmake @@ -51,7 +51,7 @@ if(onnxruntime_USE_TENSORRT) set(PROVIDERS_TENSORRT onnxruntime_providers_tensorrt) list(APPEND ONNXRUNTIME_PROVIDER_NAMES tensorrt) endif() -if(onnxruntime_USE_NNAPI) +if(onnxruntime_USE_NNAPI_DNNLIBRARY) set(PROVIDERS_NNAPI onnxruntime_providers_nnapi) list(APPEND ONNXRUNTIME_PROVIDER_NAMES nnapi) endif() @@ -461,7 +461,7 @@ if (onnxruntime_USE_OPENVINO) endif() -if (onnxruntime_USE_NNAPI) +if (onnxruntime_USE_NNAPI_DNNLIBRARY) add_definitions(-DUSE_NNAPI=1) option(DNN_READ_ONNX "" ON) set(DNN_CUSTOM_PROTOC_EXECUTABLE ${ONNX_CUSTOM_PROTOC_EXECUTABLE}) diff --git a/cmake/onnxruntime_unittests.cmake b/cmake/onnxruntime_unittests.cmake index b09d87dde7216..d1bc18fd4f0f4 100644 --- a/cmake/onnxruntime_unittests.cmake +++ b/cmake/onnxruntime_unittests.cmake @@ -204,7 +204,7 @@ if (onnxruntime_USE_NGRAPH) list(APPEND onnxruntime_test_providers_src ${onnxruntime_test_providers_ngraph_src}) endif() -if (onnxruntime_USE_NNAPI) +if (onnxruntime_USE_NNAPI_DNNLIBRARY) file(GLOB_RECURSE onnxruntime_test_providers_nnapi_src CONFIGURE_DEPENDS "${TEST_SRC_DIR}/providers/nnapi/*" ) diff --git a/samples/c_cxx/CMakeLists.txt b/samples/c_cxx/CMakeLists.txt index 8fded3363b80b..85be55782b923 100644 --- a/samples/c_cxx/CMakeLists.txt +++ b/samples/c_cxx/CMakeLists.txt @@ -15,7 +15,7 @@ endif() #onnxruntime providers option(onnxruntime_USE_CUDA "Build with CUDA support" OFF) option(onnxruntime_USE_OPENVINO "Build with OpenVINO support" OFF) -option(onnxruntime_USE_NNAPI "Build with DNNLibrary for Android NNAPI support" OFF) +option(onnxruntime_USE_NNAPI_DNNLIBRARY "Build with DNNLibrary for Android NNAPI support" OFF) option(onnxruntime_USE_DNNL "Build with DNNL support" OFF) option(onnxruntime_USE_NGRAPH "Build with nGraph support" OFF) option(onnxruntime_USE_NUPHAR "Build with Nuphar" OFF) @@ -57,10 +57,7 @@ endif() if(onnxruntime_USE_OPENVINO) add_definitions(-DUSE_OPENVINO) endif() -if(onnxruntime_USE_NNAPI) - add_definitions(-DUSE_NNAPI) -endif() -if(onnxruntime_USE_NNAPI) +if(onnxruntime_USE_NNAPI_DNNLIBRARY) add_definitions(-DUSE_NNAPI) endif() if(onnxruntime_USE_DNNL) diff --git a/server/CMakeLists.txt b/server/CMakeLists.txt index c3efb932e3503..10385f9026e52 100755 --- a/server/CMakeLists.txt +++ b/server/CMakeLists.txt @@ -8,7 +8,7 @@ project(onnxruntime C CXX) option(onnxruntime_USE_CUDA "Build with CUDA support" OFF) option(onnxruntime_USE_OPENVINO "Build with OpenVINO support" OFF) -option(onnxruntime_USE_NNAPI "Build with DNNLibrary for Android NNAPI support" OFF) +option(onnxruntime_USE_NNAPI_DNNLIBRARY "Build with DNNLibrary for Android NNAPI support" OFF) option(onnxruntime_USE_DNNL "Build with DNNL support" OFF) option(onnxruntime_USE_NGRAPH "Build with nGraph support" OFF) option(onnxruntime_USE_NUPHAR "Build with Nuphar" OFF) @@ -23,7 +23,7 @@ endif() if(onnxruntime_USE_OPENVINO) add_definitions(-DUSE_OPENVINO=1) endif() -if(onnxruntime_USE_NNAPI) +if(onnxruntime_USE_NNAPI_DNNLIBRARY) add_definitions(-DUSE_NNAPI=1) endif() if(onnxruntime_USE_DNNL) @@ -88,7 +88,7 @@ endif() add_custom_command( OUTPUT "${grpc_srcs}" "${grpc_hdrs}" COMMAND protoc - ARGS + ARGS --cpp_out "${CMAKE_CURRENT_BINARY_DIR}" --grpc_out "${CMAKE_CURRENT_BINARY_DIR}" --plugin=protoc-gen-grpc="${_gRPC_CPP_PLUGIN_EXECUTABLE}" @@ -155,7 +155,7 @@ target_include_directories(onnxruntime_server_http_core_lib ${ONNXRUNTIME_SERVER_ROOT}/http/core ${ONNXRUNTIME_SERVER_ROOT}/core ${Boost_INCLUDE_DIR} - + ) add_dependencies(onnxruntime_server_http_core_lib Boost) @@ -167,7 +167,7 @@ target_include_directories(onnxruntime_server_lib PRIVATE ${ONNXRUNTIME_SERVER_ROOT} ${ONNXRUNTIME_SERVER_ROOT}/http ${ONNXRUNTIME_SERVER_ROOT}/logging - ${ONNXRUNTIME_SERVER_ROOT}/core + ${ONNXRUNTIME_SERVER_ROOT}/core PUBLIC ${ONNXRUNTIME_SERVER_ROOT}/external/spdlog/include ${ONNXRUNTIME_SERVER_ROOT}/http/core @@ -208,10 +208,10 @@ target_include_directories(${SERVER_APP_NAME} PRIVATE target_link_libraries(${SERVER_APP_NAME} PRIVATE onnxruntime_server_http_core_lib onnxruntime_server_lib - ${grpc_reflection} #Note that this will break the tests if we try to link it to the lib so just link to the executable. + ${grpc_reflection} #Note that this will break the tests if we try to link it to the lib so just link to the executable. server_grpc_proto server_proto ${Boost_LIBRARIES} - onnxruntime_server_http_core_lib + onnxruntime_server_http_core_lib ${grpc_static_libs} protobuf::libprotobuf spdlog::spdlog onnxruntime gtest re2 ${CMAKE_DL_LIBS} Threads::Threads @@ -237,15 +237,15 @@ file(GLOB onnxruntime_test_server_src set_source_files_properties("test/unit_tests/executor_test.cc" PROPERTIES COMPILE_FLAGS -Wno-unused-parameter) endif() endif() - + add_executable(onnxruntime_server_tests ${onnxruntime_test_server_src}) add_dependencies(onnxruntime_server_tests server_proto Boost) target_link_libraries(onnxruntime_server_tests PRIVATE onnxruntime_server_http_core_lib onnxruntime_server_lib - ${grpc_reflection} #Note that this will break the tests if we try to link it to the lib so just link to the executable. + ${grpc_reflection} #Note that this will break the tests if we try to link it to the lib so just link to the executable. server_grpc_proto server_proto ${Boost_LIBRARIES} - onnxruntime_server_http_core_lib + onnxruntime_server_http_core_lib ${grpc_static_libs} protobuf::libprotobuf spdlog::spdlog onnxruntime gtest re2 gtest ${CMAKE_DL_LIBS} Threads::Threads) @@ -253,18 +253,18 @@ file(GLOB onnxruntime_test_server_src ${ONNXRUNTIME_SERVER_ROOT}/http/core ${ONNXRUNTIME_SERVER_ROOT} ${ONNXRUNTIME_SERVER_ROOT}/core) onnxruntime_protobuf_generate( - APPEND_PATH IMPORT_DIRS ${ONNXRUNTIME_SERVER_ROOT}/protobuf + APPEND_PATH IMPORT_DIRS ${ONNXRUNTIME_SERVER_ROOT}/protobuf PROTOS ${ONNXRUNTIME_SERVER_ROOT}/protobuf/predict.proto protobuf/onnx-ml.proto LANGUAGE python TARGET onnxruntime_server_tests OUT_VAR server_test_py) - + set(grpc_py "${CMAKE_CURRENT_BINARY_DIR}/prediction_service_pb2_grpc.py") add_custom_command( TARGET onnxruntime_server_tests COMMAND protoc - ARGS + ARGS --grpc_out "${CMAKE_CURRENT_BINARY_DIR}" --plugin=protoc-gen-grpc=${_gRPC_PYTHON_PLUGIN_EXECUTABLE} -I ${grpc_proto_path} diff --git a/tools/ci_build/build.py b/tools/ci_build/build.py index 412502969cb4e..510692052968c 100755 --- a/tools/ci_build/build.py +++ b/tools/ci_build/build.py @@ -560,7 +560,7 @@ def generate_build_tree(cmake_path, source_dir, build_dir, cuda_home, "ON" if args.use_openvino == "VAD-F_FP32" else "OFF"), "-Donnxruntime_USE_OPENVINO_BINARY=" + ( "ON" if args.use_openvino else "OFF"), - "-Donnxruntime_USE_NNAPI=" + ("ON" if args.use_dnnlibrary else "OFF"), + "-Donnxruntime_USE_NNAPI_DNNLIBRARY=" + ("ON" if args.use_dnnlibrary else "OFF"), "-Donnxruntime_USE_RKNPU=" + ("ON" if args.use_rknpu else "OFF"), "-Donnxruntime_USE_OPENMP=" + ( "ON" if args.use_openmp and not ( @@ -1545,6 +1545,8 @@ def main(): if args.update: cmake_extra_args = [] path_to_protoc_exe = args.path_to_protoc_exe + if not args.skip_submodule_sync: + update_submodules(source_dir) if is_windows(): if args.cmake_generator == 'Ninja': if args.x86 or args.arm or args.arm64: @@ -1617,8 +1619,6 @@ def main(): install_python_deps() if args.enable_pybind and is_windows(): install_python_deps(args.numpy_version) - if not args.skip_submodule_sync: - update_submodules(source_dir) if args.enable_onnx_tests: setup_test_data(build_dir, configs) generate_build_tree(