Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
pugs
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
code
pugs
Commits
bbae0cfd
Commit
bbae0cfd
authored
7 years ago
by
Stéphane Del Pino
Browse files
Options
Downloads
Patches
Plain Diff
Fixed get git revision on build
parent
a8f54b53
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
cmake/git_revision.cmake
+20
-0
20 additions, 0 deletions
cmake/git_revision.cmake
utils/CMakeLists.txt
+29
-17
29 additions, 17 deletions
utils/CMakeLists.txt
with
49 additions
and
17 deletions
cmake/git_revision.cmake
0 → 100644
+
20
−
0
View file @
bbae0cfd
# --------------- get git revision info ---------------
# quite hugly but seems necessary
set
(
CMAKE_CURRENT_SOURCE_DIR
${
INVOCATION_DIR
}
)
list
(
APPEND CMAKE_MODULE_PATH
"
${
INVOCATION_DIR
}
/../cmake/cmake-modules"
)
include
(
GetGitRevisionDescription
)
git_describe
(
PASTIS_VERSION
"--abbrev=0"
)
get_git_head_revision
(
PASTIS_HEAD PASTIS_HASH
)
git_local_changes
(
PASTIS_HAS_LOCAL_CHANGES
)
if
(
${
PASTIS_HAS_LOCAL_CHANGES
}
STREQUAL
"CLEAN"
)
set
(
PASTIS_IS_CLEAN true
)
else
()
set
(
PASTIS_IS_CLEAN false
)
endif
()
# Generates revision header file candidate
configure_file
(
"
${
CMAKE_CURRENT_SOURCE_DIR
}
/pastis_git_revision.hpp.in"
"
${
CMAKE_CURRENT_BINARY_DIR
}
/pastis_git_revision"
@ONLY
)
This diff is collapsed.
Click to expand it.
utils/CMakeLists.txt
+
29
−
17
View file @
bbae0cfd
...
...
@@ -9,24 +9,12 @@ add_library(
# --------------- get git revision info ---------------
list
(
APPEND CMAKE_MODULE_PATH
"
${
CMAKE_CURRENT_SOURCE_DIR
}
/../cmake/cmake-modules"
)
include
(
GetGitRevisionDescription
)
git_describe
(
PASTIS_VERSION
"--abbrev=0"
)
get_git_head_revision
(
PASTIS_HEAD PASTIS_HASH
)
git_local_changes
(
PASTIS_HAS_LOCAL_CHANGES
)
if
(
${
PASTIS_HAS_LOCAL_CHANGES
}
STREQUAL
"CLEAN"
)
set
(
PASTIS_IS_CLEAN true
)
else
()
set
(
PASTIS_IS_CLEAN false
)
endif
()
# Generates revision header file
add_custom_target
(
git_r
evis
i
on
PastisGitR
evison
ALL
DEPENDS
${
CMAKE_CURRENT_BINARY_DIR
}
/pastis_git_revision.hpp
)
DEPENDS
${
CMAKE_CURRENT_BINARY_DIR
}
/pastis_git_revision.hpp
)
set_source_files_properties
(
${
CMAKE_CURRENT_BINARY_DIR
}
/pastis_git_revision.hpp
...
...
@@ -35,7 +23,31 @@ set_source_files_properties(
HEADER_FILE_ONLY TRUE
)
configure_file
(
"
${
CMAKE_CURRENT_SOURCE_DIR
}
/pastis_git_revision.hpp.in"
"
${
CMAKE_CURRENT_BINARY_DIR
}
/pastis_git_revision.hpp"
@ONLY
)
# --------- check git revision info at build ----------
add_custom_command
(
TARGET PastisGitRevison
COMMAND
${
CMAKE_COMMAND
}
-E remove -f
${
CMAKE_CURRENT_BINARY_DIR
}
/pastis_git_revision
DEPENDS
${
CMAKE_CURRENT_BINARY_DIR
}
/pastis_git_revision.hpp
COMMENT
""
)
add_custom_command
(
OUTPUT
${
CMAKE_CURRENT_BINARY_DIR
}
/pastis_git_revision.hpp
PRE_BUILD
COMMAND
${
CMAKE_COMMAND
}
-E copy_if_different
${
CMAKE_CURRENT_BINARY_DIR
}
/pastis_git_revision
${
CMAKE_CURRENT_BINARY_DIR
}
/pastis_git_revision.hpp
COMMENT
""
DEPENDS
${
CMAKE_CURRENT_BINARY_DIR
}
/pastis_git_revision
VERBATIM
)
add_custom_command
(
OUTPUT
${
CMAKE_CURRENT_BINARY_DIR
}
/pastis_git_revision
PRE_BUILD
COMMAND
${
CMAKE_COMMAND
}
-DINVOCATION_DIR=
${
CMAKE_CURRENT_SOURCE_DIR
}
-P
${
CMAKE_CURRENT_SOURCE_DIR
}
/../cmake/git_revision.cmake
COMMENT
"Check pastis git status"
VERBATIM
)
list
(
APPEND
...
...
@@ -47,4 +59,4 @@ include_directories(${CMAKE_CURRENT_BINARY_DIR})
# Additional dependencies
add_dependencies
(
PastisUtils
git_r
evis
i
on
)
PastisGitR
evison
)
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment