Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
milvus
milvus
提交
455a31c8
M
milvus
项目概览
milvus
/
milvus
12 个月 前同步成功
通知
261
Star
22476
Fork
2472
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
M
milvus
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
455a31c8
编写于
9月 25, 2019
作者:
S
starlord
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
MS-590 Refine cmake code to support cpplint
Former-commit-id: 583d31a79b3b491c3c3bf7eda9fa613d1c6a58ff
上级
7761fd9d
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
80 addition
and
48 deletion
+80
-48
cpp/CMakeLists.txt
cpp/CMakeLists.txt
+8
-11
cpp/build-support/lint_exclusions.txt
cpp/build-support/lint_exclusions.txt
+6
-0
cpp/build.sh
cpp/build.sh
+65
-37
cpp/cmake/DefineOptions.cmake
cpp/cmake/DefineOptions.cmake
+1
-0
未找到文件。
cpp/CMakeLists.txt
浏览文件 @
455a31c8
...
@@ -44,13 +44,7 @@ set(MILVUS_VERSION "${GIT_BRANCH_NAME}")
...
@@ -44,13 +44,7 @@ set(MILVUS_VERSION "${GIT_BRANCH_NAME}")
string
(
REGEX MATCH
"[0-9]+
\\
.[0-9]+
\\
.[0-9]"
MILVUS_VERSION
"
${
MILVUS_VERSION
}
"
)
string
(
REGEX MATCH
"[0-9]+
\\
.[0-9]+
\\
.[0-9]"
MILVUS_VERSION
"
${
MILVUS_VERSION
}
"
)
find_package
(
ClangTools
)
find_package
(
ClangTools
)
if
(
"$ENV{CMAKE_EXPORT_COMPILE_COMMANDS}"
STREQUAL
"1"
OR CLANG_TIDY_FOUND
)
set
(
CMAKE_EXPORT_COMPILE_COMMANDS ON
)
# Generate a Clang compile_commands.json "compilation database" file for use
# with various development tools, such as Vim's YouCompleteMe plugin.
# See http://clang.llvm.org/docs/JSONCompilationDatabase.html
set
(
CMAKE_EXPORT_COMPILE_COMMANDS 1
)
endif
()
set
(
BUILD_SUPPORT_DIR
"
${
CMAKE_SOURCE_DIR
}
/build-support"
)
set
(
BUILD_SUPPORT_DIR
"
${
CMAKE_SOURCE_DIR
}
/build-support"
)
if
(
CMAKE_BUILD_TYPE STREQUAL
"Release"
)
if
(
CMAKE_BUILD_TYPE STREQUAL
"Release"
)
...
@@ -71,7 +65,7 @@ if(MILVUS_VERSION_MAJOR STREQUAL ""
...
@@ -71,7 +65,7 @@ if(MILVUS_VERSION_MAJOR STREQUAL ""
OR MILVUS_VERSION_MINOR STREQUAL
""
OR MILVUS_VERSION_MINOR STREQUAL
""
OR MILVUS_VERSION_PATCH STREQUAL
""
)
OR MILVUS_VERSION_PATCH STREQUAL
""
)
message
(
WARNING
"Failed to determine Milvus version from git branch name"
)
message
(
WARNING
"Failed to determine Milvus version from git branch name"
)
set
(
MILVUS_VERSION
"0.
4
.0"
)
set
(
MILVUS_VERSION
"0.
5
.0"
)
endif
()
endif
()
message
(
STATUS
"Build version =
${
MILVUS_VERSION
}
"
)
message
(
STATUS
"Build version =
${
MILVUS_VERSION
}
"
)
...
@@ -182,6 +176,9 @@ endif()
...
@@ -182,6 +176,9 @@ endif()
find_program
(
CPPLINT_BIN NAMES cpplint cpplint.py HINTS
${
BUILD_SUPPORT_DIR
}
)
find_program
(
CPPLINT_BIN NAMES cpplint cpplint.py HINTS
${
BUILD_SUPPORT_DIR
}
)
message
(
STATUS
"Found cpplint executable at
${
CPPLINT_BIN
}
"
)
message
(
STATUS
"Found cpplint executable at
${
CPPLINT_BIN
}
"
)
#
# "make lint" targets
#
add_custom_target
(
lint
add_custom_target
(
lint
${
PYTHON_EXECUTABLE
}
${
PYTHON_EXECUTABLE
}
${
BUILD_SUPPORT_DIR
}
/run_cpplint.py
${
BUILD_SUPPORT_DIR
}
/run_cpplint.py
...
@@ -194,11 +191,11 @@ add_custom_target(lint
...
@@ -194,11 +191,11 @@ add_custom_target(lint
${
MILVUS_LINT_QUIET
}
)
${
MILVUS_LINT_QUIET
}
)
#
#
# "make
format" and "make check
-format" targets
# "make
clang-format" and "make check-clang
-format" targets
#
#
if
(
${
CLANG_FORMAT_FOUND
}
)
if
(
${
CLANG_FORMAT_FOUND
}
)
# runs clang format and updates files in place.
# runs clang format and updates files in place.
add_custom_target
(
format
add_custom_target
(
clang-
format
${
PYTHON_EXECUTABLE
}
${
PYTHON_EXECUTABLE
}
${
BUILD_SUPPORT_DIR
}
/run_clang_format.py
${
BUILD_SUPPORT_DIR
}
/run_clang_format.py
--clang_format_binary
--clang_format_binary
...
@@ -211,7 +208,7 @@ if(${CLANG_FORMAT_FOUND})
...
@@ -211,7 +208,7 @@ if(${CLANG_FORMAT_FOUND})
${
MILVUS_LINT_QUIET
}
)
${
MILVUS_LINT_QUIET
}
)
# runs clang format and exits with a non-zero exit code if any files need to be reformatted
# runs clang format and exits with a non-zero exit code if any files need to be reformatted
add_custom_target
(
check-format
add_custom_target
(
check-
clang-
format
${
PYTHON_EXECUTABLE
}
${
PYTHON_EXECUTABLE
}
${
BUILD_SUPPORT_DIR
}
/run_clang_format.py
${
BUILD_SUPPORT_DIR
}
/run_clang_format.py
--clang_format_binary
--clang_format_binary
...
...
cpp/build-support/lint_exclusions.txt
浏览文件 @
455a31c8
*cmake-build-debug*
*cmake-build-release*
*cmake_build*
*src/thirdparty*
*src/core/thirdparty*
*src/grpc*
\ No newline at end of file
cpp/build.sh
浏览文件 @
455a31c8
...
@@ -8,10 +8,18 @@ BUILD_COVERAGE="OFF"
...
@@ -8,10 +8,18 @@ BUILD_COVERAGE="OFF"
DB_PATH
=
"/opt/milvus"
DB_PATH
=
"/opt/milvus"
PROFILING
=
"OFF"
PROFILING
=
"OFF"
USE_JFROG_CACHE
=
"OFF"
USE_JFROG_CACHE
=
"OFF"
RUN_CPPLINT
=
"OFF"
CUDA_COMPILER
=
/usr/local/cuda/bin/nvcc
while
getopts
"p:d:t:u
hrcgj
"
arg
while
getopts
"p:d:t:u
lrcgjh
"
arg
do
do
case
$arg
in
case
$arg
in
p
)
INSTALL_PREFIX
=
$OPTARG
;;
d
)
DB_PATH
=
$OPTARG
;;
t
)
t
)
BUILD_TYPE
=
$OPTARG
# BUILD_TYPE
BUILD_TYPE
=
$OPTARG
# BUILD_TYPE
;;
;;
...
@@ -19,11 +27,8 @@ do
...
@@ -19,11 +27,8 @@ do
echo
"Build and run unittest cases"
;
echo
"Build and run unittest cases"
;
BUILD_UNITTEST
=
"ON"
;
BUILD_UNITTEST
=
"ON"
;
;;
;;
p
)
l
)
INSTALL_PREFIX
=
$OPTARG
RUN_CPPLINT
=
"ON"
;;
d
)
DB_PATH
=
$OPTARG
;;
;;
r
)
r
)
if
[[
-d
cmake_build
]]
;
then
if
[[
-d
cmake_build
]]
;
then
...
@@ -44,63 +49,86 @@ do
...
@@ -44,63 +49,86 @@ do
echo
"
echo
"
parameter:
parameter:
-t: build type(default: Debug)
-u: building unit test options(default: OFF)
-p: install prefix(default:
$(
pwd
)
/milvus)
-p: install prefix(default:
$(
pwd
)
/milvus)
-d: db path(default: /opt/milvus)
-d: db path(default: /opt/milvus)
-t: build type(default: Debug)
-u: building unit test options(default: OFF)
-l: run cpplint, clang-format and clang-tidy(default: OFF)
-r: remove previous build directory(default: OFF)
-r: remove previous build directory(default: OFF)
-c: code coverage(default: OFF)
-c: code coverage(default: OFF)
-g: profiling(default: OFF)
-g: profiling(default: OFF)
-j: use jfrog cache build directory
-j: use jfrog cache build directory(default: OFF)
-h: help
usage:
usage:
./build.sh -
t
\$
{BUILD_TYPE} [-u] [-h] [-g] [-r] [-c] [-k] [-j
]
./build.sh -
p
\$
{INSTALL_PREFIX} -t
\$
{BUILD_TYPE} [-u] [-l] [-r] [-c] [-g] [-j] [-h
]
"
"
exit
0
exit
0
;;
;;
?
)
?
)
echo
"unknown argument"
echo
"
ERROR!
unknown argument"
exit
1
exit
1
;;
;;
esac
esac
done
done
if
[[
!
-d
cmake_build
]]
;
then
if
[[
!
-d
cmake_build
]]
;
then
mkdir
cmake_build
mkdir
cmake_build
MAKE_CLEAN
=
"ON"
fi
fi
cd
cmake_build
cd
cmake_build
CUDA_COMPILER
=
/usr/local/cuda/bin/nvcc
CMAKE_CMD
=
"cmake
\
-DBUILD_UNIT_TEST=
${
BUILD_UNITTEST
}
\
-DCMAKE_INSTALL_PREFIX=
${
INSTALL_PREFIX
}
-DCMAKE_BUILD_TYPE=
${
BUILD_TYPE
}
\
-DCMAKE_CUDA_COMPILER=
${
CUDA_COMPILER
}
\
-DBUILD_COVERAGE=
${
BUILD_COVERAGE
}
\
-DMILVUS_DB_PATH=
${
DB_PATH
}
\
-DMILVUS_ENABLE_PROFILING=
${
PROFILING
}
\
-DUSE_JFROG_CACHE=
${
USE_JFROG_CACHE
}
\
../"
echo
${
CMAKE_CMD
}
${
CMAKE_CMD
}
if
[[
${
MAKE_CLEAN
}
==
"ON"
]]
;
then
if
[[
${
MAKE_CLEAN
}
==
"ON"
]]
;
then
CMAKE_CMD
=
"cmake -DBUILD_UNIT_TEST=
${
BUILD_UNITTEST
}
\
-DCMAKE_INSTALL_PREFIX=
${
INSTALL_PREFIX
}
-DCMAKE_BUILD_TYPE=
${
BUILD_TYPE
}
\
-DCMAKE_CUDA_COMPILER=
${
CUDA_COMPILER
}
\
-DBUILD_COVERAGE=
${
BUILD_COVERAGE
}
\
-DMILVUS_DB_PATH=
${
DB_PATH
}
\
-DMILVUS_ENABLE_PROFILING=
${
PROFILING
}
\
-DUSE_JFROG_CACHE=
${
USE_JFROG_CACHE
}
\
-DCMAKE_EXPORT_COMPILE_COMMANDS=ON
\
../"
echo
${
CMAKE_CMD
}
${
CMAKE_CMD
}
make clean
make clean
fi
fi
make
-j
4
||
exit
1
if
[[
${
RUN_CPPLINT
}
==
"ON"
]]
;
then
# cpplint check
make lint
if
[
$?
-ne
0
]
;
then
echo
"ERROR! cpplint check not pass"
exit
1
fi
# clang-format check
make check-clang-format
if
[
$?
-ne
0
]
;
then
echo
"ERROR! clang-format check failed"
exit
1
fi
# clang-tidy check
make check-clang-tidy
if
[
$?
-ne
0
]
;
then
echo
"ERROR! clang-tidy check failed"
exit
1
fi
else
# compile and build
make
-j
4
||
exit
1
if
[[
${
BUILD_TYPE
}
!=
"Debug"
]]
;
then
# strip binary symbol
strip src/milvus_server
if
[[
${
BUILD_TYPE
}
!=
"Debug"
]]
;
then
fi
strip src/milvus_server
fi
make
install
||
exit
1
make
install
||
exit
1
if
[[
${
BUILD_COVERAGE
}
==
"ON"
]]
;
then
# evaluate code coverage
cd
-
if
[[
${
BUILD_COVERAGE
}
==
"ON"
]]
;
then
bash
`
pwd
`
/coverage.sh
cd
-
cd
-
bash
`
pwd
`
/coverage.sh
fi
cd
-
fi
fi
\ No newline at end of file
cpp/cmake/DefineOptions.cmake
浏览文件 @
455a31c8
...
@@ -110,6 +110,7 @@ endif()
...
@@ -110,6 +110,7 @@ endif()
#----------------------------------------------------------------------
#----------------------------------------------------------------------
set_option_category
(
"Test and benchmark"
)
set_option_category
(
"Test and benchmark"
)
unset
(
MILVUS_BUILD_TESTS CACHE
)
if
(
BUILD_UNIT_TEST
)
if
(
BUILD_UNIT_TEST
)
define_option
(
MILVUS_BUILD_TESTS
"Build the MILVUS googletest unit tests"
ON
)
define_option
(
MILVUS_BUILD_TESTS
"Build the MILVUS googletest unit tests"
ON
)
else
()
else
()
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录