未验证 提交 79709ddc 编写于 作者: X XuanYang-cn 提交者: GitHub

optimize oatpp (#3377)

* optimize oatpp
Signed-off-by: Nyangxuan <xuan.yang@zilliz.com>

* fix some bug
Signed-off-by: Nyangxuan <xuan.yang@zilliz.com>

* fit atomic not find bug
Signed-off-by: Nyangxuan <xuan.yang@zilliz.com>

* add one config fo oatpp
Signed-off-by: Nyangxuan <xuan.yang@zilliz.com>

* change oatpp version
Signed-off-by: Nyangxuan <xuan.yang@zilliz.com>

* comment url_md5
Signed-off-by: Nyangxuan <xuan.yang@zilliz.com>

* change oatpp version
Signed-off-by: Nyangxuan <xuan.yang@zilliz.com>

* change aws target name
Signed-off-by: Nyangxuan <xuan.yang@zilliz.com>
Co-authored-by: Nyangxuan <xuan.yang@zilliz.com>
上级 f2ef1cd0
......@@ -118,6 +118,7 @@ if("$ENV{CMAKE_EXPORT_COMPILE_COMMANDS}" STREQUAL "1" OR CLANG_TIDY_FOUND)
# with various development tools, such as Vim's YouCompleteMe plugin.
# See http://clang.llvm.org/docs/JSONCompilationDatabase.html
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
set(CMAKE_CXX_STANDARD_INCLUDE_DIRECTORIES ${CMAKE_CXX_IMPLICIT_INCLUDE_DIRECTORIES})
endif()
#
......
......@@ -11,8 +11,7 @@
set(MILVUS_THIRDPARTY_DEPENDENCIES
fiu
oatpp)
fiu)
message(STATUS "Using ${MILVUS_DEPENDENCY_SOURCE} approach to find dependencies")
......@@ -26,8 +25,6 @@ endforeach ()
macro(build_dependency DEPENDENCY_NAME)
if ("${DEPENDENCY_NAME}" STREQUAL "fiu")
build_fiu()
elseif ("${DEPENDENCY_NAME}" STREQUAL "oatpp")
build_oatpp()
else ()
message(FATAL_ERROR "Unknown thirdparty dependency to build: ${DEPENDENCY_NAME}")
endif ()
......@@ -204,13 +201,6 @@ else ()
"https://gitee.com/quicksilver/libfiu/repository/archive/${FIU_VERSION}.zip")
endif ()
if (DEFINED ENV{MILVUS_OATPP_URL})
set(OATPP_SOURCE_URL "$ENV{MILVUS_OATPP_URL}")
else ()
set(OATPP_SOURCE_URL "https://github.com/oatpp/oatpp/archive/${OATPP_VERSION}.tar.gz")
# set(OATPP_SOURCE_URL "https://github.com/BossZou/oatpp/archive/${OATPP_VERSION}.zip")
endif ()
if (DEFINED ENV{MILVUS_AWS_URL})
set(AWS_SOURCE_URL "$ENV{MILVUS_AWS_URL}")
else ()
......@@ -260,56 +250,3 @@ resolve_dependency(fiu)
get_target_property(FIU_INCLUDE_DIR fiu INTERFACE_INCLUDE_DIRECTORIES)
include_directories(SYSTEM ${FIU_INCLUDE_DIR})
# ----------------------------------------------------------------------
# oatpp
macro(build_oatpp)
message(STATUS "Building oatpp-${OATPP_VERSION} from source")
set(OATPP_PREFIX "${CMAKE_CURRENT_BINARY_DIR}/oatpp_ep-prefix/src/oatpp_ep")
set(OATPP_STATIC_LIB "${OATPP_PREFIX}/lib/oatpp-${OATPP_VERSION}/${CMAKE_STATIC_LIBRARY_PREFIX}oatpp${CMAKE_STATIC_LIBRARY_SUFFIX}")
set(OATPP_INCLUDE_DIR "${OATPP_PREFIX}/include/oatpp-${OATPP_VERSION}/oatpp")
set(OATPP_DIR_SRC "${OATPP_PREFIX}/src")
set(OATPP_DIR_LIB "${OATPP_PREFIX}/lib")
set(OATPP_CMAKE_ARGS
${EP_COMMON_CMAKE_ARGS}
"-DCMAKE_INSTALL_PREFIX=${OATPP_PREFIX}"
-DCMAKE_INSTALL_LIBDIR=lib
-DBUILD_SHARED_LIBS=OFF
-DOATPP_BUILD_TESTS=OFF
-DOATPP_DISABLE_LOGV=ON
-DOATPP_DISABLE_LOGD=ON
-DOATPP_DISABLE_LOGI=ON
)
ExternalProject_Add(oatpp_ep
URL
${OATPP_SOURCE_URL}
${EP_LOG_OPTIONS}
URL_MD5
"396350ca4fe5bedab3769e09eee2cc9f"
CMAKE_ARGS
${OATPP_CMAKE_ARGS}
BUILD_COMMAND
${MAKE}
${MAKE_BUILD_ARGS}
BUILD_BYPRODUCTS
${OATPP_STATIC_LIB}
)
file(MAKE_DIRECTORY "${OATPP_INCLUDE_DIR}")
add_library(oatpp STATIC IMPORTED)
set_target_properties(oatpp
PROPERTIES IMPORTED_LOCATION "${OATPP_STATIC_LIB}"
INTERFACE_INCLUDE_DIRECTORIES "${OATPP_INCLUDE_DIR}")
add_dependencies(oatpp oatpp_ep)
endmacro()
if (MILVUS_WITH_OATPP)
resolve_dependency(oatpp)
get_target_property(OATPP_INCLUDE_DIR oatpp INTERFACE_INCLUDE_DIRECTORIES)
include_directories(SYSTEM ${OATPP_INCLUDE_DIR})
endif ()
......@@ -88,9 +88,7 @@ set( THIRD_PARTY_LIBS sqlite
${GRPC_LIB}
)
set( S3_CLIENT_LIB aws-cpp-sdk-s3
aws-cpp-sdk-core
)
set( S3_CLIENT_LIB AWS::aws-cpp-sdk-s3 )
if ( MILVUS_GPU_VERSION )
set( CUDA_LIB ${CUDA_TOOLKIT_ROOT_DIR}/lib64/stubs/libnvidia-ml.so
......
......@@ -92,6 +92,11 @@ if (MILVUS_WITH_PROMETHEUS)
add_subdirectory( prometheus )
endif ()
# ****************************** Thirdparty oatpp ***************************************
if ( MILVUS_WITH_OATPP )
add_subdirectory( oatpp )
endif()
# ****************************** Thirdparty aws ***************************************
if (MILVUS_WITH_AWS)
add_subdirectory( aws )
......
#-------------------------------------------------------------------------------
# Copyright (C) 2019-2020 Zilliz. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software distributed under the License
# is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
# or implied. See the License for the specific language governing permissions and limitations under the License.
#-------------------------------------------------------------------------------
if ( DEFINED ENV{MILVUS_OATPP_URL} )
set( OATPP_SOURCE_URL "$ENV{MILVUS_OATPP_URL}" )
else()
set( OATPP_SOURCE_URL "https://github.com/oatpp/oatpp/archive/${OATPP_VERSION}.tar.gz" )
endif()
message( STATUS "Building oatpp-${OATPP_VERSION} from source" )
FetchContent_Declare(
oatpp
URL ${OATPP_SOURCE_URL}
URL_MD5 "ed2330211ec528cb0e236958e97e1974"
SOURCE_DIR ${CMAKE_CURRENT_BINARY_DIR}/oatpp-src
BINARY_DIR ${CMAKE_CURRENT_BINARY_DIR}/oatpp-build
DOWNLOAD_DIR ${THIRDPARTY_DOWNLOAD_PATH} )
FetchContent_GetProperties( oatpp )
if ( NOT oatpp_POPULATED )
FetchContent_Populate( oatpp )
set( OATPP_BUILD_TESTS CACHE BOOL OFF FORCE )
set( OATPP_INSTALL CACHE BOOL OFF FORCE )
set( OATPP_LINK_ATOMIC CACHE BOOL OFF FORCE )
set( OATPP_DISABLE_LOGV CACHE BOOL ON FORCE )
set( OATPP_DISABLE_LOGD CACHE BOOL ON FORCE )
set( OATPP_DISABLE_LOGI CACHE BOOL ON FORCE )
# Adding the following targets:
# oatpp, oatpp-test
add_subdirectory( ${oatpp_SOURCE_DIR}
${oatpp_BINARY_DIR}
EXCLUDE_FROM_ALL )
endif()
get_target_property( OATPP_INCLUDE_DIR oatpp INTERFACE_INCLUDE_DIRECTORIES )
message( STATUS ${OATPP_INCLUDE_DIR} )
get_property( var DIRECTORY "${OATPP_SOURCE_DIR}" PROPERTY COMPILE_OPTIONS )
message( STATUS "oatpp compile options: ${var}" )
......@@ -10,7 +10,7 @@ GRPC_VERSION=9a62f6e05d0be96df674d60a66f330a085ced095
ZLIB_VERSION=v1.2.11
OPENTRACING_VERSION=v1.5.1
FIU_VERSION=1.00
OATPP_VERSION=1.1.0
OATPP_VERSION=56097146836986a7c7f78f82729dce0f2c2c6b9f
AWS_VERSION=1.7.250
CRC32C_VERSION=1.1.1
......
......@@ -70,9 +70,7 @@ if ( MILVUS_GPU_VERSION )
endif()
if ( MILVUS_WITH_AWS )
set( S3_CLIENT_LIB aws-cpp-sdk-s3
aws-cpp-sdk-core
)
set( S3_CLIENT_LIB AWS::aws-cpp-sdk-s3 )
list( APPEND UNITTEST_LIBS ${S3_CLIENT_LIB}
curl
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册