GithubHelp home page GithubHelp logo

yorkt / open3d-core-android Goto Github PK

View Code? Open in Web Editor NEW

This project forked from pezcode/open3d-core-android

0.0 1.0 0.0 9 KB

Cross-compiling and using the core Open3D library on Android

CMake 98.45% Batchfile 1.55%

open3d-core-android's Introduction

Building Open3D core for Android

CMake scripts for cross-compiling the core library of Open3D for Android and linking to it with Android Studio.

Tested with:

  • Windows 10 1809
  • CMake 3.14.1
  • Android Studio 3.4.1 with Gradle plugin 3.4.1
  • Bundled Android NDK r20
  • Open3D 0.7.0

Should work on Linux hosts, too, but it's untested.

Patches

A lot of Open3D revolves around visualisation. Since that code relies on OpenGL and X11 (both of which don't exist on Android) I removed it from being compiled and included. The patches to its CMakeLists.txt can be found in open3d-android.patch. Essentially it:

  • prevents GLEW and GLFW from being built and linked
  • removes the Visualization and Tools modules

The patch file itself was created with git diff > open3d-android.patch.

Compiling

You will need Ninja on your system (and in the PATH variable).

To cross-compile Open3D, simply:

mkdir build & cd build
cmake -G Ninja -DCMAKE_INSTALL_PREFIX=../install .. && cmake --build .

This downloads a specific revision of Open3D and compiles it for all supported NDK ABIs.

  • To change the version of Open3D change the GIT_TAG in the call to ExternalProject_Add for open3d-fetch. You may have to change Open3D's CMakeLists.txt's and create an updated patch file.
  • To specify an NDK path, call CMake with -DANDROID_NDK=path/to/ndk. By default it locates the NDK bundled with Android Studio.

When it's finished, you'll find compiled versions for each Android ABI in the install folder.

Linking

To use the library in Android Studio, take a look at the template CMakeLists.txt. It defines a sample library that finds and links to Open3D. It requires two additional steps:

  1. Set OPEN3D_PATH to the Open3D install. This can be done by specifying an extra parameter to CMake in your build.gradle:
android {
  ...
  defaultConfig {
    ...
    externalNativeBuild {
      cmake {
        ...
        arguments "-DOPEN3D_PATH=path/to/Open3D/install"
      }
    }
  }
}
  1. Add the shared libraries. The template CMakeLists.txt copies the appropriate shared libraries to their own ABI folders under libs/ in the main source directory. To make Gradle find and package them, add them to the source set:
android {
  ...
  sourceSets {
    main {
      jniLibs.srcDirs = ['libs']
    }
  }
}

open3d-core-android's People

Contributors

pezcode avatar

Watchers

James Cloos 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.