From b7447403bb89ee29c46722d57e8e3fb0aa981bb8 Mon Sep 17 00:00:00 2001 From: nghodban Date: Mon, 28 Dec 2020 12:38:03 +0100 Subject: [PATCH] bos #18709 [CEA][Windows] Adding GMSH/GMSHPLUGIN to SALOME --- products/GMSHPLUGIN.pyconf | 6 +++++ products/compil_scripts/gmsh.bat | 24 ++++++++++++++++---- products/gmsh.pyconf | 14 ++++++++++++ products/patches/GMSHPlugin_Mesher-ctx.patch | 15 ++++++++++++ products/patches/gmsh_4_1_4-win.patch | 15 ++++++++++++ 5 files changed, 69 insertions(+), 5 deletions(-) create mode 100644 products/patches/GMSHPlugin_Mesher-ctx.patch create mode 100644 products/patches/gmsh_4_1_4-win.patch diff --git a/products/GMSHPLUGIN.pyconf b/products/GMSHPLUGIN.pyconf index eef7865..09d06f1 100644 --- a/products/GMSHPLUGIN.pyconf +++ b/products/GMSHPLUGIN.pyconf @@ -27,9 +27,15 @@ default : properties: { is_SALOME_module : "yes" + incremental : "yes" } + patches: [] } +default_win : +{ + patches : ['patches/GMSHPlugin_Mesher-ctx.patch'] +} version_8_1_0_to_9_1_0 : { diff --git a/products/compil_scripts/gmsh.bat b/products/compil_scripts/gmsh.bat index e47cb4b..d277401 100644 --- a/products/compil_scripts/gmsh.bat +++ b/products/compil_scripts/gmsh.bat @@ -13,12 +13,13 @@ REM clean BUILD directory if exist "%BUILD_DIR%" rmdir /Q /S %BUILD_DIR% mkdir %BUILD_DIR% -SET BLAS_LAPACK_LIBRARIES="%LAPACK_ROOT_DIR%\lib\libblas.dll.a;%LAPACK_ROOT_DIR%\lib\libcblas.dll.a;%LAPACK_ROOT_DIR%\lib\liblapack.dll.a;%LAPACK_ROOT_DIR%\lib\liblapacke.dll.a" +REM SET BLAS_LAPACK_LIBRARIES="%LAPACK_ROOT_DIR%\lib\libblas.dll.a;%LAPACK_ROOT_DIR%\lib\libcblas.dll.a;%LAPACK_ROOT_DIR%\lib\liblapack.dll.a;%LAPACK_ROOT_DIR%\lib\liblapacke.dll.a" cd %BUILD_DIR% set CMAKE_OPTIONS=%CMAKE_OPTIONS% -DCMAKE_INSTALL_PREFIX:STRING=%PRODUCT_INSTALL:\=/% set CMAKE_OPTIONS=%CMAKE_OPTIONS% -DCMAKE_BUILD_TYPE=Release -set CMAKE_OPTIONS=%CMAKE_OPTIONS% -DBUILD_LIB=ON -set CMAKE_OPTIONS=%CMAKE_OPTIONS% -DBUILD_SHARED=ON +set CMAKE_OPTIONS=%CMAKE_OPTIONS% -DENABLE_BUILD_LIB=ON +set CMAKE_OPTIONS=%CMAKE_OPTIONS% -DENABLE_BUILD_SHARED=ON +set CMAKE_OPTIONS=%CMAKE_OPTIONS% -DENABLE_BUILD_DYNAMIC=ON set CMAKE_OPTIONS=%CMAKE_OPTIONS% -DENABLE_ACIS=OFF set CMAKE_OPTIONS=%CMAKE_OPTIONS% -DENABLE_FLTK=OFF set CMAKE_OPTIONS=%CMAKE_OPTIONS% -DENABLE_ONELAB_METAMODEL=OFF @@ -27,9 +28,11 @@ set CMAKE_OPTIONS=%CMAKE_OPTIONS% -DENABLE_PETSC=OFF set CMAKE_OPTIONS=%CMAKE_OPTIONS% -DENABLE_PRIVATE_API=ON set CMAKE_OPTIONS=%CMAKE_OPTIONS% -DENABLE_CGNS=OFF set CMAKE_OPTIONS=%CMAKE_OPTIONS% -DENABLE_HXT=OFF +set CMAKE_OPTIONS=%CMAKE_OPTIONS% -DENABLE_SOLVER=ON +set CMAKE_OPTIONS=%CMAKE_OPTIONS% -DENABLE_GMM=ON set CMAKE_OPTIONS=%CMAKE_OPTIONS% -DCMAKE_GENERATOR:STRING="Visual Studio 15 2017 Win64" -set CMAKE_OPTIONS=%CMAKE_OPTIONS% -DBLAS_LAPACK_LIBRARIES:STRING=%BLAS_LAPACK_LIBRARIES% - +set CMAKE_OPTIONS=%CMAKE_OPTIONS% -DENABLE_BLAS_LAPACK=OFF +REM Set CMAKE_OPTIONS=%CMAKE_OPTIONS% -DBLAS_LAPACK_LIBRARIES:STRING=%BLAS_LAPACK_LIBRARIES% set MSBUILDDISABLENODEREUSE=1 echo. @@ -97,5 +100,16 @@ FOR %%f IN (*.h) do ( ) ENDLOCAL +cd %PRODUCT_INSTALL%\include\gmsh +SETLOCAL ENABLEDELAYEDEXPANSION +FOR %%f IN (*.h) do ( + set X=%%f + copy /Y %PRODUCT_INSTALL%\include\gmsh\%%f %PRODUCT_INSTALL%\include\%X% +) +ENDLOCAL + +REM these two files need to be moved to bin, adding bin directory to PATH does not help. +cp %PRODUCT_INSTALL%\lib\gmsh.py %PRODUCT_INSTALL%\bin\gmsh.py +cp %PRODUCT_INSTALL%\lib\gmsh.dll %PRODUCT_INSTALL%\bin\gmsh.dll echo. echo ########## END \ No newline at end of file diff --git a/products/gmsh.pyconf b/products/gmsh.pyconf index c75f8f7..22619a9 100644 --- a/products/gmsh.pyconf +++ b/products/gmsh.pyconf @@ -19,3 +19,17 @@ default : incremental : "yes" } } + +default_win: +{ + depend : ["CAS"] +} + +version_4_1_4: +{ +} + +version_4_1_4_win: +{ + patches : ['gmsh_4_1_4-win.patch"] +} \ No newline at end of file diff --git a/products/patches/GMSHPlugin_Mesher-ctx.patch b/products/patches/GMSHPlugin_Mesher-ctx.patch new file mode 100644 index 0000000..f0d2ff9 --- /dev/null +++ b/products/patches/GMSHPlugin_Mesher-ctx.patch @@ -0,0 +1,15 @@ +diff --git a/src/GMSHPlugin/GMSHPlugin_Mesher.cxx b/src/GMSHPlugin/GMSHPlugin_Mesher.cxx +index 282551b..c935857 100644 +--- a/src/GMSHPlugin/GMSHPlugin_Mesher.cxx ++++ b/src/GMSHPlugin/GMSHPlugin_Mesher.cxx +@@ -938,7 +938,10 @@ void GMSHPlugin_Mesher::mymsg::operator()(std::string level, std::string msg) + } + if (level == "Fatal") + { ++#ifndef WIN32 + CTX::instance()->lock = 0; ++#endif ++ + throw oss.str(); + } + else diff --git a/products/patches/gmsh_4_1_4-win.patch b/products/patches/gmsh_4_1_4-win.patch new file mode 100644 index 0000000..f849d3a --- /dev/null +++ b/products/patches/gmsh_4_1_4-win.patch @@ -0,0 +1,15 @@ +--- gmsh_ref/api/gmsh.h 2019-02-02 13:03:46.000000000 +0100 ++++ gmsh/api/gmsh.h 2020-12-26 15:00:16.000000000 +0100 +@@ -34,6 +34,12 @@ + #define GMSH_API + #endif + ++#ifdef WIN32 ++#if !defined(M_PI) ++ #define M_PI 3.14159265358979323846264338327950 ++#endif // M_PI ++#endif ++ + namespace gmsh { + + // A geometrical entity in the Gmsh API is represented by two integers: its -- 2.39.2