Cross building for iOS

Before trying to cross build for iOS we strongly recommend that you succeed on building OpenJFX for OS X first.

Download a sample application here

The sample application used here is a simplified version from /rt/apps/experiments/DukePad/modules/calculator (excludes OSGI references and any Java 8 syntax usage).

Besides the Calculator project, the zip file also contains a patch for OpenJFX repository

Install RoboVM

Download RoboVM from http://download.robovm.org/ and unzip it.
Install RoboVM to /opt/robovm directory

Get OpenJFX project, apply the patch and build it

 On the same directory where Calculator.zip was unzipped:

$ mkdir openjfx
$ cd openjfx
$ hg clone http://hg.openjdk.java.net/openjfx/8/graphics/rt
$ cd rt
$ patch -p1 < ../../openjfx.diff
$ gradle -PCOMPILE_TARGETS=ios -PUSE_LIPO=true
 

Note: At the time this wiki was written the iOS build expects the SDK version 7.0 to be available on the system.If you have different version that needs to specified. For example:

$ gradle -PCOMPILE_TARGETS=ios -PUSE_LIPO=true -PIOS_VERSION=6.1

Get robovm-jfx78-compat project and build it

On the same directory where Calculator.zip was unzipped:

$ git clone https://github.com/robovm/robovm-jfx78-compat
$ cd robovm-jfx78-compat
$ mvn install


Build the application code

 On the same directory where Calculator.zip was unzipped:

$ cd Calculator
$ ant

 

This will compile the java code to byte code, then it will use RoboVM to compile the byte code to native code and finally it will run the application using iPad simulator.

References:

http://blog.software4java.com/?p=41
http://www.robovm.org/docs.html
https://blogs.oracle.com/jfxprg/entry/ipack_the_ios_application_packager

 

  • No labels