Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
indiff7643
Terarkdb
提交
d76ff542
T
Terarkdb
项目概览
indiff7643
/
Terarkdb
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
T
Terarkdb
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
d76ff542
编写于
6月 18, 2021
作者:
Z
ZhaoMing
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Refine third-party/CMakeLists.txt
上级
9734c0d1
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
73 addition
and
53 deletion
+73
-53
third-party/CMakeLists.txt
third-party/CMakeLists.txt
+73
-53
未找到文件。
third-party/CMakeLists.txt
浏览文件 @
d76ff542
...
...
@@ -27,36 +27,42 @@ IF(WITH_SNAPPY)
MESSAGE
(
"[terarkdb/third-party] snappy target not exist, let's build it!"
)
ExternalProject_Add
(
snappy-project
SOURCE_DIR
${
CMAKE_CURRENT_SOURCE_DIR
}
/snappy
CONFIGURE_COMMAND rm -rf build && mkdir -p build
BUILD_IN_SOURCE 1
BUILD_COMMAND cd build && cmake ../ -DCMAKE_INSTALL_PREFIX=
${
CMAKE_BINARY_DIR
}
-DCMAKE_INSTALL_LIBDIR=
${
CMAKE_BINARY_DIR
}
/lib -DCMAKE_BUILD_TYPE=Release -DSNAPPY_BUILD_TESTS=OFF -DHAVE_LIBLZO2=OFF && make -j $
(
nproc
)
INSTALL_COMMAND cd build && ls -l && make install && cd ../ && rm -rf build
)
CONFIGURE_COMMAND cmake
${
CMAKE_CURRENT_SOURCE_DIR
}
/snappy -DCMAKE_INSTALL_PREFIX=
${
CMAKE_BINARY_DIR
}
-DCMAKE_INSTALL_LIBDIR=
${
CMAKE_BINARY_DIR
}
/lib -DCMAKE_BUILD_TYPE=Release -DCMAKE_C_FLAGS=-fPIC -DCMAKE_CXX_FLAGS=-fPIC -DSNAPPY_BUILD_TESTS=OFF -DHAVE_LIBLZO2=OFF -DCMAKE_VERBOSE_MAKEFILE=
${
CMAKE_VERBOSE_MAKEFILE
}
BUILD_IN_SOURCE 0
BUILD_COMMAND $
(
MAKE
)
INSTALL_COMMAND $
(
MAKE
)
install
)
ADD_LIBRARY
(
snappy STATIC IMPORTED GLOBAL
)
ADD_DEPENDENCIES
(
snappy snappy-project
)
SET_TARGET_PROPERTIES
(
snappy PROPERTIES
IMPORTED_LOCATION
${
CMAKE_BINARY_DIR
}
/lib/libsnappy.a
INCLUDE_DIRECTORIES
${
CMAKE_BINARY_DIR
}
/include
)
INCLUDE_DIRECTORIES
${
CMAKE_BINARY_DIR
}
/include
POSITION_INDEPENDENT_CODE ON
)
ENDIF
()
ENDIF
()
# Bytedance Internal Metrics Library
IF
(
WITH_BYTEDANCE_METRICS
)
IF
(
TARGET metrics2
)
MESSAGE
(
"[terarkdb/third-party] bytedance_metrics2 target exist, re-use it!"
)
ELSE
()
MESSAGE
(
"[terarkdb/third-party] bytedance_metrics2 target not exist, let's build it!"
)
ExternalProject_Add
(
metrics2-project
SOURCE_DIR
${
CMAKE_CURRENT_SOURCE_DIR
}
/metrics2-cmake
CONFIGURE_COMMAND rm -rf cmake-build && mkdir -p cmake-build && mkdir -p
${
CMAKE_BINARY_DIR
}
/lib
BUILD_IN_SOURCE 1
BUILD_COMMAND cd cmake-build && cmake ../ -DCMAKE_BUILD_TYPE=
${
CMAKE_BUILD_TYPE
}
&& make -j $
(
nproc
)
# metrics2 doesn't have a install instruction, so we have to manully install it
INSTALL_COMMAND cp cmake-build/libmetrics2.a
${
CMAKE_BINARY_DIR
}
/lib/
)
ADD_LIBRARY
(
metrics2 STATIC IMPORTED GLOBAL
)
ADD_DEPENDENCIES
(
metrics2 metrics2-project
)
SET_TARGET_PROPERTIES
(
metrics2 PROPERTIES
IMPORTED_LOCATION
${
CMAKE_BINARY_DIR
}
/lib/libmetrics2.a
INCLUDE_DIRECTORIES
${
CMAKE_CURRENT_SOURCE_DIR
}
/metrics2-cmake/
)
MESSAGE
(
"[terarkdb/third-party] bytedance_metrics2 target exist, re-use it!"
)
ELSE
()
MESSAGE
(
"[terarkdb/third-party] bytedance_metrics2 target not exist, let's build it!"
)
ExternalProject_Add
(
metrics2-project
SOURCE_DIR
${
CMAKE_CURRENT_SOURCE_DIR
}
/metrics2-cmake
CONFIGURE_COMMAND cmake
${
CMAKE_CURRENT_SOURCE_DIR
}
/metrics2-cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_C_FLAGS=-fPIC -DCMAKE_CXX_FLAGS=-fPIC -DCMAKE_VERBOSE_MAKEFILE=
${
CMAKE_VERBOSE_MAKEFILE
}
BUILD_IN_SOURCE 0
BUILD_COMMAND $
(
MAKE
)
# metrics2 doesn't have a install instruction, so we have to manully install it
INSTALL_COMMAND cp libmetrics2.a
${
CMAKE_BINARY_DIR
}
/lib
)
ADD_LIBRARY
(
metrics2 STATIC IMPORTED GLOBAL
)
ADD_DEPENDENCIES
(
metrics2 metrics2-project
)
SET_TARGET_PROPERTIES
(
metrics2 PROPERTIES
IMPORTED_LOCATION
${
CMAKE_BINARY_DIR
}
/lib/libmetrics2.a
INCLUDE_DIRECTORIES
${
CMAKE_CURRENT_SOURCE_DIR
}
/metrics2-cmake
POSITION_INDEPENDENT_CODE ON
)
ENDIF
()
ENDIF
()
...
...
@@ -68,16 +74,18 @@ IF(WITH_ZLIB)
MESSAGE
(
"[terarkdb/third-party] zlib target not exist, let's build it!"
)
ExternalProject_Add
(
zlib-project
SOURCE_DIR
${
CMAKE_CURRENT_SOURCE_DIR
}
/zlib
CONFIGURE_COMMAND
rm -rf build && mkdir -p build
BUILD_IN_SOURCE
1
BUILD_COMMAND
cd build && ../configure --prefix=
${
CMAKE_BINARY_DIR
}
--static && make
"CFLAGS=-fPIC -O2"
-j $
(
nproc
)
# zlib compile will produce some dirty files, we need to clean them.
INSTALL_COMMAND cd build && make install && cd ../ && rm -rf build zconf.h.included && git checkout .
)
CONFIGURE_COMMAND
${
CMAKE_CURRENT_SOURCE_DIR
}
/zlib/configure --prefix=
${
CMAKE_BINARY_DIR
}
--static
BUILD_IN_SOURCE
0
BUILD_COMMAND
$
(
MAKE
)
"CFLAGS=-fPIC -O2"
INSTALL_COMMAND $
(
MAKE
)
install
)
ADD_LIBRARY
(
zlib STATIC IMPORTED GLOBAL
)
ADD_DEPENDENCIES
(
zlib zlib-project
)
SET_TARGET_PROPERTIES
(
zlib PROPERTIES
IMPORTED_LOCATION
${
CMAKE_BINARY_DIR
}
/lib/libz.a
INCLUDE_DIRECTORIES
${
CMAKE_BINARY_DIR
}
/include
)
IMPORTED_LOCATION
${
CMAKE_BINARY_DIR
}
/lib/libz.a
INCLUDE_DIRECTORIES
${
CMAKE_BINARY_DIR
}
/include
POSITION_INDEPENDENT_CODE ON
)
ENDIF
()
ENDIF
()
...
...
@@ -89,15 +97,18 @@ IF(WITH_GFLAGS)
MESSAGE
(
"[terarkdb/third-party] gflags target not exist, let's build it!"
)
ExternalProject_Add
(
gflags-project
SOURCE_DIR
${
CMAKE_CURRENT_SOURCE_DIR
}
/gflags
CONFIGURE_COMMAND rm -rf build-cmake && mkdir -p build-cmake
BUILD_IN_SOURCE 1
BUILD_COMMAND cd build-cmake && cmake ../ -DCMAKE_INSTALL_PREFIX=
${
CMAKE_BINARY_DIR
}
-DCMAKE_BUILD_TYPE=Release && make -j $
(
nproc
)
INSTALL_COMMAND cd build-cmake && make install
)
CONFIGURE_COMMAND cmake
${
CMAKE_CURRENT_SOURCE_DIR
}
/gflags -DCMAKE_INSTALL_PREFIX=
${
CMAKE_BINARY_DIR
}
-DCMAKE_BUILD_TYPE=Release -DCMAKE_C_FLAGS=-fPIC -DCMAKE_CXX_FLAGS=-fPIC -DCMAKE_VERBOSE_MAKEFILE=
${
CMAKE_VERBOSE_MAKEFILE
}
BUILD_IN_SOURCE 0
BUILD_COMMAND $
(
MAKE
)
INSTALL_COMMAND $
(
MAKE
)
install
)
ADD_LIBRARY
(
gflags STATIC IMPORTED GLOBAL
)
ADD_DEPENDENCIES
(
gflags gflags-project
)
SET_TARGET_PROPERTIES
(
gflags PROPERTIES
IMPORTED_LOCATION
${
CMAKE_BINARY_DIR
}
/lib/libgflags.a
INCLUDE_DIRECTORIES
${
CMAKE_BINARY_DIR
}
/include
)
INCLUDE_DIRECTORIES
${
CMAKE_BINARY_DIR
}
/include
POSITION_INDEPENDENT_CODE ON
)
ENDIF
()
# end target
ENDIF
()
# end with gflags
...
...
@@ -109,16 +120,18 @@ IF(WITH_ZSTD)
MESSAGE
(
"[terarkdb/third-party] zstd target not exist, let's build it!"
)
ExternalProject_Add
(
zstd-project
SOURCE_DIR
${
CMAKE_CURRENT_SOURCE_DIR
}
/zstd
CONFIGURE_COMMAND
""
BUILD_IN_SOURCE 1
BUILD_COMMAND cd
${
CMAKE_CURRENT_SOURCE_DIR
}
/zstd && make
"CXXFLAGS=-fPIC -O2"
"CFLAGS=-fPIC -O2"
-j $
(
nproc
)
INSTALL_COMMAND PREFIX=
${
CMAKE_BINARY_DIR
}
make install
)
CONFIGURE_COMMAND cp -rT
${
CMAKE_CURRENT_SOURCE_DIR
}
/zstd .
BUILD_IN_SOURCE 0
BUILD_COMMAND $
(
MAKE
)
"CXXFLAGS=-fPIC -O2"
"CFLAGS=-fPIC -O2"
INSTALL_COMMAND PREFIX=
${
CMAKE_BINARY_DIR
}
$
(
MAKE
)
install
)
ADD_LIBRARY
(
zstd STATIC IMPORTED GLOBAL
)
ADD_DEPENDENCIES
(
zstd zstd-project
)
SET_TARGET_PROPERTIES
(
zstd PROPERTIES
IMPORTED_LOCATION
${
CMAKE_BINARY_DIR
}
/lib/libzstd.a
INCLUDE_DIRECTORIES
${
CMAKE_BINARY_DIR
}
/include
POSITION_INDEPENDENT_CODE ON
)
POSITION_INDEPENDENT_CODE ON
)
ENDIF
()
ENDIF
()
...
...
@@ -130,15 +143,17 @@ IF(WITH_LZ4)
MESSAGE
(
"[terarkdb/third-party] lz4 target not exist, let's build it!"
)
ExternalProject_Add
(
lz4-project
SOURCE_DIR
${
CMAKE_CURRENT_SOURCE_DIR
}
/lz4
CONFIGURE_COMMAND
""
BUILD_IN_SOURCE
1
BUILD_COMMAND
make
"CXXFLAGS=-fPIC -O2"
"CFLAGS=-fPIC -O2"
-j $
(
nproc
)
INSTALL_COMMAND prefix=
${
CMAKE_BINARY_DIR
}
make
install
)
CONFIGURE_COMMAND
cp -rT
${
CMAKE_CURRENT_SOURCE_DIR
}
/lz4 .
BUILD_IN_SOURCE
0
BUILD_COMMAND
$
(
MAKE
)
"CXXFLAGS=-fPIC -O2"
"CFLAGS=-fPIC -O2"
INSTALL_COMMAND prefix=
${
CMAKE_BINARY_DIR
}
$
(
MAKE
)
install
)
ADD_LIBRARY
(
lz4 STATIC IMPORTED GLOBAL
)
ADD_DEPENDENCIES
(
lz4 lz4-project
)
SET_TARGET_PROPERTIES
(
lz4 PROPERTIES
IMPORTED_LOCATION
${
CMAKE_BINARY_DIR
}
/lib/liblz4.a
INCLUDE_DIRECTORIES
${
CMAKE_BINARY_DIR
}
/include
)
INCLUDE_DIRECTORIES
${
CMAKE_BINARY_DIR
}
/include
POSITION_INDEPENDENT_CODE ON
)
ENDIF
()
ENDIF
()
...
...
@@ -150,15 +165,17 @@ IF(WITH_BZ2)
MESSAGE
(
"[terarkdb/third-party] bzip2 target not exist, let's build it!"
)
ExternalProject_Add
(
bzip2-project
SOURCE_DIR
${
CMAKE_CURRENT_SOURCE_DIR
}
/bzip2
CONFIGURE_COMMAND
""
BUILD_IN_SOURCE
1
BUILD_COMMAND
make
"CXXFLAGS=-fPIC -O2"
"CFLAGS=-fPIC -O2"
-j $
(
nproc
)
INSTALL_COMMAND
make install PREFIX=
${
CMAKE_BINARY_DIR
}
&& make clean
)
CONFIGURE_COMMAND
cp -rT
${
CMAKE_CURRENT_SOURCE_DIR
}
/bzip2 .
BUILD_IN_SOURCE
0
BUILD_COMMAND
$
(
MAKE
)
"CXXFLAGS=-fPIC -O2"
"CFLAGS=-fPIC -O2"
INSTALL_COMMAND
$
(
MAKE
)
install PREFIX=
${
CMAKE_BINARY_DIR
}
)
ADD_LIBRARY
(
bzip2 STATIC IMPORTED GLOBAL
)
ADD_DEPENDENCIES
(
bzip2 bzip2-project
)
SET_TARGET_PROPERTIES
(
bzip2 PROPERTIES
IMPORTED_LOCATION
${
CMAKE_BINARY_DIR
}
/lib/libbz2.a
INCLUDE_DIRECTORIES
${
CMAKE_BINARY_DIR
}
/include
)
INCLUDE_DIRECTORIES
${
CMAKE_BINARY_DIR
}
/include
POSITION_INDEPENDENT_CODE ON
)
ENDIF
()
ENDIF
()
...
...
@@ -170,15 +187,18 @@ IF(WITH_JEMALLOC)
MESSAGE
(
"[terarkdb/third-party] jemalloc target not exist, let's build it!"
)
ExternalProject_Add
(
jemalloc-project
SOURCE_DIR
${
CMAKE_CURRENT_SOURCE_DIR
}
/jemalloc
CONFIGURE_COMMAND
""
BUILD_IN_SOURCE 1
BUILD_COMMAND bash autogen.sh &&
"CFLAGS=-fPIC"
"CXXFLAGS=-fPIC"
"LDFLAGS=-fPIC"
./configure --prefix=
${
CMAKE_BINARY_DIR
}
--enable-prof && make -j $
(
nproc
)
INSTALL_COMMAND make install PREFIX=
${
CMAKE_BINARY_DIR
}
&& make clean
)
CONFIGURE_COMMAND cp -rT
${
CMAKE_CURRENT_SOURCE_DIR
}
/jemalloc . && bash autogen.sh &&
"CFLAGS=-fPIC"
"CXXFLAGS=-fPIC"
"LDFLAGS=-fPIC"
./configure --prefix=
${
CMAKE_BINARY_DIR
}
--enable-prof
BUILD_IN_SOURCE 0
BUILD_COMMAND $
(
MAKE
)
INSTALL_COMMAND $
(
MAKE
)
install PREFIX=
${
CMAKE_BINARY_DIR
}
)
ADD_LIBRARY
(
jemalloc STATIC IMPORTED GLOBAL
)
ADD_DEPENDENCIES
(
jemalloc jemalloc-project
)
SET_TARGET_PROPERTIES
(
jemalloc PROPERTIES
IMPORTED_LOCATION
${
CMAKE_BINARY_DIR
}
/lib/libjemalloc.a
INCLUDE_DIRECTORIES
${
CMAKE_BINARY_DIR
}
/include
)
IMPORTED_LOCATION
${
CMAKE_BINARY_DIR
}
/lib/libjemalloc.a
INCLUDE_DIRECTORIES
${
CMAKE_BINARY_DIR
}
/include
POSITION_INDEPENDENT_CODE ON
)
endif
()
ENDIF
()
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录