File rdkit-boost-166.patch of Package rdkit

patches to support the slightly outdated boost 1.66
  - boost-1.66 does not provide cmake config files
  - cf. github.com/rdkit/rdkit/pull/7862:
      revert the switch to std::unordered_set as boost-1.66 seems not to
      work otherwise


--- a/CMakeLists.txt	2024-12-20 09:56:08.000000000 +0100
+++ b/CMakeLists.txt	2025-02-13 19:25:37.577369321 +0100
@@ -72,7 +72,7 @@
 option(RDK_BUILD_MINIMAL_LIB_SUBSTRUCTLIBRARY "build support for SubstructLibrary into MinimalLib" ON )
 option(RDK_BUILD_MINIMAL_LIB_MCS "build support for MCS into MinimalLib" OFF )
 
-set(RDK_BOOST_VERSION "1.70.0")
+set(RDK_BOOST_VERSION "1.66.0")
 
 if(NOT MSVC)
   if(RDK_OPTIMIZE_POPCNT)
@@ -308,7 +308,7 @@
   endif()
 
 
-  find_package(Boost ${RDK_BOOST_VERSION} COMPONENTS "python${Python3_VERSION_MAJOR}${Python3_VERSION_MINOR}" "numpy${Python3_VERSION_MAJOR}${Python3_VERSION_MINOR}" REQUIRED CONFIG)
+  find_package(Boost ${RDK_BOOST_VERSION} COMPONENTS "python${Python3_VERSION_MAJOR}${Python3_VERSION_MINOR}" "numpy${Python3_VERSION_MAJOR}${Python3_VERSION_MINOR}" REQUIRED)
 
   target_link_libraries(rdkit_py_base INTERFACE "Boost::python${Python3_VERSION_MAJOR}${Python3_VERSION_MINOR}" "Boost::numpy${Python3_VERSION_MAJOR}${Python3_VERSION_MINOR}")
 
@@ -383,7 +383,7 @@
   endif()
 
 else(RDK_BUILD_PYTHON_WRAPPERS)
-  find_package(Boost ${RDK_BOOST_VERSION} REQUIRED CONFIG)
+  find_package(Boost ${RDK_BOOST_VERSION} REQUIRED)
 endif(RDK_BUILD_PYTHON_WRAPPERS)
 
 find_package(Eigen3)
@@ -419,7 +419,7 @@
 endif()
 
 if(RDK_USE_BOOST_SERIALIZATION)
-    find_package(Boost ${RDK_BOOST_VERSION} COMPONENTS system serialization iostreams REQUIRED CONFIG)
+    find_package(Boost ${RDK_BOOST_VERSION} COMPONENTS system serialization iostreams REQUIRED)
     target_link_libraries(rdkit_base INTERFACE ${Boost_LIBRARIES})
     target_compile_definitions(rdkit_base INTERFACE -DRDK_USE_BOOST_SERIALIZATION)
     if(NOT Boost_USE_STATIC_LIBS)
@@ -429,7 +429,7 @@
 
 if(RDK_USE_BOOST_IOSTREAMS)
     target_compile_definitions(rdkit_base INTERFACE -DRDK_USE_BOOST_IOSTREAMS)
-    find_package(Boost ${RDK_BOOST_VERSION} COMPONENTS system iostreams REQUIRED CONFIG)
+    find_package(Boost ${RDK_BOOST_VERSION} COMPONENTS system iostreams REQUIRED)
     target_link_libraries(rdkit_base INTERFACE ${Boost_LIBRARIES})
 
     if (NOT Boost_USE_STATIC_LIBS)
--- a/Code/GraphMol/RGroupDecomposition/CMakeLists.txt	2024-12-20 09:56:08.000000000 +0100
+++ b/Code/GraphMol/RGroupDecomposition/CMakeLists.txt	2025-02-13 19:17:05.730804172 +0100
@@ -23,7 +23,7 @@
 rdkit_catch_test(rgroupCatchTests catch_rgd.cpp 
 		LINK_LIBRARIES RGroupDecomposition )
 
-find_package(Boost ${RDK_BOOST_VERSION} COMPONENTS program_options CONFIG)
+find_package(Boost ${RDK_BOOST_VERSION} COMPONENTS program_options)
 if(RDK_BUILD_CPP_TESTS AND Boost_FOUND)
 	add_executable(gaExample GaExample.cpp)
 	if(NOT Boost_USE_STATIC_LIBS)
--- a/External/pubchem_shape/Wrap/CMakeLists.txt	2024-12-20 09:56:08.000000000 +0100
+++ b/External/pubchem_shape/Wrap/CMakeLists.txt	2025-02-13 19:36:42.290270090 +0100
@@ -1,7 +1,7 @@
 find_package(Python3 COMPONENTS Interpreter Development.Module NumPy REQUIRED)
 find_package(Python3 COMPONENTS Interpreter REQUIRED)
 set(py3lib "python${Python3_VERSION_MAJOR}${Python3_VERSION_MINOR}")
-find_package(Boost COMPONENTS ${py3lib} REQUIRED CONFIG)
+find_package(Boost COMPONENTS ${py3lib} REQUIRED)
 
 
 rdkit_python_extension(rdShapeAlign
--- a/Code/GraphMol/Fingerprints/MorganGenerator.cpp	2024-12-20 09:56:08.000000000 +0100
+++ b/Code/GraphMol/Fingerprints/MorganGenerator.cpp	2025-02-13 22:36:48.142249161 +0100
@@ -205,7 +205,7 @@
 
   // these are the neighborhoods that have already been added
   // to the fingerprint
-  std::unordered_set<boost::dynamic_bitset<>> neighborhoods;
+  std::vector<boost::dynamic_bitset<>> neighborhoods;
   neighborhoods.reserve(maxNumResults);
   // these are the environments around each atom:
   std::vector<boost::dynamic_bitset<>> atomNeighborhoods(
@@ -333,6 +333,12 @@
         allNeighborhoodsThisRound.push_back(
             std::make_tuple(roundAtomNeighborhoods[atomIdx],
                             static_cast<OutputType>(invar), atomIdx));
+        if (std::find(neighborhoods.begin(), neighborhoods.end(),
+                      roundAtomNeighborhoods[atomIdx]) != neighborhoods.end()) {
+          // we have seen this exact environment before, this atom
+          // is now out of consideration:
+          deadAtoms[atomIdx] = 1;
+        }
       }
     }
 
@@ -344,13 +350,14 @@
       // if we haven't seen this exact environment before, add it to the
       // result
       if (morganArguments->df_includeRedundantEnvironments ||
-          neighborhoods.count(std::get<0>(*iter)) == 0) {
+          std::find(neighborhoods.begin(), neighborhoods.end(),
+                    std::get<0>(*iter)) == neighborhoods.end()) {
         if (!morganArguments->df_onlyNonzeroInvariants ||
             (*atomInvariants)[std::get<2>(*iter)]) {
           if (includeAtoms[std::get<2>(*iter)]) {
             result.push_back(new MorganAtomEnv<OutputType>(
                 std::get<1>(*iter), std::get<2>(*iter), layer + 1));
-            neighborhoods.insert(std::get<0>(*iter));
+            neighborhoods.push_back(std::get<0>(*iter));
           }
         }
       } else {
openSUSE Build Service is sponsored by