Skip to content

Commit

Permalink
Add med libraries
Browse files Browse the repository at this point in the history
  • Loading branch information
jschueller committed Jul 12, 2023
1 parent 1ed4303 commit c5fc771
Show file tree
Hide file tree
Showing 8 changed files with 422 additions and 0 deletions.
26 changes: 26 additions & 0 deletions recipes/salome-med/bld.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@

git clone --depth 1 -b V9_11_0 https://git.salome-platform.org/gitpub/tools/configuration.git ${RECIPE_DIR}/configuration

mkdir build && cd build
cmake -LAH -G "Ninja" ^
-DCMAKE_BUILD_TYPE=Release ^
-DCMAKE_PREFIX_PATH="%LIBRARY_PREFIX%" ^
-DCMAKE_INSTALL_PREFIX="%LIBRARY_PREFIX%" ^
-DCMAKE_C_FLAGS="-DH5_USE_110_API" ^
-DCMAKE_CXX_FLAGS="-DH5_USE_110_API" ^
-DPYTHON_EXECUTABLE="%PREFIX%"/python.exe ^
-DMEDFILE_BUILD_TESTS=OFF ^
-DMEDFILE_INSTALL_DOC=OFF ^
-DMEDFILE_BUILD_PYTHON=ON ^
-DCONFIGURATION_ROOT_DIR=%RECIPE_DIR%/configuration ^
..
if errorlevel 1 exit 1

cmake --build . --target install --config Release
if errorlevel 1 exit 1

del %LIBRARY_PREFIX%\bin\*mdump*
xcopy /y /s /f %LIBRARY_PREFIX%\lib\*.dll %LIBRARY_PREFIX%\bin
mkdir %PREFIX%\Lib\site-packages\med
xcopy /y /s /f %LIBRARY_PREFIX%\lib\python%PY_VER%\site-packages\med\* %PREFIX%\Lib\site-packages\med
xcopy /y /s /f %LIBRARY_PREFIX%\lib\*.dll %PREFIX%\Lib\site-packages\med
19 changes: 19 additions & 0 deletions recipes/salome-med/build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#!/bin/sh

export CPPFLAGS="-DH5_USE_110_API ${CPPFLAGS}"

mkdir build && cd build

cmake ${CMAKE_ARGS} -LAH -G "Ninja" \
-DCMAKE_PREFIX_PATH=${PREFIX} \
-DCMAKE_FIND_FRAMEWORK=NEVER \
-DCMAKE_INSTALL_PREFIX=${PREFIX} \
-DCMAKE_INSTALL_RPATH="${PREFIX}/lib" \
-DPYTHON_EXECUTABLE=${PREFIX}/bin/python \
-DPYTHON_INCLUDE_DIR=${PREFIX}/include/python${PY_VER} \
-DPYTHON_LIBRARY=${PREFIX}/lib/libpython${PY_VER}${SHLIB_EXT} \
-DMEDFILE_BUILD_TESTS=OFF \
-DMEDFILE_INSTALL_DOC=OFF \
-DMEDFILE_BUILD_PYTHON=ON \
..
cmake --build . --target install
189 changes: 189 additions & 0 deletions recipes/salome-med/hdf5-1.12.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,189 @@
diff -rupN med-4.1.0/config/cmake_files/medMacros.cmake med-4.1.0-new/config/cmake_files/medMacros.cmake
--- med-4.1.0/config/cmake_files/medMacros.cmake 2021-12-03 09:35:30.675827163 +0100
+++ med-4.1.0-new/config/cmake_files/medMacros.cmake 2021-12-03 09:32:31.894994147 +0100
@@ -447,7 +447,7 @@ MACRO(MED_FIND_HDF5)
##
## Requires 1.10.x version
##
- IF (NOT HDF_VERSION_MAJOR_REF EQUAL 1 OR NOT HDF_VERSION_MINOR_REF EQUAL 10 OR NOT HDF_VERSION_RELEASE_REF GREATER 1)
+ IF (HDF5_VERSION VERSION_LESS 1.10.2)
MESSAGE(FATAL_ERROR "HDF5 version is ${HDF_VERSION_REF}. Only versions >= 1.10.2 are supported.")
ENDIF()
##
diff -rupN med-4.1.0/src/ci/MEDfileCompatibility.c med-4.1.0-new/src/ci/MEDfileCompatibility.c
--- med-4.1.0/src/ci/MEDfileCompatibility.c 2021-12-03 09:35:30.676827162 +0100
+++ med-4.1.0-new/src/ci/MEDfileCompatibility.c 2021-12-03 09:33:26.292942149 +0100
@@ -71,7 +71,7 @@ MEDfileCompatibility(const char* const f
_hversionMMR=10000*_hmajeur+100*_hmineur+_hrelease;
/* ISCRUTE(_hversionMMR); */
/* ISCRUTE(HDF_VERSION_NUM_REF); */
- if ( (_hversionMMR >= HDF_VERSION_NUM_REF) && (_hmineur == HDF_VERSION_MINOR_REF) ) *hdfok = MED_TRUE;
+ if (_hversionMMR >= HDF_VERSION_NUM_REF) *hdfok = MED_TRUE;

/* TODO : Vérifier si la version mineure HDF du fichier est supérieure
à la version mineure de la bibliothèque HDF utilisée :
@@ -113,7 +113,7 @@ MEDfileCompatibility(const char* const f
#if MED_NUM_MAJEUR != 4
#error "Don't forget to update the test version here when you change the major version of the library !"
#endif
-#if H5_VERS_MINOR > 10
+#if H5_VERS_MINOR > 14
#error "Don't forget to check the compatibility version of the library, depending on the internal hdf model choice !"
#error "Cf. _MEDfileCreate ..."
#endif
diff -rupN med-4.1.0/src/hdfi/_MEDattributeNumWrByName.c med-4.1.0-new/src/hdfi/_MEDattributeNumWrByName.c
--- med-4.1.0/src/hdfi/_MEDattributeNumWrByName.c 2020-03-11 10:36:37.000000000 +0100
+++ med-4.1.0-new/src/hdfi/_MEDattributeNumWrByName.c 2021-12-03 09:33:08.851958696 +0100
@@ -68,7 +68,7 @@ med_err _MEDattributeNumWrByName(med_idt

if ( (_attid=H5Aopen_by_name( pid, path, attname, H5P_DEFAULT, H5P_DEFAULT )) >= 0 ) {

- if ( H5Oget_info( pid, &_oinfo ) <0) {
+ if ( H5Oget_info( pid, &_oinfo, H5O_INFO_ALL ) <0) {
MED_ERR_(_ret,MED_ERR_CALL,MED_ERR_API,"H5Oget_info");
goto ERROR;
}
diff -rupN med-4.1.0/src/hdfi/_MEDattributeNumWr.c med-4.1.0-new/src/hdfi/_MEDattributeNumWr.c
--- med-4.1.0/src/hdfi/_MEDattributeNumWr.c 2020-03-11 10:36:37.000000000 +0100
+++ med-4.1.0-new/src/hdfi/_MEDattributeNumWr.c 2021-12-03 09:33:11.840955852 +0100
@@ -77,7 +77,7 @@ med_err _MEDattributeNumWr(med_idt pid,

if ( (_attid=H5Aopen( pid, attname, H5P_DEFAULT )) >= 0 ) {

- if ( H5Oget_info( pid, &_oinfo ) <0) {
+ if ( H5Oget_info( pid, &_oinfo, H5O_INFO_ALL ) <0) {
MED_ERR_(_ret,MED_ERR_CALL,MED_ERR_API,"H5Oget_info");
goto ERROR;
}
diff -rupN med-4.1.0/src/hdfi/_MEDcheckAttributeStringFunc.c med-4.1.0-new/src/hdfi/_MEDcheckAttributeStringFunc.c
--- med-4.1.0/src/hdfi/_MEDcheckAttributeStringFunc.c 2020-03-11 10:36:37.000000000 +0100
+++ med-4.1.0-new/src/hdfi/_MEDcheckAttributeStringFunc.c 2021-12-03 09:33:14.266953546 +0100
@@ -40,7 +40,7 @@ med_err _MEDcheckAttributeStringFunc(med
oinfo.type=H5G_LINK;
break;
case H5L_TYPE_HARD:
- if ( H5Oget_info_by_name( id, lname, &oinfo, H5P_DEFAULT ) <0) {
+ if ( H5Oget_info_by_name( id, lname, &oinfo, H5O_INFO_ALL, H5P_DEFAULT ) <0) {
MED_ERR_(_ret,MED_ERR_CALL,MED_ERR_API,"H5Oget_info_by_name");
SSCRUTE(lname);
}
diff -rupN med-4.1.0/src/hdfi/_MEDchecknSublinkFunc.c med-4.1.0-new/src/hdfi/_MEDchecknSublinkFunc.c
--- med-4.1.0/src/hdfi/_MEDchecknSublinkFunc.c 2020-03-11 10:36:36.000000000 +0100
+++ med-4.1.0-new/src/hdfi/_MEDchecknSublinkFunc.c 2021-12-03 09:33:16.487951437 +0100
@@ -41,7 +41,7 @@ med_err _MEDchecknSublinkFunc(med_idt id
oinfo.type=H5G_LINK;
break;
case H5L_TYPE_HARD:
- if ( H5Oget_info_by_name( id, lname, &oinfo, H5P_DEFAULT ) <0) {
+ if ( H5Oget_info_by_name( id, lname, &oinfo, H5O_INFO_ALL, H5P_DEFAULT ) <0) {
MED_ERR_(_ret,MED_ERR_CALL,MED_ERR_API,"H5Oget_info_by_name");
SSCRUTE(lname);
}
diff -rupN med-4.1.0/src/hdfi/_MEDdatagroupExist.c med-4.1.0-new/src/hdfi/_MEDdatagroupExist.c
--- med-4.1.0/src/hdfi/_MEDdatagroupExist.c 2020-03-11 10:36:37.000000000 +0100
+++ med-4.1.0-new/src/hdfi/_MEDdatagroupExist.c 2021-12-03 09:33:18.742949298 +0100
@@ -45,7 +45,7 @@ med_err _MEDdatagroupExist(const med_idt

case H5L_TYPE_HARD:
*isasoftlink = MED_FALSE;
- if ( H5Oget_info_by_name( gid, datagroupname, &_oinfo, H5P_DEFAULT ) <0) {
+ if ( H5Oget_info_by_name( gid, datagroupname, &_oinfo, H5O_INFO_ALL, H5P_DEFAULT ) <0) {
MED_ERR_(_ret,MED_ERR_CALL,MED_ERR_API,"H5Oget_info_by_name");
SSCRUTE( datagroupname);
}
diff -rupN med-4.1.0/src/hdfi/_MEDdatasetExist.c med-4.1.0-new/src/hdfi/_MEDdatasetExist.c
--- med-4.1.0/src/hdfi/_MEDdatasetExist.c 2020-03-11 10:36:37.000000000 +0100
+++ med-4.1.0-new/src/hdfi/_MEDdatasetExist.c 2021-12-03 09:33:24.158944167 +0100
@@ -47,7 +47,7 @@ med_err _MEDdatasetExist(const med_idt

case H5L_TYPE_HARD:
*isasoftlink = MED_FALSE;
- if ( H5Oget_info_by_name( gid, datasetname, &_oinfo, H5P_DEFAULT ) <0) {
+ if ( H5Oget_info_by_name( gid, datasetname, &_oinfo, H5O_INFO_ALL, H5P_DEFAULT ) <0) {
MED_ERR_(_ret,MED_ERR_CALL,MED_ERR_API,"H5Oget_info_by_name");
SSCRUTE( datasetname);
}
diff -rupN med-4.1.0/src/hdfi/_MEDfileCreate.c med-4.1.0-new/src/hdfi/_MEDfileCreate.c
--- med-4.1.0/src/hdfi/_MEDfileCreate.c 2021-12-03 09:35:30.677827161 +0100
+++ med-4.1.0-new/src/hdfi/_MEDfileCreate.c 2021-12-03 09:32:31.894994147 +0100
@@ -159,7 +159,7 @@ med_idt _MEDfileCreate(const char * cons
* En HDF5-1.10.0p1 cela n'a aucun effet !
* Un test autoconf permet de fixer un intervalle de version HDF à MED.
*/
-#if H5_VERS_MINOR > 10
+#if H5_VERS_MINOR > 14
#error "Don't forget to change the compatibility version of the library !"
#endif

diff -rupN med-4.1.0/src/hdfi/_MEDfileOpen.c med-4.1.0-new/src/hdfi/_MEDfileOpen.c
--- med-4.1.0/src/hdfi/_MEDfileOpen.c 2021-12-03 09:35:30.677827161 +0100
+++ med-4.1.0-new/src/hdfi/_MEDfileOpen.c 2021-12-03 09:32:31.894994147 +0100
@@ -72,7 +72,7 @@ med_idt _MEDfileOpen(const char * const

• The creation order tracking property, H5P_CRT_ORDER_TRACKED, has been set in the group creation property list (see H5Pset_link_creation_order).
*/
-#if H5_VERS_MINOR > 10
+#if H5_VERS_MINOR > 14
#error "Don't forget to change the compatibility version of the library !"
#endif
/* L'avantage de bloquer le modèle interne HDF5
diff -rupN med-4.1.0/src/hdfi/_MEDlinkObjs.c med-4.1.0-new/src/hdfi/_MEDlinkObjs.c
--- med-4.1.0/src/hdfi/_MEDlinkObjs.c 2020-03-11 10:36:37.000000000 +0100
+++ med-4.1.0-new/src/hdfi/_MEDlinkObjs.c 2021-12-03 09:33:21.096947067 +0100
@@ -62,7 +62,7 @@ med_err _MEDlinkobjs(med_idt id,const ch
sur un lien hard
Sur un lien soft H5O_TYPE_UNKNOWN
*/
- if ( H5Oget_info_by_name( id, lname, &oinfo, H5P_DEFAULT ) <0) {
+ if ( H5Oget_info_by_name( id, lname, &oinfo, H5O_INFO_ALL, H5P_DEFAULT ) <0) {
MED_ERR_(_ret,MED_ERR_CALL,MED_ERR_API,"H5Oget_info_by_name");
SSCRUTE(lname);
}
diff -rupN med-4.1.0/src/hdfi/_MEDmemFileOpen.c med-4.1.0-new/src/hdfi/_MEDmemFileOpen.c
--- med-4.1.0/src/hdfi/_MEDmemFileOpen.c 2021-12-03 09:35:30.678827160 +0100
+++ med-4.1.0-new/src/hdfi/_MEDmemFileOpen.c 2021-12-03 09:32:31.894994147 +0100
@@ -434,7 +434,7 @@ med_idt _MEDmemFileOpen(const char * con
goto ERROR;
}

-#if H5_VERS_MINOR > 10
+#if H5_VERS_MINOR > 14
#error "Don't forget to change the compatibility version of the library !"
#endif
if ( H5Pset_libver_bounds( _fapl, H5F_LIBVER_18, H5F_LIBVER_18) ) {
diff -rupN med-4.1.0/src/hdfi/_MEDparFileCreate.c med-4.1.0-new/src/hdfi/_MEDparFileCreate.c
--- med-4.1.0/src/hdfi/_MEDparFileCreate.c 2021-12-03 09:35:30.678827160 +0100
+++ med-4.1.0-new/src/hdfi/_MEDparFileCreate.c 2021-12-03 09:32:31.894994147 +0100
@@ -64,7 +64,7 @@ med_idt _MEDparFileCreate(const char * c
* En HDF5-1.10.0p1 cela n'a aucun effet !
* Un test autoconf permet de fixer un intervalle de version HDF à MED.
*/
-#if H5_VERS_MINOR > 10
+#if H5_VERS_MINOR > 14
#error "Don't forget to change the compatibility version of the library !"
#endif

diff -rupN med-4.1.0/src/hdfi/_MEDparFileOpen.c med-4.1.0-new/src/hdfi/_MEDparFileOpen.c
--- med-4.1.0/src/hdfi/_MEDparFileOpen.c 2021-12-03 09:35:30.679827159 +0100
+++ med-4.1.0-new/src/hdfi/_MEDparFileOpen.c 2021-12-03 09:32:31.894994147 +0100
@@ -55,7 +55,7 @@ med_idt _MEDparFileOpen(const char * con
MED_ERR_(_fid,MED_ERR_INIT,MED_ERR_PROPERTY,MED_ERR_PARALLEL_MSG);
goto ERROR;
}
-#if H5_VERS_MINOR > 10
+#if H5_VERS_MINOR > 14
#error "Don't forget to change the compatibility version of the library !"
#endif
if ( H5Pset_libver_bounds( _fapl, H5F_LIBVER_18, H5F_LIBVER_18 ) ) {
diff -rupN med-4.1.0/tools/medimport/2.3.6/_MEDconvertStringDatasets.c med-4.1.0-new/tools/medimport/2.3.6/_MEDconvertStringDatasets.c
--- med-4.1.0/tools/medimport/2.3.6/_MEDconvertStringDatasets.c 2020-03-11 10:36:40.000000000 +0100
+++ med-4.1.0-new/tools/medimport/2.3.6/_MEDconvertStringDatasets.c 2021-12-03 09:34:42.715870908 +0100
@@ -52,7 +52,7 @@ med_err _MEDconvertStringDatasets(med_id
oinfo.type=(H5O_type_t) H5G_LINK;
break;
case H5L_TYPE_HARD:
- if ( H5Oget_info_by_name( id, lname, &oinfo, H5P_DEFAULT ) <0) {
+ if ( H5Oget_info_by_name( id, lname, &oinfo, H5O_INFO_ALL, H5P_DEFAULT ) <0) {
MED_ERR_(_ret,MED_ERR_CALL,MED_ERR_API,"H5Oget_info_by_name");
SSCRUTE(lname);
}
14 changes: 14 additions & 0 deletions recipes/salome-med/interp_libs.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 9eceab7..62cad56 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -113,8 +113,8 @@ MED_FIND_MPI()
IF(MEDFILE_BUILD_PYTHON)
FIND_PACKAGE(SWIG REQUIRED)
INCLUDE(${SWIG_USE_FILE})
- FIND_PACKAGE(PythonLibs REQUIRED)
FIND_PACKAGE(PythonInterp REQUIRED) # to get version string ...
+ FIND_PACKAGE(PythonLibs REQUIRED)
ENDIF()

## Creation of files med_config.h.cmake
49 changes: 49 additions & 0 deletions recipes/salome-med/meta.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
{% set version = "4.1.1" %}

package:
name: salome-med
version: {{ version }}

source:
url: https://files.salome-platform.org/Salome/other/med-{{ version }}.tar.gz
sha256: dc2b5d54ebf0666e3ff2e974041d2ab0da906061323537023ab165d573389dd0
patches:
- hdf5-1.12.patch
# PythonInterp before PythonLibs, see:
# https://cmake.org/cmake/help/latest/module/FindPythonInterp.html
- interp_libs.patch
build:
number: 0
run_exports:
- {{ pin_subpackage('salome-med', max_pin='x.x') }}

requirements:
build:
- cmake
- ninja
- swig
- {{ compiler('c') }}
- {{ compiler('cxx') }}
- {{ compiler('fortran') }} # [unix]
- python # [build_platform != target_platform]
- cross-python_{{ target_platform }} # [build_platform != target_platform]
host:
- python
- hdf5
run:
- python

test:
imports:
- med

about:
home: https://www.salome-platform.org/downloads
license: LGPL-3.0-or-later
license_family: LGPL
license_file: COPYING.LESSER
summary: MED file library from Salome platform

extra:
recipe-maintainers:
- jschueller
39 changes: 39 additions & 0 deletions recipes/salome-medcoupling/bld.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
git clone --depth 1 -b V9_11_0 https://git.salome-platform.org/gitpub/tools/configuration.git %SRC_DIR%/configuration

git clone --depth 1 -b V9_11_0 https://git.salome-platform.org/gitpub/tools/medcoupling.git && cd medcoupling

mkdir build && cd build
cmake -LAH -G "Ninja" ^
-DCMAKE_BUILD_TYPE=Release ^
-DCMAKE_PREFIX_PATH="%LIBRARY_PREFIX%" ^
-DCMAKE_INSTALL_PREFIX="%LIBRARY_PREFIX%" ^
-DCMAKE_CXX_FLAGS="/bigobj" ^
-DPYTHON_EXECUTABLE="%PYTHON%" ^
-DPYTHONINTERP_ROOT_DIR="%PREFIX%" ^
-DPYTHONLIBS_ROOT_DIR="%PREFIX%" ^
-DPYTHON_ROOT_DIR="%PREFIX%" ^
-DMEDCOUPLING_BUILD_DOC=OFF ^
-DMEDCOUPLING_BUILD_TESTS=OFF ^
-DMEDCOUPLING_PARTITIONER_SCOTCH=OFF ^
-DMEDCOUPLING_USE_64BIT_IDS=OFF ^
-DCONFIGURATION_ROOT_DIR=%SRC_DIR%/configuration ^
..
if errorlevel 1 exit 1

cmake --build . --target install --config Release
if errorlevel 1 exit 1

rem xcopy /y /s /f %LIBRARY_PREFIX%\lib\*.dll %LIBRARY_PREFIX%\bin
xcopy /y /s /f %LIBRARY_PREFIX%\lib\interpkernel.dll %SP_DIR%
xcopy /y /s /f %LIBRARY_PREFIX%\lib\medcoupling.dll %SP_DIR%
xcopy /y /s /f %LIBRARY_PREFIX%\lib\medcouplingremapper.dll %SP_DIR%
xcopy /y /s /f %LIBRARY_PREFIX%\lib\medicoco.dll %SP_DIR%
xcopy /y /s /f %LIBRARY_PREFIX%\lib\medloader.dll %SP_DIR%
xcopy /y /s /f %LIBRARY_PREFIX%\lib\renumbercpp.dll %SP_DIR%
xcopy /y /s /f %LIBRARY_PREFIX%\lib\medpartitionercpp.dll %SP_DIR%
xcopy /y /s /f %LIBRARY_PREFIX%\lib\python%PY_VER%\site-packages\Case*.py %SP_DIR%
xcopy /y /s /f %LIBRARY_PREFIX%\lib\python%PY_VER%\site-packages\VTKReader.py %SP_DIR%
xcopy /y /s /f %LIBRARY_PREFIX%\lib\python%PY_VER%\site-packages\*medcoupling.py* %SP_DIR%
xcopy /y /s /f %LIBRARY_PREFIX%\lib\python%PY_VER%\site-packages\MED*.py %SP_DIR%
xcopy /y /s /f %LIBRARY_PREFIX%\lib\python%PY_VER%\site-packages\_MED*.pyd %SP_DIR%

24 changes: 24 additions & 0 deletions recipes/salome-medcoupling/build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
#!/bin/sh

git clone --depth 1 -b V9_11_0 https://git.salome-platform.org/gitpub/tools/configuration.git ${SRC_DIR}/configuration

git clone --depth 1 -b V9_11_0 https://git.salome-platform.org/gitpub/tools/medcoupling.git && cd medcoupling

mkdir build && cd build

cmake ${CMAKE_ARGS} -LAH -G "Ninja" \
-DCMAKE_PREFIX_PATH=${PREFIX} \
-DCMAKE_FIND_FRAMEWORK=NEVER \
-DCMAKE_INSTALL_PREFIX=${PREFIX} \
-DCMAKE_INSTALL_RPATH="${PREFIX}/lib" \
-DPYTHON_EXECUTABLE=${PYTHON} \
-DPYTHON_INCLUDE_DIR=${PREFIX}/include/python${PY_VER} \
-DPYTHON_LIBRARY=${PREFIX}/lib/libpython${PY_VER}${SHLIB_EXT} \
-DMEDCOUPLING_BUILD_DOC=OFF \
-DMEDCOUPLING_BUILD_TESTS=OFF \
-DMEDCOUPLING_PARTITIONER_SCOTCH=OFF \
-DMEDCOUPLING_USE_64BIT_IDS=OFF \
-DCONFIGURATION_ROOT_DIR=${SRC_DIR}/configuration \
..
cmake --build . --target install
rm -rf ${SP_SIR}/__pycache__
Loading

0 comments on commit c5fc771

Please sign in to comment.