[Gmsh] building of gmsh on mingw64
walter
steffe at tiscali.it
Tue Sep 22 20:03:37 CEST 2020
Hello,
I am used to build my application (EmCAD) and gmsh on Msys2/MINGW64 platform.
Today I made a small change to the main CMakeLists.txt file of gmsh-4.6.0-source.
This change fixes the following problem:
cmake/configure is not able to find the OCC libraries on Msys2/MINGW64 platform even if CASROOT is properly set.
This problem arises because:
1) on Msys2/MINGW64 platform the OCC libraries are located in the following folders
$CASROOT/${OCC_SYS_NAME}/gcc/lib >> dll.a libraries
$CASROOT/${OCC_SYS_NAME}/gcc/bin >> dll libraries
So I made the following small changes:
line 12179 to 1273
if(ENABLE_OCC_STATIC)
set(LIBNAME lib${OCC}.a)
else()
set(LIBNAME ${OCC})
endif()
is replaced by:
if(ENABLE_OCC_STATIC)
if(MINGW)
set(LIBNAME lib${OCC}.dll.a)
else()
set(LIBNAME lib${OCC}.a)
endif()
else()
set(LIBNAME ${OCC})
endif()
line 1284 to 1285:
find_library(OCC_LIB ${LIBNAME} HINTS ENV CASROOT PATH_SUFFIXES
lib ${OCC_SYS_NAME}/lib ${OCC_SYS_NAME}/vc8/lib)
is replaced by:
find_library(OCC_LIB ${LIBNAME} HINTS ENV CASROOT PATH_SUFFIXES lib bin
lib ${OCC_SYS_NAME} ${OCC_SYS_NAME}/vc8 ${OCC_SYS_NAME}/gcc )
line 1306 to 1307:
find_library(OCC_CAF_LIB ${OCC} HINTS ENV CASROOT PATH_SUFFIXES
lib ${OCC_SYS_NAME}/lib ${OCC_SYS_NAME}/vc8/lib)
is replaced by:
find_library(OCC_CAF_LIB ${OCC} HINTS ENV CASROOT PATH_SUFFIXES lib bin
lib ${OCC_SYS_NAME} ${OCC_SYS_NAME}/vc8 ${OCC_SYS_NAME}/gcc)
-bin has been added to PATH_SUFFIXES in both calls to find_library.
-${OCC_SYS_NAME}/gcc subfolder explitely added to ${OCC_SYS_NAME}/vc8
-lib was removed from some explicit subfolders because it is already appended by PATH_SUFFIXES
With this change, when the option ENABLE_OCC_STATIC is activated on a Msys2/MINGW64 platform, gmsh is linked with libTKernel.dll.a ...
libTKernel.dll.a is an import library in the microsoft world.
I think that this kind of library is meant to import the libTKernel.dll library placed in the gcc/bin folder.
I do not know if it make any difference with direct linkage to the dll.
Walter
More information about the gmsh
mailing list