Commit 1d2f997e by Maarten L. Hekkelman

export stuff

parent f126b1da
......@@ -98,7 +98,7 @@ find_package(Boost 1.71.0 REQUIRED COMPONENTS system iostreams regex date_time p
find_package(ZLIB)
find_package(BZip2)
include_directories(${Boost_INCLUDE_DIR} ${CMAKE_SOURCE_DIR}/include)
include_directories(${Boost_INCLUDE_DIR})
link_libraries(${Boost_LIBRARIES} ${CMAKE_THREAD_LIBS_INIT})
# Create a revision file, containing the current git version info
......@@ -106,15 +106,6 @@ link_libraries(${Boost_LIBRARIES} ${CMAKE_THREAD_LIBS_INIT})
find_package(Git)
if(GIT_FOUND AND EXISTS "${CMAKE_SOURCE_DIR}/.git")
include(GetGitRevisionDescription)
execute_process(COMMAND ${GIT_EXECUTABLE} rev-parse --short HEAD OUTPUT_VARIABLE SHORT_SHA OUTPUT_STRIP_TRAILING_WHITESPACE)
set(REVISION ${SHORT_SHA} CACHE STRING "git short sha" FORCE)
# only use the plugin to tie the configure state to the sha to force rebuilds
# of files that depend on version.h
include(GetGitRevisionDescription)
get_git_head_revision(REFSPEC COMMITHASH)
# Generate our own version string
......@@ -128,6 +119,7 @@ endif()
# generate version.h
include_directories(${CMAKE_BINARY_DIR})
configure_file("${CMAKE_SOURCE_DIR}/src/revision.hpp.in" "${CMAKE_BINARY_DIR}/revision.hpp" @ONLY)
# Sources
set(project_sources
......@@ -171,20 +163,18 @@ include_directories(
${PROJECT_SOURCE_DIR}/src
)
add_library(cifpp_obj OBJECT ${project_sources} ${project_headers})
set_target_properties(cifpp_obj PROPERTIES POSITION_INDEPENDENT_CODE 1)
add_library(cifpp SHARED $<TARGET_OBJECTS:cifpp_obj>)
add_library(cifpp SHARED ${project_sources} ${project_headers})
set_target_properties(cifpp PROPERTIES
SOVERSION ${PROJECT_VERSION}
INTERFACE_cifpp_MAJOR_VERSION cifpp_MAJOR_VERSION
COMPATIBLE_INTERFACE_STRING cifpp_MAJOR_VERSION
)
add_library(cifpp_static STATIC $<TARGET_OBJECTS:cifpp_obj>)
add_library(cifpp_static STATIC ${project_sources} ${project_headers})
if (CMAKE_CXX_COMPILER_ID STREQUAL "AppleClang")
target_link_options(cifpp PRIVATE -undefined dynamic_lookup)
target_link_options(cifpp_static PRIVATE -undefined dynamic_lookup)
endif (CMAKE_CXX_COMPILER_ID STREQUAL "AppleClang")
# download the components.cif file from CCD
......@@ -224,8 +214,6 @@ include_directories(${Boost_INCLUDE_DIRS})
link_libraries(${Boost_LIBRARIES})
add_compile_definitions(CACHE_DIR="${SHARE_INSTALL_DIR}/libcifpp" DATA_DIR="${SHARE_INSTALL_DIR}/libcifpp" )
configure_file(${PROJECT_SOURCE_DIR}/src/Config-cmake.hpp.in Config.hpp)
generate_export_header(cifpp)
# Install rules
......@@ -237,7 +225,6 @@ install(TARGETS cifpp cifpp_static
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
INCLUDES DESTINATION ${CMAKE_INSTALL_INCLUDEDIR})
install(
DIRECTORY include/cif++
DESTINATION include
......
......@@ -106,7 +106,7 @@ namespace cif
{
// flag for verbose output
extern CIFPP_DLL_IMPORT(int) VERBOSE;
CIFPP_EXPORT extern int VERBOSE;
// mmCIF mapping
// A CIF data file in this case contains entries (data blocks) which can contain
......
......@@ -45,15 +45,7 @@
#include <unistd.h>
#endif
#ifdef _MSC_VER
#ifdef CIFPP_BUILD_DLL
#define CIFPP_DLL_IMPORT(type) __declspec(dllexport) type
#else
#define CIFPP_DLL_IMPORT(type) __declspec(dllimport) type
#endif
#else
#define CIFPP_DLL_IMPORT(type) type
#endif
#include "cifpp_export.h"
namespace cif
{
......
......@@ -145,7 +145,7 @@ class Compound
// --------------------------------------------------------------------
// Factory class for Compound and Link objects
extern CIFPP_DLL_IMPORT(const) std::map<std::string, char> kAAMap, kBaseMap;
CIFPP_EXPORT extern const std::map<std::string, char> kAAMap, kBaseMap;
class CompoundFactory
{
......
......@@ -45,8 +45,8 @@ struct Spacegroup
int nr;
};
extern CIFPP_DLL_IMPORT(const Spacegroup) kSpaceGroups[];
extern CIFPP_DLL_IMPORT(const std::size_t) kNrOfSpaceGroups;
CIFPP_EXPORT extern const Spacegroup kSpaceGroups[];
CIFPP_EXPORT extern const std::size_t kNrOfSpaceGroups;
// --------------------------------------------------------------------
......@@ -128,8 +128,8 @@ struct SymopDataBlock
static_assert(sizeof(SymopDataBlock) == sizeof(uint64_t), "Size of SymopData is wrong");
extern CIFPP_DLL_IMPORT(const SymopDataBlock) kSymopNrTable[];
extern CIFPP_DLL_IMPORT(const std::size_t) kSymopNrTableSize;
CIFPP_EXPORT extern const SymopDataBlock kSymopNrTable[];
CIFPP_EXPORT extern const std::size_t kSymopNrTableSize;
// --------------------------------------------------------------------
......
......@@ -24,10 +24,6 @@
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#if __has_include("Config.hpp")
#include "Config.hpp"
#endif
#include <fstream>
#include <algorithm>
#include <mutex>
......
......@@ -54,7 +54,7 @@ namespace fs = std::filesystem;
namespace cif
{
int VERBOSE = 0;
CIFPP_EXPORT int VERBOSE = 0;
static const char* kEmptyResult = "";
......
......@@ -24,10 +24,6 @@
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#if __has_include("Config.hpp")
#include "Config.hpp"
#endif
#include <atomic>
#include <chrono>
#include <cmath>
......@@ -224,18 +220,18 @@ std::string cifIdForNumber(int number)
if (number >= 26 * 26)
{
int v = number / (26 * 26);
result += 'A' - 1 + v;
result += char('A' - 1 + v);
number %= (26 * 26);
}
if (number >= 26)
{
int v = number / 26;
result += 'A' - 1 + v;
result += char('A' - 1 + v);
number %= 26;
}
result += 'A' + number;
result += char('A' + number);
}
assert(not result.empty());
......@@ -705,21 +701,21 @@ namespace
uint64_t s = static_cast<uint64_t>(std::trunc(t.count()));
if (s > 24 * 60 * 60)
{
uint32_t days = s / (24 * 60 * 60);
auto days = s / (24 * 60 * 60);
os << days << "d ";
s %= 24 * 60 * 60;
}
if (s > 60 * 60)
{
uint32_t hours = s / (60 * 60);
auto hours = s / (60 * 60);
os << hours << "h ";
s %= 60 * 60;
}
if (s > 60)
{
uint32_t minutes = s / 60;
auto minutes = s / 60;
os << minutes << "m ";
s %= 60;
}
......@@ -793,8 +789,6 @@ void Progress::message(const std::string &inMessage)
} // namespace cif
#if USE_RSRC
// --------------------------------------------------------------------
//
// Try to find a named resource. Can be either a local file with this name,
......@@ -1219,8 +1213,6 @@ class basic_istream : public std::basic_istream<CharT, Traits>
using istream = basic_istream<char, std::char_traits<char>>;
} // namespace mrsrc
#endif
// --------------------------------------------------------------------
namespace cif
......@@ -1248,18 +1240,21 @@ std::unique_ptr<std::istream> loadResource(std::filesystem::path name)
result.reset(file.release());
}
#if defined(CACHE_DIR) and defined(DATA_DIR)
#if defined(CACHE_DIR)
if (not result and not fs::exists(p))
{
for (const char *dir : {CACHE_DIR, DATA_DIR})
{
auto p2 = fs::path(dir) / p;
auto p2 = fs::path(CACHE_DIR) / p;
if (fs::exists(p2))
{
swap(p, p2);
break;
}
}
#endif
#if defined(DATA_DIR)
if (not result and not fs::exists(p))
{
auto p2 = fs::path(DATA_DIR) / p;
if (fs::exists(p2))
swap(p, p2);
}
#endif
......@@ -1270,14 +1265,12 @@ std::unique_ptr<std::istream> loadResource(std::filesystem::path name)
result.reset(file.release());
}
#if USE_RSRC
if (not result)
if (not result and gResourceData)
{
mrsrc::rsrc rsrc(name);
if (rsrc)
result.reset(new mrsrc::istream(rsrc));
}
#endif
return result;
}
......
......@@ -24,10 +24,6 @@
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#if __has_include("Config.hpp")
#include "Config.hpp"
#endif
#include <map>
#include <mutex>
#include <numeric>
......@@ -230,7 +226,7 @@ bool Compound::atomsBonded(const std::string &atomId_1, const std::string &atomI
// --------------------------------------------------------------------
// a factory class to generate compounds
const std::map<std::string, char> kAAMap{
CIFPP_EXPORT const std::map<std::string, char> kAAMap{
{"ALA", 'A'},
{"ARG", 'R'},
{"ASN", 'N'},
......@@ -254,7 +250,7 @@ const std::map<std::string, char> kAAMap{
{"GLX", 'Z'},
{"ASX", 'B'}};
const std::map<std::string, char> kBaseMap{
CIFPP_EXPORT const std::map<std::string, char> kBaseMap{
{"A", 'A'},
{"C", 'C'},
{"G", 'G'},
......
......@@ -24,10 +24,6 @@
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#if __has_include("Config.hpp")
#include "Config.hpp"
#endif
#include <map>
#include <set>
#include <system_error>
......
......@@ -24,9 +24,6 @@
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#if __has_include("Config.hpp")
#include "Config.hpp"
#endif
#include "cif++/Cif++.hpp"
#include <map>
......
......@@ -26,10 +26,6 @@
// Calculate DSSP-like secondary structure information
#if __has_include("Config.hpp")
#include "Config.hpp"
#endif
#include <numeric>
#include <iomanip>
#include <thread>
......
......@@ -36,10 +36,6 @@
#include <boost/iostreams/filter/gzip.hpp>
#include <boost/iostreams/filtering_stream.hpp>
#if __has_include("Config.hpp")
#include "Config.hpp"
#endif
#include "cif++/Cif2PDB.hpp"
#include "cif++/CifParser.hpp"
#include "cif++/PDB2Cif.hpp"
......
......@@ -24,10 +24,6 @@
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#if __has_include("Config.hpp")
#include "Config.hpp"
#endif
#include <atomic>
#include <mutex>
......
......@@ -24,10 +24,6 @@
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#if __has_include("Config.hpp")
#include "Config.hpp"
#endif
#include <boost/algorithm/string.hpp>
#include "cif++/TlsParser.hpp"
......
#include "Config.hpp"
#include "../include/cif++/Cif++.hpp"
#include "../include/cif++/PDB2Cif.hpp"
......
#if __has_include("../src/Config.hpp")
#include "../src/Config.hpp"
#endif
#include "../include/cif++/Cif++.hpp"
#include "../include/cif++/PDB2Cif.hpp"
#include "../include/cif++/Structure.hpp"
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment