Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
L
libcifpp
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
libcifpp
Commits
24ab660e
Unverified
Commit
24ab660e
authored
Jan 18, 2022
by
Maarten L. Hekkelman
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Change logic for testing std::filesystem and libatomic
parent
883f0307
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
94 additions
and
4 deletions
+94
-4
CMakeLists.txt
+11
-4
cmake/FindAtomic.cmake
+65
-0
cmake/FindFilesystem.cmake
+2
-0
include/cif++/Structure.hpp
+6
-0
src/Structure.cpp
+10
-0
No files found.
CMakeLists.txt
View file @
24ab660e
...
...
@@ -37,7 +37,6 @@ include(CheckIncludeFiles)
include
(
CheckLibraryExists
)
include
(
CMakePackageConfigHelpers
)
include
(
Dart
)
include
(
FindFilesystem
)
include
(
GenerateExportHeader
)
set
(
CXX_EXTENSIONS OFF
)
...
...
@@ -178,8 +177,16 @@ find_package(Boost 1.70.0 REQUIRED COMPONENTS system iostreams regex program_opt
if
(
NOT MSVC AND Boost_USE_STATIC_LIBS
)
find_package
(
ZLIB REQUIRED
)
find_package
(
BZip2 REQUIRED
)
list
(
APPEND CIFPP_REQUIRED_LIBRARIES
${
ZLIB_LIBRARIES
}
${
BZip2_LIBRARIES
}
)
endif
()
include
(
FindFilesystem
)
list
(
APPEND CIFPP_REQUIRED_LIBRARIES
${
STDCPPFS_LIBRARY
}
)
include
(
FindAtomic
)
list
(
APPEND CIFPP_REQUIRED_LIBRARIES
${
STDCPPATOMIC_LIBRARY
}
)
# Create a revision file, containing the current git version info
include
(
GetGitRevisionDescription
)
...
...
@@ -203,7 +210,7 @@ if(CIFPP_RECREATE_SYMOP_DATA)
add_executable
(
symop-map-generator
"
${
CMAKE_SOURCE_DIR
}
/tools/symop-map-generator.cpp"
)
target_link_libraries
(
symop-map-generator Threads::Threads
${
Boost_LIBRARIES
}
std::filesystem
${
ZLIB_LIBRARIES
}
${
BZip2
_LIBRARIES
}
)
target_link_libraries
(
symop-map-generator Threads::Threads
${
Boost_LIBRARIES
}
${
CIFPP_REQUIRED
_LIBRARIES
}
)
if
(
Boost_INCLUDE_DIR
)
target_include_directories
(
symop-map-generator PUBLIC
${
Boost_INCLUDE_DIR
}
)
endif
()
...
...
@@ -274,7 +281,7 @@ target_include_directories(cifpp
${
CMAKE_BINARY_DIR
}
)
target_link_libraries
(
cifpp Threads::Threads
${
Boost_LIBRARIES
}
std::filesystem
${
ZLIB_LIBRARIES
}
${
BZip2
_LIBRARIES
}
)
target_link_libraries
(
cifpp Threads::Threads
${
Boost_LIBRARIES
}
${
CIFPP_REQUIRED
_LIBRARIES
}
)
if
(
CMAKE_CXX_COMPILER_ID STREQUAL
"AppleClang"
)
target_link_options
(
cifpp PRIVATE -undefined dynamic_lookup
)
...
...
@@ -431,7 +438,7 @@ if(CIFPP_BUILD_TESTS)
${
CMAKE_CURRENT_BINARY_DIR
}
# for config.h
)
target_link_libraries
(
${
CIFPP_TEST
}
PRIVATE Threads::Threads cifpp
${
Boost_LIBRARIES
}
std::filesystem
${
ZLIB_LIBRARIES
}
${
BZip2
_LIBRARIES
}
)
target_link_libraries
(
${
CIFPP_TEST
}
PRIVATE Threads::Threads cifpp
${
Boost_LIBRARIES
}
${
CIFPP_REQUIRED
_LIBRARIES
}
)
if
(
MSVC
)
# Specify unwind semantics so that MSVC knowns how to handle exceptions
...
...
cmake/FindAtomic.cmake
0 → 100644
View file @
24ab660e
# Simplistic
if
(
TARGET std::atomic
)
return
()
endif
()
cmake_minimum_required
(
VERSION 3.10
)
include
(
CMakePushCheckState
)
include
(
CheckIncludeFileCXX
)
include
(
CheckCXXSourceRuns
)
cmake_push_check_state
()
set
(
CMAKE_CXX_STANDARD 17
)
check_include_file_cxx
(
"atomic"
_CXX_ATOMIC_HAVE_HEADER
)
mark_as_advanced
(
_CXX_ATOMIC_HAVE_HEADER
)
set
(
code
[[
#include <atomic>
int main(int argc, char** argv) {
struct Test { int val; };
std::atomic<Test> s;
(void)s.is_lock_free();
return 0;
}
]]
)
check_cxx_source_runs
(
"
${
code
}
"
_CXX_ATOMIC_BUILTIN
)
if
(
_CXX_ATOMIC_BUILTIN
)
set
(
_found 1
)
else
()
list
(
APPEND CMAKE_REQUIRED_LIBRARIES atomic
)
list
(
APPEND FOLLY_LINK_LIBRARIES atomic
)
check_cxx_source_runs
(
"
${
code
}
"
_CXX_ATOMIC_LIB_NEEDED
)
if
(
NOT _CXX_ATOMIC_LIB_NEEDED
)
message
(
FATAL_ERROR
"unable to link C++ std::atomic code: you may need \
to install GNU libatomic"
)
else
()
set
(
_found 1
)
endif
()
endif
()
if
(
_found
)
add_library
(
std::atomic INTERFACE IMPORTED
)
set_property
(
TARGET std::atomic APPEND PROPERTY INTERFACE_COMPILE_FEATURES cxx_std_14
)
if
(
_CXX_ATOMIC_BUILTIN
)
# Nothing to add...
elseif
(
_CXX_ATOMIC_LIB_NEEDED
)
set_target_properties
(
std::atomic PROPERTIES IMPORTED_LIBNAME atomic
)
set
(
STDCPPATOMIC_LIBRARY atomic
)
endif
()
endif
()
cmake_pop_check_state
()
set
(
Atomic_FOUND
${
_found
}
CACHE BOOL
"TRUE if we can run a program using std::atomic"
FORCE
)
if
(
Atomic_FIND_REQUIRED AND NOT Atomic_FOUND
)
message
(
FATAL_ERROR
"Cannot run simple program using std::atomic"
)
endif
()
cmake/FindFilesystem.cmake
View file @
24ab660e
...
...
@@ -59,8 +59,10 @@ if(_found)
# Nothing to add...
elseif
(
CXX_FILESYSTEM_STDCPPFS_NEEDED
)
set_target_properties
(
std::filesystem PROPERTIES IMPORTED_LIBNAME stdc++fs
)
set
(
STDCPPFS_LIBRARY stdc++fs
)
elseif
(
CXX_FILESYSTEM_CPPFS_NEEDED
)
set_target_properties
(
std::filesystem PROPERTIES IMPORTED_LIBNAME c++fs
)
set
(
STDCPPFS_LIBRARY c++fs
)
endif
()
endif
()
...
...
include/cif++/Structure.hpp
View file @
24ab660e
...
...
@@ -481,6 +481,12 @@ class Structure
/// \brief Get a the single residue for an asym with id \a asymID
Residue
&
getResidue
(
const
std
::
string
&
asymID
);
/// \brief Get a the residue for atom \a atom
Residue
&
getResidue
(
const
mmcif
::
Atom
&
atom
);
/// \brief Get a the residue for atom \a atom
const
Residue
&
getResidue
(
const
mmcif
::
Atom
&
atom
)
const
;
// map between auth and label locations
std
::
tuple
<
std
::
string
,
int
,
std
::
string
>
MapAuthToLabel
(
const
std
::
string
&
asymID
,
...
...
src/Structure.cpp
View file @
24ab660e
...
...
@@ -2098,6 +2098,16 @@ Residue &Structure::getResidue(const std::string &asymID)
return
const_cast
<
Residue
&>
(
const_cast
<
Structure
const
&>
(
*
this
).
getResidue
(
asymID
));
}
Residue
&
Structure
::
getResidue
(
const
mmcif
::
Atom
&
atom
)
{
return
getResidue
(
atom
.
labelAsymID
(),
atom
.
labelCompID
(),
atom
.
labelSeqID
());
}
const
Residue
&
Structure
::
getResidue
(
const
mmcif
::
Atom
&
atom
)
const
{
return
getResidue
(
atom
.
labelAsymID
(),
atom
.
labelCompID
(),
atom
.
labelSeqID
());
}
File
&
Structure
::
getFile
()
const
{
return
mFile
;
...
...
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