From 4c34ae56d6e46d82abea01b877f1faa5a9d099ee Mon Sep 17 00:00:00 2001 From: Afeef Date: Tue, 14 Jun 2022 15:30:49 +0200 Subject: [PATCH] prepare to upgrade for gmsh 4.10.3 --- products/compil_scripts/gmsh-4.10.3.bat | 124 +++++++++++++++++++++ products/compil_scripts/gmsh-4.10.3.sh | 79 +++++++++++++ products/gmsh.pyconf | 11 ++ products/patches/gmsh-4.10.3-windows.patch | 13 +++ 4 files changed, 227 insertions(+) create mode 100644 products/compil_scripts/gmsh-4.10.3.bat create mode 100755 products/compil_scripts/gmsh-4.10.3.sh create mode 100644 products/patches/gmsh-4.10.3-windows.patch diff --git a/products/compil_scripts/gmsh-4.10.3.bat b/products/compil_scripts/gmsh-4.10.3.bat new file mode 100644 index 0000000..2fbabf6 --- /dev/null +++ b/products/compil_scripts/gmsh-4.10.3.bat @@ -0,0 +1,124 @@ +@echo off + +echo ########################################################################## +echo gmsh %VERSION% +echo ########################################################################## + +IF NOT DEFINED SAT_DEBUG ( + SET SAT_DEBUG=0 +) + +SET PRODUCT_BUILD_TYPE=Release +SET BUILD_SHARED=ON +if %SAT_DEBUG% == 1 ( + set PRODUCT_BUILD_TYPE=Debug + set BUILD_SHARED=OFF +) + +if NOT exist "%PRODUCT_INSTALL%" mkdir %PRODUCT_INSTALL% +if NOT exist "%PRODUCT_INSTALL%\include" mkdir %PRODUCT_INSTALL%\include +if NOT exist "%PRODUCT_INSTALL%\bin" mkdir %PRODUCT_INSTALL%\bin + +REM clean BUILD directory +if exist "%BUILD_DIR%" rmdir /Q /S %BUILD_DIR% +mkdir %BUILD_DIR% + +cd %BUILD_DIR% +set CMAKE_OPTIONS=%CMAKE_OPTIONS% -DCMAKE_INSTALL_PREFIX:STRING=%PRODUCT_INSTALL:\=/% +set CMAKE_OPTIONS=%CMAKE_OPTIONS% -DCMAKE_BUILD_TYPE=%PRODUCT_BUILD_TYPE% +set CMAKE_OPTIONS=%CMAKE_OPTIONS% -DENABLE_BUILD_LIB=ON +set CMAKE_OPTIONS=%CMAKE_OPTIONS% -DENABLE_BUILD_SHARED=%BUILD_SHARED% +set CMAKE_OPTIONS=%CMAKE_OPTIONS% -DENABLE_BUILD_DYNAMIC=%BUILD_SHARED% +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 +set CMAKE_OPTIONS=%CMAKE_OPTIONS% -DENABLE_PARSER=ON +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_TESTS=OFF +set CMAKE_OPTIONS=%CMAKE_OPTIONS% -DENABLE_PLUGINS=OFF +set CMAKE_OPTIONS=%CMAKE_OPTIONS% -DCMAKE_GENERATOR:STRING="Visual Studio 15 2017 Win64" +set MSBUILDDISABLENODEREUSE=1 + +echo. +echo ********************************************************************* +echo *** %CMAKE_ROOT%\bin\cmake %CMAKE_OPTIONS% +echo ********************************************************************* +echo. + +%CMAKE_ROOT%\bin\cmake %CMAKE_OPTIONS% %SOURCE_DIR% +if NOT %ERRORLEVEL% == 0 ( + echo "ERROR on cmake" + exit 1 +) + +echo. +echo ********************************************************************* +echo *** msbuild %MAKE_OPTIONS% /p:Configuration=%PRODUCT_BUILD_TYPE% /p:Platform=x64 ALL_BUILD.vcxproj +echo ********************************************************************* +echo. + +msbuild %MAKE_OPTIONS% /p:Configuration=%PRODUCT_BUILD_TYPE% /p:Platform=x64 ALL_BUILD.vcxproj +if NOT %ERRORLEVEL% == 0 ( + echo ERROR on msbuild gmsh.vcxproj + exit 2 +) + +echo. +echo ********************************************************************* +echo *** installation... +echo ********************************************************************* +echo. + +msbuild %MAKE_OPTIONS% /p:Configuration=%PRODUCT_BUILD_TYPE% /p:Platform=x64 INSTALL.vcxproj +if NOT %ERRORLEVEL% == 0 ( + echo ERROR on msbuild INSTALL.vcxproj + exit 3 +) + +echo. +echo ********************************************************************* +echo *** installation Headers... +echo ********************************************************************* +echo. +msbuild /p:Configuration=%PRODUCT_BUILD_TYPE% /p:Platform=x64 /p:BuildProjectReferences=false get_headers.vcxproj +if NOT %ERRORLEVEL% == 0 ( + echo ERROR on msbuild get_headers.vcxproj + exit 4 +) + +copy /Y /B %BUILD_DIR%\%PRODUCT_BUILD_TYPE%\*.lib %PRODUCT_INSTALL%\bin +copy /Y /B %BUILD_DIR%\%PRODUCT_BUILD_TYPE%\*.exp %PRODUCT_INSTALL%\bin + +SETLOCAL ENABLEDELAYEDEXPANSION +FOR %%f IN (gmsh.h gmsh.h_cwrap gmshc.h) do ( + set X=%%f + copy /Y %SOURCE_DIR%\api\%%f %PRODUCT_INSTALL%\include\%X% +) +ENDLOCAL + +cd %BUILD_DIR%\Headers\gmsh +SETLOCAL ENABLEDELAYEDEXPANSION +FOR %%f IN (*.h) do ( + set X=%%f + copy /Y %SOURCE_DIR%\api\%%f %PRODUCT_INSTALL%\include\%X% +) +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 +if %SAT_DEBUG% == 0 ( + cp %PRODUCT_INSTALL%\lib\gmsh.dll %PRODUCT_INSTALL%\bin\gmsh.dll +) + +echo. +echo ########## END diff --git a/products/compil_scripts/gmsh-4.10.3.sh b/products/compil_scripts/gmsh-4.10.3.sh new file mode 100755 index 0000000..0bed6cb --- /dev/null +++ b/products/compil_scripts/gmsh-4.10.3.sh @@ -0,0 +1,79 @@ +#!/bin/bash + +echo "##########################################################################" +echo "gmsh" $VERSION +echo "##########################################################################" + + + +CMAKE_OPTIONS="" +# common settings +CMAKE_OPTIONS="${CMAKE_OPTIONS} -DCMAKE_INSTALL_PREFIX=${PRODUCT_INSTALL}" +CMAKE_OPTIONS="${CMAKE_OPTIONS} -DCMAKE_VERBOSE_MAKEFILE=ON" +CMAKE_OPTIONS="${CMAKE_OPTIONS} -DCMAKE_BUILD_TYPE=Release" +CMAKE_OPTIONS="${CMAKE_OPTIONS} -DENABLE_BUILD_SHARED=ON" + +# build options +echo "*** GMSH version $VERSION >= 4." +CMAKE_OPTIONS="${CMAKE_OPTIONS} -DENABLE_ACIS=OFF" +CMAKE_OPTIONS="${CMAKE_OPTIONS} -DENABLE_FLTK=OFF" +CMAKE_OPTIONS="${CMAKE_OPTIONS} -DENABLE_MED=OFF" +CMAKE_OPTIONS="${CMAKE_OPTIONS} -DENABLE_ONELAB_METAMODEL=OFF" +CMAKE_OPTIONS="${CMAKE_OPTIONS} -DENABLE_PARSER=ON" +CMAKE_OPTIONS="${CMAKE_OPTIONS} -DENABLE_PETSC=OFF" +CMAKE_OPTIONS="${CMAKE_OPTIONS} -DENABLE_PRIVATE_API=ON" +CMAKE_OPTIONS="${CMAKE_OPTIONS} -DENABLE_CGNS=OFF" # default value is set to ON in release 4.1.4 +CMAKE_OPTIONS="${CMAKE_OPTIONS} -DCMAKE_INSTALL_LIBDIR=${PRODUCT_INSTALL}/lib" # strangely on Ubuntu GMSH installs the .so in lib instead of lib/lib64 - so force to lib64 +CMAKE_OPTIONS="${CMAKE_OPTIONS} -DCMAKE_PREFIX_PATH=${LAPACK_ROOT_DIR}" # set path of third libraries to our associated internal products +CMAKE_OPTIONS="${CMAKE_OPTIONS} -DENABLE_OPENMP=ON" # get OpenMP based parallelism working +CMAKE_OPTIONS="${CMAKE_OPTIONS} -DENABLE_PLUGINS=OFF" # needed for correct GmshFinalize() after version 4.3.0 +if [[ $DIST_NAME == "FD" && $DIST_VERSION == "32" ]] +then + CMAKE_OPTIONS="${CMAKE_OPTIONS} -DENABLE_MMG3D=OFF" # removed anyhow in GMS 4.6 +fi + +echo "*** cmake" $CMAKE_OPTIONS +cmake $CMAKE_OPTIONS $SOURCE_DIR + +if [ $? -ne 0 ] +then + echo "ERROR on CMake" + exit 1 +fi + +echo +echo "*** make" $MAKE_OPTIONS +make $MAKE_OPTIONS +if [ $? -ne 0 ] +then + echo "ERROR on make" + exit 2 +fi + +echo +echo "*** make install" +make install +if [ $? -ne 0 ] +then + echo "ERROR on make install" + exit 3 +fi + +echo +if [ -n "$SALOME_GMSH_HEADERS_STD" ]; then + echo "Using standard directory structure" +else + echo "*** copy all .h in sources to install" + cp -f --backup=numbered `find $SOURCE_DIR -name "*.h"` $PRODUCT_INSTALL/include/ && \ + mv $PRODUCT_INSTALL/include/gmsh/* $PRODUCT_INSTALL/include/ && \ + rmdir $PRODUCT_INSTALL/include/gmsh/ + if [ $? -ne 0 ] + then + echo "ERROR on copy" + exit 4 + fi +fi + +echo +echo "########## END" + diff --git a/products/gmsh.pyconf b/products/gmsh.pyconf index ea75b6e..94edc97 100644 --- a/products/gmsh.pyconf +++ b/products/gmsh.pyconf @@ -30,6 +30,17 @@ default_win: } } +version_4_10_3: +{ + compil_script : "gmsh-4.10.3.sh" +} + +version_4_10_3_win: +{ + compil_script : "gmsh-4.10.3.bat" + patches: ['gmsh-4.10.3-windows.patch'] +} + version_4_8_4: { compil_script : "gmsh-4.8.4.sh" diff --git a/products/patches/gmsh-4.10.3-windows.patch b/products/patches/gmsh-4.10.3-windows.patch new file mode 100644 index 0000000..8ae2c4f --- /dev/null +++ b/products/patches/gmsh-4.10.3-windows.patch @@ -0,0 +1,13 @@ +diff -Naur gmsh_ref/CMakeLists.txt gmsh_new/CMakeLists.txt +--- gmsh_ref/CMakeLists.txt 2022-05-26 10:51:23.000000000 +0200 ++++ gmsh_new/CMakeLists.txt 2022-06-14 15:01:11.502544660 +0200 +@@ -1340,9 +1340,6 @@ + set_config_option(HAVE_OCC "OpenCASCADE") + list(APPEND EXTERNAL_LIBRARIES ${OCC_LIBS}) + list(APPEND EXTERNAL_INCLUDES ${OCC_INC}) +- if(WIN32 AND NOT MSVC) +- add_definitions(-DOCC_CONVERT_SIGNALS) +- endif() + endif() + endif() + -- 2.39.2