From fb7b0467342b15d207c39b5b3fbb676b493619f5 Mon Sep 17 00:00:00 2001
From: Christophe Geuzaine <cgeuzaine@ulg.ac.be>
Date: Tue, 28 Feb 2012 14:53:27 +0000
Subject: [PATCH] disable wrappers if the module is not compiled in

PS : we should discuss a better strategy to clean this up
---
 wrappers/gmshpy/gmshMesh.i   | 9 ++++++++-
 wrappers/gmshpy/gmshPost.i   | 6 ++++--
 wrappers/gmshpy/gmshSolver.i | 7 +++++--
 3 files changed, 17 insertions(+), 5 deletions(-)

diff --git a/wrappers/gmshpy/gmshMesh.i b/wrappers/gmshpy/gmshMesh.i
index c48c77ac35..9fafb67a5d 100644
--- a/wrappers/gmshpy/gmshMesh.i
+++ b/wrappers/gmshpy/gmshMesh.i
@@ -4,17 +4,20 @@
 
 %{
   #include "GmshConfig.h"
-
+#if defined(HAVE_MESH)
   #include "Generator.h"
   #include "highOrderTools.h"
   #include "meshGFaceLloyd.h"
   #include "meshGFaceOptimize.h"
   #include "meshPartitionOptions.h"
   #include "Levy3D.h"
+#if defined(HAVE_METIS) || defined(HAVE_CHACO)
   #include "meshPartition.h"
+#endif
   #include "meshMetric.h"
   #include "Field.h"
   #include "CenterlineField.h"
+#endif
 %}
 
 %include std_vector.i
@@ -23,13 +26,17 @@ namespace std {
 }
 
 %include "GmshConfig.h"
+#if defined(HAVE_MESH)
 %include "Generator.h"
 %include "highOrderTools.h"
 %include "meshGFaceLloyd.h"
 %include "meshGFaceOptimize.h"
 %include "meshPartitionOptions.h"
 %include "Levy3D.h"
+#if defined(HAVE_METIS) || defined(HAVE_CHACO)
 %include "meshPartition.h"
+#endif
 %include "meshMetric.h"
 %include "Field.h"
 %include "CenterlineField.h"
+#endif
diff --git a/wrappers/gmshpy/gmshPost.i b/wrappers/gmshpy/gmshPost.i
index db5e70c9d0..82affcc127 100644
--- a/wrappers/gmshpy/gmshPost.i
+++ b/wrappers/gmshpy/gmshPost.i
@@ -6,16 +6,18 @@
 %{
   #include "GmshConfig.h"
   #include "fullMatrix.h"
+#if defined(HAVE_POST)
   #include "PView.h"
   #include "PViewFactory.h"
   #include "PViewData.h"
+#endif
 %}
 
 %include "GmshConfig.h"
+#if defined(HAVE_POST)
 %include "PView.h"
-
 %include "PViewFactory.h"
-
 %apply double &OUTPUT { double &val}
 %include "PViewData.h"
+#endif
 
diff --git a/wrappers/gmshpy/gmshSolver.i b/wrappers/gmshpy/gmshSolver.i
index 244f7909e2..0e0a917b99 100644
--- a/wrappers/gmshpy/gmshSolver.i
+++ b/wrappers/gmshpy/gmshSolver.i
@@ -7,16 +7,18 @@
 
 %{
   #include "GmshConfig.h"
+#if defined(HAVE_SOLVER)
   #include "dofManager.h"
   #include "elasticitySolver.h"
   #include "linearSystem.h"
   #include "linearSystemCSR.h"
   #include "linearSystemFull.h"
   #include "linearSystemPETSc.h"
+#endif
 %}
 
 %include "GmshConfig.h"
-
+#if defined(HAVE_SOLVER)
 %include "dofManager.h"
 %template(dofManagerDouble) dofManager<double>;
 %include "elasticitySolver.h"
@@ -28,7 +30,8 @@
 %template(linearSystemTAUCSDouble) linearSystemCSRTaucs<double>;
 %include "linearSystemFull.h"
 %template(linearSystemFullDouble) linearSystemFull<double> ;
-#ifdef HAVE_PETSC
+#if defined(HAVE_PETSC)
 %include "linearSystemPETSc.h"
 %template(linearSystemPETScDouble) linearSystemPETSc<double>;
 #endif
+#endif
-- 
GitLab