Java bindings to use PDAL on JVM.
// 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"Development purposes (including binaries):
- Install PDAL (using brew / package managers (unix) / build from sources / etc) without
-DWITH_PDAL_JNI=ONflag - Build native libs
./sbt native/nativeCompile(optionally, binaries would be built during tests run) - Run
./sbt core/testto run PDAL tests
Only Java development purposes:
- Provide
$LD_LIBRARY_PATHor$DYLD_LIBRARY_PATH - If you don't want to provide global variable you can pass
-Djava.library.path=<path>into sbt:./sbt -Djava.library.path=<path> - Set
PDAL_DEPEND_ON_NATIVE=false(to disablenativeproject build) - 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>- 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- 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")