CytopiaTeam / Cytopia

:deciduous_tree::house_with_garden::office::evergreen_tree: A city building simulation game
https://www.cytopia.net
GNU General Public License v3.0
1.97k stars 104 forks source link

Port Cytopia to Android #149

Closed SimplyLiz closed 4 years ago

SimplyLiz commented 5 years ago

Port Cytopia to android.

Cytopia can be built for Android with or without SDL_Mixer. As workaround, the conan guys used the "dummy" audio configuration, so it probably won't work

CMake Call: cmake -DCMAKE_TOOLCHAIN_FILE="~/.conan/data/android_ndk_installer/r19c/bincrafters/stable/package/84fc5086d5b84ea42507b9623275f83e74452fe1/build/cmake/android.toolchain.cmake" -DCMAKE_BUILD_TYPE=Release -DENABLE_SDL2_MIXER=OFF -DANDROID_PLATFORM=android-21 -DCMAKE_ANDROID_ARCH_ABI=armeabi-v7a ../IsometricEngine

My changes are in #148

It compiles / links and there is a resulting binary.

Maybe there's also a better way to reference the android.toolchain.cmake with some conan variables within cmake?

@AnotherFoxGuy I hope you can help us out here, i have no clue how to create an APK...

SimplyLiz commented 4 years ago

in the branch android_new, Cytopia won't link because it can't find the main function:

function _start_main: error: undefined reference to 'main'

The old branch android works and a binary is produced.

to build cytopia for android:

mkdir build_android
cd build_android
 conan install ../Cytopia/ --build=missing -pr=../Cytopia/cmake/conan/android.profile 
cmake -DCMAKE_TOOLCHAIN_FILE=/home/talantyyr/.conan/data/android_ndk_installer/r19c/bincrafters/stable/package/84fc5086d5b84ea42507b9623275f83e74452fe1/build/cmake/android.toolchain.cmake  -DCMAKE_BUILD_TYPE=Release -DBUILD_TEST=OFF -DENABLE_ANGELSCRIPT=OFF -DENABLE_AUDIO=OFF -DENABLE_MOFILEREADER=OFF -DANDROID_PLATFORM=android-21 -DCMAKE_ANDROID_ARCH_ABI=armeabi-v7a ../Cytopia/

The file that's being produced:

└─ $ ▶ file Cytopia 
Cytopia: ELF 32-bit LSB shared object, ARM, EABI5 version 1 (SYSV), dynamically linked, interpreter /system/, BuildID[sha1]=337e8858af2529eaee8c5c35d21cee382539adcd, with debug_info, not stripped