mirror of
https://github.com/capstone-engine/llvm-capstone.git
synced 2024-11-29 00:21:14 +00:00
Make lld cmake not compute commit revision twice
r354605 moved LLD to the unified revision handling introduced in rL353268 / r352729 and removed uses of LLD_REPOSITORY_STRING and LLD_REVISION_STRING. After this change, we no longer compute the (now-unused) values of these two variables. Since this removes the only use of llvm/utils/GetRepositoryPath, remove that too (it's redundant with the system added in r354605). While here, also remove LLD_VERSION_MAJOR and LLD_VERSION_MINOR. Their uses were removed in r285163. Also remove LLD_VERSION from Version.inc which as far as I can tell has been unused since the file was added in r219277. No behavior change. Differential Revision: https://reviews.llvm.org/D72803
This commit is contained in:
parent
c969335abd
commit
4b6d9ac392
@ -130,39 +130,6 @@ string(REGEX REPLACE "([0-9]+)\\.[0-9]+(\\.[0-9]+)?" "\\1" LLD_VERSION_MAJOR
|
|||||||
string(REGEX REPLACE "[0-9]+\\.([0-9]+)(\\.[0-9]+)?" "\\1" LLD_VERSION_MINOR
|
string(REGEX REPLACE "[0-9]+\\.([0-9]+)(\\.[0-9]+)?" "\\1" LLD_VERSION_MINOR
|
||||||
${LLD_VERSION})
|
${LLD_VERSION})
|
||||||
|
|
||||||
# Determine LLD revision and repository.
|
|
||||||
# TODO: Figure out a way to get the revision and the repository on windows.
|
|
||||||
if ( NOT CMAKE_SYSTEM_NAME MATCHES "Windows" )
|
|
||||||
execute_process(COMMAND ${CMAKE_SOURCE_DIR}/utils/GetSourceVersion ${LLD_SOURCE_DIR}
|
|
||||||
OUTPUT_VARIABLE LLD_REVISION)
|
|
||||||
|
|
||||||
execute_process(COMMAND ${CMAKE_SOURCE_DIR}/utils/GetRepositoryPath ${LLD_SOURCE_DIR}
|
|
||||||
OUTPUT_VARIABLE LLD_REPOSITORY)
|
|
||||||
if ( LLD_REPOSITORY )
|
|
||||||
# Replace newline characters with spaces
|
|
||||||
string(REGEX REPLACE "(\r?\n)+" " " LLD_REPOSITORY ${LLD_REPOSITORY})
|
|
||||||
# Remove leading spaces
|
|
||||||
STRING(REGEX REPLACE "^[ \t\r\n]+" "" LLD_REPOSITORY "${LLD_REPOSITORY}" )
|
|
||||||
# Remove trailing spaces
|
|
||||||
string(REGEX REPLACE "(\ )+$" "" LLD_REPOSITORY ${LLD_REPOSITORY})
|
|
||||||
endif()
|
|
||||||
|
|
||||||
if ( LLD_REVISION )
|
|
||||||
# Replace newline characters with spaces
|
|
||||||
string(REGEX REPLACE "(\r?\n)+" " " LLD_REVISION ${LLD_REVISION})
|
|
||||||
# Remove leading spaces
|
|
||||||
STRING(REGEX REPLACE "^[ \t\r\n]+" "" LLD_REVISION "${LLD_REVISION}" )
|
|
||||||
# Remove trailing spaces
|
|
||||||
string(REGEX REPLACE "(\ )+$" "" LLD_REVISION ${LLD_REVISION})
|
|
||||||
endif()
|
|
||||||
endif ()
|
|
||||||
|
|
||||||
# Configure the Version.inc file.
|
|
||||||
configure_file(
|
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/include/lld/Common/Version.inc.in
|
|
||||||
${CMAKE_CURRENT_BINARY_DIR}/include/lld/Common/Version.inc)
|
|
||||||
|
|
||||||
|
|
||||||
if (CMAKE_SOURCE_DIR STREQUAL CMAKE_BINARY_DIR)
|
if (CMAKE_SOURCE_DIR STREQUAL CMAKE_BINARY_DIR)
|
||||||
message(FATAL_ERROR "In-source builds are not allowed. CMake would overwrite "
|
message(FATAL_ERROR "In-source builds are not allowed. CMake would overwrite "
|
||||||
"the makefiles distributed with LLVM. Please create a directory and run cmake "
|
"the makefiles distributed with LLVM. Please create a directory and run cmake "
|
||||||
|
@ -1,6 +1 @@
|
|||||||
#define LLD_VERSION @LLD_VERSION@
|
|
||||||
#define LLD_VERSION_STRING "@LLD_VERSION@"
|
#define LLD_VERSION_STRING "@LLD_VERSION@"
|
||||||
#define LLD_VERSION_MAJOR @LLD_VERSION_MAJOR@
|
|
||||||
#define LLD_VERSION_MINOR @LLD_VERSION_MINOR@
|
|
||||||
#define LLD_REVISION_STRING "@LLD_REVISION@"
|
|
||||||
#define LLD_REPOSITORY_STRING "@LLD_REPOSITORY@"
|
|
||||||
|
@ -1,27 +0,0 @@
|
|||||||
#!/bin/sh
|
|
||||||
|
|
||||||
usage() {
|
|
||||||
echo "usage: $0 <source root>"
|
|
||||||
echo " Prints the source control repository path of the given source"
|
|
||||||
echo " directory, the exact format of the revision string depends on the"
|
|
||||||
echo " source control system. If the source control system isn't known,"
|
|
||||||
echo " the output is empty and the exit code is 1."
|
|
||||||
exit 1
|
|
||||||
}
|
|
||||||
|
|
||||||
if [ $# != 1 ] || [ ! -d $1 ]; then
|
|
||||||
usage;
|
|
||||||
fi
|
|
||||||
|
|
||||||
cd $1
|
|
||||||
if [ -d .svn ]; then
|
|
||||||
svn info | grep '^URL:' | cut -d: -f2-
|
|
||||||
elif [ -f .git/svn/.metadata ]; then
|
|
||||||
git svn info | grep 'URL:' | cut -d: -f2-
|
|
||||||
elif [ -d .git ]; then
|
|
||||||
git remote -v | grep 'fetch' | awk '{ print $2 }' | head -n1
|
|
||||||
else
|
|
||||||
exit 1;
|
|
||||||
fi
|
|
||||||
|
|
||||||
exit 0
|
|
@ -4,13 +4,5 @@ import("//llvm/version.gni")
|
|||||||
write_cmake_config("version") {
|
write_cmake_config("version") {
|
||||||
input = "Version.inc.in"
|
input = "Version.inc.in"
|
||||||
output = "$target_gen_dir/Version.inc"
|
output = "$target_gen_dir/Version.inc"
|
||||||
values = [
|
values = [ "LLD_VERSION=$llvm_version" ]
|
||||||
"LLD_VERSION=$llvm_version",
|
|
||||||
"LLD_VERSION_MAJOR=$llvm_version_major",
|
|
||||||
"LLD_VERSION_MINOR=$llvm_version_minor",
|
|
||||||
|
|
||||||
# FIXME: Real values for these:
|
|
||||||
"LLD_REVISION=",
|
|
||||||
"LLD_REPOSITORY=",
|
|
||||||
]
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user