I'm trying to make the leap to android. I'm trying to follow along the guide here:
https://wiki.allegro.cc/index.php?title=Running_Allegro_applications_on_Android
I'm getting to the point of actually compiling allegro for android. I've got allegro checked out from git on the 5.2.2.0 tag. Then, following the guide, I do:
mkdir Build/Android cd Build/Android cmake ../.. -DANDROID_NDK_TOOLCHAIN_ROOT=$TC -DWANT_ANDROID=on -DCMAKE_BUILD_TYPE=Debug -DANDROID_TARGET=android-15
After running that I get the following warnings:
-- Generating done CMake Warning: Manually-specified variables were not used by the project: ANDROID_NDK_TOOLCHAIN_ROOT ANDROID_TARGET WANT_ANDROID
What am I missing here? Any idea why it is not recognizing the specified variables?
edit: looks like the wiki is out of date. SiegeLord pointed me to the readme. ANDROID_NDK_TOOLCHAIN_ROOT should be specified as an environment variable, and the WANT_ANDROID is replaced with a reference to the Android toolchain. So this works:
ANDROID_NDK_TOOLCHAIN_ROOT=$TC cmake ../.. -DCMAKE_TOOLCHAIN_FILE=../../cmake/Toolchain-android.cmake -DCMAKE_BUILD_TYPE=Debug -DANDROID_TARGET=android-15 make
But then I run into the next problem:
You can also use this to build Allegro apps with Android Studio. It worked for me.
I'll give that a try. It looks like the instructions in the android readme assume older tools that are now deprecated.
edit:
Ok, I got it working! At least I have now a HelloWorld app running in a virtual android device. Thanks Elias!
I still believe it's worth updating the android README if somebody knows how to get it compiling with a more recent toolchain. Or give instructions on how to install an older toolchain. And update the wiki. I would do it myself if I knew what the correct procedure is.
The wiki is read only unfortunately.
Who owns the wiki admin ? If it's Gideon, he asked for help on it. Or maybe Thomas ?
For what it's worth, if you want to compile yourself for some reason (to fix a bug!) here's a guide that works. To build for architectures other than armeabi-v7a, repeat all steps except use one of armeabi, x86, x86_64, arm64-v8a, mips, mips64 instead.
Download and unpack https://dl.google.com/android/android-sdk_r24.4.1-linux.tgz
Download and unpack https://dl.google.com/android/repository/android-ndk-r12b-linux-x86_64.zip
Download and unpack http://download.oracle.com/otn-pub/java/jdk/8u102-b14/jdk-8u102-linux-x64.tar.gz
set JAVA_HOME=jdk-8u102-linux-x64
android-sdk_r24.4.1-linux/tools/android update sdk -u -a -t platform-tools
android-sdk_r24.4.1-linux/tools/android update sdk -u -a -t build-tools-24.0.2
android-sdk_r24.4.1-linux/tools/android update sdk -u -a -t android-24
android-sdk_r24.4.1-linux/tools/android update sdk -u -a -t extra-android-m2repository
python android-ndk-r12b-linux-x86_64/build/tools/make_standalone_toolchain.py --arch arm --api 15 --install-dir toolchain-armeabi-v7a
set ANDROID_NDK_ROOT=android-ndk-r12b-linux-x86_64
set ANDROID_NDK_TOOLCHAIN_ROOT=toolchain-armeabi-v7a
set PKG_CONFIG_LIBDIR=toolchain-armeabi-v7a/lib
set PATH=android-ndk-r12b-linux-x86_64:${PATH}
set PATH=android-sdk_r24.4.1-linux/tools:${PATH}
set PATH=toolchain-armeabi-v7a/bin:${PATH}
Download and unpack http://download.savannah.gnu.org/releases/freetype/freetype-2.7.tar.bz2
cd toolchain-armeabi-v7a/freetype-2.7
./configure --host=arm-linux-androideabi --prefix=toolchain-armeabi-v7a --without-png --without-harfbuzz
make
make install
Download and unpack http://downloads.xiph.org/releases/ogg/libogg-1.3.2.tar.xz
everything like Freetype except: ./configure --host=arm-linux-androideabi --prefix=toolchain-armeabi-v7a
Download and unpack http://downloads.xiph.org/releases/vorbis/libvorbis-1.3.5.tar.xz
everything like Ogg
mkdir build-android-armeabi-v7a
cd build-android-armeabi-v7a
cmake ../allegro -DCMAKE_TOOLCHAIN_FILE=../allegro/cmake/Toolchain-android.cmake -DARM_TARGETS=armeabi-v7a -DCMAKE_BUILD_TYPE=Release -DANDROID_TARGET=android-24 -DWANT_DEMO=off -DWANT_EXAMPLES=off -DWANT_TESTS=off -DWANT_DOCS=off -DPKG_CONFIG_EXECUTABLE=/usr/bin/pkg-config -DOGG_LIBRARY=toolchain-armeabi-v7a/lib/libogg.a -DOGG_INCLUDE_DIR=toolchain-armeabi-v7a/include -DVORBIS_LIBRARY=toolchain-armeabi-v7a/lib/libvorbis.a -DVORBISFILE_LIBRARY=toolchain-armeabi-v7a/lib/libvorbisfile.a -DVORBIS_INCLUDE_DIR=toolchain-armeabi-v7a/include -DSUPPORT_VORBIS=true -DFREETYPE_LIBRARY=toolchain-armeabi-v7a/lib/libfreetype.a -DFREETYPE_INCLUDE_DIRS=toolchain-armeabi-v7a/include;toolchain-armeabi-v7a/include/freetype2
make
make install