-
Notifications
You must be signed in to change notification settings - Fork 2
/
build-hdf5.sh
executable file
·57 lines (48 loc) · 1.43 KB
/
build-hdf5.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
#!/usr/bin/env bash
set -ex
: ${SOURCE_ROOT:?} ${INSTALL_ROOT:?} ${GCC_VERSION:?} ${CC:?} ${CXX:?} \
${CMAKE_COMMAND:?} ${CMAKE_VERSION:?}
DIR_SRC=${SOURCE_ROOT}/hdf5
DIR_BUILD=${INSTALL_ROOT}/hdf5/build
DIR_INSTALL=${INSTALL_ROOT}/hdf5
FILE_MODULE=${INSTALL_ROOT}/modules/hdf5/${HDF5_VERSION}
if [[ ! -d ${DIR_SRC} ]]; then
git clone https://github.com/HDFGroup/hdf5 ${DIR_SRC}
cd ${DIR_SRC}
git checkout hdf5-${HDF5_VERSION//./_}
cd -
fi
if [[ -d "/etc/opt/cray/release/" ]]; then
try1="-DALLOW_UNSUPPORTED=ON \
-DHDF5_ENABLE_PARALLEL:BOOL=ON \
-DHDF5_BUILD_CPP_LIB:BOOL=OFF "
fi
${CMAKE_COMMAND} \
-Wno-dev \
-H${DIR_SRC} \
-B${DIR_BUILD} \
-DCMAKE_INSTALL_PREFIX=${DIR_INSTALL} \
-DCMAKE_C_COMPILER=$CC \
-DCMAKE_CXX_COMPILER=$CXX \
-DBUILD_TESTING=OFF \
${try1} \
-DCMAKE_BUILD_TYPE=Release
${CMAKE_COMMAND} --build ${DIR_BUILD} --target install -- -j${PARALLEL_BUILD} VERBOSE=1
mkdir -p $(dirname ${FILE_MODULE})
cat >${FILE_MODULE} <<EOF
#%Module
proc ModulesHelp { } {
puts stderr {HDF5}
}
module-whatis {HDF5}
set root ${DIR_INSTALL}
conflict hdf5
module load gcc/${GCC_VERSION}
module load cmake/${CMAKE_VERSION}
prereq gcc/${GCC_VERSION}
prereq cmake/${CMAKE_VERSION}
prepend-path CPATH \$root/include
prepend-path PATH \$root/bin
prepend-path LD_LIBRARY_PATH \$root/lib
prepend-path LIBRARY_PATH \$root/lib
EOF