From e27b8c4792b79cd53b284fec34bfe6cd510ce5c8 Mon Sep 17 00:00:00 2001 From: Nabil Ghodbane Date: Mon, 25 Nov 2024 16:16:15 +0100 Subject: [PATCH] bos #43656: [EDF28716] Integration of MEDFile patch - Homard --- products/compil_scripts/med-4.1.1.bat | 93 ++++++ products/medfile.pyconf | 7 +- .../med-4.1.1-fix_symbol_export_Win.patch | 305 ++++++++++++++++++ 3 files changed, 403 insertions(+), 2 deletions(-) create mode 100644 products/compil_scripts/med-4.1.1.bat create mode 100644 products/patches/med-4.1.1-fix_symbol_export_Win.patch diff --git a/products/compil_scripts/med-4.1.1.bat b/products/compil_scripts/med-4.1.1.bat new file mode 100644 index 0000000..9cc8f9c --- /dev/null +++ b/products/compil_scripts/med-4.1.1.bat @@ -0,0 +1,93 @@ +@echo off + +echo ########################################################################## +echo med %VERSION% +echo ########################################################################## + +IF NOT DEFINED SAT_DEBUG ( + SET SAT_DEBUG=0 +) + +IF NOT DEFINED CMAKE_GENERATOR ( + SET CMAKE_GENERATOR="Visual Studio 15 2017" +) + +SET PRODUCT_BUILD_TYPE=Release +IF DEFINED SAT_CMAKE_BUILD_TYPE ( + SET PRODUCT_BUILD_TYPE=%SAT_CMAKE_BUILD_TYPE% +) + +if %SAT_DEBUG% == 1 ( + set PRODUCT_BUILD_TYPE=Debug +) + +if NOT exist "%PRODUCT_INSTALL%" mkdir %PRODUCT_INSTALL% +REM clean BUILD directory +if exist "%BUILD_DIR%" rmdir /Q /S %BUILD_DIR% +mkdir %BUILD_DIR% + +SET CMAKE_OPTIONS= +SET CMAKE_OPTIONS=%CMAKE_OPTIONS% -DCMAKE_INSTALL_PREFIX:STRING=%PRODUCT_INSTALL:\=/% +SET CMAKE_OPTIONS=%CMAKE_OPTIONS% -DCMAKE_BUILD_TYPE:STRING=%PRODUCT_BUILD_TYPE% +SET CMAKE_OPTIONS=%CMAKE_OPTIONS% -DMEDFILE_BUILD_STATIC_LIBS:BOOL=OFF +SET CMAKE_OPTIONS=%CMAKE_OPTIONS% -DMEDFILE_BUILD_SHARED_LIBS:BOOL=ON +SET CMAKE_OPTIONS=%CMAKE_OPTIONS% -DHDF5_ROOT_DIR:STRING=%HDF5_ROOT_DIR% +SET CMAKE_OPTIONS=%CMAKE_OPTIONS% -DCMAKE_IMPORT_LIBRARY_PREFIX="" +SET CMAKE_OPTIONS=%CMAKE_OPTIONS% -DCMAKE_IMPORT_LIBRARY_SUFFIX=".lib" +SET CMAKE_OPTIONS=%CMAKE_OPTIONS% -DCMAKE_Fortran_FLAGS="-fimplicit-none -i8" +if DEFINED SALOME_USE_64BIT_IDS ( + SET CMAKE_OPTIONS=%CMAKE_OPTIONS% -DMED_MEDINT_TYPE:STRING="long long" +) + +if DEFINED SAT_HPC ( + SET CMAKE_OPTIONS=%CMAKE_OPTIONS% -DMEDFILE_USE_MPI:BOOL=ON +) else ( + SET CMAKE_OPTIONS=%CMAKE_OPTIONS% -DMEDFILE_USE_MPI:BOOL=OFF +) + +SET CMAKE_OPTIONS=%CMAKE_OPTIONS% -G %CMAKE_GENERATOR% -A x64 + +cd %BUILD_DIR% + +echo. +echo -------------------------------------------------------------------------- +echo *** %CMAKE_ROOT%\bin\cmake %CMAKE_OPTIONS% %SOURCE_DIR% +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 -------------------------------------------------------------------------- + +msbuild %MAKE_OPTIONS% /p:Configuration=%PRODUCT_BUILD_TYPE% /p:Platform=x64 ALL_BUILD.vcxproj +if NOT %ERRORLEVEL% == 0 ( + echo ERROR on msbuild ALL_BUILD.vcxproj + exit 2 +) + +echo. +echo -------------------------------------------------------------------------- +echo *** msbuild %MAKE_OPTIONS% /p:Configuration=%PRODUCT_BUILD_TYPE% /p:Platform=x64 INSTALL.vcxproj +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 +) + +REM rename documentation directory +cd %PRODUCT_INSTALL%\share\doc +mv med-fichier* med + +taskkill /F /IM "mspdbsrv.exe" + + +echo. +echo ########## END diff --git a/products/medfile.pyconf b/products/medfile.pyconf index 182766c..4b0847e 100644 --- a/products/medfile.pyconf +++ b/products/medfile.pyconf @@ -41,8 +41,11 @@ version_4_1_1 : version_4_1_1_win : { - compil_script : "medCMake.bat" - patches : ['med-4.1.0_win_3x_files_support.patch', 'med-4.1.1-symlink-or-copy.patch'] + compil_script : "med-4.1.1.bat" + patches : ['med-4.1.0_win_3x_files_support.patch', + 'med-4.1.1-symlink-or-copy.patch', + 'med-4.1.1-fix_symbol_export_Win.patch' + ] properties : { incremental : "yes" diff --git a/products/patches/med-4.1.1-fix_symbol_export_Win.patch b/products/patches/med-4.1.1-fix_symbol_export_Win.patch new file mode 100644 index 0000000..3440059 --- /dev/null +++ b/products/patches/med-4.1.1-fix_symbol_export_Win.patch @@ -0,0 +1,305 @@ +--- med-4.1.1/src/CMakeLists.txt 2024-09-04 10:56:33.719528869 +0200 ++++ med-4.1.1_update/src/CMakeLists.txt 2024-09-05 13:34:58.928896824 +0200 +@@ -1,151 +1,151 @@ +-INCLUDE_DIRECTORIES( +- ${HDF5_INCLUDE_DIRS} +- ${MPI_INCLUDE_DIRS}) +- +-# On Win platform, we need to make sure symbols are properly exported in +-# the intermediary OBJECT targes built in the sub-directories: +-# The definition "-D_EXPORTS" is normally added automatically by CMake +-# when building Win DLL, +-# but this doesn't work when using intermediary targets (ADD_LIBRARY(... OBJECT ...) +-IF(WIN32) +- ADD_DEFINITIONS(-DmedC_EXPORTS) +-ENDIF() +- +-# Specific include logic - see CMakeLists.txt inside: +-ADD_SUBDIRECTORY("2.3.6") +- +-# Important: the following include comes AFTER the subdirectory 2.3.6 +-# to ensure the include works properly (2.3.6 includes are specific) +-INCLUDE_DIRECTORIES(${PROJECT_BINARY_DIR}/include +- ${PROJECT_SOURCE_DIR}/include) +- +-# Get pure C intermediary targets: +-ADD_SUBDIRECTORY(hdfi) +-ADD_SUBDIRECTORY(ci) +-ADD_SUBDIRECTORY(misc) +- +-IF(CMAKE_Fortran_COMPILER_WORKS) +- # Build intermediate targets _cfi, _cfi_static and _fi: +- ADD_SUBDIRECTORY(cfi) +- ADD_SUBDIRECTORY(fi) +- +- SET(medfort_wrap_SOURCES +- MEDiteratorsF.f +- $ +- $ +- $ +- $ +- ) +- +- SET(medfort_static_wrap_SOURCES +- MEDiteratorsF.f +- $ +- $ +- $ +- $ +- ) +-ENDIF() +- +-SET(medC_SOURCES +- MEDiterators.c +- $ +- $ +- $ +- $ +- $ +- $ +- $ +-) +- +-SET(medC_static_SOURCES +- MEDiterators.c +- $ +- $ +- $ +- $ +- $ +- $ +- $ +-) +- +-########################### Pure C stuff ################################### +-############################################################################ +- +-### Installation preparation: +-SET(_export_group "medfileTargets") +- +-######### Shared Libraries ########## +-IF(MEDFILE_BUILD_SHARED_LIBS) +- ADD_LIBRARY(medC SHARED ${medC_SOURCES}) +- SET_TARGET_PROPERTIES(medC PROPERTIES +- SOVERSION 11 +- VERSION 11.1.1) +- TARGET_LINK_LIBRARIES(medC ${HDF5_LIBS} ${MPI_LIBS}) +- MED_SET_DEFINITIONS(medC NOGDI) +- +- INSTALL(TARGETS medC EXPORT ${_export_group} DESTINATION lib${LIB_SUFFIX}) +-ENDIF() +- +-######### Static Libraries ########## +-## +-## Target names are suffixed with "_static" but file +-## names remain the same. +- +-IF(MEDFILE_BUILD_STATIC_LIBS) +- ADD_LIBRARY(medC_static STATIC ${medC_SOURCES}) +- SET_TARGET_PROPERTIES(medC_static PROPERTIES OUTPUT_NAME medC) +- TARGET_LINK_LIBRARIES(medC_static ${HDF5_LIBS} ${MPI_LIBS}) +- MED_SET_DEFINITIONS(medC_static NOGDI) +- +- INSTALL(TARGETS medC_static EXPORT ${_export_group} DESTINATION lib${LIB_SUFFIX}) +-ENDIF() +- +-########################### Fortran stuff ################################### +-############################################################################# +-IF(CMAKE_Fortran_COMPILER_WORKS) +- +- ######### Shared Libraries ########## +- IF(MEDFILE_BUILD_SHARED_LIBS) +- ## Intermediate library - this is unavoidable +- ## if we want the Fortran wrapper to build correctly under win. +- ADD_LIBRARY(medfwrap SHARED ${medfort_wrap_SOURCES}) +- SET_TARGET_PROPERTIES(medfwrap PROPERTIES +- SOVERSION 11 +- VERSION 11.1.1) +- TARGET_LINK_LIBRARIES(medfwrap medC) +- INSTALL(TARGETS medfwrap EXPORT ${_export_group} DESTINATION lib${LIB_SUFFIX}) +- +- # Add Shared MED library +- ADD_LIBRARY(med SHARED MEDiterators.c) +- SET_TARGET_PROPERTIES(med PROPERTIES +- SOVERSION 11 +- VERSION 11.1.1) +- TARGET_LINK_LIBRARIES(medfwrap medC) +- TARGET_LINK_LIBRARIES(med medfwrap) +- +- # Install only the resulting library: +- INSTALL(TARGETS med EXPORT ${_export_group} DESTINATION lib${LIB_SUFFIX}) +- ENDIF() +- +- ######### Static Libraries ########## +- ## +- ## Target names are suffixed with "_static" but file +- ## names remain the same. +- IF(MEDFILE_BUILD_STATIC_LIBS) +- ## Intermediate library - this is unavoidable +- ## if we want the Fortran wrapper to build correctly under win. +- ADD_LIBRARY(medfwrap_static STATIC ${medfort_wrap_SOURCES}) +- SET_TARGET_PROPERTIES(medfwrap_static PROPERTIES OUTPUT_NAME medfwrap) +- TARGET_LINK_LIBRARIES(medfwrap_static medC_static) +- INSTALL(TARGETS medfwrap_static EXPORT ${_export_group} DESTINATION lib${LIB_SUFFIX}) +- +- # Add Static MED library +- ADD_LIBRARY(med_static STATIC MEDiterators.c) +- SET_TARGET_PROPERTIES(med_static PROPERTIES OUTPUT_NAME med) +- TARGET_LINK_LIBRARIES(med_static medfwrap_static) +- +- # Install only the resulting library: +- INSTALL(TARGETS med_static EXPORT ${_export_group} DESTINATION lib${LIB_SUFFIX}) +- ENDIF() +- +-ENDIF(CMAKE_Fortran_COMPILER_WORKS) ++INCLUDE_DIRECTORIES( ++ ${HDF5_INCLUDE_DIRS} ++ ${MPI_INCLUDE_DIRS}) ++SET(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS ON) ++# On Win platform, we need to make sure symbols are properly exported in ++# the intermediary OBJECT targes built in the sub-directories: ++# The definition "-D_EXPORTS" is normally added automatically by CMake ++# when building Win DLL, ++# but this doesn't work when using intermediary targets (ADD_LIBRARY(... OBJECT ...) ++IF(WIN32) ++ ADD_DEFINITIONS(-DmedC_EXPORTS) ++ENDIF() ++ ++# Specific include logic - see CMakeLists.txt inside: ++ADD_SUBDIRECTORY("2.3.6") ++ ++# Important: the following include comes AFTER the subdirectory 2.3.6 ++# to ensure the include works properly (2.3.6 includes are specific) ++INCLUDE_DIRECTORIES(${PROJECT_BINARY_DIR}/include ++ ${PROJECT_SOURCE_DIR}/include) ++ ++# Get pure C intermediary targets: ++ADD_SUBDIRECTORY(hdfi) ++ADD_SUBDIRECTORY(ci) ++ADD_SUBDIRECTORY(misc) ++ ++IF(CMAKE_Fortran_COMPILER_WORKS) ++ # Build intermediate targets _cfi, _cfi_static and _fi: ++ ADD_SUBDIRECTORY(cfi) ++ ADD_SUBDIRECTORY(fi) ++ ++ SET(medfort_wrap_SOURCES ++ MEDiteratorsF.f ++ $ ++ $ ++ $ ++ $ ++ ) ++ ++ SET(medfort_static_wrap_SOURCES ++ MEDiteratorsF.f ++ $ ++ $ ++ $ ++ $ ++ ) ++ENDIF() ++ ++SET(medC_SOURCES ++ MEDiterators.c ++ $ ++ $ ++ $ ++ $ ++ $ ++ $ ++ $ ++) ++ ++SET(medC_static_SOURCES ++ MEDiterators.c ++ $ ++ $ ++ $ ++ $ ++ $ ++ $ ++ $ ++) ++ ++########################### Pure C stuff ################################### ++############################################################################ ++ ++### Installation preparation: ++SET(_export_group "medfileTargets") ++ ++######### Shared Libraries ########## ++IF(MEDFILE_BUILD_SHARED_LIBS) ++ ADD_LIBRARY(medC SHARED ${medC_SOURCES}) ++ SET_TARGET_PROPERTIES(medC PROPERTIES ++ SOVERSION 11 ++ VERSION 11.1.1) ++ TARGET_LINK_LIBRARIES(medC ${HDF5_LIBS} ${MPI_LIBS}) ++ MED_SET_DEFINITIONS(medC NOGDI) ++ ++ INSTALL(TARGETS medC EXPORT ${_export_group} DESTINATION lib${LIB_SUFFIX}) ++ENDIF() ++ ++######### Static Libraries ########## ++## ++## Target names are suffixed with "_static" but file ++## names remain the same. ++ ++IF(MEDFILE_BUILD_STATIC_LIBS) ++ ADD_LIBRARY(medC_static STATIC ${medC_SOURCES}) ++ SET_TARGET_PROPERTIES(medC_static PROPERTIES OUTPUT_NAME medC) ++ TARGET_LINK_LIBRARIES(medC_static ${HDF5_LIBS} ${MPI_LIBS}) ++ MED_SET_DEFINITIONS(medC_static NOGDI) ++ ++ INSTALL(TARGETS medC_static EXPORT ${_export_group} DESTINATION lib${LIB_SUFFIX}) ++ENDIF() ++ ++########################### Fortran stuff ################################### ++############################################################################# ++IF(CMAKE_Fortran_COMPILER_WORKS) ++ ++ ######### Shared Libraries ########## ++ IF(MEDFILE_BUILD_SHARED_LIBS) ++ ## Intermediate library - this is unavoidable ++ ## if we want the Fortran wrapper to build correctly under win. ++ ADD_LIBRARY(medfwrap SHARED ${medfort_wrap_SOURCES}) ++ SET_TARGET_PROPERTIES(medfwrap PROPERTIES ++ SOVERSION 11 ++ VERSION 11.1.1) ++ TARGET_LINK_LIBRARIES(medfwrap medC) ++ INSTALL(TARGETS medfwrap EXPORT ${_export_group} DESTINATION lib${LIB_SUFFIX}) ++ ++ # Add Shared MED library ++ ADD_LIBRARY(med SHARED MEDiterators.c) ++ SET_TARGET_PROPERTIES(med PROPERTIES ++ SOVERSION 11 ++ VERSION 11.1.1) ++ TARGET_LINK_LIBRARIES(medfwrap medC) ++ TARGET_LINK_LIBRARIES(med medfwrap) ++ ++ # Install only the resulting library: ++ INSTALL(TARGETS med EXPORT ${_export_group} DESTINATION lib${LIB_SUFFIX}) ++ ENDIF() ++ ++ ######### Static Libraries ########## ++ ## ++ ## Target names are suffixed with "_static" but file ++ ## names remain the same. ++ IF(MEDFILE_BUILD_STATIC_LIBS) ++ ## Intermediate library - this is unavoidable ++ ## if we want the Fortran wrapper to build correctly under win. ++ ADD_LIBRARY(medfwrap_static STATIC ${medfort_wrap_SOURCES}) ++ SET_TARGET_PROPERTIES(medfwrap_static PROPERTIES OUTPUT_NAME medfwrap) ++ TARGET_LINK_LIBRARIES(medfwrap_static medC_static) ++ INSTALL(TARGETS medfwrap_static EXPORT ${_export_group} DESTINATION lib${LIB_SUFFIX}) ++ ++ # Add Static MED library ++ ADD_LIBRARY(med_static STATIC MEDiterators.c) ++ SET_TARGET_PROPERTIES(med_static PROPERTIES OUTPUT_NAME med) ++ TARGET_LINK_LIBRARIES(med_static medfwrap_static) ++ ++ # Install only the resulting library: ++ INSTALL(TARGETS med_static EXPORT ${_export_group} DESTINATION lib${LIB_SUFFIX}) ++ ENDIF() ++ ++ENDIF(CMAKE_Fortran_COMPILER_WORKS) -- 2.39.2