Onelab/Mobile

From ONELAB
Revision as of 09:34, 14 October 2013 by Maxime (talk | contribs)

Jump to: navigation, search

Mobile - Test the Beta

Android

Requirement:

  • You need an Android device running Android >= 4.0


Here is the step to install Onelab on your device:

  1. Download the file (Onelab.apk)
  2. You have to allow installation of non-Market apps
    > Settings > Security > Unknown sources
  3. Then you can install the application
    To do that, you can upload the file on your SD card and then use a file explorer to open the file.
    Or you can use Android SDK's tool named adb and install the file:
    adb install Onelab.apk

iOS (iPad, iPhone, ...)

Requirement:

  • You need an iOS device running iOS >= 6.0


To install the application on your device, you need to send us your device ID.
To know how to locate this ID you can check apple website.
Then we will add your device in the list of the device for Onelab beta, and you will be able to install Onelab.

How to add a model

Android

On Android, you can open .geo, .pro files from a file explorer.

iOS

To add a model on iOS you can use File Sharing.
The model have to be in a directory with extension ".onelab".
Example for magnet:

magnet.onelab/
   magnet.geo
   magnet.pro
   magnet_data.pro
   Magnetostatics.pro
   infos.xml

and the file "infos.xml" looks like:

<?xml version="1.0" encoding="utf-8"?>

<models>
        <model>
                <title>Magnet</title>
                <summary>Simple magnet example.</summary>
                <file type="pro">magnet.pro</file>
        </model>
</models>

Mobile - Build for iOS

Requirement:

  • You need to be on a Mac
  • You need to have xcode >= 4
  • You need to have the iOS SDK >= 6.0

Compile the framework for iOS simulator

To compile for the simulator, the framework have to be for i386 architecture Example for Gmsh:

mkdir buildIOSSimulator
cd buildIOSSimulator
cmake -DENABLE_LIB=1 -DDEFAULT=0 -DENABLE_BLAS_LAPACK=1 -DENABLE_MESH=1 -DENABLE_ONELAB=1 -DENABLE_POST=1 -DCMAKE_CXX_FLAGS='-m32' ../
make framework

Compile the frameworks for iOS device

To compile for an iOS device you need a toolchain (e.g. ios-cmake).

mkdir buildIOS
cd buildIOS
cmake -DDEFAULT=0 -DENABLE_LIB=1 -DENABLE_BLAS_LAPACK=1 -DENABLE_MESH=1 -DENABLE_ONELAB=1 -DENABLE_POST=1 -DCMAKE_TOOLCHAIN_FILE=/path/to/iOS.cmake -Gxcode ../
xcodebuild -target lib -configuration Release

Create the project

To create the project you have to create a new directory and then, create the project with cmake

mkdir iOSProject
cd iOSProject
cmake ../contrib/mobile/
make xcodeProject

Then you can use "open" command to open the project with xcode.

open Onelab/Onelab.xcodeproj

Mobile - Build for Android

This procedure has been tested only on a Linux distribution
Requirement:

  • You need to have Android SDK with a level >= 14
  • You also need Android NDK to compile libraries

Compile the libraries

Most of the Android powered device run on an ARMv7 architecture.
Here is the way to compile Gmsh library for this architecture.
To do this, you need a toolchain (e.g android-cmake)

mkdir buildAndroid
cd buildAndroid
cmake -DCMAKE_TOOLCHAIN_FILE=/path/to/android.toolchain.cmake -DDEFAULT=0 -DENABLE_LIB=1 -DENABLE_BLAS_LAPACK=1 -DENABLE_MESH=1 -DENABLE_ONELAB=1 -DENABLE_POST=1 ../
make androidGmsh

Create the project

The project need multiples libraries:

  • Gmsh
  • GetDP
  • ONELAB (see below)
  • PETSc
  • BLAS & LAPACK

The ONELAB library is a small library to interface the application (Java) with Gmsh (Native library). You can build it from gmsh-svn (it's in /contrib/mobile/)

To use the automated cmake procedure you have to create a directory (e.g. Gmsh) with:

  • The library with directory name and without any extension (e.g. Gmsh)
  • The headers (they can be obtain with "make getHeaders")

The final directory for Gmsh looks like

Gmsh/
   Gmsh
   Headers/
       *.h

Then you can create the project:

make androidProject

Then you can open the project with Eclipse or with Android Studio You can also compile using the command line:

android update project --name Onelab --path . --target targetID
ant release