Skip to content

Commit 0cc18c6

Browse files
author
邓佳佳
committed
Merge branch 'release/8.4.0'
Signed-off-by: 邓佳佳 <dengjiajia@corp.netease.com>
2 parents 5bee174 + 59e785b commit 0cc18c6

File tree

4,135 files changed

+83799
-1016232
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

4,135 files changed

+83799
-1016232
lines changed

.clang-format

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
BasedOnStyle: Chromium
2+
ColumnLimit: 150
3+
BreakBeforeBraces: Attach
4+
IndentWidth: 4
5+
BreakConstructorInitializers: BeforeComma
6+
ConstructorInitializerAllOnOneLineOrOnePerLine: false
7+
ConstructorInitializerIndentWidth: 4
8+
AccessModifierOffset: -4
Lines changed: 361 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,361 @@
1+
# - Returns a version string from Git
2+
#
3+
# These functions force a re-configure on each git commit so that you can
4+
# trust the values of the variables in your build system.
5+
#
6+
# get_git_head_revision(<refspecvar> <hashvar> [ALLOW_LOOKING_ABOVE_CMAKE_SOURCE_DIR])
7+
#
8+
# Returns the refspec and sha hash of the current head revision
9+
#
10+
# git_describe(<var> [<additional arguments to git describe> ...])
11+
#
12+
# Returns the results of git describe on the source tree, and adjusting
13+
# the output so that it tests false if an error occurs.
14+
#
15+
# git_describe_working_tree(<var> [<additional arguments to git describe> ...])
16+
#
17+
# Returns the results of git describe on the working tree (--dirty option),
18+
# and adjusting the output so that it tests false if an error occurs.
19+
#
20+
# git_get_exact_tag(<var> [<additional arguments to git describe> ...])
21+
#
22+
# Returns the results of git describe --exact-match on the source tree,
23+
# and adjusting the output so that it tests false if there was no exact
24+
# matching tag.
25+
#
26+
# git_local_changes(<var>)
27+
#
28+
# Returns either "CLEAN" or "DIRTY" with respect to uncommitted changes.
29+
# Uses the return code of "git diff-index --quiet HEAD --".
30+
# Does not regard untracked files.
31+
#
32+
# Requires CMake 2.6 or newer (uses the 'function' command)
33+
#
34+
# Original Author:
35+
# 2009-2020 Ryan Pavlik <ryan.pavlik@gmail.com> <abiryan@ryand.net>
36+
# http://academic.cleardefinition.com
37+
#
38+
# Copyright 2009-2013, Iowa State University.
39+
# Copyright 2013-2020, Ryan Pavlik
40+
# Copyright 2013-2020, Contributors
41+
# SPDX-License-Identifier: BSL-1.0
42+
# Distributed under the Boost Software License, Version 1.0.
43+
# (See accompanying file LICENSE_1_0.txt or copy at
44+
# http://www.boost.org/LICENSE_1_0.txt)
45+
46+
if(__get_git_revision_description)
47+
return()
48+
endif()
49+
set(__get_git_revision_description YES)
50+
51+
# We must run the following at "include" time, not at function call time,
52+
# to find the path to this module rather than the path to a calling list file
53+
get_filename_component(_gitdescmoddir ${CMAKE_CURRENT_LIST_FILE} PATH)
54+
55+
# Function _git_find_closest_git_dir finds the next closest .git directory
56+
# that is part of any directory in the path defined by _start_dir.
57+
# The result is returned in the parent scope variable whose name is passed
58+
# as variable _git_dir_var. If no .git directory can be found, the
59+
# function returns an empty string via _git_dir_var.
60+
#
61+
# Example: Given a path C:/bla/foo/bar and assuming C:/bla/.git exists and
62+
# neither foo nor bar contain a file/directory .git. This wil return
63+
# C:/bla/.git
64+
#
65+
function(_git_find_closest_git_dir _start_dir _git_dir_var)
66+
set(cur_dir "${_start_dir}")
67+
set(git_dir "${_start_dir}/.git")
68+
while(NOT EXISTS "${git_dir}")
69+
# .git dir not found, search parent directories
70+
set(git_previous_parent "${cur_dir}")
71+
get_filename_component(cur_dir ${cur_dir} DIRECTORY)
72+
if(cur_dir STREQUAL git_previous_parent)
73+
# We have reached the root directory, we are not in git
74+
set(${_git_dir_var}
75+
""
76+
PARENT_SCOPE)
77+
return()
78+
endif()
79+
set(git_dir "${cur_dir}/.git")
80+
endwhile()
81+
set(${_git_dir_var}
82+
"${git_dir}"
83+
PARENT_SCOPE)
84+
endfunction()
85+
86+
function(get_git_head_revision _refspecvar _hashvar)
87+
_git_find_closest_git_dir("${CMAKE_CURRENT_SOURCE_DIR}" GIT_DIR)
88+
89+
if("${ARGN}" STREQUAL "ALLOW_LOOKING_ABOVE_CMAKE_SOURCE_DIR")
90+
set(ALLOW_LOOKING_ABOVE_CMAKE_SOURCE_DIR TRUE)
91+
else()
92+
set(ALLOW_LOOKING_ABOVE_CMAKE_SOURCE_DIR FALSE)
93+
endif()
94+
if(NOT "${GIT_DIR}" STREQUAL "")
95+
file(RELATIVE_PATH _relative_to_source_dir "${CMAKE_SOURCE_DIR}"
96+
"${GIT_DIR}")
97+
if("${_relative_to_source_dir}" MATCHES "[.][.]" AND NOT ALLOW_LOOKING_ABOVE_CMAKE_SOURCE_DIR)
98+
# We've gone above the CMake root dir.
99+
set(GIT_DIR "")
100+
endif()
101+
endif()
102+
if("${GIT_DIR}" STREQUAL "")
103+
set(${_refspecvar}
104+
"GITDIR-NOTFOUND"
105+
PARENT_SCOPE)
106+
set(${_hashvar}
107+
"GITDIR-NOTFOUND"
108+
PARENT_SCOPE)
109+
return()
110+
endif()
111+
112+
# Check if the current source dir is a git submodule or a worktree.
113+
# In both cases .git is a file instead of a directory.
114+
#
115+
if(NOT IS_DIRECTORY ${GIT_DIR})
116+
# The following git command will return a non empty string that
117+
# points to the super project working tree if the current
118+
# source dir is inside a git submodule.
119+
# Otherwise the command will return an empty string.
120+
#
121+
execute_process(
122+
COMMAND "${GIT_EXECUTABLE}" rev-parse
123+
--show-superproject-working-tree
124+
WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}"
125+
OUTPUT_VARIABLE out
126+
ERROR_QUIET OUTPUT_STRIP_TRAILING_WHITESPACE)
127+
if(NOT "${out}" STREQUAL "")
128+
# If out is empty, GIT_DIR/CMAKE_CURRENT_SOURCE_DIR is in a submodule
129+
file(READ ${GIT_DIR} submodule)
130+
string(REGEX REPLACE "gitdir: (.*)$" "\\1" GIT_DIR_RELATIVE
131+
${submodule})
132+
string(STRIP ${GIT_DIR_RELATIVE} GIT_DIR_RELATIVE)
133+
get_filename_component(SUBMODULE_DIR ${GIT_DIR} PATH)
134+
get_filename_component(GIT_DIR ${SUBMODULE_DIR}/${GIT_DIR_RELATIVE}
135+
ABSOLUTE)
136+
set(HEAD_SOURCE_FILE "${GIT_DIR}/HEAD")
137+
else()
138+
# GIT_DIR/CMAKE_CURRENT_SOURCE_DIR is in a worktree
139+
file(READ ${GIT_DIR} worktree_ref)
140+
# The .git directory contains a path to the worktree information directory
141+
# inside the parent git repo of the worktree.
142+
#
143+
string(REGEX REPLACE "gitdir: (.*)$" "\\1" git_worktree_dir
144+
${worktree_ref})
145+
string(STRIP ${git_worktree_dir} git_worktree_dir)
146+
_git_find_closest_git_dir("${git_worktree_dir}" GIT_DIR)
147+
set(HEAD_SOURCE_FILE "${git_worktree_dir}/HEAD")
148+
endif()
149+
else()
150+
set(HEAD_SOURCE_FILE "${GIT_DIR}/HEAD")
151+
endif()
152+
set(GIT_DATA "${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/git-data")
153+
if(NOT EXISTS "${GIT_DATA}")
154+
file(MAKE_DIRECTORY "${GIT_DATA}")
155+
endif()
156+
157+
if(NOT EXISTS "${HEAD_SOURCE_FILE}")
158+
return()
159+
endif()
160+
set(HEAD_FILE "${GIT_DATA}/HEAD")
161+
configure_file("${HEAD_SOURCE_FILE}" "${HEAD_FILE}" COPYONLY)
162+
163+
configure_file("${_gitdescmoddir}/GetGitRevisionDescription.cmake.in"
164+
"${GIT_DATA}/grabRef.cmake" @ONLY)
165+
include("${GIT_DATA}/grabRef.cmake")
166+
167+
set(${_refspecvar}
168+
"${HEAD_REF}"
169+
PARENT_SCOPE)
170+
set(${_hashvar}
171+
"${HEAD_HASH}"
172+
PARENT_SCOPE)
173+
endfunction()
174+
175+
function(git_latest_tag _var)
176+
if(NOT GIT_FOUND)
177+
find_package(Git QUIET)
178+
endif()
179+
if(NOT GIT_FOUND)
180+
set(${_var}
181+
"GIT-NOTFOUND"
182+
PARENT_SCOPE)
183+
return()
184+
endif()
185+
execute_process(
186+
COMMAND "${GIT_EXECUTABLE}" describe --abbrev=0
187+
WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}"
188+
RESULT_VARIABLE res
189+
OUTPUT_VARIABLE out
190+
ERROR_QUIET OUTPUT_STRIP_TRAILING_WHITESPACE)
191+
if(NOT res EQUAL 0)
192+
set(out "GIT-TAG-NOTFOUND")
193+
endif()
194+
195+
set(${_var}
196+
"${out}"
197+
PARENT_SCOPE)
198+
endfunction()
199+
200+
function(git_commit_counts _var)
201+
if(NOT GIT_FOUND)
202+
find_package(Git QUIET)
203+
endif()
204+
if(NOT GIT_FOUND)
205+
set(${_var}
206+
"GIT-NOTFOUND"
207+
PARENT_SCOPE)
208+
return()
209+
endif()
210+
execute_process(
211+
COMMAND "${GIT_EXECUTABLE}" rev-list HEAD --count
212+
WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}"
213+
RESULT_VARIABLE res
214+
OUTPUT_VARIABLE out
215+
ERROR_QUIET OUTPUT_STRIP_TRAILING_WHITESPACE)
216+
if(NOT res EQUAL 0)
217+
set(out "GIT-TAG-NOTFOUND")
218+
endif()
219+
220+
set(${_var}
221+
"${out}"
222+
PARENT_SCOPE)
223+
endfunction()
224+
225+
function(git_describe _var)
226+
if(NOT GIT_FOUND)
227+
find_package(Git QUIET)
228+
endif()
229+
get_git_head_revision(refspec hash)
230+
if(NOT GIT_FOUND)
231+
set(${_var}
232+
"GIT-NOTFOUND"
233+
PARENT_SCOPE)
234+
return()
235+
endif()
236+
if(NOT hash)
237+
set(${_var}
238+
"HEAD-HASH-NOTFOUND"
239+
PARENT_SCOPE)
240+
return()
241+
endif()
242+
243+
execute_process(
244+
COMMAND "${GIT_EXECUTABLE}" describe --tags --always ${hash} ${ARGN}
245+
WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}"
246+
RESULT_VARIABLE res
247+
OUTPUT_VARIABLE out
248+
ERROR_QUIET OUTPUT_STRIP_TRAILING_WHITESPACE)
249+
if(NOT res EQUAL 0)
250+
set(out "${out}-${res}-NOTFOUND")
251+
endif()
252+
253+
set(${_var}
254+
"${out}"
255+
PARENT_SCOPE)
256+
endfunction()
257+
258+
function(git_release_version _var)
259+
if(NOT GIT_FOUND)
260+
find_package(Git QUIET)
261+
endif()
262+
get_git_head_revision(refspec hash)
263+
if(NOT GIT_FOUND)
264+
set(${_var}
265+
"GIT-NOTFOUND"
266+
PARENT_SCOPE)
267+
return()
268+
endif()
269+
if(NOT hash)
270+
set(${_var}
271+
"HEAD-HASH-NOTFOUND"
272+
PARENT_SCOPE)
273+
return()
274+
endif()
275+
276+
execute_process(
277+
COMMAND "${GIT_EXECUTABLE}" symbolic-ref --short -q HEAD
278+
WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}"
279+
RESULT_VARIABLE res
280+
OUTPUT_VARIABLE out
281+
ERROR_QUIET OUTPUT_STRIP_TRAILING_WHITESPACE)
282+
if(NOT res EQUAL 0)
283+
set(out "${out}-${res}-NOTFOUND")
284+
endif()
285+
286+
string(FIND ${out} "release/" found})
287+
if(${out} MATCHES "^release/.+$")
288+
string(REPLACE "release/" "" tmp_out ${out})
289+
set(${_var} "${tmp_out}" PARENT_SCOPE)
290+
else()
291+
set(${_var} "" PARENT_SCOPE)
292+
endif()
293+
endfunction()
294+
295+
function(git_describe_working_tree _var)
296+
if(NOT GIT_FOUND)
297+
find_package(Git QUIET)
298+
endif()
299+
if(NOT GIT_FOUND)
300+
set(${_var}
301+
"GIT-NOTFOUND"
302+
PARENT_SCOPE)
303+
return()
304+
endif()
305+
306+
execute_process(
307+
COMMAND "${GIT_EXECUTABLE}" describe --dirty ${ARGN}
308+
WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}"
309+
RESULT_VARIABLE res
310+
OUTPUT_VARIABLE out
311+
ERROR_QUIET OUTPUT_STRIP_TRAILING_WHITESPACE)
312+
if(NOT res EQUAL 0)
313+
set(out "${out}-${res}-NOTFOUND")
314+
endif()
315+
316+
set(${_var}
317+
"${out}"
318+
PARENT_SCOPE)
319+
endfunction()
320+
321+
function(git_get_exact_tag _var)
322+
git_describe(out --exact-match ${ARGN})
323+
set(${_var}
324+
"${out}"
325+
PARENT_SCOPE)
326+
endfunction()
327+
328+
function(git_local_changes _var)
329+
if(NOT GIT_FOUND)
330+
find_package(Git QUIET)
331+
endif()
332+
get_git_head_revision(refspec hash)
333+
if(NOT GIT_FOUND)
334+
set(${_var}
335+
"GIT-NOTFOUND"
336+
PARENT_SCOPE)
337+
return()
338+
endif()
339+
if(NOT hash)
340+
set(${_var}
341+
"HEAD-HASH-NOTFOUND"
342+
PARENT_SCOPE)
343+
return()
344+
endif()
345+
346+
execute_process(
347+
COMMAND "${GIT_EXECUTABLE}" diff-index --quiet HEAD --
348+
WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}"
349+
RESULT_VARIABLE res
350+
OUTPUT_VARIABLE out
351+
ERROR_QUIET OUTPUT_STRIP_TRAILING_WHITESPACE)
352+
if(res EQUAL 0)
353+
set(${_var}
354+
"CLEAN"
355+
PARENT_SCOPE)
356+
else()
357+
set(${_var}
358+
"DIRTY"
359+
PARENT_SCOPE)
360+
endif()
361+
endfunction()

0 commit comments

Comments
 (0)