Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
D
DP3
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Requirements
Jira
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
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
Mattia Mancini
DP3
Commits
d3edb869
Commit
d3edb869
authored
1 year ago
by
Chiara Salvoni
Browse files
Options
Downloads
Patches
Plain Diff
AST-1430
: add comit hash to cmake file
parent
90fcd10e
No related branches found
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
CMakeLists.txt
+7
-0
7 additions, 0 deletions
CMakeLists.txt
base/Main.cc
+1
-1
1 addition, 1 deletion
base/Main.cc
base/Version.h.in
+9
-1
9 additions, 1 deletion
base/Version.h.in
with
17 additions
and
2 deletions
CMakeLists.txt
+
7
−
0
View file @
d3edb869
...
...
@@ -21,6 +21,13 @@ else()
message
(
FATAL_ERROR
"Failed to parse DP3_VERSION='
${
DP3_VERSION
}
'"
)
endif
()
# Get the latest abbreviated commit hash of the working branch
execute_process
(
COMMAND git describe
WORKING_DIRECTORY
${
CMAKE_CURRENT_LIST_DIR
}
OUTPUT_VARIABLE DP3_GIT_HASH
OUTPUT_STRIP_TRAILING_WHITESPACE
)
option
(
BUILD_WITH_CUDA
"Build with CUDA support"
FALSE
)
if
(
BUILD_WITH_CUDA
)
project
(
...
...
This diff is collapsed.
Click to expand it.
base/Main.cc
+
1
−
1
View file @
d3edb869
...
...
@@ -47,7 +47,7 @@ int main(int argc, char* argv[]) {
showUsage
();
return
0
;
}
else
if
(
param
==
"-v"
||
param
==
"--version"
)
{
std
::
cout
<<
DP3Version
::
AsString
()
<<
'\n'
;
std
::
cout
<<
DP3Version
::
AsString
(
true
)
<<
'\n'
;
return
0
;
}
}
...
...
This diff is collapsed.
Click to expand it.
base/Version.h.in
+
9
−
1
View file @
d3edb869
...
...
@@ -11,11 +11,19 @@
#define DP3_INSTALL_PATH "@CMAKE_INSTALL_PREFIX@"
#define DP3_COMMIT_HASH "@DP3_GIT_HASH@"
#include <string>
class DP3Version {
public:
static std::string AsString() { return "DP3 " + std::string(DP3_VERSION); }
static std::string AsString(bool add_commit_hash = false) {
std::string version = "DP3 " + std::string(DP3_VERSION);
std::string commit_hash = std::string(DP3_COMMIT_HASH).empty()
? "Commit hash undefined"
: std::string(DP3_COMMIT_HASH);
return add_commit_hash ? version + "\n" + commit_hash : version;
}
};
#endif
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