summary refs log tree commit diff stats
path: root/examples/cross_calculator/android/scripts
diff options
context:
space:
mode:
authorAraq <rumpf_a@web.de>2012-09-08 15:39:37 -0700
committerAraq <rumpf_a@web.de>2012-09-08 15:39:37 -0700
commit9c63d12cef05709c79ce6d0f6b0cffd0f2243fe7 (patch)
tree5403ed6c16295dca3cd6f60971e0e40583e64af7 /examples/cross_calculator/android/scripts
parent4cd795b3eefce8fad3a933848455e677b2e2c67b (diff)
parentf6e7aebbd9a7185b3c45f2734636090c0efd2b2b (diff)
downloadNim-9c63d12cef05709c79ce6d0f6b0cffd0f2243fe7.tar.gz
Merge pull request #199 from gradha/implement_cross_platform_example
Implement cross platform example
Diffstat (limited to 'examples/cross_calculator/android/scripts')
-rwxr-xr-xexamples/cross_calculator/android/scripts/jnibuild.sh22
-rwxr-xr-xexamples/cross_calculator/android/scripts/nimbuild.sh34
-rwxr-xr-xexamples/cross_calculator/android/scripts/tags.sh13
3 files changed, 69 insertions, 0 deletions
diff --git a/examples/cross_calculator/android/scripts/jnibuild.sh b/examples/cross_calculator/android/scripts/jnibuild.sh
new file mode 100755
index 000000000..8b61f20f7
--- /dev/null
+++ b/examples/cross_calculator/android/scripts/jnibuild.sh
@@ -0,0 +1,22 @@
+#!/bin/sh
+
+# Force errors to fail script.
+set -e
+
+# If we are running from inside the scripts subdir, get out.
+if [ ! -d src ]
+then
+	cd ..
+fi
+
+# Ok, are we out now?
+if [ -d src ]
+then
+	javah -classpath bin/classes \
+		-o jni/backend-jni.h \
+		com.github.nimrod.crosscalculator.CrossCalculator
+else
+	echo "Uh oh, bin/classes directory not found?"
+	echo "Try compiling your java code, or opening in eclipse."
+	exit 1
+fi
diff --git a/examples/cross_calculator/android/scripts/nimbuild.sh b/examples/cross_calculator/android/scripts/nimbuild.sh
new file mode 100755
index 000000000..97130b8dd
--- /dev/null
+++ b/examples/cross_calculator/android/scripts/nimbuild.sh
@@ -0,0 +1,34 @@
+#!/bin/sh
+
+# Set this to the local or full path of your nimrod compiler
+PATH_TO_NIMROD=~/project/nimrod/bin/nimrod
+# Set this to the location of the nimbase.h file so
+# the script can update it if it changes.
+PATH_TO_NIMBASE=~/project/nimrod/lib/nimbase.h
+
+# Force errors to fail script.
+set -e
+
+# If we are running from inside the scripts subdir, get out.
+if [ ! -d src ]
+then
+	cd ..
+fi
+
+DEST_NIMBASE=jni/nimcache/nimbase.h
+
+# Ok, are we out now?
+if [ -d src ]
+then
+	$PATH_TO_NIMROD c --noMain  --app:lib \
+		--nimcache:jni/nimcache --cpu:arm --os:linux \
+		--compileOnly --header ../nimrod_backend/*.nim
+	if [ "${PATH_TO_NIMBASE}" -nt "${DEST_NIMBASE}" ]
+	then
+		echo "Updating nimbase.h"
+		cp "${PATH_TO_NIMBASE}" "${DEST_NIMBASE}"
+	fi
+else
+	echo "Uh oh, src directory not found?"
+	exit 1
+fi
diff --git a/examples/cross_calculator/android/scripts/tags.sh b/examples/cross_calculator/android/scripts/tags.sh
new file mode 100755
index 000000000..95507064f
--- /dev/null
+++ b/examples/cross_calculator/android/scripts/tags.sh
@@ -0,0 +1,13 @@
+#!/bin/sh
+
+if [ ! -d src ]
+then
+	cd ..
+fi
+
+if [ -d src ]
+then
+	~/bin/objctags -R \
+		jni \
+		src
+fi