|
Allegro Devlopment on Andoid |
nshade
Member #4,372
February 2004
|
So I have a game that is written in pure C and only uses stdio.h, math.h and Allegro as my libraries. Right it it compiles under Visual Studio/Windows and GCC/Linux with no warnings, so it's as "pure" as it's going to get. My goal was to port this to Android and iOS as it's interface benefits the most from a touch screen. I was porting this game from DOS and one of my goals was to get it into the most portable shape possible so generic C was the key. (With Allegro as the game lib) I looked at the wiki for Allegro development for Android it looks outrageously complicated, and it's asking for... java? I see that there is something called "Android Studio" which like an all in one solution. Any tips on how to start this? |
Elias
Member #358
May 2000
|
This worked at some point: https://github.com/liballeg/android Unfortunately Android Studio changes a lot between versions so I probably need to update it. But if it works then at least getting an initial sample app up and running should be easy. The rest is then just figuring out the folder structure and some minor things like the icon and store description. It's also not too hard integrating Android Java APIs, like the touch keyboard or Google Play - since you can just call into Java code from C code. -- |
nshade
Member #4,372
February 2004
|
Thank you, that has helps so much... ===EDIT=== Location for cmake data for Android Studio 3: set(NATIVE_LIB native-lib) (I found it ) |
Elias
Member #358
May 2000
|
I wish they would come up with a standard way to include NDK components in a maven repository. I'm almost tempted to just remove it and instead force you to download the .aar and .so and .h files separately. But the above way almost works -- |
Edgar Reynaldo
Major Reynaldo
May 2007
|
I'm gonna borrow this thread since I have the same topic to discuss. I created a new empty activity configured as described in https://github.com/liballeg/android , and it mostly works. I'm having trouble getting it to find the JNI_INCLUDE folder and allegro.cmake though, or something else is wrong. It keeps failing on line 18 of allegro.cmake, which means the .so file was not found. I'm sure I set the JNI_INCLUDE directory correctly, but it still doesn't work. So, these lines : set(NATIVE_LIB native-lib) set(JNI_FOLDER ../../jni) include(libs/allegro5-release-5.2.4.1A/assets/jniIncludes/allegro.cmake) don't work. That's exactly where everything is located after I unpacked the .aar file for allegro. This is the error I'm getting : Build command failed. Error while executing process E:\AndroidSDK\cmake\3.6.4111459\bin\cmake.exe with arguments {-HC:\Users\Marc\AndroidStudioProjects\HelloAllegro\app -BC:\Users\Marc\AndroidStudioProjects\HelloAllegro\app\.externalNativeBuild\cmake\debug\mips -DANDROID_ABI=mips -DANDROID_PLATFORM=android-15 -DCMAKE_LIBRARY_OUTPUT_DIRECTORY=C:\Users\Marc\AndroidStudioProjects\HelloAllegro\app\build\intermediates\cmake\debug\obj\mips -DCMAKE_BUILD_TYPE=Debug -DANDROID_NDK=E:\AndroidSDK\ndk-bundle -DCMAKE_CXX_FLAGS=-std=c++11 -frtti -fexceptions -DCMAKE_TOOLCHAIN_FILE=E:\AndroidSDK\ndk-bundle\build\cmake\android.toolchain.cmake -DCMAKE_MAKE_PROGRAM=E:\AndroidSDK\cmake\3.6.4111459\bin\ninja.exe -GAndroid Gradle - Ninja} CMake Error at libs/allegro5-release-5.2.4.1A/assets/jniIncludes/allegro.cmake:18 (message): -- Configuring incomplete, errors occurred! See also "C:/Users/Marc/AndroidStudioProjects/HelloAllegro/app/.externalNativeBuild/cmake/debug/mips/CMakeFiles/CMakeOutput.log". It gives the same error for every architecture, and CMakeOutput.log is not helpful to me. My Website! | EAGLE GUI Library Demos | My Deviant Art Gallery | Spiraloid Preview | A4 FontMaker | Skyline! (Missile Defense) Eagle and Allegro 5 binaries | Older Allegro 4 and 5 binaries | Allegro 5 compile guide |
Elias
Member #358
May 2000
|
Where (absolute filesystem path) is allegro.cmake located? -- |
Edgar Reynaldo
Major Reynaldo
May 2007
|
It's under c:\users\me\AndroidStudioProjects\HelloAllegro\app under libs/allegro5-release-5.2.4.1A/assets/jniIncludes/allegro.cmake EDIT 1get_filename_component(ABI ${CMAKE_BINARY_DIR} NAME)
2set(base ${CMAKE_CURRENT_LIST_DIR})
3
4macro(standard_library NAME)
5 string(TOUPPER ${NAME} UNAME)
6 find_library(LIB_${UNAME} ${NAME})
7 target_link_libraries(${NATIVE_LIB} ${LIB_${UNAME}})
8endmacro()
9
10macro(allegro_library NAME)
11 string(TOUPPER ${NAME} UNAME)
12 set(path ${base}/${JNI_FOLDER}/${ABI}/lib${NAME})
13 if(EXISTS "${path}-debug.so")
14 set(LIB_${UNAME} ${path}-debug.so)
15 elseif(EXISTS "${path}.so")
16 set(LIB_${UNAME} ${path}.so)
17 else()
18 message(SEND_ERROR "${path}.so does not exist")
19 endif()
20 target_link_libraries(${NATIVE_LIB} ${LIB_${UNAME}})
21endmacro()
22
23include_directories(${base}/${ABI}/include)
24allegro_library(allegro)
25allegro_library(allegro_acodec)
26allegro_library(allegro_audio)
27allegro_library(allegro_color)
28allegro_library(allegro_font)
29allegro_library(allegro_image)
30allegro_library(allegro_primitives)
31allegro_library(allegro_ttf)
32standard_library(m)
33standard_library(z)
34standard_library(log)
35standard_library(GLESv2)
EDIT android { buildTypes { all { ndk { // abiFilters "mips" , "mips64" abiFilters "arm64-v8a" , "armeabi" , "armeabi-v7a" , "x86" , "x86_64" } } } } And now I have a yellow screen fading to red and back. Yay! \o/ My Website! | EAGLE GUI Library Demos | My Deviant Art Gallery | Spiraloid Preview | A4 FontMaker | Skyline! (Missile Defense) Eagle and Allegro 5 binaries | Older Allegro 4 and 5 binaries | Allegro 5 compile guide |
|