2021-08-05 16:55:34 +02:00
|
|
|
#!/bin/bash
|
|
|
|
|
2023-05-25 18:20:56 +02:00
|
|
|
# We want the script to crash on the 1st error:
|
|
|
|
set -e
|
|
|
|
|
2021-08-05 16:55:34 +02:00
|
|
|
# Check that script is executed from tools directory
|
|
|
|
if [[ $(basename $PWD) != "tools" ]] ; then
|
|
|
|
echo "This script should run in the tools directory"
|
|
|
|
exit -1
|
|
|
|
fi
|
|
|
|
|
2023-05-25 18:20:56 +02:00
|
|
|
DO_HDF5=0
|
|
|
|
if [[ -z ${1} ]] && [[ "${1}" == "--without-hdf5" ]] ; then
|
2024-08-10 17:34:44 +02:00
|
|
|
echo ""
|
|
|
|
echo "******************** WARNING **********************"
|
|
|
|
echo "* Compiling Python API without the HDF5 back end. *"
|
|
|
|
echo "***************************************************"
|
|
|
|
echo ""
|
2023-05-25 18:20:56 +02:00
|
|
|
DO_HDF5=1
|
|
|
|
else
|
|
|
|
echo "Compiling Python API with the HDF5 back end."
|
|
|
|
fi
|
|
|
|
|
2021-08-05 16:55:34 +02:00
|
|
|
TREXIO_ROOT=$(dirname "${PWD}../")
|
|
|
|
|
|
|
|
# First define readonly global variables.
|
|
|
|
readonly SRC=${TREXIO_ROOT}/src
|
|
|
|
readonly INCLUDIR=${TREXIO_ROOT}/include
|
|
|
|
readonly TOOLS=${TREXIO_ROOT}/tools
|
|
|
|
readonly PYDIR=${TREXIO_ROOT}/python
|
2021-08-18 14:40:42 +02:00
|
|
|
readonly PYTREXIODIR=${PYDIR}/pytrexio
|
2023-05-25 18:20:56 +02:00
|
|
|
readonly PYDIR_TREXIO_H=${PYDIR}/src/trexio.h
|
2021-08-05 16:55:34 +02:00
|
|
|
|
2021-08-18 12:30:03 +02:00
|
|
|
# Create src and trexio directories in the python folder if not yet done
|
2021-08-05 16:55:34 +02:00
|
|
|
mkdir -p ${PYDIR}/src
|
2021-08-18 12:30:03 +02:00
|
|
|
mkdir -p ${PYTREXIODIR}
|
2021-08-05 16:55:34 +02:00
|
|
|
|
|
|
|
# Copy all the source code and header files in the corresponding python directory
|
2021-08-24 10:51:29 +02:00
|
|
|
cp ${SRC}/pytrexio.py ${PYTREXIODIR}/pytrexio.py
|
|
|
|
cp ${SRC}/trexio.py ${PYDIR}/trexio.py
|
2023-05-25 18:20:56 +02:00
|
|
|
cp ${SRC}/trexio.c ${SRC}/trexio_s.h ${SRC}/trexio_private.h ${PYDIR}/src
|
|
|
|
cp ${SRC}/trexio_text.{c,h} ${PYDIR}/src
|
|
|
|
cp ${SRC}/pytrexio_wrap.c ${PYDIR}/src/pytrexio_wrap.c
|
|
|
|
cp ${INCLUDIR}/trexio.h ${PYDIR}/src
|
|
|
|
cp ${INCLUDIR}/config.h ${PYDIR}/src
|
|
|
|
|
|
|
|
|
|
|
|
if [[ ${DO_HDF5} == 0 ]] ; then
|
|
|
|
cp ${SRC}/trexio_hdf5.{c,h} ${PYDIR}/src
|
2022-01-26 14:00:05 +01:00
|
|
|
fi
|
2021-11-01 11:58:04 +01:00
|
|
|
|
2021-08-05 16:55:34 +02:00
|
|
|
# Copy additional info
|
2021-09-08 19:34:16 +02:00
|
|
|
cp ${TREXIO_ROOT}/AUTHORS ${TREXIO_ROOT}/LICENSE ${PYDIR}
|