GithubHelp home page GithubHelp logo

wakerealitydev / ifterpcrosscompileandroidcmake Goto Github PK

View Code? Open in Web Editor NEW
0.0 1.0 0.0 482 KB

Interactive Fiction Interpreter Cross Compile Android - using the CMake NDK build system - Example app Thunderfall

CMake 23.89% C 3.83% Makefile 7.51% Java 59.83% Shell 4.93%
cmake android android-studio ndk glulxe remglk json interactive-fiction

ifterpcrosscompileandroidcmake's Introduction

IFTerpCrossCompileAndroidCMake

This is a newer alternate to the https://github.com/WakeRealityDev/IFTerpCrossCompileAndroid project that uses gcc and Android.mk.

This project uses clang and CMake system with integrated Android Studio 2.3.3 compilation of the NDK code.

This example app is also known as Thunderfall.

Based on Hello JNI

Hello JNI is an Android sample that uses JNI to call C code from a Android Java Activity.

This sample uses the new Android Studio CMake plugin with C++ support.

Pre-requisites

  • Android Studio 2.3.3+ with NDK bundle.

Getting Started

Tested on Ubuntu 17.04 x86 system, latest Google Android NDK from Android Studio as of 2017-08-07. Bash is not required, you could manually run the commands inside of the checkout_terps_and_glk.sh script. These basic steps should work on Linux, OS X, Windows, etc - as long as you have the Android NDK properly installed and some way to download the IF interpreter and RemGlk.

  1. Checkout this project from GitHub.com
  2. $ chmod +x checkout_terps_and_glk.sh
  3. $ ./checkout_terps_and_glk.sh
  4. Launch Android Studio and open the project.

RemGlk + Glulxe source code are not in this project and the bash script will download them intot he proper folder.

You will not need to run ndk-build, the C code build should be automatically performed by the gradle system of Android Studio.

Resulting APK

The APK built with this project should have two binary files in the libs directory (example, arm-v7a CPU):

lib_app_glulxe.so 228kB
libhello-jni.so 9kB

The libhello-jni.so is part of the Google Sample and isn't relevant to the Interactive Fiction code, but it was left in to show the inherited orgins of the code and CMake compilation system.

The important thing to understand is that lib_app_glulxe.so is actualy not a dynamic library but instead an stand-alone executable binary for the Android device. It is only named ".so" to be packaged into the APK - it is not the proper extension for the file given it's stand-alone executable binary format.

If you unzip the APK and extract the lib_app_glulxe.so, you should be able to test it directly as an Android exectuable app:

$ adb push lib_app_glulxe.so /data/local/tmp
$ adb shell
  Now on Android shell it can be executed directly:
  $ cd /data/local/tmp
  $ chmod +x lib_app_glulxe.so
  $ ./lib_app_glulxe.so

At this point you should be able to send JSON to stdin to interface with the RemGlk that is on top of Glulxe interpreter.

Beyond Hello JNI

The commit history of this project will show how a library named :fictionengines was introduced and the NDK code moved into the library.

A sample story is now included in the app, and a basic Activity that can render the RemGlk JSON is now included, borrowed from the Thunderstrike app. This app is now named Thunderfall.

License for the original Hello JNI

Copyright 2015 Google, Inc.

Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with this work for additional information regarding copyright ownership. The ASF licenses this file to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

ifterpcrosscompileandroidcmake's People

Contributors

wakerealitydev avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.