diff --git a/CMakeLists.txt b/CMakeLists.txt index 7f190fe37282cd1e2cf863c1ffa96cd32996f4c5..ea8c6ac05f5b3099bb09a9dcde33d878e0d7ee9d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -50,6 +50,7 @@ option(DEPLOYMENT "switch on deployment settings" OFF) option(COMPILE_TESTS "whether unit tests should be compiled by default" OFF) option(ENABLE_STATIC "whether static libraries should be compiled" OFF) option(DEBIAN_STYLE_LIBEXEC "whether 'libexec' should be put under 'lib/openstructure" OFF) +option(HIDDEN_VISIBILITY "on gcc, use -fvisibility=hidden" OFF) if (CXX) set(CMAKE_CXX_COMPILER ${CXX}) @@ -250,9 +251,14 @@ if (CMAKE_COMPILER_IS_GNUCXX) # with multiple -fno-strict-aliasing flags, triggering a complete rebuild whenever # cmake is run set (CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -fno-strict-aliasing") + if(HIDDEN_VISIBILITY) + set (CMAKE_CXX_FLAGS "-fvisibility=hidden") + set (_HIDDEN_VIS ON) + else(HIDDEN_VISIBILITY) + set (_HIDDEN_VIS OFF) + endif(HIDDEN_VISIBILITY) endif() - # basic environment include_directories(${Boost_INCLUDE_DIRS} ${FFTW_INCLUDE_PATH} @@ -313,5 +319,6 @@ message(STATUS " Compound Lib (-DCOMPOUND_LIB) : ${_COMP_LIB}\n" " TMAlign and TMScore (-DCOMPILE_TMTOOLS) : ${_TM_TOOLS}\n" " Static Libraries (-DENABLE_STATIC) : ${ENABLE_STATIC}\n" - " Debian-style 'libexec' (-DDEBIAN_STYLE_LIBEXEC) : ${_DEBIAN_STYLE_LIBEXEC}" ) + " Debian-style 'libexec' (-DDEBIAN_STYLE_LIBEXEC) : ${_DEBIAN_STYLE_LIBEXEC}\n" + " Hidden object visibility (-DHIDDEN_VISIBILITY) : ${_HIDDEN_VIS}") diff --git a/modules/conop/src/compound.hh b/modules/conop/src/compound.hh index baca26eb74e5d0a576841486cb7b5be2c74fb4d0..7e8c424571967ea5a7b0e339323561488b598d1e 100644 --- a/modules/conop/src/compound.hh +++ b/modules/conop/src/compound.hh @@ -29,7 +29,7 @@ namespace ost { namespace conop { -struct Date { +struct DLLEXPORT_OST_CONOP Date { Date(int y, int m, int d): year(y), month(m), day(d) { } @@ -68,7 +68,7 @@ struct Date { int day; }; -struct AtomSpec { +struct DLLEXPORT_OST_CONOP AtomSpec { AtomSpec() : ordinal(0), is_leaving(false) { } @@ -88,7 +88,7 @@ struct AtomSpec { } }; -struct BondSpec { +struct DLLEXPORT_OST_CONOP BondSpec { BondSpec() : atom_one(0), atom_two(0), order(1) { diff --git a/modules/geom/src/composite3.hh b/modules/geom/src/composite3.hh index e780f8deb4d126042ae60e5ed41ee51d97f902d6..8e88050366915bac120bcaf5ccdf4c8d43164a5c 100644 --- a/modules/geom/src/composite3.hh +++ b/modules/geom/src/composite3.hh @@ -27,6 +27,7 @@ #include "mat3.hh" #include "quat.hh" +#include "module_config.hh" /* composite classes in 3D space @@ -47,7 +48,7 @@ private: Vec3 ori_,dir_; }; -std::ostream& operator<<(std::ostream& s, const Line3& l); +DLLEXPORT_OST_GEOM std::ostream& operator<<(std::ostream& s, const Line3& l); class DLLEXPORT_OST_GEOM Plane { public: @@ -80,7 +81,7 @@ private: Real p_; }; -class DLLEXPORT Sphere { +class DLLEXPORT_OST_GEOM Sphere { public: Sphere(); Sphere(const Vec3& origin, Real r); @@ -98,7 +99,7 @@ private: /// half extent /// /// \relates Cuboid -class DLLEXPORT CuboidAxis { +class DLLEXPORT_OST_GEOM CuboidAxis { public: CuboidAxis(): axis_(), half_extent_(0.0) { } @@ -112,7 +113,7 @@ private: }; /// \brief arbitrary oriented bounding cuboid -class DLLEXPORT Cuboid { +class DLLEXPORT_OST_GEOM Cuboid { public: Cuboid(); Cuboid(const Vec3& center, const CuboidAxis& a, @@ -140,7 +141,7 @@ private: CuboidAxis axes_[3]; }; -class DLLEXPORT Rotation3 +class DLLEXPORT_OST_GEOM Rotation3 { public: Rotation3(); @@ -184,8 +185,8 @@ private: typedef std::vector<Rotation3> Rotation3List; -DLLEXPORT Rotation3List ImportEulerAngles (const boost::filesystem::path& loc); -DLLEXPORT void ExportEulerAngles (const Rotation3List& rot_list, +DLLEXPORT_OST_GEOM Rotation3List ImportEulerAngles (const boost::filesystem::path& loc); +DLLEXPORT_OST_GEOM void ExportEulerAngles (const Rotation3List& rot_list, const boost::filesystem::path& loc); } // ns diff --git a/modules/geom/src/vecmat3_op.hh b/modules/geom/src/vecmat3_op.hh index 5489ea9e8f1c48f669053fafa45f14220b52384f..49d466081cb45b913dfb9b6ae2638f9a84030dcd 100644 --- a/modules/geom/src/vecmat3_op.hh +++ b/modules/geom/src/vecmat3_op.hh @@ -211,15 +211,15 @@ inline Real DistanceWithPBC(const Vec3& v1, const Vec3& v2, const Vec3& basis_ve return sqrt(Distance2WithPBC(v1, v2, basis_vec)); } //! returns the minimal distance between the points in two Vec3List -Real MinDistance(const Vec3List& l1, const Vec3List& l2); +DLLEXPORT_OST_GEOM Real MinDistance(const Vec3List& l1, const Vec3List& l2); //! returns the minimal distance between the points in two Vec3List // with periodic boundaries in x,y,z given in basis_vec -Real MinDistanceWithPBC(const Vec3List& l1, const Vec3List& l2, Vec3& basis_vec); +DLLEXPORT_OST_GEOM Real MinDistanceWithPBC(const Vec3List& l1, const Vec3List& l2, Vec3& basis_vec); //!wraps a vector in a box with periodic boundaries -Vec3 WrapVec3(const Vec3& v1,const Vec3& box_center,const Vec3& basis_vec); -//!wraps all the verctors in a Vec3List in a box with periodic boundaries -Vec3List WrapVec3List(const Vec3List& vl,const Vec3& box_center,const Vec3& basis_vec); +DLLEXPORT_OST_GEOM Vec3 WrapVec3(const Vec3& v1,const Vec3& box_center,const Vec3& basis_vec); +//!wraps all the vectors in a Vec3List in a box with periodic boundaries +DLLEXPORT_OST_GEOM Vec3List WrapVec3List(const Vec3List& vl,const Vec3& box_center,const Vec3& basis_vec); } // ns diff --git a/modules/mol/alg/src/filter_clashes.hh b/modules/mol/alg/src/filter_clashes.hh index 64ae81040ed83f0cf00bf5f8beff92979f25b67e..f9d7473b6ce1eb0d5044c6f46a4bebadc86bff83 100644 --- a/modules/mol/alg/src/filter_clashes.hh +++ b/modules/mol/alg/src/filter_clashes.hh @@ -25,7 +25,7 @@ namespace ost { namespace mol { namespace alg { /// \brief List of reference atom-atom distances to detect clashes between non-bonded atoms -class ClashingDistances +class DLLEXPORT_OST_MOL_ALG ClashingDistances { public: @@ -61,7 +61,7 @@ private: /// \brief List of stereo chemical parameters (Bonds and angles) /// /// For each item (bond or angle in a specific residue), stores the mean and standard deviation -class StereoChemicalParams +class DLLEXPORT_OST_MOL_ALG StereoChemicalParams { public: diff --git a/modules/mol/alg/src/local_dist_diff_test.hh b/modules/mol/alg/src/local_dist_diff_test.hh index ed6e10badd68fc0ba760350f1d7c1551428f2d79..9803f0a723d3c77ae8b1332ef5ab09e444ae5ff1 100644 --- a/modules/mol/alg/src/local_dist_diff_test.hh +++ b/modules/mol/alg/src/local_dist_diff_test.hh @@ -28,7 +28,7 @@ namespace ost { namespace mol { namespace alg { /// \brief Contains the infomation needed to uniquely identify an atom in a structure /// /// Used by the the Local Distance Difference Test classes and functions -class UniqueAtomIdentifier +class DLLEXPORT_OST_MOL_ALG UniqueAtomIdentifier { public: @@ -169,7 +169,7 @@ Real DLLEXPORT_OST_MOL_ALG LDDTHA(EntityView& v, const GlobalRDMap& global_dist_ /// \brief Creates a list of distances to check during a Local Difference Distance Test /// /// Requires a reference structure and an inclusion radius (max_dist) -GlobalRDMap CreateDistanceList(const EntityView& ref,Real max_dist); +GlobalRDMap DLLEXPORT_OST_MOL_ALG CreateDistanceList(const EntityView& ref,Real max_dist); /// \brief Creates a list of distances to check during a Local Difference Distance Test starting from multiple reference structures /// @@ -193,17 +193,17 @@ GlobalRDMap CreateDistanceList(const EntityView& ref,Real max_dist); /// must be passed to the function. These parameters do not influence the output distance list, which always includes all distances /// within the provided max_dist (to make it consistent with the single-reference corresponding function). However, the parameters are used when /// dealing with the naming convention of residues with ambiguous nomenclature. -GlobalRDMap CreateDistanceListFromMultipleReferences(const std::vector<EntityView>& ref_list,std::vector<Real>& cutoff_list, int sequence_separation, Real max_dist); +GlobalRDMap DLLEXPORT_OST_MOL_ALG CreateDistanceListFromMultipleReferences(const std::vector<EntityView>& ref_list,std::vector<Real>& cutoff_list, int sequence_separation, Real max_dist); /// \brief Prints all distances in a global distance list to standard output -void PrintGlobalRDMap(const GlobalRDMap& glob_dist_list); +void DLLEXPORT_OST_MOL_ALG PrintGlobalRDMap(const GlobalRDMap& glob_dist_list); /// \brief Prints all distances in a residue distance list to standard output -void PrintResidueRDMap(const ResidueRDMap& res_dist_list); +void DLLEXPORT_OST_MOL_ALG PrintResidueRDMap(const ResidueRDMap& res_dist_list); // required by some helper function. Cannot reuse similar functions in other modules without creating // circular dependencies -bool IsStandardResidue(String rn); +bool DLLEXPORT_OST_MOL_ALG IsStandardResidue(String rn); }}} diff --git a/modules/mol/base/src/chain_type.hh b/modules/mol/base/src/chain_type.hh index 18a00fb457cd4f49ba261aab3f2f74c11cb91508..4167280fc6a7a7b0b09376d6da0665532f2a1831 100644 --- a/modules/mol/base/src/chain_type.hh +++ b/modules/mol/base/src/chain_type.hh @@ -22,6 +22,8 @@ #include <ost/base.hh> #include <ost/string_ref.hh> +#include "module_config.hh" + namespace ost { namespace mol { /// \enum different kinds of chains @@ -46,7 +48,7 @@ typedef enum { /// /// \return The ChainType corresponding to the input, throws a /// std::runtime_error on unknown type -ChainType ChainTypeFromString(const StringRef identifier); +ChainType DLLEXPORT_OST_MOL ChainTypeFromString(const StringRef identifier); /// \brief Create a ChainType item for a given string /// @@ -54,7 +56,7 @@ ChainType ChainTypeFromString(const StringRef identifier); /// /// \return The ChainType corresponding to the input, throws a /// std::runtime_error on unknown type -ChainType ChainTypeFromString(const String& identifier); +ChainType DLLEXPORT_OST_MOL ChainTypeFromString(const String& identifier); /// \brief Return the String identifier for a given type /// @@ -62,7 +64,7 @@ ChainType ChainTypeFromString(const String& identifier); /// /// \return String corresponding to the input, throws a std::runtime_error on /// unknown type -String StringFromChainType(ChainType type); +String DLLEXPORT_OST_MOL StringFromChainType(ChainType type); }} //ns diff --git a/modules/mol/base/src/coord_frame.hh b/modules/mol/base/src/coord_frame.hh index ad76a5dc869d281775ca61fe0ce191fc6a4d8757..b7cce0661ef615db5799e0dfe287d0d0187cb74c 100644 --- a/modules/mol/base/src/coord_frame.hh +++ b/modules/mol/base/src/coord_frame.hh @@ -216,31 +216,31 @@ public: This function returns a vector containing the atom indices of the atoms in an EntityView; it is used to accelerate the extraction of information from a trajectory */ - void GetIndices(const EntityView& sele, std::vector<unsigned long>& indices); + DLLEXPORT_OST_MOL void GetIndices(const EntityView& sele, std::vector<unsigned long>& indices); /*! This function returns a vector containing the atom masses of the atoms in an EntityView; it is used together with GetIndices to accelerate the extraction of RMSD from a trajectory */ - void GetMasses(const EntityView& sele, std::vector<Real>& masses); + DLLEXPORT_OST_MOL void GetMasses(const EntityView& sele, std::vector<Real>& masses); //! conveniece for GetIndices and GetMasses in one call - void GetIndicesAndMasses(const EntityView& sele, - std::vector<unsigned long>& indices, - std::vector<Real>& masses); + DLLEXPORT_OST_MOL void GetIndicesAndMasses(const EntityView& sele, + std::vector<unsigned long>& indices, + std::vector<Real>& masses); //! Writes the positions of all atoms in the EntityView into the provided vec3 list - void GetPositions(const EntityView& sele, std::vector<geom::Vec3>& ref_pos); - + DLLEXPORT_OST_MOL void GetPositions(const EntityView& sele, std::vector<geom::Vec3>& ref_pos); + //! Writes the indices of all atoms in the EntityView into the provided list - void GetCaIndices(const EntityView& segment, std::vector<unsigned long>& indices_ca); - + DLLEXPORT_OST_MOL void GetCaIndices(const EntityView& segment, std::vector<unsigned long>& indices_ca); + //! Writes the backbone indices of all residues in the EntityView into the provided list - void GetCaCONIndices(const EntityView& segment, - std::vector<unsigned long>& indices_ca, - std::vector<unsigned long>& indices_c, - std::vector<unsigned long>& indices_o, - std::vector<unsigned long>& indices_n); + DLLEXPORT_OST_MOL void GetCaCONIndices(const EntityView& segment, + std::vector<unsigned long>& indices_ca, + std::vector<unsigned long>& indices_c, + std::vector<unsigned long>& indices_o, + std::vector<unsigned long>& indices_n); }}