Allegro.cc - Online Community

Allegro.cc Forums » Programming Questions » Actual best ways to compile for Android and IOS

Credits go to Elias for helping out!
This thread is locked; no one can reply to it. rss feed Print
Actual best ways to compile for Android and IOS
GullRaDriel
Member #3,861
September 2003
avatar

Hi there,

I have a set of .c and .h files that can be compiled as separated files or as a library, and classic programs using the set along with a Makefile.

Actually I support 3 OS targets, detected in the Makefile (Solaris, Linux, Windows).

I'm asking myself how to port the whole thing to Android, and what are the way to do it.

if possible, I would have loved to make it whole from command lines, and a configurable support for allegro5.

For IOS I never targeted that OS, and I don't even know if it supports C.

Any guide/help/hint/tuto would be welcome.

"Code is like shit - it only smells if it is not yours"
Allegro Wiki, full of examples and articles !!

Elias
Member #358
May 2000

I have an "android" folder with the standard Android-Studio layout. And a symbolic link to the actual sources. Basically:

my_game/src/main.c
my_game/src/ui/inventory_screen.c
...

my_game/android/app/src/main/cpp -> my_game/src

Then just "gradle buildDebug" and it builds the APK. Things like the Android keyboard or Android ads I do in my normal sources, just guarded with #ifdef. That means I don't even include the "android" folder in git as it's just the empty Allegro Android project.

--
"Either help out or stop whining" - Evert

GullRaDriel
Member #3,861
September 2003
avatar

Can I have that folder please ? I would be happy to adapt it. Looks like it fits my need.

:D

"Code is like shit - it only smells if it is not yours"
Allegro Wiki, full of examples and articles !!

Elias
Member #358
May 2000

http://allegro5.org/empty_allegro_game.zip

unzip empty_allegro_game.zip
cd empty_allegro_game/android
./gradlew installDebug

As long as you had an Android device with USB debugging plugged in while doing that it should now have an app called "Empty Allegro Test".

The NDK uses cmake to compile any native code - the key file to adapt for the Android build is android/app/src/main/cpp/CMakeLists.txt.

--
"Either help out or stop whining" - Evert

GullRaDriel
Member #3,861
September 2003
avatar

Okay, thanks for the infos/scripts.

I'm going to peek into it and see how it works !

"Code is like shit - it only smells if it is not yours"
Allegro Wiki, full of examples and articles !!

Go to: