qcscine / molassembler

Chemoinformatics toolkit with support for inorganic molecules
https://scine.ethz.ch/download/molassembler
BSD 3-Clause "New" or "Revised" License
33 stars 7 forks source link

Use boost/outcome.hpp instead of outcome/outcome.hpp #2

Closed awvwgk closed 1 year ago

awvwgk commented 2 years ago

The outcome module is available in boost >=1.70 (see https://www.boost.org/doc/libs/1_70_0/libs/outcome/doc/html/index.html). Is there a reason to require a separate dependency instead of using boost proper?


Potential patch

diff --git a/CMakeLists.txt b/CMakeLists.txt
index b3754ef4..a04a9152 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -75,8 +75,6 @@ find_package(Boost
 )
 include(ImportNauty)
 import_nauty()
-include(ImportOutcome)
-import_outcome()
 include(ImportJSON)
 import_json()
 include(ImportRingDecomposerLib)
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 67a7542f..d87f233b 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -41,7 +41,6 @@ if(${CMAKE_VERSION} VERSION_GREATER_EQUAL "3.12.0")
   target_link_libraries(molassembler_obj PRIVATE
     Boost::boost
     Scine::UtilsOS
-    outcome
     RingDecomposerLib
     json
     Boost::filesystem
@@ -53,7 +52,6 @@ else()
   target_include_directories(molassembler_obj
     PUBLIC
       $<TARGET_PROPERTY:Scine::UtilsOS,INTERFACE_INCLUDE_DIRECTORIES>
-      $<TARGET_PROPERTY:outcome,INTERFACE_INCLUDE_DIRECTORIES>
       $<TARGET_PROPERTY:RingDecomposerLib,INTERFACE_INCLUDE_DIRECTORIES>
       $<TARGET_PROPERTY:Boost::boost,INTERFACE_INCLUDE_DIRECTORIES>
   )
@@ -67,7 +65,6 @@ target_compile_options(molassembler_obj PRIVATE
 target_include_directories(molassembler_obj SYSTEM PRIVATE
   ${Boost_INCLUDE_DIR}
   ${RDL_INCLUDE_DIR}
-  $<TARGET_PROPERTY:outcome,INTERFACE_INCLUDE_DIRECTORIES>
   $<TARGET_PROPERTY:Eigen3::Eigen,INTERFACE_INCLUDE_DIRECTORIES>
   $<TARGET_PROPERTY:json,INTERFACE_INCLUDE_DIRECTORIES>
   $<TARGET_PROPERTY:nauty,INTERFACE_INCLUDE_DIRECTORIES>
@@ -108,7 +105,6 @@ function(molassembler_library_links target_name)
   target_link_libraries(${target_name}
     PUBLIC
       Scine::UtilsOS
-      outcome
     PRIVATE
       Boost::filesystem
       Boost::system
diff --git a/src/Molassembler/Conformers.h b/src/Molassembler/Conformers.h
index b059541e..9d17bc72 100644
--- a/src/Molassembler/Conformers.h
+++ b/src/Molassembler/Conformers.h
@@ -10,13 +10,13 @@

 #include "Molassembler/Types.h"
 #include "Utils/Typenames.h"
-#include "outcome/outcome.hpp"
+#include "boost/outcome.hpp"
 #include <vector>

 namespace Scine {
 namespace Molassembler {

-namespace outcome = OUTCOME_V2_NAMESPACE;
+namespace outcome = BOOST_OUTCOME_V2_NAMESPACE;

 // Forward-declarations
 class Molecule;
diff --git a/src/Molassembler/DirectedConformerGenerator.h b/src/Molassembler/DirectedConformerGenerator.h
index bd4fb290..febf0e89 100644
--- a/src/Molassembler/DirectedConformerGenerator.h
+++ b/src/Molassembler/DirectedConformerGenerator.h
@@ -23,7 +23,7 @@ class AtomCollection;

 namespace Molassembler {

-namespace outcome = OUTCOME_V2_NAMESPACE;
+namespace outcome = BOOST_OUTCOME_V2_NAMESPACE;

 class Molecule;

diff --git a/src/Molassembler/DistanceGeometry/ConformerGeneration.h b/src/Molassembler/DistanceGeometry/ConformerGeneration.h
index 34222636..bff37ab8 100644
--- a/src/Molassembler/DistanceGeometry/ConformerGeneration.h
+++ b/src/Molassembler/DistanceGeometry/ConformerGeneration.h
@@ -17,7 +17,7 @@
 namespace Scine {
 namespace Molassembler {

-namespace outcome = OUTCOME_V2_NAMESPACE;
+namespace outcome = BOOST_OUTCOME_V2_NAMESPACE;

 namespace DistanceGeometry {
 namespace Detail {
diff --git a/src/Molassembler/DistanceGeometry/DistanceBoundsMatrix.h b/src/Molassembler/DistanceGeometry/DistanceBoundsMatrix.h
index 9480f78e..aa7331aa 100644
--- a/src/Molassembler/DistanceGeometry/DistanceBoundsMatrix.h
+++ b/src/Molassembler/DistanceGeometry/DistanceBoundsMatrix.h
@@ -21,7 +21,7 @@ namespace Random {
 class Engine;
 } // namespace Random

-namespace outcome = OUTCOME_V2_NAMESPACE;
+namespace outcome = BOOST_OUTCOME_V2_NAMESPACE;

 namespace DistanceGeometry {

diff --git a/src/Molassembler/DistanceGeometry/ExplicitBoundsGraph.h b/src/Molassembler/DistanceGeometry/ExplicitBoundsGraph.h
index 0f950ec8..f0611d29 100644
--- a/src/Molassembler/DistanceGeometry/ExplicitBoundsGraph.h
+++ b/src/Molassembler/DistanceGeometry/ExplicitBoundsGraph.h
@@ -28,7 +28,7 @@ namespace Random {
 class Engine;
 } // namespace Random

-namespace outcome = OUTCOME_V2_NAMESPACE;
+namespace outcome = BOOST_OUTCOME_V2_NAMESPACE;

 // Forward-declare PrivateGraph
 class PrivateGraph;
diff --git a/src/Molassembler/DistanceGeometry/ImplicitBoundsGraph.h b/src/Molassembler/DistanceGeometry/ImplicitBoundsGraph.h
index 01b702a3..526c20ae 100644
--- a/src/Molassembler/DistanceGeometry/ImplicitBoundsGraph.h
+++ b/src/Molassembler/DistanceGeometry/ImplicitBoundsGraph.h
@@ -32,7 +32,7 @@ namespace Random {
 class Engine;
 } // namespace Random

-namespace outcome = OUTCOME_V2_NAMESPACE;
+namespace outcome = BOOST_OUTCOME_V2_NAMESPACE;

 // Forward-declare PrivateGraph
 class PrivateGraph;
weymutht commented 2 years ago

Right now, we also want/need to support Boost versions older than 1.70.0.

awvwgk commented 2 years ago

Might be possible to do this by adding a small proxy header to switch between outcome/outcome.hpp and boost/outcome.hpp depending on the boost version (BOOST_VERSION).

weymutht commented 1 year ago

This is fixed in release 2.0.0.