mirror of
https://github.com/PDB-REDO/libcifpp.git
synced 2026-06-04 13:54:25 +08:00
remove dependency on boost::program_options
This commit is contained in:
@@ -184,18 +184,17 @@ if(CIFPP_RECREATE_SYMOP_DATA)
|
||||
# The tool to create the table
|
||||
add_executable(symop-map-generator "${CMAKE_SOURCE_DIR}/tools/symop-map-generator.cpp")
|
||||
|
||||
target_link_libraries(symop-map-generator Threads::Threads
|
||||
Boost::regex Boost::program_options ${CIFPP_REQUIRED_LIBRARIES})
|
||||
target_link_libraries(symop-map-generator Threads::Threads ${CIFPP_REQUIRED_LIBRARIES})
|
||||
|
||||
set($ENV{CLIBD} ${CLIBD})
|
||||
|
||||
add_custom_command(
|
||||
OUTPUT ${CMAKE_SOURCE_DIR}/src/SymOpTable_data.hpp
|
||||
COMMAND $<TARGET_FILE:symop-map-generator> ${CLIBD}/syminfo.lib ${CMAKE_SOURCE_DIR}/src/SymOpTable_data.hpp
|
||||
OUTPUT ${CMAKE_SOURCE_DIR}/src/structure/SymOpTable_data.hpp
|
||||
COMMAND $<TARGET_FILE:symop-map-generator> ${CLIBD}/syminfo.lib ${CMAKE_SOURCE_DIR}/src/structure/SymOpTable_data.hpp
|
||||
)
|
||||
|
||||
add_custom_target(
|
||||
OUTPUT ${CMAKE_SOURCE_DIR}/src/SymOpTable_data.hpp
|
||||
OUTPUT ${CMAKE_SOURCE_DIR}/src/structure/SymOpTable_data.hpp
|
||||
DEPENDS symop-map-generator "$ENV{CLIBD}/syminfo.lib"
|
||||
)
|
||||
endif()
|
||||
@@ -418,7 +417,7 @@ if(CIFPP_BUILD_TESTS)
|
||||
|
||||
list(APPEND CIFPP_tests
|
||||
|
||||
# pdb2cif
|
||||
pdb2cif
|
||||
# rename-compound
|
||||
# structure
|
||||
# sugar
|
||||
|
||||
@@ -1,46 +1,24 @@
|
||||
#include "../include/cif++/Cif++.hpp"
|
||||
#include "../include/cif++/PDB2Cif.hpp"
|
||||
#include "../include/cif++/cif.hpp"
|
||||
#include "../include/cif++/pdb/PDB2Cif.hpp""
|
||||
|
||||
#include <iostream>
|
||||
#include <fstream>
|
||||
|
||||
#include <boost/program_options.hpp>
|
||||
|
||||
// #include "pdb2cif.h"
|
||||
|
||||
namespace po = boost::program_options;
|
||||
|
||||
int main(int argc, char* argv[])
|
||||
{
|
||||
using namespace std::literals;
|
||||
|
||||
po::options_description desc("pdb2cif-test options");
|
||||
desc.add_options()
|
||||
("input,i", po::value<std::string>(), "Input file")
|
||||
("help,h", "Display help message")
|
||||
("verbose,v", "Verbose output")
|
||||
("debug,d", po::value<int>(), "Debug level (for even more verbose output)");
|
||||
|
||||
po::positional_options_description p;
|
||||
p.add("input", 1);
|
||||
|
||||
po::variables_map vm;
|
||||
po::store(po::command_line_parser(argc, argv).options(desc).positional(p).run(), vm);
|
||||
po::notify(vm);
|
||||
|
||||
if (vm.count("help") or vm.count("input") == 0)
|
||||
if (argc != 2)
|
||||
{
|
||||
std::cerr << desc << std::endl;
|
||||
std::cerr << "Usage: pdb2cif-test <input-file>" << std::endl;
|
||||
exit(1);
|
||||
}
|
||||
|
||||
cif::VERBOSE = vm.count("verbose") != 0;
|
||||
if (vm.count("debug"))
|
||||
cif::VERBOSE = vm["debug"].as<int>();
|
||||
|
||||
std::ifstream is(vm["input"].as<std::string>());
|
||||
std::ifstream is(argv[1]);
|
||||
if (not is.is_open())
|
||||
throw std::runtime_error("Could not open file " + vm["input"].as<std::string>());
|
||||
throw std::runtime_error("Could not open file "s + argv[1]);
|
||||
|
||||
cif::File f;
|
||||
ReadPDBFile(is, f);
|
||||
|
||||
@@ -5,10 +5,6 @@
|
||||
#include <iostream>
|
||||
#include <fstream>
|
||||
|
||||
#include <boost/program_options.hpp>
|
||||
|
||||
namespace po = boost::program_options;
|
||||
|
||||
int main(int argc, char* argv[])
|
||||
{
|
||||
cif::VERBOSE = 3;
|
||||
|
||||
@@ -34,12 +34,9 @@
|
||||
#include <map>
|
||||
#include <filesystem>
|
||||
|
||||
#include <boost/program_options.hpp>
|
||||
|
||||
#include <cstdlib>
|
||||
|
||||
namespace fs = std::filesystem;
|
||||
namespace po = boost::program_options;
|
||||
|
||||
std::regex kNameRx(R"(^(\d+) +(\d+) +(\d+) +(\S+) +(\S+) +(\S+) +'([^']+)'( +'([^']+)')?(?: +!.+)?$)");
|
||||
|
||||
@@ -233,35 +230,14 @@ int main(int argc, char* const argv[])
|
||||
|
||||
try
|
||||
{
|
||||
po::options_description visible_options("symop-map-generator symlib-file output-file");
|
||||
visible_options.add_options()
|
||||
( "help,h", "Display help message" )
|
||||
( "verbose,v", "Verbose output") ;
|
||||
|
||||
po::options_description hidden_options("hidden options");
|
||||
hidden_options.add_options()
|
||||
( "input,i", po::value<std::string>(), "Input file")
|
||||
( "output,o", po::value<std::string>(), "Output file");
|
||||
|
||||
po::options_description cmdline_options;
|
||||
cmdline_options.add(visible_options).add(hidden_options);
|
||||
|
||||
po::positional_options_description p;
|
||||
p.add("input", 1);
|
||||
p.add("output", 1);
|
||||
|
||||
po::variables_map vm;
|
||||
po::store(po::command_line_parser(argc, argv).options(cmdline_options).positional(p).run(), vm);
|
||||
po::notify(vm);
|
||||
|
||||
if (vm.count("input") == 0 or vm.count("output") == 0 or vm.count("help"))
|
||||
if (argc != 3)
|
||||
{
|
||||
std::cerr << visible_options << std::endl;
|
||||
exit(vm.count("help") == 0);
|
||||
std::cerr << "Usage symop-map-generator <input-file> <output-file>" << std::endl;
|
||||
exit(1);
|
||||
}
|
||||
|
||||
fs::path input(vm["input"].as<std::string>());
|
||||
fs::path output(vm["output"].as<std::string>());
|
||||
fs::path input(argv[1]);
|
||||
fs::path output(argv[2]);
|
||||
|
||||
tmpFile = output.parent_path() / (output.filename().string() + ".tmp");
|
||||
|
||||
|
||||
@@ -45,3 +45,7 @@ fetch_dictionary () {
|
||||
|
||||
fetch_dictionary "/var/cache/libcifpp/mmcif_pdbx_v50.dic" "https://mmcif.wwpdb.org/dictionaries/ascii/mmcif_pdbx_v50.dic.gz"
|
||||
fetch_dictionary "/var/cache/libcifpp/components.cif" "ftp://ftp.wwpdb.org/pub/pdb/data/monomers/components.cif.gz"
|
||||
|
||||
# this one is not compressed
|
||||
|
||||
wget -O/var/cache/libcifpp/mmcif_ma.dic "https://github.com/ihmwg/ModelCIF/raw/master/dist/mmcif_ma.dic"
|
||||
|
||||
Reference in New Issue
Block a user