Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
CamiTK
CamiTK Community Edition
Commits
addaebfb
Commit
addaebfb
authored
Mar 30, 2016
by
Emmanuel Promayon
Browse files
FIXED improved CamiTK version information
parent
ce48318f
Changes
4
Hide whitespace changes
Inline
Side-by-side
sdk/SDKConfig.cmake
View file @
addaebfb
...
...
@@ -31,14 +31,16 @@ if(NOT EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/libraries/core/CamiTKVersion.h)
# the svn command itself
include
(
cmake/modules/macros/GetGitInfo.cmake
)
get_git_info
(
${
CMAKE_CURRENT_SOURCE_DIR
}
)
set
(
CAMITK_VERSION_GIT
".
${
CAMITK_GIT_COMMIT_COUNT
}
"
)
set
(
CAMITK_SVN_SUBVERSION_FOUND
"1"
)
set
(
CAMITK_VERSION_GIT
".
${
CAMITK_GIT_BRANCH
}
.
${
CAMITK_GIT_ABBREVIATED_HASH
}
"
)
set
(
CAMITK_GIT_FOUND
"1"
)
set
(
CAMITK_GIT_HASH
"
${
CAMITK_GIT_HASH
}
"
)
set
(
CAMITK_GIT_DATE
"
${
CAMITK_GIT_COMMITER_DATE
}
"
)
else
()
set
(
CAMITK_VERSION_GIT
".git"
)
set
(
CAMITK_
SVN_SUBVERSION
_FOUND
"0"
)
set
(
CAMITK_
GIT
_FOUND
"0"
)
endif
()
else
()
set
(
CAMITK_
SVN_SUBVERSION
_FOUND
"0"
)
set
(
CAMITK_
GIT
_FOUND
"0"
)
set
(
CAMITK_SOURCE_PACKAGE_VERSION
"1"
)
endif
()
...
...
sdk/applications/config/CamiTKVersionInformation.h.in
View file @
addaebfb
...
...
@@ -28,18 +28,18 @@ bool compiledFromPackageSource() {
return @CAMITK_SOURCE_PACKAGE_VERSION@;
}
/// if the SDK is compiled from the
svn
version, this function returns if more
svn
information are available
bool hasMore
Svn
Information() {
return @CAMITK_
SVN_SUBVERSION
_FOUND@;
/// if the SDK is compiled from the
git
version, this function returns if more
git
information are available
bool hasMore
Git
Information() {
return @CAMITK_
GIT
_FOUND@;
}
/// if the SDK is compiled from the
svn
version, this function returns the
svn revision
std::string
svnRevision
() {
return "@CAMITK_
SVN_WC_REVISION
@";
/// if the SDK is compiled from the
git
version, this function returns the
git complete hash
std::string
gitHash
() {
return "@CAMITK_
GIT_HASH
@";
}
/// if the SDK is compiled from the
svn
version, this function returns the
date of the last modified SDK file (YYYY-MM-DD HH:MM:SS)
std::string
svn
Date() {
return "@CAMITK_
SVN
_DATE@";
/// if the SDK is compiled from the
git
version, this function returns the
last commit date
std::string
git
Date() {
return "@CAMITK_
GIT
_DATE@";
}
\ No newline at end of file
sdk/applications/config/main.cpp
View file @
addaebfb
...
...
@@ -63,9 +63,9 @@ int main(int argc, char *argv[]) {
if
(
compiledFromPackageSource
())
std
::
cout
<<
"Compiled using package source."
<<
std
::
endl
;
else
{
std
::
cout
<<
"Compiled using
svn
"
;
if
(
hasMore
Svn
Information
())
{
//Check if CAMITK_
SVN_SUBVERSION
_FOUND can be set to "1" otherwise we never get into this 'if'
std
::
cout
<<
"
Rev
: "
<<
svnRevision
()
<<
", Date: "
<<
svn
Date
()
<<
std
::
endl
;
std
::
cout
<<
"Compiled using
git
"
;
if
(
hasMore
Git
Information
())
{
//
Check if CAMITK_
GIT
_FOUND can be set to "1" otherwise we never get into this 'if'
std
::
cout
<<
"
Hash
: "
<<
gitHash
()
<<
", Date: "
<<
git
Date
()
<<
std
::
endl
;
}
std
::
cout
<<
"."
<<
std
::
endl
;
}
...
...
sdk/cmake/modules/macros/GetGitInfo.cmake
View file @
addaebfb
...
...
@@ -25,14 +25,29 @@ macro(get_git_info dir)
)
execute_process
(
COMMAND
${
GIT_EXECUTABLE
}
log -1 --format=%h
WORKING_DIRECTORY
${
CMAKE_SOURCE_DIR
}
OUTPUT_VARIABLE CAMITK_GIT_ABBREVIATED_HASH
OUTPUT_STRIP_TRAILING_WHITESPACE
)
execute_process
(
COMMAND
${
GIT_EXECUTABLE
}
log -1 --format=%H
WORKING_DIRECTORY
${
CMAKE_SOURCE_DIR
}
OUTPUT_VARIABLE CAMITK_GIT_HASH
OUTPUT_STRIP_TRAILING_WHITESPACE
)
execute_process
(
COMMAND
${
GIT_EXECUTABLE
}
log -1 --format=%cd
WORKING_DIRECTORY
${
CMAKE_SOURCE_DIR
}
OUTPUT_VARIABLE CAMITK_GIT_COMMITER_DATE
OUTPUT_STRIP_TRAILING_WHITESPACE
)
if
(
NOT CAMITK_GIT_COMMIT_COUNT
)
message
(
WARNING
"Unable to find the commit number using git :
${
GIT_EXECUTABLE
}
"
)
set
(
CAMITK_GIT_COMMIT_COUNT
"unknown"
)
set
(
CAMITK_GIT_BRANCH
"unknown"
)
set
(
CAMITK_GIT_HASH
"unknown"
)
set
(
CAMITK_GIT_ABBREVIATED_HASH
"unknown"
)
endif
()
endmacro
()
\ No newline at end of file
Write
Preview
Supports
Markdown
0%
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!
Cancel
Please
register
or
sign in
to comment