未验证 提交 36a5ff50 编写于 作者: H huangjiyi 提交者: GitHub

[cmake] add brpc third party cache (#54522)

* update

* test

* Update brpc.cmake

* update

---------
Co-authored-by: Nrisemeup1 <62429225+risemeup1@users.noreply.github.com>
上级 bae32a05
......@@ -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}
......
......@@ -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)
......
......@@ -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)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册