forked from LedgerHQ/lib-ledger-core
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgenerate_interfaces.sh
executable file
·42 lines (37 loc) · 1.67 KB
/
generate_interfaces.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
#!/usr/bin/env bash
# Generate library API with djinni
echo "Generating core API"
if [[ $# -gt 0 ]] ; then
trace="true";
else
trace="false";
fi
echo "Enable debug compilation " $trace
PACKAGE_NAME=ledgerapp_nodejs
DEST=api/core/nodejs
CORE_CPP_API_DIRECTORY=core/src/api
CORE_CPP_JNI_DIRECTORY=core/src/jni
# export-header-name : is the name of header generated by CMake command
# "generate_export_header", it allows to export global data symbols in dlls.
# This option is MANDATORY in case of msvc (2015) build.
# This option will be the name of the imported header and the correponding variable (defined
# by EXPORT_MACRO_NAME option) should be exactly same name in upper case
# prune export directories
rm -rf $DEST $CORE_CPP_API_DIRECTORY $CORE_CPP_JNI_DIRECTORY
./djinni/src/run --idl ./core/core.djinni \
--cpp-out $CORE_CPP_API_DIRECTORY \
--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_DIRECTORY/jni \
--java-out api/core/java \
--java-package co.ledger.core \
--node-out $DEST \
--node-type-prefix NJS \
--node-include-cpp ../../../core/src/api \
--node-package $PACKAGE_NAME \
--export-header-name libcore_export \
--trace $trace
cp ./djinni/support-lib/jni/* $CORE_CPP_JNI_DIRECTORY/jni
cp ./djinni/support-lib/*.hpp $CORE_CPP_JNI_DIRECTORY