Blob Blame History Raw
diff -rupN gmsh-2.9.0-source/CMakeLists.txt gmsh-2.9.0-source-new/CMakeLists.txt
--- gmsh-2.9.0-source/CMakeLists.txt	2015-03-12 12:14:16.000000000 +0100
+++ gmsh-2.9.0-source-new/CMakeLists.txt	2015-03-13 23:52:54.804192621 +0100
@@ -160,8 +160,7 @@ set(GMSH_API
   contrib/MeshOptimizer/MeshOptObjectiveFunction.h contrib/MeshOptimizer/MeshOptVertexCoord.h 
   contrib/MeshQualityOptimizer/MeshQualityObjContribIdealJac.h
   contrib/MeshQualityOptimizer/MeshQualityObjContribInvCond.h
-  contrib/MeshQualityOptimizer/MeshQualityOptimizer.h
-  contrib/MathEx/mathex.h)
+  contrib/MeshQualityOptimizer/MeshQualityOptimizer.h)
 
 get_property(IAMCHILD DIRECTORY  PROPERTY PARENT_DIRECTORY)
 if(IAMCHILD)
@@ -645,7 +644,7 @@ endif(HAVE_FLTK OR HAVE_QT OR ENABLE_GRA
 
 if(HAVE_MESH OR HAVE_PLUGINS)
   if(ENABLE_ANN)
-    find_library(ANN_LIB ann PATH_SUFFIXES lib)
+    find_library(ANN_LIB ANN PATH_SUFFIXES lib)
     find_path(ANN_INC "ANN.h" PATH_SUFFIXES src include ANN)
     if(ANN_LIB AND ANN_INC)
       list(APPEND EXTERNAL_LIBRARIES ${ANN_LIB})
@@ -660,8 +659,16 @@ if(HAVE_MESH OR HAVE_PLUGINS)
 endif(HAVE_MESH OR HAVE_PLUGINS)
 
 if(ENABLE_BFGS)
-  add_subdirectory(contrib/lbfgs)
-  include_directories(contrib/lbfgs)
+  find_library(BFGS_LIB lbfgs PATH_SUFFIXES lib)
+  find_path(BFGS_INC "lbfgs.h" PATH_SUFFIXES include)
+  if(BFGS_LIB AND BFGS_INC)
+    list(APPEND EXTERNAL_LIBRARIES ${BFGS_LIB} -lalglib)
+    list(APPEND EXTERNAL_INCLUDES ${BFGS_INC})
+  else(BFGS_LIB AND BFGS_INC)
+    message(STATUS "System libbfgs not found: using contrib/lbfgs instead")
+    add_subdirectory(contrib/lbfgs)
+    include_directories(contrib/lbfgs)
+  endif(BFGS_LIB AND BFGS_INC)
   set_config_option(HAVE_BFGS "Bfgs")
 endif(ENABLE_BFGS)
 
@@ -707,8 +714,16 @@ if(ENABLE_KBIPACK)
 endif(ENABLE_KBIPACK)
 
 if(ENABLE_MATHEX)
-  add_subdirectory(contrib/MathEx)
-  include_directories(contrib/MathEx)
+  find_library(MATHEX_LIB mathex PATH_SUFFIXES lib)
+  find_path(MATHEX_INC "mathex.h" PATH_SUFFIXES src include)
+  if(MATHEX_LIB AND MATHEX_INC)
+     list(APPEND EXTERNAL_LIBRARIES ${MATHEX_LIB})
+     list(APPEND EXTERNAL_INCLUDES ${MATHEX_INC})
+  else(MATHEX_LIB AND MATHEX_INC)
+     message(STATUS "System MATHEX not found: using contrib/MathEx instead")
+    add_subdirectory(contrib/MathEx)
+    include_directories(contrib/MathEx)
+  endif(MATHEX_LIB AND MATHEX_INC)
   set_config_option(HAVE_MATHEX "MathEx")
 endif(ENABLE_MATHEX)
 
@@ -739,13 +754,17 @@ endif(ENABLE_POPPLER)
 
 if(HAVE_MESH OR HAVE_SOLVER)
   if(ENABLE_METIS)
-    # Gmsh currently uses Metis 4 - we should switch to Metis 5 and use the
-    # system lib if available
-    add_subdirectory(contrib/Metis)
-    include_directories(contrib/Metis)
+    find_library(METIS_LIB metis PATH_SUFFIXES lib)
+    find_path(METIS_INC "metis.h" PATH_SUFFIXES include)
+    if(METIS_LIB AND METIS_INC)
+      list(APPEND EXTERNAL_LIBRARIES ${METIS_LIB})
+      list(APPEND EXTERNAL_INCLUDES ${METIS_INC})
+    else(METIS_LIB AND METIS_INC)
+      message(STATUS "System metis not found: using contrib/Metis instead")
+      add_subdirectory(contrib/Metis)
+      include_directories(contrib/Metis)
+    endif(METIS_LIB AND METIS_INC)
     set_config_option(HAVE_METIS "Metis")
-    message(STATUS "Note: By including Metis you have to comply with Metis' "
-            "special licensing requirements stated in contrib/Metis/README.txt.")
   endif(ENABLE_METIS)
 
   if(ENABLE_CHACO)
@@ -757,8 +776,16 @@ endif(HAVE_MESH OR HAVE_SOLVER)
 
 if(HAVE_MESH)
   if(ENABLE_VORO3D)
-    add_subdirectory(contrib/voro++)
-    include_directories(contrib/voro++/src)
+    find_library(VORO3D_LIB voro++ PATH_SUFFIXES lib)
+    find_path(VORO3D_INC "voro++.hh" PATH_SUFFIXES include/voro++)
+    if(VORO3D_LIB AND VORO3D_INC)
+      list(APPEND EXTERNAL_LIBRARIES ${VORO3D_LIB})
+      list(APPEND EXTERNAL_INCLUDES ${VORO3D_INC})
+    else(VORO3D_LIB AND VORO3D_INC)
+      message(STATUS "System voro++ not found: using contrib/voro++ instead")
+      add_subdirectory(contrib/voro++)
+      include_directories(contrib/voro++)
+    endif(VORO3D_LIB AND VORO3D_INC)
     set_config_option(HAVE_VORO3D "Voro3D")
   endif(ENABLE_VORO3D)
 
@@ -770,9 +797,22 @@ if(HAVE_MESH)
   endif(ENABLE_BLOSSOM)
 
   if(ENABLE_NETGEN)
-    add_subdirectory(contrib/Netgen)
-    include_directories(contrib/Netgen contrib/Netgen/libsrc/include 
-                        contrib/Netgen/nglib)
+    find_library(NETGEN_LIB nglib PATH_SUFFIXES lib)
+    find_path(NETGEN_INC "nglib.h" PATH_SUFFIXES include/netgen-mesher)
+    if(NETGEN_LIB AND NETGEN_INC)
+      list(APPEND EXTERNAL_LIBRARIES ${NETGEN_LIB})
+      list(APPEND EXTERNAL_INCLUDES ${NETGEN_INC})
+      # Netgen private headers contain what contrib/Salome does
+      list(APPEND EXTERNAL_LIBRARIES -lngocc -lngcsg -lngmesh)
+      list(APPEND EXTERNAL_INCLUDES ${NETGEN_INC}/private ${NETGEN_INC} ${NETGEN_INC}/private/include)
+      add_definitions(-DOCCGEOMETRY)
+      set_config_option(HAVE_SALOME "Salome")
+    else(NETGEN_LIB AND NETGEN_INC)
+      message(STATUS "System netgen not found: using contrib/Netgen instead")
+      add_subdirectory(contrib/Netgen)
+      include_directories(contrib/Netgen contrib/Netgen/libsrc/include 
+                          contrib/Netgen/nglib)
+    endif(NETGEN_LIB AND NETGEN_INC)
     set_config_option(HAVE_NETGEN "Netgen")
     add_definitions(-DNO_PARALLEL_THREADS -DNOTCL)
   endif(ENABLE_NETGEN)
@@ -784,8 +824,8 @@ if(HAVE_MESH)
   endif(ENABLE_BAMG)
 
   if(ENABLE_MMG3D)
-    find_library(MMG3D_LIB mmg3dlib4.0 PATH_SUFFIXES lib)
-    find_path(MMG3D_INC "libmmg3d.h" PATH_SUFFIXES src include)
+    find_library(MMG3D_LIB mmg3d4 PATH_SUFFIXES lib)
+    find_path(MMG3D_INC "libmmg3d4.h" PATH_SUFFIXES src include)
     if(MMG3D_LIB AND MMG3D_INC)
        list(APPEND EXTERNAL_LIBRARIES ${MMG3D_LIB})
        list(APPEND EXTERNAL_INCLUDES ${MMG3D_INC})
@@ -1127,19 +1167,6 @@ if(ENABLE_OCC)
       endif(NOT OCC_CONFIG_H)
     endif(OCC_INC)
   endif(NUM_OCC_LIBS EQUAL NUM_OCC_LIBS_REQUIRED)
-  if(HAVE_OCC)
-    if(ENABLE_SGEOM)
-      add_subdirectory(contrib/SGEOM)
-      include_directories(contrib/SGEOM)
-      add_definitions(-DSGEOMGEOMETRY)
-      set_config_option(HAVE_SGEOM "SGEOM")
-    elseif(ENABLE_SALOME)
-      add_subdirectory(contrib/Salome)
-      include_directories(contrib/Salome)
-      add_definitions(-DOCCGEOMETRY)
-      set_config_option(HAVE_SALOME "Salome")
-    endif(ENABLE_SGEOM)
-  endif(HAVE_OCC)
 endif(ENABLE_OCC)
 
 if(ENABLE_ACIS)
diff -rupN gmsh-2.9.0-source/Geo/GModelFactory.cpp gmsh-2.9.0-source-new/Geo/GModelFactory.cpp
--- gmsh-2.9.0-source/Geo/GModelFactory.cpp	2015-03-08 14:03:26.000000000 +0100
+++ gmsh-2.9.0-source-new/Geo/GModelFactory.cpp	2015-03-13 23:52:22.325508412 +0100
@@ -496,7 +496,7 @@ void GeoFactory::healGeometry(GModel *gm
 #include <GeomAPI_PointsToBSpline.hxx>
 #include "OCC_Connect.h"
 #if defined(HAVE_SALOME)
-#include "Partition_Spliter.hxx"
+#include <occ/Partition_Spliter.hxx>
 #endif
 
 GVertex *OCCFactory::addVertex(GModel *gm, double x, double y, double z, double lc)
diff -rupN gmsh-2.9.0-source/Geo/GModelIO_OCC.cpp gmsh-2.9.0-source-new/Geo/GModelIO_OCC.cpp
--- gmsh-2.9.0-source/Geo/GModelIO_OCC.cpp	2015-03-08 14:03:26.000000000 +0100
+++ gmsh-2.9.0-source-new/Geo/GModelIO_OCC.cpp	2015-03-13 23:52:22.326508433 +0100
@@ -19,7 +19,7 @@
 #if defined(HAVE_OCC)
 
 #if defined(HAVE_SALOME)
-#include "Partition_Spliter.hxx"
+#include <occ/Partition_Spliter.hxx>
 #endif
 
 void addSimpleShapes(TopoDS_Shape theShape, TopTools_ListOfShape &theList);
diff -rupN gmsh-2.9.0-source/Mesh/CMakeLists.txt gmsh-2.9.0-source-new/Mesh/CMakeLists.txt
--- gmsh-2.9.0-source/Mesh/CMakeLists.txt	2015-03-08 14:03:14.000000000 +0100
+++ gmsh-2.9.0-source-new/Mesh/CMakeLists.txt	2015-03-13 23:52:22.327508454 +0100
@@ -39,6 +39,7 @@ set(SRC
     Field.cpp
     CenterlineField.cpp
     surfaceFiller.cpp
+    nglib_gmsh.cpp
 )
 
 file(GLOB HDR RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} *.h) 
diff -rupN gmsh-2.9.0-source/Mesh/meshGRegionMMG3D.cpp gmsh-2.9.0-source-new/Mesh/meshGRegionMMG3D.cpp
--- gmsh-2.9.0-source/Mesh/meshGRegionMMG3D.cpp	2015-03-08 14:03:14.000000000 +0100
+++ gmsh-2.9.0-source-new/Mesh/meshGRegionMMG3D.cpp	2015-03-13 23:52:22.327508454 +0100
@@ -19,7 +19,7 @@
 #include "Context.h"
 
 extern "C" {
-#include <libmmg3d.h>
+#include <libmmg3d4.h>
 #define M_UNUSED    (1 << 0)
 }