Compare commits

...

9 Commits
cql ... v9.0.6

Author SHA1 Message Date
Maarten L. Hekkelman
06f1a308c3 update changelog 2026-01-27 14:25:01 +01:00
Maarten L. Hekkelman
1aed6a593c Remove windows link statements 2026-01-27 13:48:11 +01:00
Maarten L. Hekkelman
b969df1194 Fixed pdb.hpp header file, contained a wrong signature 2026-01-23 13:12:14 +01:00
UENO, M.
8f5b9eb631 Use find_package for FastFloat prior to FetchContent_Declare (#73)
* Use `find_package` for FastFloat prior to `FetchContent_Declare`

* Convert space to tab
2025-12-22 07:26:41 +01:00
Maarten L. Hekkelman
73f18a4da2 PCRE2 is not thread safe, the way it is used in libcifpp type validator 2025-12-20 08:38:59 +01:00
Maarten L. Hekkelman
7a9d94bc57 private linking to fast_float 2025-11-27 15:34:20 +01:00
Maarten L. Hekkelman
a3ba760ab5 Merge branch 'develop' into trunk 2025-11-27 15:29:46 +01:00
Maarten L. Hekkelman
510e336306 exclude from all for fast_float 2025-11-27 09:06:22 +01:00
Maarten L. Hekkelman
ffff2479d2 revert version-string code 2025-11-26 13:17:14 +01:00
5 changed files with 42 additions and 45 deletions

View File

@@ -32,7 +32,7 @@ endif()
# set the project name
project(
libcifpp
VERSION 9.0.5
VERSION 9.0.6
LANGUAGES CXX C)
list(PREPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake")
@@ -43,6 +43,7 @@ include(GenerateExportHeader)
include(CTest)
include(ExternalProject)
include(FetchContent)
include(VersionString)
# When building with ninja-multiconfig, build both debug and release by default
if(CMAKE_GENERATOR STREQUAL "Ninja Multi-Config")
@@ -129,13 +130,6 @@ if(MSVC)
# make msvc standards compliant...
add_compile_options(/permissive- /bigobj)
add_link_options(/NODEFAULTLIB:library)
# This is dubious...
if(BUILD_SHARED_LIBS)
set(CMAKE_MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>DLL")
else()
set(CMAKE_MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>")
endif()
endif()
# Libraries
@@ -170,14 +164,21 @@ endif()
# Using fast_float for float parsing, but only if needed
try_compile(STD_CHARCONV_COMPILING
SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/cmake/test-charconv.cpp)
SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/cmake/test-charconv.cpp
CXX_STANDARD 20
CXX_STANDARD_REQUIRED ON)
if(NOT STD_CHARCONV_COMPILING)
message(NOTICE "libcifpp: Using fast_float for std::from_chars")
FetchContent_Declare(fastfloat
GIT_REPOSITORY "https://github.com/fastfloat/fast_float"
GIT_TAG v8.0.2)
FetchContent_MakeAvailable(fastfloat)
find_package(FastFloat 8.0 QUIET CONFIG)
if(NOT FastFloat_FOUND)
message(STATUS "FastFloat not found in system, fetching from GitHub")
FetchContent_Declare(fastfloat
GIT_REPOSITORY "https://github.com/fastfloat/fast_float"
GIT_TAG v8.0.2
EXCLUDE_FROM_ALL)
FetchContent_MakeAvailable(fastfloat)
endif()
endif()
find_package(Threads)
@@ -239,6 +240,9 @@ if(CIFPP_RECREATE_SYMOP_DATA)
"$ENV{CLIBD}/symop.lib")
endif()
# Create a revision file, containing the current git version info
write_version_header("${CMAKE_CURRENT_SOURCE_DIR}/src/" LIB_NAME "LibCIFPP")
# Sources
set(project_sources
${CMAKE_CURRENT_SOURCE_DIR}/src/category.cpp
@@ -300,10 +304,6 @@ set(project_headers
add_library(cifpp)
add_library(cifpp::cifpp ALIAS cifpp)
# Create a revision file, containing the current git version info
include(VersionString)
add_version_header(cifpp "${CMAKE_CURRENT_SOURCE_DIR}/src/revision.hpp" LIB_NAME "LibCIFPP")
if(TARGET my-eigen3)
add_dependencies(cifpp my-eigen3)
endif()
@@ -346,7 +346,7 @@ else()
endif()
if(NOT STD_CHARCONV_COMPILING)
target_link_libraries(cifpp PUBLIC FastFloat::fast_float)
target_link_libraries(cifpp PRIVATE FastFloat::fast_float)
endif()
if(CMAKE_CXX_COMPILER_ID STREQUAL "AppleClang")

View File

@@ -1,3 +1,6 @@
Version 9.0.6
- Various small fixes
Version 9.0.5
- Added exists to compound_factory
- Added sub_matrix, fix and extend determinant calculation

View File

@@ -199,13 +199,24 @@ endif()
endfunction()
# Create a revision file, containing the current git version info, if any
function(add_version_header _target _header_file)
function(write_version_header dir)
set(flags )
set(options LIB_NAME)
set(options LIB_NAME FILE_NAME)
set(sources )
cmake_parse_arguments(VERSION_STRING_OPTION "${flags}" "${options}" "${sources}" ${ARGN})
# parameter check
if(NOT IS_DIRECTORY ${dir})
message(FATAL_ERROR "First parameter to write_version_header should be a directory where the final revision.hpp file will be placed")
endif()
if(VERSION_STRING_OPTION_FILE_NAME)
set(file_name "${VERSION_STRING_OPTION_FILE_NAME}")
else()
set(file_name "revision.hpp")
endif()
# Where to store intermediate files
set(VERSION_STRING_DATA "${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/VersionString")
if(NOT EXISTS "${VERSION_STRING_DATA}")
@@ -259,27 +270,6 @@ function(add_version_header _target _header_file)
set(BOOL_IS_MAIN "true")
endif()
set(HEADER_IN_FILE "${_current_cmake_module_dir}/revision.hpp.in")
set(HEADER_OUT_FILE "${_header_file}")
file(WRITE "${VERSION_STRING_DATA}/generate-header.cmake.in" [[
set(REVISION_GIT_TAGREF "@REVISION_GIT_TAGREF@")
set(BUILD_NUMBER "@BUILD_NUMBER@")
set(REVISION_DATE_TIME "@REVISION_DATE_TIME@")
set(VAR_PREFIX "@VAR_PREFIX@")
set(IDENT_PREFIX "@IDENT_PREFIX@")
set(BOOL_IS_MAIN "@BOOL_IS_MAIN@")
configure_file("@HEADER_IN_FILE@" "@HEADER_OUT_FILE@" @ONLY)
]])
configure_file("${VERSION_STRING_DATA}/generate-header.cmake.in" "${VERSION_STRING_DATA}/generate-header.cmake" @ONLY)
add_custom_command(
OUTPUT "${_header_file}"
COMMAND "${CMAKE_COMMAND}" -P "${VERSION_STRING_DATA}/generate-header.cmake"
)
target_sources("${_target}" PRIVATE "${_header_file}")
set_target_properties("${_target}" PROPERTIES ADDITIONAL_CLEAN_FILES "${_header_file}")
configure_file("${_current_cmake_module_dir}/revision.hpp.in" "${dir}/${file_name}" @ONLY)
endfunction()

View File

@@ -64,7 +64,7 @@ file read(std::istream &is);
* @brief Read a file in legacy PDB format from std::istream @a is and
* put the data into @a cifFile
*/
file read_pdb_file(std::istream &pdbFile);
void read_pdb_file(std::istream &pdbFile, cif::file &cifFile);
// mmCIF to PDB

View File

@@ -27,12 +27,11 @@
#include "cif++/validate.hpp"
#include "cif++/category.hpp"
#include "cif++/dictionary_parser.hpp"
#include "cif++/gzio.hpp"
#include "cif++/utilities.hpp"
#include <cassert>
#include <fstream>
#include <iostream>
#include <mutex>
// The validator depends on regular expressions. Unfortunately,
// the implementation of std::regex in g++ is buggy and crashes
@@ -75,6 +74,7 @@ struct regex_impl
private:
pcre2_code *m_rx = nullptr;
pcre2_match_data *m_data = nullptr;
mutable std::mutex m_mutex;
};
regex_impl::regex_impl(std::string_view rx)
@@ -95,6 +95,8 @@ regex_impl::regex_impl(std::string_view rx)
regex_impl::~regex_impl()
{
std::unique_lock lock(m_mutex);
if (m_data)
pcre2_match_data_free(m_data);
@@ -104,6 +106,8 @@ regex_impl::~regex_impl()
bool regex_impl::match(std::string_view v) const
{
std::unique_lock lock(m_mutex);
bool result = false;
if (int rc = pcre2_match(m_rx, (PCRE2_SPTR)v.data(), v.length(), 0, 0, m_data, nullptr); rc >= 0)