make ringdecomposerlib a mandatory dependency (#9209)

This commit is contained in:
Ricardo Rodriguez
2026-03-27 18:17:27 +01:00
committed by GitHub
parent 1657b788e9
commit f3dd424d28
16 changed files with 14 additions and 60 deletions

View File

@@ -12,11 +12,10 @@ rdkit_library(GraphMol
SHARED
LINK_LIBRARIES RDGeometryLib RDGeneral)
target_compile_definitions(GraphMol PRIVATE RDKIT_GRAPHMOL_BUILD)
if (RDK_USE_URF)
target_link_libraries(GraphMol PUBLIC ${RDK_URF_LIBS})
if (RDK_INSTALL_STATIC_LIBS AND NOT RDK_BUILD_STATIC_LIBS_ONLY)
target_link_libraries(GraphMol PUBLIC ${RDK_URF_LIBS})
if (RDK_INSTALL_STATIC_LIBS AND NOT RDK_BUILD_STATIC_LIBS_ONLY)
target_link_libraries(GraphMol_static PUBLIC ${RDK_URF_LIBS}_static)
endif ()
endif ()
rdkit_headers(Atom.h

View File

@@ -1157,7 +1157,6 @@ void fastFindRings(const ROMol &mol) {
FindRings::storeRingsInfo(mol, res);
}
#ifdef RDK_USE_URF
void findRingFamilies(const ROMol &mol, bool includeDativeBonds,
bool includeHydrogenBonds) {
if (mol.getRingInfo()->isInitialized()) {
@@ -1214,13 +1213,6 @@ void findRingFamilies(const ROMol &mol, bool includeDativeBonds,
free(edges);
}
}
#else
void findRingFamilies(const ROMol &mol, bool includeDativeBonds,
bool includeHydrogenBonds) {
BOOST_LOG(rdErrorLog)
<< "This version of the RDKit was built without URF support" << std::endl;
}
#endif
} // namespace MolOps
} // namespace RDKit

View File

@@ -267,7 +267,6 @@ void RingInfo::initFusedRings() {
}
}
#ifdef RDK_USE_URF
unsigned int RingInfo::numRingFamilies() const {
PRECONDITION(df_init, "RingInfo not initialized");
return d_atomRingFamilies.size();
@@ -288,7 +287,6 @@ unsigned int RingInfo::addRingFamily(const INT_VECT &atomIndices,
return rdcast<unsigned int>(d_atomRingFamilies.size());
}
#endif
void RingInfo::initialize(RDKit::FIND_RING_TYPE ringType) {
df_init = true;
@@ -304,10 +302,9 @@ void RingInfo::reset() {
d_bondMembers.clear();
d_atomRings.clear();
d_bondRings.clear();
#ifdef RDK_USE_URF
d_atomRingFamilies.clear();
d_bondRingFamilies.clear();
#endif
}
void RingInfo::preallocate(unsigned int numAtoms, unsigned int numBonds) {
d_atomMembers.resize(numAtoms);

View File

@@ -15,13 +15,9 @@
#include <vector>
#include <RDGeneral/BoostStartInclude.h>
#include <boost/dynamic_bitset.hpp>
#ifdef RDK_USE_URF
#include <boost/shared_ptr.hpp>
#endif
#include <RDGeneral/BoostEndInclude.h>
#ifdef RDK_USE_URF
#include <RingDecomposerLib.h>
#endif
namespace RDKit {
//! A class to store information about a molecule's rings
@@ -270,7 +266,6 @@ class RDKIT_GRAPHMOL_EXPORT RingInfo {
*/
std::vector<unsigned int> fusedRingNeighbors(unsigned int ringIdx);
#ifdef RDK_USE_URF
//! adds a ring family to our data
/*!
\param atomIndices the integer indices of the atoms involved in the
@@ -317,7 +312,6 @@ class RDKIT_GRAPHMOL_EXPORT RingInfo {
//! check if the ring families have been initialized
bool areRingFamiliesInitialized() const { return dp_urfData != nullptr; }
#endif
//! @}
@@ -333,10 +327,8 @@ class RDKIT_GRAPHMOL_EXPORT RingInfo {
std::vector<boost::dynamic_bitset<>> d_fusedRings;
std::vector<unsigned int> d_numFusedBonds;
#ifdef RDK_USE_URF
public:
boost::shared_ptr<RDL_data> dp_urfData;
#endif
};
} // namespace RDKit

View File

@@ -1322,7 +1322,6 @@ struct molops_wrapper {
python::def("FastFindRings", MolOps::fastFindRings, docString.c_str(),
python::args("mol"));
#ifdef RDK_USE_URF
docString =
"Generate Unique Ring Families.\n\
\n\
@@ -1338,7 +1337,6 @@ struct molops_wrapper {
(python::args("mol"), python::arg("includeDativeBonds") = false,
python::arg("includeHydrogenBonds") = false),
docString.c_str());
#endif
// ------------------------------------------------------------------------
docString = R"DOC(Parameters controlling H addition.)DOC";

View File

@@ -46,7 +46,6 @@ python::object bondRingSizes(const RingInfo *self, unsigned int idx) {
return python::tuple(self->bondRingSizes(idx));
}
#ifdef RDK_USE_URF
python::object atomRingFamilies(const RingInfo *self) {
python::list res;
for (const auto &ring : self->atomRingFamilies()) {
@@ -61,7 +60,6 @@ python::object bondRingFamilies(const RingInfo *self) {
}
return python::tuple(res);
}
#endif
void addRing(RingInfo *self, python::object atomRing, python::object bondRing) {
unsigned int nAts = boost::python::len(atomRing);
@@ -121,7 +119,6 @@ struct ringinfo_wrapper {
.def("BondMembers", bondMembers, python::args("self", "idx"))
.def("AtomRingSizes", atomRingSizes, python::args("self", "idx"))
.def("BondRingSizes", bondRingSizes, python::args("self", "idx"))
#ifdef RDK_USE_URF
.def("NumRingFamilies", &RingInfo::numRingFamilies,
python::args("self"))
.def("NumRelevantCycles", &RingInfo::numRelevantCycles,
@@ -130,7 +127,6 @@ struct ringinfo_wrapper {
.def("BondRingFamilies", bondRingFamilies, python::args("self"))
.def("AreRingFamiliesInitialized",
&RingInfo::areRingFamiliesInitialized, python::args("self"))
#endif
.def("AddRing", addRing,
(python::arg("self"), python::arg("atomIds"),
python::arg("bondIds")),

View File

@@ -681,7 +681,6 @@ TEST_CASE("Github #8945") {
}
}
#ifdef RDK_USE_URF
TEST_CASE("Test findRingFamilies") {
SECTION("basic check") {
auto m = R"SMI(c1ccc2c(c1)C3CC3C4CC5CC4CC25)SMI"_smiles;
@@ -770,4 +769,3 @@ TEST_CASE("Test findRingFamilies") {
CHECK(r->bondRingFamilies().size() == numRings);
}
}
#endif

View File

@@ -7754,7 +7754,6 @@ M END)CTAB";
REQUIRE(v86.dotProduct(v16) < -1e-4);
}
#ifdef RDK_USE_URF
TEST_CASE("Testing ring family calculation") {
{
constexpr const char *smiles = "C(C1C2C3C41)(C2C35)C45"; // cubane
@@ -7799,7 +7798,6 @@ TEST_CASE("Testing ring family calculation") {
delete m;
}
}
#endif
TEST_CASE("Testing adding coordinates to a terminal atom") {
auto mol = R"CTAB(

View File

@@ -37,9 +37,7 @@ set(swigRDKitLibList "${swigRDKitLibList}"
"ForceFieldHelpers;ForceField;EigenSolvers;Optimizer;MolAlign;O3AAlign;"
"Alignment;SimDivPickers;RDGeometryLib;RDStreams;RDGeneral;"
)
if(RDK_USE_URF)
set(swigRDKitLibList "${swigRDKitLibList};${RDK_URF_LIBS};")
endif(RDK_USE_URF)
set(swigRDKitLibList "${swigRDKitLibList};${RDK_URF_LIBS};")
set(swigRDKitLibs "")
foreach(swigRDKitLib ${swigRDKitLibList})
set(swigRDKitLibs "${swigRDKitLibs}${swigRDKitLib}${swigRDKitLibSuffix};")

View File

@@ -61,9 +61,7 @@ if(RDK_BUILD_CFFI_LIB)
add_definitions(-DRDK_BUILD_INCHI_SUPPORT)
list(APPEND LIBS_TO_USE RDInchiLib)
endif()
if(RDK_URF_LIBS)
list(APPEND LIBS_TO_USE RingDecomposerLib)
endif()
list(APPEND LIBS_TO_USE RingDecomposerLib)
if(RDK_CFFI_STATIC AND ((NOT WIN32) OR (WIN32 AND RDK_INSTALL_DLLS_MSVC)))
set(staticLibSuffix "_static")

View File

@@ -143,9 +143,7 @@ set(pgRDKitLibList "${pgRDKitLibList}"
"FileParsers;SmilesParse;Fingerprints;Subgraphs;Descriptors;"
"PartialCharges;SubstructMatch;GraphMol;EigenSolvers;DataStructs;Depictor;"
"RDGeometryLib;RDGeneral")
if(RDK_USE_URF)
set(pgRDKitLibList "${pgRDKitLibList};${RDK_URF_LIBS}")
endif(RDK_USE_URF)
set(pgRDKitLibList "${pgRDKitLibList};${RDK_URF_LIBS}")
set (pgRDKitLibs "")
foreach(pgRDKitLib ${pgRDKitLibList})
if (NOT pgRDKitLibs STREQUAL "")

View File

@@ -40,8 +40,6 @@
#cmakedefine RDK_BUILD_FREETYPE_SUPPORT
#cmakedefine RDK_USE_URF
#cmakedefine RDK_BUILD_YAEHMOP_SUPPORT
#cmakedefine RDK_BUILD_XYZ2MOL_SUPPORT