generate.sh 681 Bytes
Newer Older
Paul's avatar
Paul committed
1
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
Paul Fultz II's avatar
Paul Fultz II committed
2
SRC_DIR=$DIR/../src
3
4
5
6
7
8
9
10
PYTHON=python3
if type -p python3.6 > /dev/null ; then
    PYTHON=python3.6
fi
if type -p python3.8 > /dev/null ; then
    PYTHON=python3.8
fi
ls -1 $DIR/include/ | xargs -n 1 -P $(nproc) -I{} -t bash -c "$PYTHON $DIR/te.py $DIR/include/{} | clang-format-5.0 -style=file > $SRC_DIR/include/migraphx/{}"
Paul Fultz II's avatar
Paul Fultz II committed
11
12

function api {
13
    $PYTHON $DIR/api.py $SRC_DIR/api/migraphx.py $1 | clang-format-5.0 -style=file > $2
Paul Fultz II's avatar
Paul Fultz II committed
14
15
16
}

api $DIR/api/migraphx.h $SRC_DIR/api/include/migraphx/migraphx.h
17
echo "Finished generating header migraphx.h"
Paul Fultz II's avatar
Paul Fultz II committed
18
api $DIR/api/api.cpp $SRC_DIR/api/api.cpp
19
echo "Finished generating source api.cpp "