Skip to content

Commit

Permalink
Android: Add generate script.
Browse files Browse the repository at this point in the history
  • Loading branch information
marcel303 committed Sep 6, 2020
1 parent 614e987 commit 7a46725
Showing 1 changed file with 45 additions and 0 deletions.
45 changes: 45 additions & 0 deletions android-generate.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
# todo : verify all submodules are synced somehow
# git submodule update --init --recursive

root=$PWD
chibi_bin="./chibi-build/chibi/chibi"

# end the shell script when an error occurs
set -e

# detect operating system
unameOut="$(uname -s)"
case "${unameOut}" in
Linux*) os=linux;;
Darwin*) os=mac;;
*) os="unknown"
esac

# create "-filter <...>" command line arguments to be passed to chibi if this shell script received any arguments of its own
target_arg=""
for arg in "$@"
do
target_arg="$target_arg-target $arg "
done

if [ "$target_arg" != "" ]; then
#tput smul; # underline
tput bold; # bold
#tput setab 0; # bg = black
tput setaf 2; # fg = green
echo "using filter: $target_arg"
tput sgr0; # reset text formatting
fi

# build chibi binary
mkdir -p chibi-build/chibi
cd chibi-build/chibi && cmake -DCMAKE_BUILD_TYPE=Release ../../chibi && cmake --build . --config Release
cd "$root"

# generate gradle files using chibi
mkdir -p chibi-build/gradle-files
"$chibi_bin" -g . chibi-build/gradle-files -platform android $target_arg

if [ "$os" == "mac" ]; then
open -a Finder -R chibi-build/gradle-files/build.gradle
fi

0 comments on commit 7a46725

Please sign in to comment.