This module provides two new actions:
-
ndk-makefileGenerate
Android.mkandApplication.mkmakefiles from a Premake solution/project description. Runndk-buildin a generated project directory to build the necessary shared or static libraries. -
ndk-manifest(Experimental) Generate
AndroidManifest.xmland Java glue code. The glue code generation assumes you'll be extending an existing Java class, and places a trivial class in the correct output directory for the application's package name. Java source files in the project are copied into the build directory as well, so that ant can see them. The manifest generated is simple, but is suitable for e.g. porting games using libraries such as SDL2. For more advanced use it would be better to create your own manifest and JNI wrappers.
Some Premake configuration options are mapped to suitable NDK options. E.g. optimize is mapped to APP_OPTIM,
and framework should specify the API level, e.g. android-10. New configuration options are also available:
-
abis: A list of strings specifying one or more ABIs to generate code for. -
stl: A string specifying the STL support desired. Defaults tosystem, i.e. minimal C runtime with no STL support. -
packagename: Forndk-manifestonly, a string specifiying the package name to use. E.g.com.mycompany.myapp -
basepackagename: Forndk-manifestonly, a string specifying the package containing the Activity class to extend. -
activityname: Forndk-manifestonly, a string specifiying the name of your application's activity. -
baseactivityname: Forndk-manifestonly, a string specifying the name of the activity you're extending. -
packageversion: Forndk-manifestonly, an integer specifying the package's revision number.
Notes:
-
To install the module, copy
modules\ndkto the directory containing your Premake5 binary, or in a suitable.premakedirectory. Then addrequire 'ndk'to your Premake script to use it. -
Projects using premake-ndk should use the
androidplatform to specify Android-specific options. -
Unlike (for example) Visual Studio projects, the generated makefiles do not support multiple configurations. Instead they are placed under one directory per configuration below the project's location.
-
Nothing is generated to represent solutions. The NDK build system is app-centric, so makefiles are generated for windowed application projects and static or shared libraries. The NDK generates all objects and binaries per-app, so you would generally only run
ndk-buildor other build commands in the application directory. -
You will need to run
android update projectin the application directory after generating the manifest before you can build the application APK withant. -
This module is very much a work-in-progress. Comments welcome!