From 430e7243abc67e6e0dd4988aae803ea789e05f52 Mon Sep 17 00:00:00 2001
From: Christophe Geuzaine <cgeuzaine@uliege.be>
Date: Fri, 17 Dec 2021 08:05:13 +0100
Subject: [PATCH] testing find_library() modification on windows proposed in
 #1673

---
 api/GenApi.py    |  6 ++++--
 api/gen.py       |  2 +-
 api/gmsh.h       |  8 ++++----
 api/gmsh.h_cwrap |  4 ++--
 api/gmsh.jl      |  8 ++++----
 api/gmsh.py      | 14 ++++++++------
 api/gmshc.h      |  8 ++++----
 api/gmshf.h      |  8 ++++----
 8 files changed, 31 insertions(+), 27 deletions(-)

diff --git a/api/GenApi.py b/api/GenApi.py
index 7d9acb2757..a32b270857 100644
--- a/api/GenApi.py
+++ b/api/GenApi.py
@@ -1148,11 +1148,13 @@ libpath = os.path.join(libdir, libname)
 if not os.path.exists(libpath):
     libpath = os.path.join(moduledir, libname)
     if not os.path.exists(libpath):
-        libpath = find_library("{7}")
+        if platform.system() == "Windows":
+            libpath = find_library("{7}-{3}.{4}")
+        else:
+            libpath = find_library("{7}")
 
 lib = CDLL(libpath)
 
-
 try_numpy = True # set this to False to never use numpy
 
 use_numpy = False
diff --git a/api/gen.py b/api/gen.py
index 43979398fd..b471303a2b 100644
--- a/api/gen.py
+++ b/api/gen.py
@@ -509,7 +509,7 @@ mesh.add('removeDuplicateNodes', doc, None)
 doc = '''Split (into two triangles) all quadrangles in surface `tag' whose quality is lower than `quality'. If `tag' < 0, split quadrangles in all surfaces.'''
 mesh.add('splitQuadrangles', doc, None, idouble('quality', '1.'), iint('tag', '-1'))
 
-doc = '''Classify ("color") the surface mesh based on the angle threshold `angle' (in radians), and create new discrete surfaces, curves and points accordingly. If `boundary' is set, also create discrete curves on the boundary if the surface is open. If `forReparametrization' is set, create edges and surfaces that can be reparametrized using a single map. If `curveAngle' is less than Pi, also force curves to be split according to `curveAngle'. If `exportDiscrete' is set, clear any built-in CAD kernel entities and export the discrete entities in the built-in CAD kernel.'''
+doc = '''Classify ("color") the surface mesh based on the angle threshold `angle' (in radians), and create new discrete surfaces, curves and points accordingly. If `boundary' is set, also create discrete curves on the boundary if the surface is open. If `forReparametrization' is set, create curves and surfaces that can be reparametrized using a single map. If `curveAngle' is less than Pi, also force curves to be split according to `curveAngle'. If `exportDiscrete' is set, clear any built-in CAD kernel entities and export the discrete entities in the built-in CAD kernel.'''
 mesh.add('classifySurfaces', doc, None, idouble('angle'), ibool('boundary', 'true', 'True'), ibool('forReparametrization', 'false', 'False'), idouble('curveAngle', 'M_PI', 'pi', 'pi'), ibool('exportDiscrete', 'true', 'True'))
 
 doc = '''Create a geometry for the discrete entities `dimTags' (represented solely by a mesh, without an underlying CAD description), i.e. create a parametrization for discrete curves and surfaces, assuming that each can be parametrized with a single map. If `dimTags' is empty, create a geometry for all the discrete entities.'''
diff --git a/api/gmsh.h b/api/gmsh.h
index d657bed07c..fcc9ad7d72 100644
--- a/api/gmsh.h
+++ b/api/gmsh.h
@@ -6,7 +6,7 @@
 #ifndef GMSH_H
 #define GMSH_H
 
-// This file defines the Gmsh C++ API (v4.9.0).
+// This file defines the Gmsh C++ API (v4.9.1).
 //
 // Do not edit it directly: it is automatically generated by `api/gen.py'.
 //
@@ -20,10 +20,10 @@
 #include <utility>
 #include <functional>
 
-#define GMSH_API_VERSION "4.9.0"
+#define GMSH_API_VERSION "4.9.1"
 #define GMSH_API_VERSION_MAJOR 4
 #define GMSH_API_VERSION_MINOR 9
-#define GMSH_API_VERSION_PATCH 0
+#define GMSH_API_VERSION_PATCH 1
 
 #if defined(GMSH_DLL)
 #if defined(GMSH_DLL_EXPORT)
@@ -1601,7 +1601,7 @@ namespace gmsh { // Top-level functions
       // (in radians), and create new discrete surfaces, curves and points
       // accordingly. If `boundary' is set, also create discrete curves on the
       // boundary if the surface is open. If `forReparametrization' is set, create
-      // edges and surfaces that can be reparametrized using a single map. If
+      // curves and surfaces that can be reparametrized using a single map. If
       // `curveAngle' is less than Pi, also force curves to be split according to
       // `curveAngle'. If `exportDiscrete' is set, clear any built-in CAD kernel
       // entities and export the discrete entities in the built-in CAD kernel.
diff --git a/api/gmsh.h_cwrap b/api/gmsh.h_cwrap
index 338ee5c4e7..47a2fa9683 100644
--- a/api/gmsh.h_cwrap
+++ b/api/gmsh.h_cwrap
@@ -6,7 +6,7 @@
 #ifndef GMSH_H
 #define GMSH_H
 
-// This file redefines the Gmsh C++ API in terms of the C API (v4.9.0).
+// This file redefines the Gmsh C++ API in terms of the C API (v4.9.1).
 //
 // This is provided as a convenience for users of the binary Gmsh SDK whose C++
 // compiler ABI is not compatible with the ABI of the C++ compiler used to create
@@ -2453,7 +2453,7 @@ namespace gmsh { // Top-level functions
       // (in radians), and create new discrete surfaces, curves and points
       // accordingly. If `boundary' is set, also create discrete curves on the
       // boundary if the surface is open. If `forReparametrization' is set, create
-      // edges and surfaces that can be reparametrized using a single map. If
+      // curves and surfaces that can be reparametrized using a single map. If
       // `curveAngle' is less than Pi, also force curves to be split according to
       // `curveAngle'. If `exportDiscrete' is set, clear any built-in CAD kernel
       // entities and export the discrete entities in the built-in CAD kernel.
diff --git a/api/gmsh.jl b/api/gmsh.jl
index fbb7aadb2e..497af22667 100644
--- a/api/gmsh.jl
+++ b/api/gmsh.jl
@@ -3,7 +3,7 @@
 # See the LICENSE.txt file in the Gmsh root directory for license information.
 # Please report all issues on https://gitlab.onelab.info/gmsh/gmsh/issues.
 
-# This file defines the Gmsh Julia API (v4.9.0).
+# This file defines the Gmsh Julia API (v4.9.1).
 #
 # Do not edit it directly: it is automatically generated by `api/gen.py'.
 #
@@ -17,10 +17,10 @@ Top-level functions
 """
 module gmsh
 
-const GMSH_API_VERSION = "4.9.0"
+const GMSH_API_VERSION = "4.9.1"
 const GMSH_API_VERSION_MAJOR = 4
 const GMSH_API_VERSION_MINOR = 9
-const GMSH_API_VERSION_PATCH = 0
+const GMSH_API_VERSION_PATCH = 1
 const libdir = dirname(@__FILE__)
 const libname = Sys.iswindows() ? "gmsh-4.9.dll" : "libgmsh"
 import Libdl
@@ -3172,7 +3172,7 @@ const split_quadrangles = splitQuadrangles
 Classify ("color") the surface mesh based on the angle threshold `angle` (in
 radians), and create new discrete surfaces, curves and points accordingly. If
 `boundary` is set, also create discrete curves on the boundary if the surface is
-open. If `forReparametrization` is set, create edges and surfaces that can be
+open. If `forReparametrization` is set, create curves and surfaces that can be
 reparametrized using a single map. If `curveAngle` is less than Pi, also force
 curves to be split according to `curveAngle`. If `exportDiscrete` is set, clear
 any built-in CAD kernel entities and export the discrete entities in the built-
diff --git a/api/gmsh.py b/api/gmsh.py
index eeceedd25c..73d3baf915 100644
--- a/api/gmsh.py
+++ b/api/gmsh.py
@@ -3,7 +3,7 @@
 # See the LICENSE.txt file in the Gmsh root directory for license information.
 # Please report all issues on https://gitlab.onelab.info/gmsh/gmsh/issues.
 
-# This file defines the Gmsh Python API (v4.9.0).
+# This file defines the Gmsh Python API (v4.9.1).
 #
 # Do not edit it directly: it is automatically generated by `api/gen.py'.
 #
@@ -18,10 +18,10 @@ import os
 import platform
 from math import pi
 
-GMSH_API_VERSION = "4.9.0"
+GMSH_API_VERSION = "4.9.1"
 GMSH_API_VERSION_MAJOR = 4
 GMSH_API_VERSION_MINOR = 9
-GMSH_API_VERSION_PATCH = 0
+GMSH_API_VERSION_PATCH = 1
 
 __version__ = GMSH_API_VERSION
 
@@ -41,11 +41,13 @@ libpath = os.path.join(libdir, libname)
 if not os.path.exists(libpath):
     libpath = os.path.join(moduledir, libname)
     if not os.path.exists(libpath):
-        libpath = find_library("gmsh")
+        if platform.system() == "Windows":
+            libpath = find_library("gmsh-4.9")
+        else:
+            libpath = find_library("gmsh")
 
 lib = CDLL(libpath)
 
-
 try_numpy = True # set this to False to never use numpy
 
 use_numpy = False
@@ -3709,7 +3711,7 @@ class model:
             (in radians), and create new discrete surfaces, curves and points
             accordingly. If `boundary' is set, also create discrete curves on the
             boundary if the surface is open. If `forReparametrization' is set, create
-            edges and surfaces that can be reparametrized using a single map. If
+            curves and surfaces that can be reparametrized using a single map. If
             `curveAngle' is less than Pi, also force curves to be split according to
             `curveAngle'. If `exportDiscrete' is set, clear any built-in CAD kernel
             entities and export the discrete entities in the built-in CAD kernel.
diff --git a/api/gmshc.h b/api/gmshc.h
index 63fdc96172..a2e30d400e 100644
--- a/api/gmshc.h
+++ b/api/gmshc.h
@@ -9,7 +9,7 @@
 #define GMSHC_H
 
 /*
- * This file defines the Gmsh C API (v4.9.0).
+ * This file defines the Gmsh C API (v4.9.1).
  *
  * Do not edit it directly: it is automatically generated by `api/gen.py'.
  *
@@ -19,10 +19,10 @@
 
 #include <stddef.h>
 
-#define GMSH_API_VERSION "4.9.0"
+#define GMSH_API_VERSION "4.9.1"
 #define GMSH_API_VERSION_MAJOR 4
 #define GMSH_API_VERSION_MINOR 9
-#define GMSH_API_VERSION_PATCH 0
+#define GMSH_API_VERSION_PATCH 1
 
 #if defined(GMSH_DLL)
 #if defined(GMSH_DLL_EXPORT)
@@ -1409,7 +1409,7 @@ GMSH_API void gmshModelMeshSplitQuadrangles(const double quality,
  * (in radians), and create new discrete surfaces, curves and points
  * accordingly. If `boundary' is set, also create discrete curves on the
  * boundary if the surface is open. If `forReparametrization' is set, create
- * edges and surfaces that can be reparametrized using a single map. If
+ * curves and surfaces that can be reparametrized using a single map. If
  * `curveAngle' is less than Pi, also force curves to be split according to
  * `curveAngle'. If `exportDiscrete' is set, clear any built-in CAD kernel
  * entities and export the discrete entities in the built-in CAD kernel. */
diff --git a/api/gmshf.h b/api/gmshf.h
index ec95e936e8..3f71c6c336 100644
--- a/api/gmshf.h
+++ b/api/gmshf.h
@@ -10,7 +10,7 @@ c
 !DEC$ DEFINE GMSHF_H
 
 c
-c  This file defines the Gmsh Fortran API (v4.9.0).
+c  This file defines the Gmsh Fortran API (v4.9.1).
 c
 c  Do not edit it directly: it is automatically generated by `api/gen.py'.
 c
@@ -20,13 +20,13 @@ c
 
 !DEC$ DEFINE GMSH_API_VERSION_MAJOR = 4
 !DEC$ DEFINE GMSH_API_VERSION_MINOR = 9
-!DEC$ DEFINE GMSH_API_VERSION_PATCH = 0
+!DEC$ DEFINE GMSH_API_VERSION_PATCH = 1
 
       module gmsh_fortran
 
         use, intrinsic :: iso_c_binding
 
-        character(len = 5), parameter :: GMSH_API_VERSION = "4.9.0"
+        character(len = 5), parameter :: GMSH_API_VERSION = "4.9.1"
         real(c_double), parameter::M_PI = 3.14159265358979323846d0
 
         interface
@@ -2953,7 +2953,7 @@ c
 !  (in radians), and create new discrete surfaces, curves and points
 !  accordingly. If `boundary' is set, also create discrete curves on the
 !  boundary if the surface is open. If `forReparametrization' is set, create
-!  edges and surfaces that can be reparametrized using a single map. If
+!  curves and surfaces that can be reparametrized using a single map. If
 !  `curveAngle' is less than Pi, also force curves to be split according to
 !  `curveAngle'. If `exportDiscrete' is set, clear any built-in CAD kernel
 !  entities and export the discrete entities in the built-in CAD kernel.
-- 
GitLab