Giter Site home page Giter Site logo

mhekkel / libmcfp Goto Github PK

View Code? Open in Web Editor NEW
2.0 2.0 0.0 237 KB

A header only library that can collect configuration options from command line arguments and configuration files

Home Page: https://mhekkel.github.io/libmcfp/

License: BSD 2-Clause "Simplified" License

CMake 7.31% C++ 92.69%
argument-parser argv-parser config config-file configuration

libmcfp's People

Contributors

mhekkel avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar

libmcfp's Issues

installation issue for dssp

Hi,

I'm trying to install DSSP so, as indicated here https://github.com/PDB-REDO/dssp, I need libmcfp to do so.

However in the last step of the installation (cmake --install .) I have the following error:
-- Install configuration: ""
-- Installing: /usr/local/include/mcfp.hpp
CMake Error at cmake_install.cmake:41 (file):
file INSTALL cannot copy file
"/home/charlieccp/libmcfp/include/mcfp/mcfp.hpp" to
"/usr/local/include/mcfp.hpp": Permission denied.

Note that all other steps worked without any problem.

Could you please advice me on what to do now?

I'm using ubuntu on windows.

Thanks for your time.

Best wishes,
Charlotte

No installation instructions

Would be nice to include in the README. This worked for me on Ubuntu:

git clone https://github.com/mhekkel/libmcfp
cd libmcfp/
mkdir build
cd build/
cmake ..
cmake --build .
cmake --install .

Installation issue

I am trying to install libmcfp from source on Snellius (Red Hat Enterprise Linux 8.6, GCC 8.5.0). I am following the steps in the readme, and when I do cmake --build . I get the following:

Error
[ 50%] Building CXX object CMakeFiles/libmcfp-unit-test.dir/test/unit-test.cpp.o
In file included from /home/ccrocion/repositories/libmcfp/test/unit-test.cpp:32:
/home/ccrocion/repositories/libmcfp/include/mcfp/mcfp.hpp: In instantiation of ‘void mcfp::config::init(std::string_view, Options ...) [with Options = {mcfp::detail::option<void>, mcfp::detail::option<int>, mcfp::detail::option<int>, mcfp::detail::option<float>, mcfp::detail::option<float>}; std::string_view = std::basic_string_view<char>]’:
/home/ccrocion/repositories/libmcfp/test/unit-test.cpp:68:48:   required from here
/home/ccrocion/repositories/libmcfp/include/mcfp/mcfp.hpp:87:16: error: no matching function for call to ‘mcfp::config::config_impl<>::config_impl(mcfp::detail::option<void>, mcfp::detail::option<int>, mcfp::detail::option<int>, mcfp::detail::option<float>, mcfp::detail::option<float>)’
   m_impl.reset(new config_impl(std::forward<Options>(options)...));
                ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/ccrocion/repositories/libmcfp/include/mcfp/mcfp.hpp:653:3: note: candidate: ‘mcfp::config::config_impl<Options>::config_impl(Options ...) [with Options = {}]’
   config_impl(Options... options)
   ^~~~~~~~~~~
/home/ccrocion/repositories/libmcfp/include/mcfp/mcfp.hpp:653:3: note:   candidate expects 0 arguments, 5 provided
/home/ccrocion/repositories/libmcfp/include/mcfp/mcfp.hpp:649:9: note: candidate: ‘mcfp::config::config_impl<>::config_impl(const mcfp::config::config_impl<>&)’
  struct config_impl : public config_impl_base
         ^~~~~~~~~~~
/home/ccrocion/repositories/libmcfp/include/mcfp/mcfp.hpp:649:9: note:   candidate expects 1 argument, 5 provided
/home/ccrocion/repositories/libmcfp/include/mcfp/mcfp.hpp:649:9: note: candidate: ‘mcfp::config::config_impl<>::config_impl(mcfp::config::config_impl<>&&)’
/home/ccrocion/repositories/libmcfp/include/mcfp/mcfp.hpp:649:9: note:   candidate expects 1 argument, 5 provided
/home/ccrocion/repositories/libmcfp/include/mcfp/mcfp.hpp: In instantiation of ‘void mcfp::config::init(std::string_view, Options ...) [with Options = {mcfp::detail::option<int>, mcfp::detail::option<int>}; std::string_view = std::basic_string_view<char>]’:
/home/ccrocion/repositories/libmcfp/test/unit-test.cpp:152:38:   required from here
/home/ccrocion/repositories/libmcfp/include/mcfp/mcfp.hpp:87:16: error: no matching function for call to ‘mcfp::config::config_impl<>::config_impl(mcfp::detail::option<int>, mcfp::detail::option<int>)’
   m_impl.reset(new config_impl(std::forward<Options>(options)...));
                ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/ccrocion/repositories/libmcfp/include/mcfp/mcfp.hpp:653:3: note: candidate: ‘mcfp::config::config_impl<Options>::config_impl(Options ...) [with Options = {}]’
   config_impl(Options... options)
   ^~~~~~~~~~~
/home/ccrocion/repositories/libmcfp/include/mcfp/mcfp.hpp:653:3: note:   candidate expects 0 arguments, 2 provided
/home/ccrocion/repositories/libmcfp/include/mcfp/mcfp.hpp:649:9: note: candidate: ‘mcfp::config::config_impl<>::config_impl(const mcfp::config::config_impl<>&)’
  struct config_impl : public config_impl_base
         ^~~~~~~~~~~
/home/ccrocion/repositories/libmcfp/include/mcfp/mcfp.hpp:649:9: note:   candidate expects 1 argument, 2 provided
/home/ccrocion/repositories/libmcfp/include/mcfp/mcfp.hpp:649:9: note: candidate: ‘mcfp::config::config_impl<>::config_impl(mcfp::config::config_impl<>&&)’
/home/ccrocion/repositories/libmcfp/include/mcfp/mcfp.hpp:649:9: note:   candidate expects 1 argument, 2 provided
/home/ccrocion/repositories/libmcfp/include/mcfp/mcfp.hpp: In instantiation of ‘void mcfp::config::init(std::string_view, Options ...) [with Options = {mcfp::detail::option<const char*>, mcfp::detail::option<std::basic_string_view<char, std::char_traits<char> > >, mcfp::detail::option<char [4]>}; std::string_view = std::basic_string_view<char>]’:
/home/ccrocion/repositories/libmcfp/test/unit-test.cpp:228:36:   required from here
/home/ccrocion/repositories/libmcfp/include/mcfp/mcfp.hpp:87:16: error: no matching function for call to ‘mcfp::config::config_impl<>::config_impl(mcfp::detail::option<const char*>, mcfp::detail::option<std::basic_string_view<char> >, mcfp::detail::option<char [4]>)’
   m_impl.reset(new config_impl(std::forward<Options>(options)...));
                ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/ccrocion/repositories/libmcfp/include/mcfp/mcfp.hpp:653:3: note: candidate: ‘mcfp::config::config_impl<Options>::config_impl(Options ...) [with Options = {}]’
   config_impl(Options... options)
   ^~~~~~~~~~~
/home/ccrocion/repositories/libmcfp/include/mcfp/mcfp.hpp:653:3: note:   candidate expects 0 arguments, 3 provided
/home/ccrocion/repositories/libmcfp/include/mcfp/mcfp.hpp:649:9: note: candidate: ‘mcfp::config::config_impl<>::config_impl(const mcfp::config::config_impl<>&)’
  struct config_impl : public config_impl_base
         ^~~~~~~~~~~
/home/ccrocion/repositories/libmcfp/include/mcfp/mcfp.hpp:649:9: note:   candidate expects 1 argument, 3 provided
/home/ccrocion/repositories/libmcfp/include/mcfp/mcfp.hpp:649:9: note: candidate: ‘mcfp::config::config_impl<>::config_impl(mcfp::config::config_impl<>&&)’
/home/ccrocion/repositories/libmcfp/include/mcfp/mcfp.hpp:649:9: note:   candidate expects 1 argument, 3 provided
/home/ccrocion/repositories/libmcfp/include/mcfp/mcfp.hpp: In instantiation of ‘void mcfp::config::init(std::string_view, Options ...) [with Options = {mcfp::detail::option<const char*>, mcfp::detail::option<int>, mcfp::detail::option<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, mcfp::detail::option<float>, mcfp::detail::option<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, mcfp::detail::option<void>}; std::string_view = std::basic_string_view<char>]’:
/home/ccrocion/repositories/libmcfp/test/unit-test.cpp:423:37:   required from here
/home/ccrocion/repositories/libmcfp/include/mcfp/mcfp.hpp:87:16: error: no matching function for call to ‘mcfp::config::config_impl<>::config_impl(mcfp::detail::option<const char*>, mcfp::detail::option<int>, mcfp::detail::option<std::__cxx11::basic_string<char> >, mcfp::detail::option<float>, mcfp::detail::option<std::__cxx11::basic_string<char> >, mcfp::detail::option<void>)’
   m_impl.reset(new config_impl(std::forward<Options>(options)...));
                ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/ccrocion/repositories/libmcfp/include/mcfp/mcfp.hpp:653:3: note: candidate: ‘mcfp::config::config_impl<Options>::config_impl(Options ...) [with Options = {}]’
   config_impl(Options... options)
   ^~~~~~~~~~~
/home/ccrocion/repositories/libmcfp/include/mcfp/mcfp.hpp:653:3: note:   candidate expects 0 arguments, 6 provided
/home/ccrocion/repositories/libmcfp/include/mcfp/mcfp.hpp:649:9: note: candidate: ‘mcfp::config::config_impl<>::config_impl(const mcfp::config::config_impl<>&)’
  struct config_impl : public config_impl_base
         ^~~~~~~~~~~
/home/ccrocion/repositories/libmcfp/include/mcfp/mcfp.hpp:649:9: note:   candidate expects 1 argument, 6 provided
/home/ccrocion/repositories/libmcfp/include/mcfp/mcfp.hpp:649:9: note: candidate: ‘mcfp::config::config_impl<>::config_impl(mcfp::config::config_impl<>&&)’
/home/ccrocion/repositories/libmcfp/include/mcfp/mcfp.hpp:649:9: note:   candidate expects 1 argument, 6 provided
/home/ccrocion/repositories/libmcfp/include/mcfp/mcfp.hpp: In instantiation of ‘void mcfp::config::init(std::string_view, Options ...) [with Options = {mcfp::detail::option<const char*>, mcfp::detail::option<int>, mcfp::detail::option<float>, mcfp::detail::option<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, mcfp::detail::option<void>}; std::string_view = std::basic_string_view<char>]’:
/home/ccrocion/repositories/libmcfp/test/unit-test.cpp:477:38:   required from here
/home/ccrocion/repositories/libmcfp/include/mcfp/mcfp.hpp:87:16: error: no matching function for call to ‘mcfp::config::config_impl<>::config_impl(mcfp::detail::option<const char*>, mcfp::detail::option<int>, mcfp::detail::option<float>, mcfp::detail::option<std::__cxx11::basic_string<char> >, mcfp::detail::option<void>)’
   m_impl.reset(new config_impl(std::forward<Options>(options)...));
                ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/ccrocion/repositories/libmcfp/include/mcfp/mcfp.hpp:653:3: note: candidate: ‘mcfp::config::config_impl<Options>::config_impl(Options ...) [with Options = {}]’
   config_impl(Options... options)
   ^~~~~~~~~~~
/home/ccrocion/repositories/libmcfp/include/mcfp/mcfp.hpp:653:3: note:   candidate expects 0 arguments, 5 provided
/home/ccrocion/repositories/libmcfp/include/mcfp/mcfp.hpp:649:9: note: candidate: ‘mcfp::config::config_impl<>::config_impl(const mcfp::config::config_impl<>&)’
  struct config_impl : public config_impl_base
         ^~~~~~~~~~~
/home/ccrocion/repositories/libmcfp/include/mcfp/mcfp.hpp:649:9: note:   candidate expects 1 argument, 5 provided
/home/ccrocion/repositories/libmcfp/include/mcfp/mcfp.hpp:649:9: note: candidate: ‘mcfp::config::config_impl<>::config_impl(mcfp::config::config_impl<>&&)’
/home/ccrocion/repositories/libmcfp/include/mcfp/mcfp.hpp:649:9: note:   candidate expects 1 argument, 5 provided
/home/ccrocion/repositories/libmcfp/include/mcfp/mcfp.hpp: In instantiation of ‘void mcfp::config::init(std::string_view, Options ...) [with Options = {mcfp::detail::option<const char*>, mcfp::detail::option<int>, mcfp::detail::option<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >}; std::string_view = std::basic_string_view<char>]’:
/home/ccrocion/repositories/libmcfp/test/unit-test.cpp:496:47:   required from here
/home/ccrocion/repositories/libmcfp/include/mcfp/mcfp.hpp:87:16: error: no matching function for call to ‘mcfp::config::config_impl<>::config_impl(mcfp::detail::option<const char*>, mcfp::detail::option<int>, mcfp::detail::option<std::__cxx11::basic_string<char> >)’
   m_impl.reset(new config_impl(std::forward<Options>(options)...));
                ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/ccrocion/repositories/libmcfp/include/mcfp/mcfp.hpp:653:3: note: candidate: ‘mcfp::config::config_impl<Options>::config_impl(Options ...) [with Options = {}]’
   config_impl(Options... options)
   ^~~~~~~~~~~
/home/ccrocion/repositories/libmcfp/include/mcfp/mcfp.hpp:653:3: note:   candidate expects 0 arguments, 3 provided
/home/ccrocion/repositories/libmcfp/include/mcfp/mcfp.hpp:649:9: note: candidate: ‘mcfp::config::config_impl<>::config_impl(const mcfp::config::config_impl<>&)’
  struct config_impl : public config_impl_base
         ^~~~~~~~~~~
/home/ccrocion/repositories/libmcfp/include/mcfp/mcfp.hpp:649:9: note:   candidate expects 1 argument, 3 provided
/home/ccrocion/repositories/libmcfp/include/mcfp/mcfp.hpp:649:9: note: candidate: ‘mcfp::config::config_impl<>::config_impl(mcfp::config::config_impl<>&&)’
/home/ccrocion/repositories/libmcfp/include/mcfp/mcfp.hpp:649:9: note:   candidate expects 1 argument, 3 provided
gmake[2]: *** [CMakeFiles/libmcfp-unit-test.dir/build.make:76: CMakeFiles/libmcfp-unit-test.dir/test/unit-test.cpp.o] Error 1
gmake[1]: *** [CMakeFiles/Makefile2:813: CMakeFiles/libmcfp-unit-test.dir/all] Error 2
gmake: *** [Makefile:146: all] Error 2

Unknown CMake command "check_required_components".

cif-tools fails to compile due to issue in the file /usr/local/lib/cmake/libmcfp/libmcfpConfig.cmake. It says:
Unknown CMake command "check_required_components".

The reason is that configure_package_config_file() should be used instead of the plain configure_file() as explained in:
https://cmake.org/cmake/help/latest/module/CMakePackageConfigHelpers.html#command:configure_package_config_file

To reproduce, create the Dockerfile and build the docker container:

FROM ubuntu:24.04 AS devel

RUN apt update \
&& apt install -y libboost-dev zlib1g-dev cmake libeigen3-dev openbabel gcc g++ git

RUN git clone https://github.com/PDB-REDO/libcifpp.git \ 
&& cd libcifpp \
&& git checkout v7.0.3 \
&& cmake -S . -B build -DCMAKE_BUILD_TYPE=Release \
&& cmake --build build \
&& cmake --install build \
&& cp -r include/cif++/* /usr/local/include/cif++/

RUN git clone https://github.com/mhekkel/libmcfp.git \ 
&& cd libmcfp \
&& git checkout v1.3.1 \
#&& patch -p1 < ../libmcfpConfig.patch \
&& cmake -S . -B build -DCMAKE_BUILD_TYPE=Release \
&& cmake --build build \
&& cmake --install build

RUN git clone https://github.com/PDB-REDO/cif-tools.git \
&& cd cif-tools \
&& git checkout v1.0.11 \
&& cmake -S . -B build -DCMAKE_BUILD_TYPE=Release \
&& cmake --build build \
&& cmake --install build

To fix the error, create the file libmcfpConfig.patch with:

diff --git a/CMakeLists.txt b/CMakeLists.txt
index e162c1e..3f3ed46 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -99,8 +99,9 @@ install(EXPORT mcfp
        DESTINATION lib/cmake/libmcfp
        FILE "libmcfpTargets.cmake")
 
-configure_file(${PROJECT_SOURCE_DIR}/cmake/libmcfpConfig.cmake.in
-       ${CMAKE_CURRENT_BINARY_DIR}/libmcfpConfig.cmake @ONLY)
+configure_package_config_file(${PROJECT_SOURCE_DIR}/cmake/libmcfpConfig.cmake.in
+       ${CMAKE_CURRENT_BINARY_DIR}/libmcfpConfig.cmake
+       INSTALL_DESTINATION lib/cmake/libmcfp)
 
 install(FILES "${CMAKE_CURRENT_BINARY_DIR}/libmcfpConfig.cmake"
        DESTINATION lib/cmake/libmcfp)

Then build the docker image with the following Dockerfile:

FROM ubuntu:24.04 AS devel

RUN apt update \
&& apt install -y libboost-dev zlib1g-dev cmake libeigen3-dev openbabel gcc g++ git

RUN git clone https://github.com/PDB-REDO/libcifpp.git \ 
&& cd libcifpp \
&& git checkout v7.0.3 \
&& cmake -S . -B build -DCMAKE_BUILD_TYPE=Release \
&& cmake --build build \
&& cmake --install build \
&& cp -r include/cif++/* /usr/local/include/cif++/

COPY libmcfpConfig.patch libmcfpConfig.patch 

RUN git clone https://github.com/mhekkel/libmcfp.git \ 
&& cd libmcfp \
&& git checkout v1.3.1 \
&& patch -p1 < ../libmcfpConfig.patch \
&& cmake -S . -B build -DCMAKE_BUILD_TYPE=Release \
&& cmake --build build \
&& cmake --install build

RUN git clone https://github.com/PDB-REDO/cif-tools.git \
&& cd cif-tools \
&& git checkout v1.0.11 \
&& cmake -S . -B build -DCMAKE_BUILD_TYPE=Release \
&& cmake --build build \
&& cmake --install build

This fixes the issue, however, cif-tools fails to compile (error at the linking step) but I will submit a dedicated issue for this one.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.