diff --git a/.gitignore b/.gitignore index 10e34cdaf..76cedbce3 100644 --- a/.gitignore +++ b/.gitignore @@ -36,6 +36,7 @@ __pycache__/ /Code/RDBoost/test.h /Code/RDGeneral/RDConfig.h /Code/RDGeneral/export.h +/Code/RDGeneral/test.h /Code/RDGeneral/versions.h /Code/RDGeneral/versions.cpp diff --git a/Code/ForceField/MMFF/AngleConstraint.h b/Code/ForceField/MMFF/AngleConstraint.h index abb4a599b..e0e6ebd1b 100644 --- a/Code/ForceField/MMFF/AngleConstraint.h +++ b/Code/ForceField/MMFF/AngleConstraint.h @@ -19,10 +19,10 @@ namespace ForceFields { namespace MMFF { //! An angle range constraint modelled after a AngleBendContrib -class RDKIT_FORCEFIELD_EXPORT RDKIT_FORCEFIELD_EXPORT AngleConstraintContrib +class RDKIT_FORCEFIELD_EXPORT AngleConstraintContrib : public ForceFieldContrib { public: - AngleConstraintContrib() {}; + AngleConstraintContrib(){}; //! Constructor /*! \param owner pointer to the owning ForceField @@ -53,7 +53,8 @@ class RDKIT_FORCEFIELD_EXPORT RDKIT_FORCEFIELD_EXPORT AngleConstraintContrib }; private: - int d_at1Idx{-1}, d_at2Idx{-1}, d_at3Idx{-1}; //!< indices of atoms forming the angle + int d_at1Idx{-1}, d_at2Idx{-1}, + d_at3Idx{-1}; //!< indices of atoms forming the angle double d_minAngleDeg, d_maxAngleDeg; //!< rest amplitudes of the angle double d_forceConstant; //!< force constant of the angle constraint }; diff --git a/Code/ForceField/MMFF/TorsionAngle.h b/Code/ForceField/MMFF/TorsionAngle.h index 18e60a151..24ad925c7 100644 --- a/Code/ForceField/MMFF/TorsionAngle.h +++ b/Code/ForceField/MMFF/TorsionAngle.h @@ -25,11 +25,9 @@ namespace MMFF { class MMFFTor; //! the torsion term for MMFF -class RDKIT_FORCEFIELD_EXPORT RDKIT_FORCEFIELD_EXPORT TorsionAngleContrib - : public ForceFieldContrib { +class RDKIT_FORCEFIELD_EXPORT TorsionAngleContrib : public ForceFieldContrib { public: - TorsionAngleContrib() - {}; + TorsionAngleContrib(){}; //! Constructor /*! The torsion is between atom1 - atom2 - atom3 - atom4 diff --git a/Code/ForceField/MMFF/TorsionConstraint.h b/Code/ForceField/MMFF/TorsionConstraint.h index 5366474a7..cf4acc3b1 100644 --- a/Code/ForceField/MMFF/TorsionConstraint.h +++ b/Code/ForceField/MMFF/TorsionConstraint.h @@ -19,11 +19,10 @@ namespace ForceFields { namespace MMFF { //! A dihedral angle range constraint modelled after a TorsionContrib -class RDKIT_FORCEFIELD_EXPORT RDKIT_FORCEFIELD_EXPORT TorsionConstraintContrib +class RDKIT_FORCEFIELD_EXPORT TorsionConstraintContrib : public ForceFieldContrib { public: - TorsionConstraintContrib() - {}; + TorsionConstraintContrib(){}; //! Constructor /*! \param owner pointer to the owning ForceField @@ -55,9 +54,10 @@ class RDKIT_FORCEFIELD_EXPORT RDKIT_FORCEFIELD_EXPORT TorsionConstraintContrib }; private: - void setParameters(ForceField *owner, unsigned int idx1, - unsigned int idx2, unsigned int idx3, unsigned int idx4, - double minDihedralDeg, double maxDihedralDeg, double forceConst); + void setParameters(ForceField *owner, unsigned int idx1, unsigned int idx2, + unsigned int idx3, unsigned int idx4, + double minDihedralDeg, double maxDihedralDeg, + double forceConst); double computeDihedralTerm(double dihedral) const; int d_at1Idx{-1}, d_at2Idx{-1}, d_at3Idx{-1}, d_at4Idx{-1}; //!< indices of atoms forming the dihedral angle diff --git a/Code/GraphMol/Abbreviations/Abbreviations.h b/Code/GraphMol/Abbreviations/Abbreviations.h index 4d4f33ac7..3accb5862 100644 --- a/Code/GraphMol/Abbreviations/Abbreviations.h +++ b/Code/GraphMol/Abbreviations/Abbreviations.h @@ -19,7 +19,7 @@ class ROMol; class RWMol; namespace Abbreviations { -RDKIT_ABBREVIATIONS_EXPORT struct AbbreviationDefinition { +struct RDKIT_ABBREVIATIONS_EXPORT AbbreviationDefinition { std::string label; std::string displayLabel; std::string displayLabelW; @@ -34,7 +34,7 @@ RDKIT_ABBREVIATIONS_EXPORT struct AbbreviationDefinition { return !(*this == other); } }; -RDKIT_ABBREVIATIONS_EXPORT struct AbbreviationMatch { +struct RDKIT_ABBREVIATIONS_EXPORT AbbreviationMatch { std::vector> match; AbbreviationDefinition abbrev; AbbreviationMatch(const std::vector>& matchArg, diff --git a/Code/GraphMol/CIPLabeler/CMakeLists.txt b/Code/GraphMol/CIPLabeler/CMakeLists.txt index 15c530c63..6a6ed85ae 100644 --- a/Code/GraphMol/CIPLabeler/CMakeLists.txt +++ b/Code/GraphMol/CIPLabeler/CMakeLists.txt @@ -25,6 +25,7 @@ rdkit_library(CIPLabeler target_compile_definitions(CIPLabeler PRIVATE RDKIT_CIPLABELER_BUILD) rdkit_headers(CIPLabeler.h + TooManyNodesException.h DEST CIPLabeler) rdkit_catch_test(testCIPLabeler catch_tests.cpp @@ -33,15 +34,13 @@ rdkit_catch_test(testCIPLabeler catch_tests.cpp ${configs_src} ${rules_src} LINK_LIBRARIES SmilesParse GraphMol) +# Set the BUILD macro to keep dll linkage consistency, since, in order +# to test private, unexported functions, we are building the test from +# sources, and NOT linking to the lib. +if(RDK_BUILD_CPP_TESTS) + target_compile_definitions(testCIPLabeler PRIVATE RDKIT_CIPLABELER_BUILD) +endif() + if(RDK_BUILD_PYTHON_WRAPPERS) add_subdirectory(Wrap) endif() - - - - - - - - - diff --git a/Code/GraphMol/CIPLabeler/TooManyNodesException.h b/Code/GraphMol/CIPLabeler/TooManyNodesException.h index c684232cd..d7b989d6a 100644 --- a/Code/GraphMol/CIPLabeler/TooManyNodesException.h +++ b/Code/GraphMol/CIPLabeler/TooManyNodesException.h @@ -13,13 +13,16 @@ #include #include +#include + namespace RDKit { namespace CIPLabeler { -class TooManyNodesException : public std::runtime_error { -public: +class RDKIT_CIPLABELER_EXPORT TooManyNodesException + : public std::runtime_error { + public: TooManyNodesException(const std::string &msg) : std::runtime_error(msg){}; }; -} // namespace CIPLabeler -} // namespace RDKit \ No newline at end of file +} // namespace CIPLabeler +} // namespace RDKit \ No newline at end of file diff --git a/Code/GraphMol/FileParsers/FileParsers.h b/Code/GraphMol/FileParsers/FileParsers.h index 1818df051..98e7bc08e 100644 --- a/Code/GraphMol/FileParsers/FileParsers.h +++ b/Code/GraphMol/FileParsers/FileParsers.h @@ -25,7 +25,8 @@ namespace RDKit { const int MOLFILE_MAXLINE = 256; RDKIT_FILEPARSERS_EXPORT std::string strip(const std::string &orig); -class MolFileUnhandledFeatureException : public std::exception { +class RDKIT_FILEPARSERS_EXPORT MolFileUnhandledFeatureException + : public std::exception { public: //! construct with an error message explicit MolFileUnhandledFeatureException(const char *msg) : _msg(msg){}; diff --git a/Code/GraphMol/FileParsers/MolSGroupParsing.h b/Code/GraphMol/FileParsers/MolSGroupParsing.h index dd32688b2..2e94ceb28 100644 --- a/Code/GraphMol/FileParsers/MolSGroupParsing.h +++ b/Code/GraphMol/FileParsers/MolSGroupParsing.h @@ -129,7 +129,8 @@ void ParseSGroupV2000SBTLine(IDX_TO_SGROUP_MAP &sGroupMap, RWMol *mol, /* ------------------ V3000 Utils ------------------ */ template -std::vector ParseV3000Array(std::stringstream &stream); +RDKIT_FILEPARSERS_EXPORT std::vector ParseV3000Array( + std::stringstream &stream); #if defined(WIN32) && defined(RDKIT_DYN_LINK) template RDKIT_FILEPARSERS_EXPORT std::vector ParseV3000Array( std::stringstream &); diff --git a/Code/JavaWrappers/GenericRDKitException.h b/Code/JavaWrappers/GenericRDKitException.h index eeea379d1..c54ce08df 100644 --- a/Code/JavaWrappers/GenericRDKitException.h +++ b/Code/JavaWrappers/GenericRDKitException.h @@ -11,10 +11,11 @@ #include #include +#include namespace RDKit { -class GenericRDKitException : public std::exception { +class RDKIT_RDGENERAL_EXPORT GenericRDKitException : public std::exception { public: GenericRDKitException(const std::string &i) : _value(i){}; GenericRDKitException(const char *msg) : _value(msg){}; diff --git a/Code/JavaWrappers/csharp_wrapper/GraphMolCSharp.i b/Code/JavaWrappers/csharp_wrapper/GraphMolCSharp.i index 57d3a8ad2..0ba9881f2 100644 --- a/Code/JavaWrappers/csharp_wrapper/GraphMolCSharp.i +++ b/Code/JavaWrappers/csharp_wrapper/GraphMolCSharp.i @@ -70,6 +70,7 @@ %include /* undefine RDKIT__EXPORT macros */ +%include %include /* Include the base types before anything that will utilize them */ #ifdef SWIGWIN diff --git a/Code/JavaWrappers/gmwrapper/GraphMolJava.i b/Code/JavaWrappers/gmwrapper/GraphMolJava.i index 302fb6e29..cb69e653a 100644 --- a/Code/JavaWrappers/gmwrapper/GraphMolJava.i +++ b/Code/JavaWrappers/gmwrapper/GraphMolJava.i @@ -69,6 +69,7 @@ %include /* undefine RDKIT__EXPORT macros */ +%include %include /* Include the base types before anything that will utilize them */ #ifdef SWIGWIN diff --git a/Code/Query/AndQuery.h b/Code/Query/AndQuery.h index 7e8daf01c..c613a4cef 100644 --- a/Code/Query/AndQuery.h +++ b/Code/Query/AndQuery.h @@ -18,7 +18,7 @@ namespace Queries { //! a Query implementing AND: requires all children to be \c true template -class AndQuery +class RDKIT_QUERY_EXPORT AndQuery : public Query { public: typedef Query BASE; diff --git a/Code/Query/EqualityQuery.h b/Code/Query/EqualityQuery.h index 1bca660fd..42caa58b1 100644 --- a/Code/Query/EqualityQuery.h +++ b/Code/Query/EqualityQuery.h @@ -20,7 +20,7 @@ namespace Queries { template -class EqualityQuery +class RDKIT_QUERY_EXPORT EqualityQuery : public Query { public: EqualityQuery() { this->df_negate = false; }; diff --git a/Code/Query/GreaterEqualQuery.h b/Code/Query/GreaterEqualQuery.h index 9145f7d1f..fa537d5fb 100644 --- a/Code/Query/GreaterEqualQuery.h +++ b/Code/Query/GreaterEqualQuery.h @@ -18,7 +18,7 @@ namespace Queries { //! value (and an optional tolerance) template -class GreaterEqualQuery +class RDKIT_QUERY_EXPORT GreaterEqualQuery : public EqualityQuery { public: GreaterEqualQuery() { this->d_tol = 0; }; diff --git a/Code/Query/GreaterQuery.h b/Code/Query/GreaterQuery.h index 51352675e..3f34b172d 100644 --- a/Code/Query/GreaterQuery.h +++ b/Code/Query/GreaterQuery.h @@ -18,7 +18,7 @@ namespace Queries { //! value (and an optional tolerance) template -class GreaterQuery +class RDKIT_QUERY_EXPORT GreaterQuery : public EqualityQuery { public: GreaterQuery() { this->d_tol = 0; }; diff --git a/Code/Query/LessEqualQuery.h b/Code/Query/LessEqualQuery.h index 9c11fc3fd..a61e3c38a 100644 --- a/Code/Query/LessEqualQuery.h +++ b/Code/Query/LessEqualQuery.h @@ -18,7 +18,7 @@ namespace Queries { //! value (and an optional tolerance) template -class LessEqualQuery +class RDKIT_QUERY_EXPORT LessEqualQuery : public EqualityQuery { public: LessEqualQuery() { this->d_tol = 0; }; diff --git a/Code/Query/LessQuery.h b/Code/Query/LessQuery.h index 05ba453c2..a9ac24e6f 100644 --- a/Code/Query/LessQuery.h +++ b/Code/Query/LessQuery.h @@ -18,7 +18,7 @@ namespace Queries { //! value (and an optional tolerance) template -class LessQuery +class RDKIT_QUERY_EXPORT LessQuery : public EqualityQuery { public: LessQuery() { this->d_tol = 0; }; diff --git a/Code/Query/OrQuery.h b/Code/Query/OrQuery.h index 81bfad9dd..1f546c351 100644 --- a/Code/Query/OrQuery.h +++ b/Code/Query/OrQuery.h @@ -17,7 +17,7 @@ namespace Queries { //! a Query implementing AND: requires any child to be \c true template -class OrQuery +class RDKIT_QUERY_EXPORT OrQuery : public Query { public: typedef Query BASE; diff --git a/Code/Query/Query.h b/Code/Query/Query.h index 746a10889..c9c87c213 100644 --- a/Code/Query/Query.h +++ b/Code/Query/Query.h @@ -42,7 +42,7 @@ class Int2Type { */ template -class Query { +class RDKIT_QUERY_EXPORT Query { public: typedef std::shared_ptr< Query> diff --git a/Code/Query/RangeQuery.h b/Code/Query/RangeQuery.h index 3ab573f48..fa6c99749 100644 --- a/Code/Query/RangeQuery.h +++ b/Code/Query/RangeQuery.h @@ -24,7 +24,7 @@ namespace Queries { //! There is also an optional tolerance to be used in comparisons template -class RangeQuery +class RDKIT_QUERY_EXPORT RangeQuery : public Query { public: RangeQuery() : d_upper(0), d_lower(0) { this->df_negate = false; }; diff --git a/Code/Query/SetQuery.h b/Code/Query/SetQuery.h index 270d74cc7..d81c46f27 100644 --- a/Code/Query/SetQuery.h +++ b/Code/Query/SetQuery.h @@ -22,7 +22,7 @@ namespace Queries { //! template -class SetQuery +class RDKIT_QUERY_EXPORT SetQuery : public Query { public: typedef std::set CONTAINER_TYPE; diff --git a/Code/Query/XOrQuery.h b/Code/Query/XOrQuery.h index 6f295ef23..2bbad55bf 100644 --- a/Code/Query/XOrQuery.h +++ b/Code/Query/XOrQuery.h @@ -18,7 +18,7 @@ namespace Queries { //! a Query implementing XOR: requires exactly one child to be \c true template -class XOrQuery +class RDKIT_QUERY_EXPORT XOrQuery : public Query { public: typedef Query BASE; diff --git a/Code/RDGeneral/BadFileException.h b/Code/RDGeneral/BadFileException.h index 3d3f09611..cfe8e862f 100644 --- a/Code/RDGeneral/BadFileException.h +++ b/Code/RDGeneral/BadFileException.h @@ -18,7 +18,7 @@ namespace RDKit { //! used by various file parsing classes to indicate a bad file -class BadFileException : public std::runtime_error { +class RDKIT_RDGENERAL_EXPORT BadFileException : public std::runtime_error { public: //! construct with an error message explicit BadFileException(const char *msg) diff --git a/Code/RDGeneral/CMakeLists.txt b/Code/RDGeneral/CMakeLists.txt index 6ab589fcc..054e82c8b 100644 --- a/Code/RDGeneral/CMakeLists.txt +++ b/Code/RDGeneral/CMakeLists.txt @@ -7,7 +7,7 @@ CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/RDConfig.h.cmake rdkit_library(RDGeneral - Invariant.cpp types.cpp utils.cpp RDLog.cpp + Invariant.cpp types.cpp utils.cpp RDGeneralExceptions.cpp RDLog.cpp LocaleSwitcher.cpp versions.cpp SHARED) target_compile_definitions(RDGeneral PRIVATE RDKIT_RDGENERAL_BUILD) @@ -62,6 +62,7 @@ rdkit_headers(Exceptions.h LocaleSwitcher.h Ranking.h hanoiSort.h + RDExportMacros.h export.h test.h ConcurrentQueue.h diff --git a/Code/RDGeneral/Exceptions.h b/Code/RDGeneral/Exceptions.h index c1140ca0c..c8f78c72e 100644 --- a/Code/RDGeneral/Exceptions.h +++ b/Code/RDGeneral/Exceptions.h @@ -16,7 +16,7 @@ //! \brief Class to allow us to throw an \c IndexError from C++ and have //! it make it back to Python //! -class IndexErrorException : public std::runtime_error { +class RDKIT_RDGENERAL_EXPORT IndexErrorException : public std::runtime_error { public: IndexErrorException(int i) : std::runtime_error("IndexErrorException"), @@ -36,7 +36,7 @@ class IndexErrorException : public std::runtime_error { //! \brief Class to allow us to throw a \c ValueError from C++ and have //! it make it back to Python //! -class ValueErrorException : public std::runtime_error { +class RDKIT_RDGENERAL_EXPORT ValueErrorException : public std::runtime_error { public: ValueErrorException(const std::string& i) : std::runtime_error("ValueErrorException"), _value(i){}; @@ -52,7 +52,7 @@ class ValueErrorException : public std::runtime_error { //! \brief Class to allow us to throw a \c KeyError from C++ and have //! it make it back to Python //! -class KeyErrorException : public std::runtime_error { +class RDKIT_RDGENERAL_EXPORT KeyErrorException : public std::runtime_error { public: KeyErrorException(std::string key) : std::runtime_error("KeyErrorException"), diff --git a/Code/RDGeneral/FileParseException.h b/Code/RDGeneral/FileParseException.h index 4c8267a7c..ffb96c607 100644 --- a/Code/RDGeneral/FileParseException.h +++ b/Code/RDGeneral/FileParseException.h @@ -16,7 +16,7 @@ namespace RDKit { //! used by various file parsing classes to indicate a parse error -class FileParseException : public std::runtime_error { +class RDKIT_RDGENERAL_EXPORT FileParseException : public std::runtime_error { public: //! construct with an error message explicit FileParseException(const char *msg) diff --git a/Code/RDGeneral/RDExportMacros.h b/Code/RDGeneral/RDExportMacros.h new file mode 100644 index 000000000..cd1db48ff --- /dev/null +++ b/Code/RDGeneral/RDExportMacros.h @@ -0,0 +1,40 @@ +// +// Copyright (C) 2021 Schrödinger, LLC +// +// @@ All Rights Reserved @@ +// This file is part of the RDKit. +// The contents are covered by the terms of the BSD license +// which is included in the file license.txt, found at the root +// of the RDKit source tree. +// + +#pragma once + +#ifndef SWIG +#ifdef _MSC_VER +#pragma warning(disable : 4251) +#pragma warning(disable : 4275) +#endif + +#include + +// RDKit export macro definitions +#ifdef RDKIT_DYN_LINK +#if defined( WIN32 ) && defined( _MSC_VER ) && defined( BOOST_HAS_DECLSPEC ) +#define RDKIT_EXPORT_API __declspec(dllexport) +#define RDKIT_IMPORT_API __declspec(dllimport) +#elif __GNUC__ >= 4 || defined( __clang__ ) +#define RDKIT_EXPORT_API __attribute__((visibility("default"))) +#define RDKIT_IMPORT_API __attribute__((visibility("default"))) +#endif // WIN32 +#endif // RDKIT_DYN_LINK +// RDKit end export macro definitions + +#endif // SWIG + +#ifndef RDKIT_EXPORT_API +#define RDKIT_EXPORT_API +#endif +#ifndef RDKIT_IMPORT_API +#define RDKIT_IMPORT_API +#endif \ No newline at end of file diff --git a/Code/RDGeneral/RDGeneralExceptions.cpp b/Code/RDGeneral/RDGeneralExceptions.cpp new file mode 100644 index 000000000..f5f71a7ea --- /dev/null +++ b/Code/RDGeneral/RDGeneralExceptions.cpp @@ -0,0 +1,18 @@ +// +// Copyright (C) 2021 Schrödinger, LLC +// +// @@ All Rights Reserved @@ +// This file is part of the RDKit. +// The contents are covered by the terms of the BSD license +// which is included in the file license.txt, found at the root +// of the RDKit source tree. +// + +/* + * This file is just to make sure exceptions in this directory + * get built into the library. + */ + +#include "BadFileException.h" +#include "Exceptions.h" +#include "FileParseException.h" diff --git a/Code/cmake/Modules/RDKitUtils.cmake b/Code/cmake/Modules/RDKitUtils.cmake index f67d36aec..d7f880425 100644 --- a/Code/cmake/Modules/RDKitUtils.cmake +++ b/Code/cmake/Modules/RDKitUtils.cmake @@ -243,16 +243,9 @@ function(createExportTestHeaders) list(SORT exportLibs) set(exportPath "Code/RDGeneral/export.h") file(WRITE "${CMAKE_BINARY_DIR}/${exportPath}.tmp" - "// auto-generated __declspec definition header\n" + "// auto-generated export definition header\n" "#pragma once\n" - "#ifndef SWIG\n" - "#ifdef _MSC_VER\n" - "#pragma warning(disable:4251)\n" - "#pragma warning(disable:4275)\n" - "#endif\n" - "\n" - "#include \n" - "#endif\n") + "#include \n") set(testPath "Code/RDGeneral/test.h") file(WRITE "${CMAKE_BINARY_DIR}/${testPath}.tmp" "// auto-generated header to be imported in all cpp tests\n" @@ -262,15 +255,10 @@ function(createExportTestHeaders) file(APPEND "${CMAKE_BINARY_DIR}/${exportPath}.tmp" "\n" "// RDKIT_${exportLib}_EXPORT definitions\n" - "#if defined(BOOST_HAS_DECLSPEC) && defined(RDKIT_DYN_LINK) && !defined(SWIG)\n" "#ifdef RDKIT_${exportLib}_BUILD\n" - "#define RDKIT_${exportLib}_EXPORT __declspec(dllexport)\n" + "#define RDKIT_${exportLib}_EXPORT RDKIT_EXPORT_API\n" "#else\n" - "#define RDKIT_${exportLib}_EXPORT __declspec(dllimport)\n" - "#endif\n" - "#endif\n" - "#ifndef RDKIT_${exportLib}_EXPORT\n" - "#define RDKIT_${exportLib}_EXPORT\n" + "#define RDKIT_${exportLib}_EXPORT RDKIT_IMPORT_API\n" "#endif\n" "// RDKIT_${exportLib}_EXPORT end definitions\n") file(APPEND "${CMAKE_BINARY_DIR}/${testPath}.tmp" @@ -279,6 +267,19 @@ function(createExportTestHeaders) "#undef RDKIT_${exportLib}_BUILD\n" "#endif\n") endforeach() + file(APPEND "${CMAKE_BINARY_DIR}/${exportPath}.tmp" + "\n" + "/*\n" + " * Do not dll export/import to export queries (it will mess up with the\n" + " * templates), but make sure it is visible for *nix\n" + " */\n" + "// RDKIT_QUERY_EXPORT definitions\n" + "#if defined(RDKIT_DYN_LINK) && defined(WIN32) && defined(_MSC_VER) && defined(BOOST_HAS_DECLSPEC)\n" + "#define RDKIT_QUERY_EXPORT\n" + "#else\n" + "#define RDKIT_QUERY_EXPORT RDKIT_GRAPHMOL_EXPORT\n" + "#endif\n" + "// RDKIT_QUERY_EXPORT end definitions\n") execute_process(COMMAND ${CMAKE_COMMAND} -E copy_if_different "${CMAKE_BINARY_DIR}/${exportPath}.tmp" "${CMAKE_SOURCE_DIR}/${exportPath}") execute_process(COMMAND ${CMAKE_COMMAND} -E copy_if_different diff --git a/Contrib/ConformerParser/CMakeLists.txt b/Contrib/ConformerParser/CMakeLists.txt index b7dd84585..0a3b4f9cc 100644 --- a/Contrib/ConformerParser/CMakeLists.txt +++ b/Contrib/ConformerParser/CMakeLists.txt @@ -1,10 +1,10 @@ rdkit_library(ConformerParser ConformerParser.cpp LINK_LIBRARIES GraphMol) +target_compile_definitions(SmilesParse PRIVATE RDKIT_CONFORMERPARSER_BUILD) -rdkit_test(testConformerParser test.cpp - LINK_LIBRARIES ConformerParser -FileParsers SmilesParse -GraphMol RDGeometryLib RDGeneral) +rdkit_test(testConformerParser test.cpp + LINK_LIBRARIES ConformerParser FileParsers SmilesParse + GraphMol RDGeometryLib RDGeneral) if(RDK_BUILD_PYTHON_WRAPPERS) add_subdirectory(Wrap) diff --git a/Contrib/ConformerParser/ConformerParser.h b/Contrib/ConformerParser/ConformerParser.h index c0dd63031..7c8f6e154 100644 --- a/Contrib/ConformerParser/ConformerParser.h +++ b/Contrib/ConformerParser/ConformerParser.h @@ -15,7 +15,8 @@ // with the distribution. // * Neither the name of Novartis Institutes for BioMedical Research Inc. // nor the names of its contributors may be used to endorse or promote -// products derived from this software without specific prior written permission. +// products derived from this software without specific prior written +// permission. // // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT @@ -40,7 +41,7 @@ #include -namespace RDKit{ +namespace RDKit { class ROMol; class Conformer; namespace ConformerParser { @@ -54,8 +55,9 @@ namespace ConformerParser { Returns: integer vector with confIds */ -INT_VECT addConformersFromList(ROMol &mol, const std::vector > &coords, - int numConf=-1); +RDKIT_CONFORMERPARSER_EXPORT INT_VECT addConformersFromList( + ROMol &mol, const std::vector> &coords, + int numConf = -1); /*! Converts an Amber trajectory into a list of doubles @@ -64,10 +66,11 @@ INT_VECT addConformersFromList(ROMol &mol, const std::vector \param coords list with coordinates */ -void readAmberTrajectory(const std::string &fName, std::vector > &coords, - unsigned int numAtoms); +RDKIT_CONFORMERPARSER_EXPORT void readAmberTrajectory( + const std::string &fName, std::vector> &coords, + unsigned int numAtoms); -} // end namespace ConformerParser -} // end namespace RDKit +} // end namespace ConformerParser +} // end namespace RDKit #endif diff --git a/External/GA/util/export.h b/External/GA/util/export.h index 772a70f6d..6405410e1 100644 --- a/External/GA/util/export.h +++ b/External/GA/util/export.h @@ -9,20 +9,7 @@ // #pragma once -#ifndef SWIG -# ifdef _MSC_VER -# pragma warning(disable : 4251) -# pragma warning(disable : 4275) -# endif - -# include -#endif - -#if defined(BOOST_HAS_DECLSPEC) && defined(RDKIT_DYN_LINK) && !defined(SWIG) -# define GA_EXPORT __declspec(dllexport) -#endif -#ifndef GA_EXPORT -# define GA_EXPORT -#endif +#include +#define GA_EXPORT RDKIT_EXPORT_API diff --git a/External/RingFamilies/CMakeLists.txt b/External/RingFamilies/CMakeLists.txt index 1ea8eb1d7..2ec52d3f4 100644 --- a/External/RingFamilies/CMakeLists.txt +++ b/External/RingFamilies/CMakeLists.txt @@ -28,8 +28,8 @@ file(GLOB URFSOURCES "${URFLIB_DIR}/*.c") if((MSVC AND RDK_INSTALL_DLLS_MSVC) OR ((NOT MSVC) AND WIN32)) set (ringdecomposerlib_h ${URFLIB_DIR}/RingDecomposerLib.h) file(READ ${ringdecomposerlib_h} ringdecomposerlib_h_data) - if (NOT "${ringdecomposerlib_h_data}" STREQUAL "RDKIT_URFLIB_BUILD") - string(REGEX REPLACE "([ ]*)(#define[ ]+RDL_API[ ]+__declspec)(\\([ ]*dllexport[ ]*\\))" "\\1#ifdef RDKIT_URFLIB_BUILD\n\\1\\2\\3\n\\1#else\n\\1\\2(dllimport)\n\\1#endif" ringdecomposerlib_h_data "${ringdecomposerlib_h_data}") + if (NOT "${ringdecomposerlib_h_data}" MATCHES "RDKIT_URFLIB_BUILD") + string(REGEX REPLACE "([ ]*)(#define[ ]+RDL_API[ ]+__declspec)(\\([ ]*dllexport[ ]*\\))" "\\1#ifdef RDKIT_URFLIB_BUILD\n\\1\\1\\2\\3\n\\1#else\n\\1\\1\\2(dllimport)\n\\1#endif" ringdecomposerlib_h_data "${ringdecomposerlib_h_data}") file(WRITE ${ringdecomposerlib_h} "${ringdecomposerlib_h_data}") endif() endif()