GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — GitHub - pezcode/open3d-core-android: Cross-compiling and using the core Open3D library on Android

BranchesTags
Open more actions menu

Latest commit

 

History

8 Commits
8 Commits

Folders and files

NameName
Last commit message
Last commit date
android-studio
android-studio
 
 
.gitignore
.gitignore
 
 
CMakeLists.txt
CMakeLists.txt
 
 
Readme.md
Readme.md
 
 
build.bat
build.bat
 
 
open3d-android.config.cmake
open3d-android.config.cmake
 
 
open3d-android.patch
open3d-android.patch
 
 

Repository files navigation

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']
    }
  }
}

About

Cross-compiling and using the core Open3D library on Android

Topics

androidandroid-studiocmakendkopen3d

Resources

Readme
Activity

Stars

23 stars

Watchers

3 watching

Forks

16 forks
Report repository

Releases

Contributors

Languages

You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.