Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
D
dssp
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
open
dssp
Commits
8b290992
Unverified
Commit
8b290992
authored
Jan 25, 2022
by
Maarten L. Hekkelman
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Version string
parent
dae8e82f
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
82 additions
and
90 deletions
+82
-90
CMakeLists.txt
+2
-13
cmake/VersionString.cmake
+77
-0
src/dssp.cpp
+1
-64
src/dssp.hpp
+0
-5
src/mkdssp.cpp
+2
-3
src/revision.hpp.in
+0
-5
No files found.
CMakeLists.txt
View file @
8b290992
...
@@ -95,19 +95,8 @@ if(UNIX AND NOT APPLE)
...
@@ -95,19 +95,8 @@ if(UNIX AND NOT APPLE)
endif
()
endif
()
# Create a revision file, containing the current git version info
# Create a revision file, containing the current git version info
include
(
VersionString
)
include
(
GetGitRevisionDescription
)
write_version_header
()
if
(
NOT
(
GIT-NOTFOUND OR HEAD-HASH-NOTFOUND
))
get_git_head_revision
(
REFSPEC COMMITHASH
)
# Generate our own version string
git_describe_working_tree
(
BUILD_VERSION_STRING --match=build --dirty
)
endif
()
# generate version.h
include_directories
(
${
CMAKE_BINARY_DIR
}
PRIVATE
)
string
(
TIMESTAMP BUILD_DATE_TIME
"%Y-%m-%dT%H:%M:%SZ"
UTC
)
configure_file
(
"
${
CMAKE_SOURCE_DIR
}
/src/revision.hpp.in"
"
${
CMAKE_BINARY_DIR
}
/revision.hpp"
@ONLY
)
# Optionally use mrc to create resources
# Optionally use mrc to create resources
find_package
(
Mrc
)
find_package
(
Mrc
)
...
...
cmake/VersionString.cmake
0 → 100644
View file @
8b290992
# SPDX-License-Identifier: BSD-2-Clause
# Copyright (c) 2021 NKI/AVL, Netherlands Cancer Institute
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
# 1. Redistributions of source code must retain the above copyright notice, this
# list of conditions and the following disclaimer
# 2. Redistributions in binary form must reproduce the above copyright notice,
# this list of conditions and the following disclaimer in the documentation
# and/or other materials provided with the distribution.
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
# ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
# ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
cmake_minimum_required
(
VERSION 3.15
)
# Create a revision file, containing the current git version info, if any
function
(
write_version_header
)
include
(
GetGitRevisionDescription
)
if
(
NOT
(
GIT-NOTFOUND OR HEAD-HASH-NOTFOUND
))
git_describe_working_tree
(
BUILD_VERSION_STRING --match=build --dirty
)
if
(
BUILD_VERSION_STRING MATCHES
"build-([0-9]+)-g([0-9a-f]+)(-dirty)?"
)
set
(
BUILD_GIT_TAGREF
"
${
CMAKE_MATCH_2
}
"
)
if
(
CMAKE_MATCH_3
)
set
(
BUILD_VERSION_STRING
"
${
CMAKE_MATCH_1
}
*"
)
else
()
set
(
BUILD_VERSION_STRING
"
${
CMAKE_MATCH_1
}
"
)
endif
()
endif
()
else
()
set
(
BUILD_VERSION_STRING
"no git info available"
)
endif
()
include_directories
(
${
CMAKE_BINARY_DIR
}
PRIVATE
)
string
(
TIMESTAMP BUILD_DATE_TIME
"%Y-%m-%dT%H:%M:%SZ"
UTC
)
if
(
ARGC GREATER 0
)
set
(
VAR_PREFIX
"
${
ARGV0
}
"
)
endif
()
file
(
WRITE
"
${
CMAKE_BINARY_DIR
}
/revision.hpp.in"
[[// Generated revision file
#pragma once
#include <ostream>
const char k@VAR_PREFIX@ProjectName[] = "@PROJECT_NAME@";
const char k@VAR_PREFIX@VersionNumber[] = "@PROJECT_VERSION@";
const char k@VAR_PREFIX@VersionGitTag[] = "@BUILD_GIT_TAGREF@";
const char k@VAR_PREFIX@BuildInfo[] = "@BUILD_VERSION_STRING@";
const char k@VAR_PREFIX@BuildDate[] = "@BUILD_DATE_TIME@";
inline void write_version_string(std::ostream &os, bool verbose)
{
os << k@VAR_PREFIX@ProjectName << " version " << k@VAR_PREFIX@VersionNumber << std::endl;
if (verbose)
{
os << "build: " << k@VAR_PREFIX@BuildInfo << ' ' << k@VAR_PREFIX@BuildDate << std::endl;
if (k@VAR_PREFIX@VersionGitTag[0] != 0)
os << "git tag: " << k@VAR_PREFIX@VersionGitTag << std::endl;
}
}
]]
)
configure_file
(
"
${
CMAKE_BINARY_DIR
}
/revision.hpp.in"
"
${
CMAKE_BINARY_DIR
}
/revision.hpp"
@ONLY
)
endfunction
()
src/dssp.cpp
View file @
8b290992
...
@@ -40,71 +40,8 @@
...
@@ -40,71 +40,8 @@
#include <cif++/Cif2PDB.hpp>
#include <cif++/Cif2PDB.hpp>
#include "dssp.hpp"
#include "dssp.hpp"
// --------------------------------------------------------------------
namespace
{
std
::
string
gVersionNr
,
gVersionDate
;
}
void
load_version_info
()
{
const
std
::
regex
rxVersionNr
(
R"(build-(\d+)-g[0-9a-f]{7}(-dirty)?)"
),
rxVersionDate
(
R"(Date: +(\d{4}-\d{2}-\d{2}).*)"
),
rxVersionNr2
(
R"(mkdssp-version: (\d+(?:\.\d+)+))"
);
#include "revision.hpp"
#include "revision.hpp"
struct
membuf
:
public
std
::
streambuf
{
membuf
(
char
*
data
,
size_t
length
)
{
this
->
setg
(
data
,
data
,
data
+
length
);
}
}
buffer
(
const_cast
<
char
*>
(
kRevision
),
sizeof
(
kRevision
));
std
::
istream
is
(
&
buffer
);
std
::
string
line
;
while
(
getline
(
is
,
line
))
{
std
::
smatch
m
;
if
(
std
::
regex_match
(
line
,
m
,
rxVersionNr
))
{
gVersionNr
+=
" (build "
+
m
[
1
].
str
()
+
(
m
[
2
].
matched
?
"*)"
:
")"
);
continue
;
}
if
(
std
::
regex_match
(
line
,
m
,
rxVersionDate
))
{
gVersionDate
=
m
[
1
];
continue
;
}
// always the first, replace with more specific if followed by the other info
if
(
std
::
regex_match
(
line
,
m
,
rxVersionNr2
))
{
gVersionNr
=
m
[
1
];
continue
;
}
}
}
std
::
string
get_version_nr
()
{
return
gVersionNr
/* + '/' + cif::get_version_nr()*/
;
}
std
::
string
get_version_date
()
{
return
gVersionDate
;
}
std
::
string
get_version_string
()
{
return
gVersionNr
+
" "
+
gVersionDate
;
}
// --------------------------------------------------------------------
// --------------------------------------------------------------------
std
::
string
ResidueToDSSPLine
(
const
mmcif
::
DSSP
::
ResidueInfo
&
info
)
std
::
string
ResidueToDSSPLine
(
const
mmcif
::
DSSP
::
ResidueInfo
&
info
)
...
@@ -415,7 +352,7 @@ void annotateDSSP(mmcif::Structure& structure, const mmcif::DSSP& dssp, bool wri
...
@@ -415,7 +352,7 @@ void annotateDSSP(mmcif::Structure& structure, const mmcif::DSSP& dssp, bool wri
}
}
}
}
db
.
add_software
(
"dssp"
,
"other"
,
get_version_nr
(),
get_version_date
()
);
db
.
add_software
(
"dssp"
,
"other"
,
kVersionNumber
,
kBuildDate
);
db
.
write
(
os
);
db
.
write
(
os
);
}
}
src/dssp.hpp
View file @
8b290992
...
@@ -29,11 +29,6 @@
...
@@ -29,11 +29,6 @@
#include <cif++/Structure.hpp>
#include <cif++/Structure.hpp>
#include <cif++/Secondary.hpp>
#include <cif++/Secondary.hpp>
void
load_version_info
();
std
::
string
get_version_nr
();
std
::
string
get_version_date
();
std
::
string
get_version_string
();
void
writeDSSP
(
const
mmcif
::
Structure
&
structure
,
const
mmcif
::
DSSP
&
dssp
,
std
::
ostream
&
os
);
void
writeDSSP
(
const
mmcif
::
Structure
&
structure
,
const
mmcif
::
DSSP
&
dssp
,
std
::
ostream
&
os
);
void
annotateDSSP
(
mmcif
::
Structure
&
structure
,
const
mmcif
::
DSSP
&
dssp
,
bool
writeOther
,
std
::
ostream
&
os
);
void
annotateDSSP
(
mmcif
::
Structure
&
structure
,
const
mmcif
::
DSSP
&
dssp
,
bool
writeOther
,
std
::
ostream
&
os
);
src/mkdssp.cpp
View file @
8b290992
...
@@ -46,6 +46,7 @@
...
@@ -46,6 +46,7 @@
#include <boost/iostreams/filtering_stream.hpp>
#include <boost/iostreams/filtering_stream.hpp>
#include "dssp.hpp"
#include "dssp.hpp"
#include "revision.hpp"
namespace
fs
=
std
::
filesystem
;
namespace
fs
=
std
::
filesystem
;
namespace
io
=
boost
::
iostreams
;
namespace
io
=
boost
::
iostreams
;
...
@@ -115,7 +116,7 @@ int d_main(int argc, const char* argv[])
...
@@ -115,7 +116,7 @@ int d_main(int argc, const char* argv[])
if
(
vm
.
count
(
"version"
))
if
(
vm
.
count
(
"version"
))
{
{
std
::
cout
<<
argv
[
0
]
<<
" version "
<<
get_version_string
()
<<
std
::
endl
;
write_version_string
(
std
::
cout
,
vm
.
count
(
"verbose"
))
;
exit
(
0
);
exit
(
0
);
}
}
...
@@ -242,8 +243,6 @@ int main(int argc, const char* argv[])
...
@@ -242,8 +243,6 @@ int main(int argc, const char* argv[])
#if defined(DATA_DIR)
#if defined(DATA_DIR)
cif
::
addDataDirectory
(
DATA_DIR
);
cif
::
addDataDirectory
(
DATA_DIR
);
#endif
#endif
load_version_info
();
result
=
d_main
(
argc
,
argv
);
result
=
d_main
(
argc
,
argv
);
}
}
catch
(
const
std
::
exception
&
ex
)
catch
(
const
std
::
exception
&
ex
)
...
...
src/revision.hpp.in
deleted
100644 → 0
View file @
dae8e82f
const char kRevision[] = R"(
mkdssp-version: @PROJECT_VERSION@
@BUILD_VERSION_STRING@
Date: @BUILD_DATE_TIME@
)";
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a 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