forked from pingcap/tiflash
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Auto-build tiflash proxy using cmake (pingcap#3960)
- Loading branch information
1 parent
9026220
commit e7612d9
Showing
17 changed files
with
169 additions
and
151 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
option(USE_INTERNAL_TIFLASH_PROXY "Set to FALSE to use external tiflash proxy instead of bundled. (Experimental. Set to FALSE on your own risk)" ${NOT_UNBUNDLED}) | ||
|
||
if(NOT EXISTS "${TiFlash_SOURCE_DIR}/contrib/tiflash-proxy/Makefile") | ||
if(USE_INTERNAL_TIFLASH_PROXY) | ||
message(WARNING "submodule contrib/tiflash-proxy is missing. to fix try run: \n git submodule update --init") | ||
message(WARNING "Can't use internal tiflash proxy") | ||
set(USE_INTERNAL_TIFLASH_PROXY 0) | ||
endif() | ||
set(MISSING_INTERNAL_TIFLASH_PROXY 1) | ||
endif() | ||
|
||
if(NOT USE_INTERNAL_TIFLASH_PROXY) | ||
find_path(TIFLASH_PROXY_INCLUDE_DIR NAMES RaftStoreProxyFFI/ProxyFFI.h PATH_SUFFIXES raftstore-proxy/ffi/src) | ||
find_library(TIFLASH_PROXY_LIBRARY NAMES tiflash_proxy PATH_SUFFIXES PATH_SUFFIXES target/release) | ||
if(NOT TIFLASH_PROXY_INCLUDE_DIR) | ||
message(WARNING "Can't find external tiflash proxy include dir") | ||
set(EXTERNAL_TIFLASH_PROXY_FOUND 0) | ||
elseif(NOT TIFLASH_PROXY_LIBRARY) | ||
message(WARNING "Can't find external tiflash proxy library") | ||
set(EXTERNAL_TIFLASH_PROXY_FOUND 0) | ||
else() | ||
set(EXTERNAL_TIFLASH_PROXY_FOUND 1) | ||
endif() | ||
endif() | ||
|
||
if(NOT EXTERNAL_TIFLASH_PROXY_FOUND) | ||
if(NOT MISSING_INTERNAL_TIFLASH_PROXY) | ||
set(TIFLASH_PROXY_INCLUDE_DIR "${TiFlash_SOURCE_DIR}/contrib/tiflash-proxy/raftstore-proxy/ffi/src") | ||
set(TIFLASH_PROXY_LIBRARY libtiflash_proxy) | ||
set(USE_INTERNAL_TIFLASH_PROXY 1) | ||
else() | ||
message(FATAL_ERROR "Can't find tiflash proxy") | ||
endif() | ||
endif() | ||
|
||
set(TIFLASH_PROXY_FOUND TRUE) | ||
|
||
message(STATUS "Using tiflash proxy: ${USE_INTERNAL_TIFLASH_PROXY} : ${TIFLASH_PROXY_INCLUDE_DIR}, ${TIFLASH_PROXY_LIBRARY}") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
set(_TIFLASH_PROXY_SOURCE_DIR "${TiFlash_SOURCE_DIR}/contrib/tiflash-proxy") | ||
set(_TIFLASH_PROXY_LIBRARY "${_TIFLASH_PROXY_SOURCE_DIR}/target/release/${CMAKE_SHARED_LIBRARY_PREFIX}tiflash_proxy${CMAKE_SHARED_LIBRARY_SUFFIX}") | ||
file(GLOB_RECURSE _TIFLASH_PROXY_SRCS "${_TIFLASH_PROXY_SOURCE_DIR}/*.rs") | ||
|
||
add_custom_command(OUTPUT ${_TIFLASH_PROXY_LIBRARY} | ||
COMMENT "Building tiflash proxy" | ||
COMMAND make release | ||
VERBATIM | ||
WORKING_DIRECTORY ${_TIFLASH_PROXY_SOURCE_DIR} | ||
DEPENDS "${_TIFLASH_PROXY_SRCS}" "${_TIFLASH_PROXY_SOURCE_DIR}/Cargo.lock" "${_TIFLASH_PROXY_SOURCE_DIR}/rust-toolchain") | ||
|
||
add_custom_target(tiflash_proxy ALL | ||
DEPENDS ${_TIFLASH_PROXY_LIBRARY}) | ||
|
||
add_library(libtiflash_proxy SHARED IMPORTED GLOBAL) | ||
set_target_properties(libtiflash_proxy PROPERTIES IMPORTED_LOCATION ${_TIFLASH_PROXY_LIBRARY}) | ||
add_dependencies(libtiflash_proxy tiflash_proxy) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.