From 71b5366cc60bf16228fe9cff979176a4b45d8f48 Mon Sep 17 00:00:00 2001
From: Christophe Geuzaine <cgeuzaine@uliege.be>
Date: Fri, 17 Dec 2021 19:20:37 +0100
Subject: [PATCH] test Lib subdirectory to find DLL (cf. #1673)

---
 api/GenApi.py | 12 +++++++-----
 api/gmsh.py   | 12 +++++++-----
 2 files changed, 14 insertions(+), 10 deletions(-)

diff --git a/api/GenApi.py b/api/GenApi.py
index a32b270857..d2df61fbfb 100644
--- a/api/GenApi.py
+++ b/api/GenApi.py
@@ -1145,13 +1145,15 @@ else:
     libdir = os.path.dirname(os.path.dirname(moduledir))
 
 libpath = os.path.join(libdir, libname)
+if not os.path.exists(libpath):
+    libpath = os.path.join(libdir, "Lib", libname)
 if not os.path.exists(libpath):
     libpath = os.path.join(moduledir, libname)
-    if not os.path.exists(libpath):
-        if platform.system() == "Windows":
-            libpath = find_library("{7}-{3}.{4}")
-        else:
-            libpath = find_library("{7}")
+if not os.path.exists(libpath):
+    if platform.system() == "Windows":
+        libpath = find_library("{7}-{3}.{4}")
+    else:
+        libpath = find_library("{7}")
 
 lib = CDLL(libpath)
 
diff --git a/api/gmsh.py b/api/gmsh.py
index 73d3baf915..e2e468f0d3 100644
--- a/api/gmsh.py
+++ b/api/gmsh.py
@@ -38,13 +38,15 @@ else:
     libdir = os.path.dirname(os.path.dirname(moduledir))
 
 libpath = os.path.join(libdir, libname)
+if not os.path.exists(libpath):
+    libpath = os.path.join(libdir, "Lib", libname)
 if not os.path.exists(libpath):
     libpath = os.path.join(moduledir, libname)
-    if not os.path.exists(libpath):
-        if platform.system() == "Windows":
-            libpath = find_library("gmsh-4.9")
-        else:
-            libpath = find_library("gmsh")
+if not os.path.exists(libpath):
+    if platform.system() == "Windows":
+        libpath = find_library("gmsh-4.9")
+    else:
+        libpath = find_library("gmsh")
 
 lib = CDLL(libpath)
 
-- 
GitLab