Skip to content

Commit

Permalink
Revert "[clang][cmake] Add options to pass in vcs repo and revision i…
Browse files Browse the repository at this point in the history
…nfo"

This reverts commit 1f5e737.
  • Loading branch information
zhuhan0 committed Apr 17, 2023
1 parent 8f906be commit c720c1d
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 22 deletions.
14 changes: 0 additions & 14 deletions clang/lib/Basic/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -14,31 +14,17 @@ set(generate_vcs_version_script "${LLVM_CMAKE_DIR}/GenerateVersionFromVCS.cmake"
if(llvm_vc AND LLVM_APPEND_VC_REV)
set(llvm_source_dir ${LLVM_MAIN_SRC_DIR})
endif()
if (LLVM_VC_REPOSITORY AND LLVM_VC_REVISION)
set(llvm_source_dir ${LLVM_SOURCE_DIR})
set(llvm_vc_repository ${LLVM_VC_REPOSITORY})
set(llvm_vc_revision ${LLVM_VC_REVISION})
endif()
if(clang_vc AND LLVM_APPEND_VC_REV)
set(clang_source_dir ${CLANG_SOURCE_DIR})
endif()
if (CLANG_VC_REPOSITORY AND CLANG_VC_REVISION)
set(clang_source_dir ${CLANG_SOURCE_DIR})
set(clang_vc_repository ${CLANG_VC_REPOSITORY})
set(clang_vc_revision ${CLANG_VC_REVISION})
endif()

# Create custom target to generate the VC revision include.
add_custom_command(OUTPUT "${version_inc}"
DEPENDS "${llvm_vc}" "${clang_vc}" "${generate_vcs_version_script}"
COMMAND ${CMAKE_COMMAND} "-DNAMES=\"LLVM;CLANG\""
"-DLLVM_SOURCE_DIR=${llvm_source_dir}"
"-DCLANG_SOURCE_DIR=${clang_source_dir}"
"-DCLANG_VC_REPOSITORY=${clang_vc_repository}"
"-DCLANG_VC_REVISION=${clang_vc_revision}"
"-DHEADER_FILE=${version_inc}"
"-DLLVM_VC_REPOSITORY=${llvm_vc_repository}"
"-DLLVM_VC_REVISION=${llvm_vc_revision}"
-P "${generate_vcs_version_script}")

# Mark the generated header as being generated.
Expand Down
14 changes: 6 additions & 8 deletions llvm/cmake/modules/GenerateVersionFromVCS.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,10 @@ include(VersionFromVCS)
# Handle strange terminals
set(ENV{TERM} "dumb")

function(append_info name revision repository)
function(append_info name path)
if(path)
get_source_info("${path}" revision repository)
endif()
if(revision)
file(APPEND "${HEADER_FILE}.tmp"
"#define ${name}_REVISION \"${revision}\"\n")
Expand All @@ -36,15 +39,10 @@ function(append_info name revision repository)
endfunction()

foreach(name IN LISTS NAMES)
if(${name}_VC_REPOSITORY AND ${name}_VC_REVISION)
set(revision ${${name}_VC_REVISION})
set(repository ${${name}_VC_REPOSITORY})
elseif(DEFINED ${name}_SOURCE_DIR)
get_source_info(${${name}_SOURCE_DIR} revision repository)
else()
if(NOT DEFINED ${name}_SOURCE_DIR)
message(FATAL_ERROR "${name}_SOURCE_DIR is not defined")
endif()
append_info(${name} ${revision} ${repository})
append_info(${name} "${${name}_SOURCE_DIR}")
endforeach()

# Copy the file only if it has changed.
Expand Down

0 comments on commit c720c1d

Please sign in to comment.