-
Notifications
You must be signed in to change notification settings - Fork 14
Building MOAI on Ubuntu 16.04
Tested on fresh ubuntu 16.04 installation (as root)
Install Prerequisites
apt-get update
apt-get install cmake git-core build-essential libglu1-mesa-dev
apt-get install libxmu-dev libxi-dev libxxf86vm-dev libxcb-util0-dev
apt-get install autoconf libtool unzip
Grab moai community and checkout the pull-180 branch
git clone https://github.com/moai/moai-community.git --recursive
cd moai-community
Submodules are a pain, lets get on the right branch and ensure the submodules are happy
git checkout pull-180
git submodule update
cd sdk/moai
git submodule init
git submodule update --recursive
cd ../..
setup our local environment (and helper script)
cp scripts/env-local.sh.template scripts/env-local.sh
source ./scripts/env-linux.sh
build moai binary for linux
./scripts/build-linux.sh
add pito and moai to path
cd bin
export PATH=$PATH:$(pwd)
cd ..
Test pito
pito
If that worked, lets make a project
cd ~
pito new-project moaiproj
cd moaiproj
pito run
you should see a moai window with an example app. Lets get ready to add an android host
Grab the NDK
wget https://dl.google.com/android/repository/android-ndk-r12b-linux-x86_64.zip
unzip android-ndk-r12b-linux-x86_64.zip
grab jdk
apt-get install default-jdk
grab the SDK
wget https://dl.google.com/android/repository/sdk-tools-linux-3859397.zip
unzip -d android-sdk sdk-tools-linux-3859397.zip
cd android-sdk/tools/bin
./sdkmanager platform-tools
./sdkmanager "build-tools;22.0.1"
./sdkmanager "platforms;android-22"
./sdkmanager "extras;android;m2repository"
./sdkmanager "extras;google;m2repository"
#some 32bit libraries are needed for the android sdk tools to run correctly atm (since it uses build tools 22.0.1)
apt-get install lib32stdc++6 lib32z1
now to tell our environment where these things are edit the moai-community/scripts/env-local.sh to set the path to ANDROID_NDK and ANDROID_SDK_HOME
vi ./scripts/env-local.sh
# add keys for ANDROID_NDK=/home/<user>/android-ndk-r12b
# and ANDROID_SDK_HOME=/home/<user>/android-sdk
source ./scripts/env-linux.sh
Build android native shared libraries
./scripts/build-android.sh
build an android host
cd ~/moaiproj
pito host create android
pito host build android
#apk is spat out here. you can build and debug with android studio, or use adb to install and launch apk
ls /hosts/android/moai/build/outputs/apk
To quickly launch the latest version of your application on android without waiting for a full rebuild of the apk, you cna use pito run -a
which will use your last built apk from pito host build android
and repack it with latest assets and lua files, it will then launch on the first detected device.
pito run -a