Skip to content

Instantly share code, notes, and snippets.

@mekya
Last active November 16, 2017 12:21
Show Gist options
  • Save mekya/fdf2f1c4fa1cfd88b61d4bcc1d704de5 to your computer and use it in GitHub Desktop.
Save mekya/fdf2f1c4fa1cfd88b61d4bcc1d704de5 to your computer and use it in GitHub Desktop.
How to Build Draco 1.2.1 For Android with gnustl - Using with PCL

Draco 1.2.1 release

Edit src/draco/core/options.h

Add below function to Options class

  #include <sstream>
  
  ...
  
  template<typename T>
  std::string to_string(T value) {
          std::stringstream os;
          os << value;
          return os.str();
  }

Replace the places where std::to_string is used in options.cc with the below structure

#ifdef ANDROID
      options_[name] += to_string(val);
#else
      options_[name] += std::to_string(val);
#endif

Save file and run the commands below

cd /path/to/draco

mkdir build
cd build
cmake ../ \
  -DCMAKE_SYSTEM_NAME=Android \
  -DCMAKE_SYSTEM_VERSION=18 \
  -DCMAKE_ANDROID_ARCH_ABI=armeabi-v7a \
  -DCMAKE_ANDROID_NDK=/Users/mekya/softwares/android-ndk-r12b \
  -DCMAKE_ANDROID_STL_TYPE=gnustl_static \
  -DCMAKE_CXX_FLAGS="-DDRACO_POINT_CLOUD_COMPRESSION_SUPPORTED \
  -DDRACO_MESH_COMPRESSION_SUPPORTED \
  -DDRACO_STANDARD_EDGEBREAKER_SUPPORTED \
  -DDRACO_PREDICTIVE_EDGEBREAKER_SUPPORTED \
  -D__STDC_FORMAT_MACROS \
  -DANDROID" \
  -DCMAKE_INSTALL_PREFIX=./install \
  -DCMAKE_CXX_STANDARD=11

make
make install
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment