Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: solvespace/solvespace
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: fa6622903010
Choose a base ref
...
head repository: solvespace/solvespace
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: e7b75f19c34c
Choose a head ref
  • 1 commit
  • 3 files changed
  • 1 contributor

Commits on May 1, 2019

  1. Revert "CMake: replace GetGitCommitHash with .gitattributes and $Id$."

    This reverts commit c962357.
    
    $Id$ inserts the SHA1 of the *blob*, not the *commit*, and is
    therefore completely worthless.
    whitequark committed May 1, 2019
    Copy the full SHA
    e7b75f1 View commit details
Showing with 43 additions and 3 deletions.
  1. +0 −2 .gitattributes
  2. +8 −1 CMakeLists.txt
  3. +35 −0 cmake/GetGitCommitHash.cmake
2 changes: 0 additions & 2 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -8,5 +8,3 @@
*.lib binary
*.png binary
*.slvs binary

/CMakeLists.txt ident
9 changes: 8 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -22,10 +22,17 @@ set(CMAKE_USER_MAKE_RULES_OVERRIDE_CXX

# project

# NOTE TO PACKAGERS: The embedded git commit hash is critical for rapid bug triage when the builds
# can come from a variety of sources. If you are mirroring the sources or otherwise build when
# the .git directory is not present, please comment the following line:
include(GetGitCommitHash)
# and instead uncomment the following, adding the complete git hash of the checkout you are using:
# set(GIT_COMMIT_HASH 0000000000000000000000000000000000000000)

project(solvespace)
set(solvespace_VERSION_MAJOR 3)
set(solvespace_VERSION_MINOR 0)
string(SUBSTRING "$Id$" 5 8 solvespace_GIT_HASH)
string(SUBSTRING "${GIT_COMMIT_HASH}" 0 8 solvespace_GIT_HASH)

set(ENABLE_GUI ON CACHE BOOL
"Whether the graphical interface is enabled")
35 changes: 35 additions & 0 deletions cmake/GetGitCommitHash.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
function(get_git_commit_hash)
get_filename_component(GIT_DESCRIBE_CMAKE_DIR ${CMAKE_CURRENT_LIST_FILE} PATH)
get_filename_component(GIT_ROOT ${GIT_DESCRIBE_CMAKE_DIR} PATH)
set(GIT_DIR "${GIT_ROOT}/.git")

# Add a CMake configure dependency to the currently checked out revision.
set(GIT_DEPENDS ${GIT_DIR}/HEAD)
file(READ ${GIT_DIR}/HEAD HEAD_REF)
if(HEAD_REF MATCHES "ref: (.+)\n")
set(HEAD_REF ${CMAKE_MATCH_1})
if(EXISTS "${GIT_DIR}/${HEAD_REF}")
list(APPEND GIT_DEPENDS ${GIT_DIR}/${HEAD_REF})
file(READ ${GIT_DIR}/${HEAD_REF} HEAD_REF)
elseif(EXISTS "${GIT_DIR}/packed-refs")
list(APPEND GIT_DEPENDS ${GIT_DIR}/packed-refs)
file(READ "${GIT_DIR}/packed-refs" PACKED_REFS)
if(${PACKED_REFS} MATCHES "([0-9a-z]*) ${HEAD_REF}")
set(HEAD_REF ${CMAKE_MATCH_1})
else()
set(HEAD_REF "")
endif()
else()
set(HEAD_REF "")
endif()
endif()
set_property(DIRECTORY APPEND PROPERTY CMAKE_CONFIGURE_DEPENDS ${GIT_DEPENDS})

string(STRIP ${HEAD_REF} HEAD_REF)
if(HEAD_REF STREQUAL "")
message(WARNING "Cannot determine git HEAD")
else()
set(GIT_COMMIT_HASH ${HEAD_REF} PARENT_SCOPE)
endif()
endfunction()
get_git_commit_hash()