153 | | A window with installable packages should open. In addition to any packages checked by default, make sure 'Android SDK Platform-tools' is checked and click 'Install packages'. |
154 | | |
155 | | Google publishes a [http://developer.android.com/sdk/ndk/index.html Native Development Kit] (NDK), which is a set of tools for building native applications for the Android platform. Unfortunately, the official NDK does not and will not support the `std::wstring` (wide characters) datatype, which is required by the game, so we'll have to use the unofficial [http://www.crystax.net/android/ndk.php Crystax NDK]. This is merely an extension of the official NDK, adding support for wide characters and other features maligned by Google. |
156 | | |
157 | | Download the r8-crystax-1 NDK release from [http://www.crystax.net/en/android/ndk this page] to the working directory and then unpack there, e.g.: |
| 153 | A window with installable packages should open. In addition to any packages checked by default, make sure '''Android SDK Platform-tools''', and '''Android 4.4.2 (API 19) -> SDK Platform''' are checked and click 'Install packages'. '''Android 4.4.2 (API 19) -> SDK Platform''' is needed only to build the APK, the game will still run on lower API (it needs API-12 or higher). |
| 154 | |
| 155 | ~~Google publishes a [http://developer.android.com/sdk/ndk/index.html Native Development Kit] (NDK), which is a set of tools for building native applications for the Android platform. Unfortunately, the official NDK does not and will not support the `std::wstring` (wide characters) datatype, which is required by the game, so we'll have to use the unofficial [http://www.crystax.net/android/ndk.php Crystax NDK]. This is merely an extension of the official NDK, adding support for wide characters and other features maligned by Google.~~ |
| 156 | |
| 157 | ~~Download the r8-crystax-1 NDK release from [http://www.crystax.net/en/android/ndk this page] to the working directory and then unpack there, e.g.:~~ |
| 158 | |
| 159 | Download the [http://developer.android.com/sdk/ndk/index.html official NDK]. |
178 | | Finally, download the game sources from SVN to any location, e.g.: |
179 | | {{{ |
180 | | $ svn co http://svn.wildfiregames.com/public/ps/trunk/ ~/android/0ad-game |
181 | | }}} |
| 189 | Download and install [http://www.qt.io/download-open-source Qt SDK] '''for Android'''. Pyrogenesis doesn't depend on Qt, it needs it just to build the engine and create APK. You'll use !QtCreator to manage, build, '''run & debug on Android'' Pyrogenesis. If you are not used with !QtCreator, [http://www.kdab.com/qtcreator here] you can find its reference card. |
| 190 | |
| 191 | Finally, download the game sources from '''a temporary github location''' to any location, e.g.: |
| 192 | {{{ |
| 193 | $ git clone https://github.com/bog-dan-ro/0ad.git |
| 194 | }}} |
| 195 | |
| 196 | |
| 197 | ~~Finally, download the game sources from SVN to any location, e.g.:~~ |
| 198 | ~~$ svn co http://svn.wildfiregames.com/public/ps/trunk/ ~/android/0ad-game~~ |
207 | | The script hardcodes the expected locations of NDK and SDK, so put them there or adjust the script, and it will output to `~/android/toolchain-0ad`. That should download and compile loads of stuff. |
208 | | |
209 | | Build the game like: |
210 | | {{{ |
211 | | cd build/workspaces/ |
212 | | ./update-workspaces.sh --gles --android --without-audio --disable-atlas --with-system-mozjs185 --with-system-enet --with-system-nvtt --without-nvtt |
213 | | |
214 | | cd gcc/ |
215 | | TOOLCHAIN=${HOME}/android/toolchain-0ad PKG_CONFIG_LIBDIR=${TOOLCHAIN}/sysroot/usr/local/lib/pkgconfig LDFLAGS="-lSDL2 -L=/usr/local/lib -L../../android/sdl-project/libs/armeabi" INCLUDES="--sysroot=${TOOLCHAIN}/sysroot -I${TOOLCHAIN}/arm-linux-androideabi/include/c++/4.6/arm-linux-androideabi/armv7-a/ -I../../android/sdl-project/jni/SDL/include -isystem=/usr/local/include/boost-1_45" CXX=${TOOLCHAIN}/bin/arm-linux-androideabi-g++ make pyrogenesis -j3 config=debug |
216 | | }}} |
217 | | |
218 | | Then attach a device, and in `build/android/sdl-project/` run "`make push-apk`" and "`make push-so`". Run `/sdcard/0ad.apk` on the device to install. |
219 | | |
220 | | The .apk is basically just the standard SDL android-project, and it loads `/data/local/libpyrogenesis_dbg.so` which contains all the engine code. That means you can recompile and then upload the engine code (via "`make push-so`") on the host PC, and don't have to manually reinstall the app after each change. If you want a non-debug build, remove the "`config=debug`" when building the game, then copy `binaries/system/libpyrogenesis.so` to `libpyrogenesis_dbg.so` before running "`make push-so`". |
221 | | |
222 | | You need to use the game engine to create `public.zip` for data files, since it has to convert all the textures/models/animations/etc into a different format before zipping them up. Build a standard non-Android copy of the game, then run it like |
223 | | {{{ |
224 | | mkdir temp |
225 | | binaries/system/pyrogenesis -archivebuild=binaries/data/mods/public -archivebuild-output=temp/public.zip -archivebuild-compress |
226 | | }}} |
227 | | and it should print lots of output and will take a while (maybe ten minutes or more). Then copy to `/sdcard/0ad/data/mods/public/public.zip` and the game should see it. (If you want to change a few data files after that, you don't need to regenerate `public.zip` - just copy the individual files straight into `mods/public/` and they'll override the zipped version.) |
228 | | |
229 | | Also, copy `binaries/data/config/default.cfg` into `/sdcard/0ad/appdata/config/`, and optionally set any local configuration values in `/sdcard/0ad/appdata/config/local.cfg`. |
230 | | |
231 | | Then try running the game, and use "`adb logcat`" to see what fails, and fix it. |
| 207 | The script searches for NDK in '''~/android/android-ndk''' if you have it in another location then use '''-n''' parameter to pass its location. The script should run without problems. If fails and you can't fix it, please contact us, otherwise you'll not be able to compile Pyrogenesis. |
| 208 | |
| 209 | Next step is to setup !QtCreator for Android. [http://www.kdab.com/qt-on-android-episode-2/ This article] explains you how to do it. |
| 210 | After you've finished to setup !QtCreator for Android, then you can open the project from `0ad/build/android/qtcreator/qtceator.pro`. After you open the project, make sure you choose an '''Android KIT''', check first part of [http://www.kdab.com/qt-android-episode-3/ this article] for more information. |
| 211 | |
| 212 | Do not try to start the game if you didn't push the game data (check the next step). |
| 213 | |
| 214 | ~~Build the game like:~~ |
| 215 | ~~cd build/workspaces/~~ |
| 216 | ~~./update-workspaces.sh --gles --android --without-audio --disable-atlas --with-system-mozjs185 --with-system-enet --with-system-nvtt --without-nvtt~~ |
| 217 | |
| 218 | ~~cd gcc/~~ |
| 219 | ~~TOOLCHAIN=${HOME}/android/toolchain-0ad PKG_CONFIG_LIBDIR=${TOOLCHAIN}/sysroot/usr/local/lib/pkgconfig LDFLAGS="-lSDL2 -L=/usr/local/lib -L../../android/sdl-project/libs/armeabi" INCLUDES="--sysroot=${TOOLCHAIN}/sysroot -I${TOOLCHAIN}/arm-linux-androideabi/include/c++/4.6/arm-linux-androideabi/armv7-a/ -I../../android/sdl-project/jni/SDL/include -isystem=/usr/local/include/boost-1_45" CXX=${TOOLCHAIN}/bin/arm-linux-androideabi-g++ make pyrogenesis -j3 config=debug~~ |
| 220 | |
| 221 | ~~Then attach a device, and in `build/android/sdl-project/` run "`make push-apk`" and "`make push-so`". Run `/sdcard/0ad.apk` on the device to install.~~ |
| 222 | |
| 223 | ~~The .apk is basically just the standard SDL android-project, and it loads `/data/local/libpyrogenesis_dbg.so` which contains all the engine code. That means you can recompile and then upload the engine code (via "`make push-so`") on the host PC, and don't have to manually reinstall the app after each change. If you want a non-debug build, remove the "`config=debug`" when building the game, then copy `binaries/system/libpyrogenesis.so` to `libpyrogenesis_dbg.so` before running "`make push-so`".~~ |
| 224 | |
| 225 | You need to use the game engine to create `public.zip` and `mod.zip` for data files, since it has to convert all the textures/models/animations/etc into a different format before zipping them up. Build a standard non-Android copy of the game, then run it like |
| 226 | {{{ |
| 227 | $ mkdir temp |
| 228 | $ binaries/system/pyrogenesis -archivebuild=binaries/data/mods/public -archivebuild-output=temp/public.zip -archivebuild-compress |
| 229 | $ binaries/system/pyrogenesis -archivebuild=binaries/data/mods/mod -archivebuild-output=temp/mod.zip -archivebuild-compress |
| 230 | }}} |
| 231 | and it should print lots of output and will take a while (maybe ten minutes or more). |
| 232 | |
| 233 | Then copy them to your device: |
| 234 | {{{ |
| 235 | $ adb push temp/public.zip /sdcard/0ad/data/mods/public/public.zip |
| 236 | $ adb push temp/mod.zip /sdcard/0ad/data/mods/mod/mod.zip |
| 237 | }}} |
| 238 | |
| 239 | and the game should see it. (If you want to change a few data files after that, you don't need to regenerate `public.zip` - just copy the individual files straight into `mods/public/` and they'll override the zipped version.) |
| 240 | |
| 241 | Also, copy `binaries/data/config/default.cfg` into `/sdcard/0ad/appdata/config/default.cfg`, and optionally set any local configuration values in `/sdcard/0ad/appdata/config/user.cfg`. |
| 242 | {{{ |
| 243 | $ adb push binaries/data/config/default.cfg /sdcard/0ad/appdata/config/default.cfg |
| 244 | }}} |
| 245 | |
| 246 | Then finally, try running/debugging the game using !QtCreator (press Ctrl+R run, F5 debug). |
| 247 | |
| 248 | ~~~Then try running the game, and use "`adb logcat`" to see what fails, and fix it.~~~ |