8000 PDAL/java at master · hengli/PDAL · GitHub
[go: up one dir, main page]

Skip to content

Latest commit

 

History

History
 
 

java

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

README.md

PDAL Java bindings

Join the chat at https://gitter.im/PDAL/PDAL

Java bindings to use PDAL on JVM.

Using PDAL JNI with SBT

// pdal is published to maven central, but you can use following repos in addition
resolvers ++= Seq(
  Resolver.sonatypeRepo("releases"),
  Resolver.sonatypeRepo("snapshots") // for snaphots
)

libraryDependencies ++= Seq(
  "io.pdal" %% "pdal" % "1.4.0"
)

It's required to have native JNI binary in java.library.path:

// Mac OS X example with manual JNI installation
// Though it's strongly recommended to use WITH_PDAL_JNI during PDAL build
// cp -f native/target/resource_managed/main/native/x86_64-darwin/libpdaljni.1.4.dylib /usr/local/lib/libpdaljni.1.4.dylib
// place built binary into /usr/local/lib, and pass java.library.path to your JVM
javaOptions += "-Djava.library.path=/usr/local/lib"

How to compile

Development purposes (including binaries):

  1. Install PDAL (using brew / package managers (unix) / build from sources / etc) without -DWITH_PDAL_JNI=ON flag
  2. Build native libs ./sbt native/nativeCompile (optionally, binaries would be built during tests run)
  3. Run ./sbt core/test to run PDAL tests

Only Java development purposes:

  1. Provide $LD_LIBRARY_PATH or $DYLD_LIBRARY_PATH
  2. If you don't want to provide global variable you can pass -Djava.library.path=<path> into sbt: ./sbt -Djava.library.path=<path>
  3. Set PDAL_DEPEND_ON_NATIVE=false (to disable native project build)
  4. Run PDAL_DEPEND_ON_NATIVE=false ./sbt

Finally the possible command to launch and build PDAL JNI bindings could be:

# Including binaries build
# WARN: PDAL should be built without `-DWITH_PDAL_JNI=ON` flag
./sbt
# Java side development without binaries build
# WARN: PDAL should be built with `-DWITH_PDAL_JNI=ON` flag
PDAL_DEPEND_ON_NATIVE=false ./sbt -Djava.library.path=<path>

Possible issues and solutions

  1. In case of not installed as global PDAL change this line to:
set(CMAKE_CXX_FLAGS "$ENV{PDAL_LD_FLAGS} $ENV{PDAL_CXX_FLAGS} -std=c++11")

In this case sbt launch would be the following:

PDAL_LD_FLAGS=`pdal-config --libs` PDAL_CXX_FLAGS=`pdal-config --includes` ./sbt
  1. Sometimes can happen a bad dynamic linking issue (somehow spoiled environment), the quick workaround would be to replace this line to:
set(CMAKE_CXX_FLAGS "-L<path to dynamic libs> -std=c++11")
0