-
Notifications
You must be signed in to change notification settings - Fork 29
/
Copy pathjnihelper.sh
executable file
·61 lines (50 loc) · 1.1 KB
/
jnihelper.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
55
56
57
58
59
60
61
#!/bin/bash
NATIVE_ACCESSER_PATH='in/derros/jni/Utilities.java'
NATIVE_ACCESSER_CLASS_NAME='in.derros.jni.Utilities'
PWD=`pwd`
echo
echo 'Java Native Interface Helper'
echo 'Created by RJ Fang'
echo 'Options: ./jnihelper.sh'
echo '--refresh-header Refreshes the header'
echo '--build Tries CMake build'
echo '--execute-java Tests library'
echo
refresh_header () {
cd java
javah $NATIVE_ACCESSER_CLASS_NAME
cd ../
echo "Generation finished."
}
buildj () {
rm -rf build
mkdir build
cd build
cmake ../
make
ls
cd ../
echo 'Build finished.'
}
exej () {
cd java/
javac $NATIVE_ACCESSER_PATH
java $NATIVE_ACCESSER_CLASS_NAME -D$PWD/../build
cd ../
}
if [ "$1" != "" ]; then
while [ "$1" != "" ]; do
case $1 in
--refresh-header ) refresh_header
;;
--build ) buildj
;;
--execute-java | --exej ) exej
esac
shift
done
else
refresh_header
buildj
exej
fi