forked from LedgerHQ/lib-ledger-core
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgenerateBindings.sh
executable file
·54 lines (45 loc) · 1.37 KB
/
generateBindings.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
#!/usr/bin/env bash
PACKAGE_NAME=ledgercore
DEST=$1
CORE_BUILD=$2
CORE_CPP_API=core/src/api
CORE_CPP_JNI=core/src/jni
if [[ "$*" == "--help" || "$#" != "2" ]];
then
echo "usage: ./generateBindings.sh <dest> <core_build>"
echo -e "\tdest: The node bindings target destination. This is"
echo -e "\t typically the cloned repository that contains"
echo -e "\t the node bindings for lib-core."
echo -e "\tcore_build: The path to your lib-core build directory."
exit 0
fi
./djinni/src/run \
--idl ./core/core.djinni \
--cpp-out $CORE_CPP_API \
--cpp-namespace ledger::core::api \
--cpp-optional-template std::experimental::optional \
--cpp-optional-header "\"../utils/optional.hpp\"" \
--jni-include-cpp-prefix "../../api/" \
--jni-out $CORE_CPP_JNI/jni \
--node-out $DEST/src \
--node-type-prefix NJS \
--node-include-cpp ../include \
--node-package $PACKAGE_NAME \
--export-header-name libcore_export
# copy include files
rm -rf $DEST/include
cp -r $CORE_CPP_API $DEST/include
# copy util files
rm -rf $DEST/utils
mkdir $DEST/utils
cp -r core/src/utils/optional.hpp $DEST/utils
cp -r core/src/libcore_export.h $DEST/include
# copy lib files
rm -rf $DEST/lib
mkdir $DEST/lib
# copy dynamic library
cp $CORE_BUILD/core/src/libledger-core.* $DEST/lib
# create tmp folder if needed
if [ ! -e $DEST/js/tmp ]; then
mkdir $DEST/js/tmp
fi