From 22efe568efbe2af9a53879026471120f8566597b Mon Sep 17 00:00:00 2001
From: Matti Pellika <matti.pellikka@tut.fi>
Date: Wed, 3 Jun 2009 17:44:32 +0000
Subject: [PATCH] Added "#if defined(HAVE_KBIPACK)" preprocessor directives to
 only enable homology plugin & compile the code when kbipack & gmp library is
 avaible.

---
 Geo/CellComplex.cpp            | 3 ++-
 Geo/CellComplex.h              | 3 +++
 Geo/ChainComplex.cpp           | 4 ++--
 Geo/Homology.cpp               | 3 ++-
 Geo/Homology.h                 | 5 ++++-
 Plugin/HomologyComputation.cpp | 4 +++-
 Plugin/HomologyComputation.h   | 3 +++
 Plugin/PluginManager.cpp       | 2 ++
 8 files changed, 21 insertions(+), 6 deletions(-)

diff --git a/Geo/CellComplex.cpp b/Geo/CellComplex.cpp
index e7b608f1fc..64d87e5fe1 100644
--- a/Geo/CellComplex.cpp
+++ b/Geo/CellComplex.cpp
@@ -7,6 +7,7 @@
 
 #include "CellComplex.h"
 
+#if defined(HAVE_KBIPACK)
 
 CellComplex::CellComplex( std::vector<GEntity*> domain, std::vector<GEntity*> subdomain ){
   
@@ -795,4 +796,4 @@ void CellComplex::printComplex(int dim){
   }
 }
 
-
+#endif
diff --git a/Geo/CellComplex.h b/Geo/CellComplex.h
index c4a415654f..1252592f31 100644
--- a/Geo/CellComplex.h
+++ b/Geo/CellComplex.h
@@ -25,6 +25,7 @@
 #include "GFace.h"
 #include "GVertex.h"
 
+#if defined(HAVE_KBIPACK)
 
 // Abstract class representing an elemtary cell of a cell complex.
 class Cell
@@ -661,3 +662,5 @@ class CellComplex
 };
 
 #endif
+
+#endif
diff --git a/Geo/ChainComplex.cpp b/Geo/ChainComplex.cpp
index c5e3fca8c8..876f9ae76a 100644
--- a/Geo/ChainComplex.cpp
+++ b/Geo/ChainComplex.cpp
@@ -437,8 +437,6 @@ std::vector<int> ChainComplex::getCoeffVector(int dim, int chainNumber){
   
 }
 
-#endif
-
 Chain::Chain(std::set<Cell*, Less_Cell> cells, std::vector<int> coeffs, CellComplex* cellComplex, std::string name){
   
   int i = 0;
@@ -524,3 +522,5 @@ void Chain::getData(std::map<int, std::vector<double> > & data){
   
   return; 
 }
+
+#endif
diff --git a/Geo/Homology.cpp b/Geo/Homology.cpp
index 6ff1b406f7..6b1f79aa2e 100644
--- a/Geo/Homology.cpp
+++ b/Geo/Homology.cpp
@@ -9,7 +9,7 @@
 #include "Homology.h"
 #include "ChainComplex.h"
 
-
+#if defined(HAVE_KBIPACK)
 Homology::Homology(GModel* model, std::vector<int> physicalDomain, std::vector<int> physicalSubdomain){
   
   _model = model;
@@ -147,3 +147,4 @@ void Homology::findThickCuts(std::string fileName){
   delete chains;
   
 }
+#endif
diff --git a/Geo/Homology.h b/Geo/Homology.h
index 1e805b0db7..b5f013653b 100644
--- a/Geo/Homology.h
+++ b/Geo/Homology.h
@@ -9,9 +9,10 @@
 #define _HOMOLOGY_H_
 
 #include <sstream>
-
 #include "CellComplex.h"
 
+#if defined(HAVE_KBIPACK)
+
 template <class TTypeA, class TTypeB>
 bool convert(const TTypeA& input, TTypeB& output ){
    std::stringstream stream;
@@ -40,3 +41,5 @@ class Homology
 };
 
 #endif
+
+#endif
diff --git a/Plugin/HomologyComputation.cpp b/Plugin/HomologyComputation.cpp
index 0587ec553d..b7d4825630 100644
--- a/Plugin/HomologyComputation.cpp
+++ b/Plugin/HomologyComputation.cpp
@@ -13,7 +13,7 @@
 #include "PViewDataGModel.h"
 #include "HomologyComputation.h"
 
-
+#if defined(HAVE_KBIPACK)
 StringXNumber HomologyComputationOptions_Number[] = {
   {GMSH_FULLRC, "Physical group for domain", NULL, 0.},
   {GMSH_FULLRC, "Physical group for subdomain", NULL, 0.},
@@ -115,3 +115,5 @@ PView *GMSH_HomologyComputationPlugin::execute(PView *v)
   
   return 0;
 }
+
+#endif
diff --git a/Plugin/HomologyComputation.h b/Plugin/HomologyComputation.h
index 5af64b6acf..b5e43f8738 100644
--- a/Plugin/HomologyComputation.h
+++ b/Plugin/HomologyComputation.h
@@ -11,6 +11,7 @@
 #include <string>
 #include "Plugin.h"
 
+#if defined(HAVE_KBIPACK)
 extern "C"
 {
   GMSH_Plugin *GMSH_RegisterHomologyComputationPlugin();
@@ -31,3 +32,5 @@ public:
 };
 
 #endif
+
+#endif
diff --git a/Plugin/PluginManager.cpp b/Plugin/PluginManager.cpp
index 64b0455ffe..0485342d86 100644
--- a/Plugin/PluginManager.cpp
+++ b/Plugin/PluginManager.cpp
@@ -229,8 +229,10 @@ void PluginManager::registerDefaultPlugins()
 #endif
     allPlugins.insert(std::pair<const char*, GMSH_Plugin*>
                       ("FiniteElement", GMSH_RegisterFiniteElementPlugin()));
+#if defined(HAVE_KBIPACK)
     allPlugins.insert(std::pair<const char*, GMSH_Plugin*>
                       ("HomologyComputation", GMSH_RegisterHomologyComputationPlugin()));
+#endif
   }
 
 #if defined(HAVE_FLTK)
-- 
GitLab