mirror of
https://github.com/TREX-CoE/trexio.git
synced 2025-01-08 20:33:36 +01:00
add comments to build_trexio
This commit is contained in:
parent
faa936cc54
commit
ed77a86215
@ -1,13 +1,18 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
if [[ $(basename $PWD) != "src" ]] ; then
|
# Check that script is executed from tools directory
|
||||||
echo "This script should run in the src directory"
|
if [[ $(basename $PWD) != "tools" ]] ; then
|
||||||
|
echo "This script should run in the tools directory"
|
||||||
exit -1
|
exit -1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# Go to src directory
|
||||||
|
cd ../src
|
||||||
|
|
||||||
# We want the script to crash on the 1st error:
|
# We want the script to crash on the 1st error:
|
||||||
set -e
|
set -e
|
||||||
|
|
||||||
|
# Create directories for templates
|
||||||
echo "create populated directories"
|
echo "create populated directories"
|
||||||
mkdir -p templates_front/populated
|
mkdir -p templates_front/populated
|
||||||
mkdir -p templates_text/populated
|
mkdir -p templates_text/populated
|
||||||
@ -16,6 +21,7 @@ mkdir -p templates_hdf5/populated
|
|||||||
# It is important to ad '--' to rm because it tells rm that what follows are
|
# It is important to ad '--' to rm because it tells rm that what follows are
|
||||||
# not options. It is safer.
|
# not options. It is safer.
|
||||||
|
|
||||||
|
# Cleaning of existing data
|
||||||
echo "remove existing templates"
|
echo "remove existing templates"
|
||||||
rm -f -- templates_front/*.{c,h,f90}
|
rm -f -- templates_front/*.{c,h,f90}
|
||||||
rm -f -- templates_text/*.{c,h}
|
rm -f -- templates_text/*.{c,h}
|
||||||
@ -26,6 +32,7 @@ rm -f -- templates_front/populated/*
|
|||||||
rm -f -- templates_text/populated/*
|
rm -f -- templates_text/populated/*
|
||||||
rm -f -- templates_hdf5/populated/*
|
rm -f -- templates_hdf5/populated/*
|
||||||
|
|
||||||
|
# Function to produce TREXIO source files from org-mode files
|
||||||
function tangle()
|
function tangle()
|
||||||
{
|
{
|
||||||
local command="(org-babel-tangle-file \"$1\")"
|
local command="(org-babel-tangle-file \"$1\")"
|
||||||
@ -36,24 +43,27 @@ function tangle()
|
|||||||
--eval "$command"
|
--eval "$command"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# Produce source files for front end
|
||||||
echo "tangle org files to generate templates"
|
echo "tangle org files to generate templates"
|
||||||
cd templates_front
|
cd templates_front
|
||||||
tangle templator_front.org
|
tangle templator_front.org
|
||||||
cd ..
|
cd ..
|
||||||
|
|
||||||
|
# Produce source files for TEXT back end
|
||||||
cd templates_text
|
cd templates_text
|
||||||
tangle templator_text.org
|
tangle templator_text.org
|
||||||
cd ..
|
cd ..
|
||||||
|
|
||||||
|
# Produce source files for HDF5 back end
|
||||||
cd templates_hdf5
|
cd templates_hdf5
|
||||||
tangle templator_hdf5.org
|
tangle templator_hdf5.org
|
||||||
cd ..
|
cd ..
|
||||||
|
|
||||||
|
# Populate templates with TREXIO structure according to trex.json file
|
||||||
echo "run generator script to populate templates"
|
echo "run generator script to populate templates"
|
||||||
python3 generator.py
|
python3 generator.py
|
||||||
|
|
||||||
sleep 2
|
# Put pieces of source files together
|
||||||
|
|
||||||
echo "compile populated files in the lib source files "
|
echo "compile populated files in the lib source files "
|
||||||
cd templates_front
|
cd templates_front
|
||||||
source build.sh
|
source build.sh
|
||||||
@ -70,3 +80,5 @@ source build.sh
|
|||||||
cp trexio* ../
|
cp trexio* ../
|
||||||
cd ..
|
cd ..
|
||||||
|
|
||||||
|
# Come back to the TREXIO root directory
|
||||||
|
cd ..
|
||||||
|
Loading…
Reference in New Issue
Block a user