diff --git a/cmake/external/brpc.cmake b/cmake/external/brpc.cmake index f806b302529693fd1de17cf527e62aaca68dc605..3c44168921a7cd434ee63ab250ddf2d6da103064 100755 --- a/cmake/external/brpc.cmake +++ b/cmake/external/brpc.cmake @@ -18,7 +18,6 @@ find_package(OpenSSL REQUIRED) message(STATUS "ssl:" ${OPENSSL_SSL_LIBRARY}) message(STATUS "crypto:" ${OPENSSL_CRYPTO_LIBRARY}) -message(STATUS "WITH_SNAPPY:" ${WITH_SNAPPRY}) add_library(ssl SHARED IMPORTED GLOBAL) set_property(TARGET ssl PROPERTY IMPORTED_LOCATION ${OPENSSL_SSL_LIBRARY}) @@ -37,6 +36,27 @@ set(BRPC_LIBRARIES include_directories(${BRPC_INCLUDE_DIR}) +# clone brpc to Paddle/third_party +set(BRPC_SOURCE_DIR ${PADDLE_SOURCE_DIR}/third_party/brpc) +set(BRPC_URL https://github.com/apache/brpc.git) +set(BRPC_TAG 1.4.0) + +if(NOT EXISTS ${BRPC_SOURCE_DIR}) + execute_process(COMMAND ${GIT_EXECUTABLE} clone -b ${BRPC_TAG} ${BRPC_URL} + ${BRPC_SOURCE_DIR}) +else() + # check git tag + execute_process( + COMMAND ${GIT_EXECUTABLE} -C ${BRPC_SOURCE_DIR} describe --tags + OUTPUT_VARIABLE CURRENT_TAG + OUTPUT_STRIP_TRAILING_WHITESPACE) + if(NOT ${CURRENT_TAG} STREQUAL ${BRPC_TAG}) + message(STATUS "Checkout brpc to ${BRPC_TAG}") + execute_process(COMMAND ${GIT_EXECUTABLE} -C ${BRPC_SOURCE_DIR} checkout -q + ${BRPC_TAG}) + endif() +endif() + # Reference https://stackoverflow.com/questions/45414507/pass-a-list-of-prefix-paths-to-externalproject-add-in-cmake-args set(prefix_path "${THIRD_PARTY_PATH}/install/gflags|${THIRD_PARTY_PATH}/install/leveldb|${THIRD_PARTY_PATH}/install/snappy|${THIRD_PARTY_PATH}/install/gtest|${THIRD_PARTY_PATH}/install/protobuf|${THIRD_PARTY_PATH}/install/zlib|${THIRD_PARTY_PATH}/install/glog" @@ -46,8 +66,7 @@ set(prefix_path ExternalProject_Add( extern_brpc ${EXTERNAL_PROJECT_LOG_ARGS} - GIT_REPOSITORY "https://github.com/apache/incubator-brpc" - GIT_TAG 1.4.0 + SOURCE_DIR ${BRPC_SOURCE_DIR} PREFIX ${BRPC_PREFIX_DIR} UPDATE_COMMAND "" CMAKE_ARGS -DCMAKE_CXX_COMPILER=${CMAKE_CXX_COMPILER} diff --git a/cmake/external/libmct.cmake b/cmake/external/libmct.cmake index 15ee59642094a817fd4af51a9874b6ac24e0db91..44207750f717ec66f9e3e24edbf1d5eeceb92a71 100644 --- a/cmake/external/libmct.cmake +++ b/cmake/external/libmct.cmake @@ -65,9 +65,7 @@ ExternalProject_Add( COMMAND ${CMAKE_COMMAND} -E copy ${LIBMCT_DOWNLOAD_DIR}/CMakeLists.txt ${LIBMCT_INSTALL_DIR} CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=${LIBMCT_INSTALL_ROOT} - -DCMAKE_BUILD_TYPE=${THIRD_PARTY_BUILD_TYPE} - CMAKE_CACHE_ARGS -DCMAKE_INSTALL_PREFIX:PATH=${LIBMCT_INSTALL_ROOT} - -DCMAKE_BUILD_TYPE=${THIRD_PARTY_BUILD_TYPE}) + CMAKE_CACHE_ARGS -DCMAKE_INSTALL_PREFIX:PATH=${LIBMCT_INSTALL_ROOT}) add_library(libmct INTERFACE) diff --git a/cmake/external/xbyak.cmake b/cmake/external/xbyak.cmake index a146d53d606e95e7ea0d0a10de64540ebf3820c9..a384c36be40e12a8cb7fc67a33456eb3351c6bc8 100644 --- a/cmake/external/xbyak.cmake +++ b/cmake/external/xbyak.cmake @@ -39,9 +39,7 @@ ExternalProject_Add( PREFIX ${XBYAK_PREFIX_DIR} UPDATE_COMMAND "" CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=${XBYAK_INSTALL_ROOT} - -DCMAKE_BUILD_TYPE=${THIRD_PARTY_BUILD_TYPE} - CMAKE_CACHE_ARGS -DCMAKE_INSTALL_PREFIX:PATH=${XBYAK_INSTALL_ROOT} - -DCMAKE_BUILD_TYPE=${THIRD_PARTY_BUILD_TYPE}) + CMAKE_CACHE_ARGS -DCMAKE_INSTALL_PREFIX:PATH=${XBYAK_INSTALL_ROOT}) add_library(xbyak INTERFACE)