diff --git a/CMakeLists.txt b/CMakeLists.txt index 21ffaa00ce..ba26a9e544 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -533,6 +533,7 @@ set (USE_PDAL_PLUGIN_SOCI FALSE CACHE BOOL "Build the soci driver as a plugin ra set (USE_PDAL_PLUGIN_OCI FALSE CACHE BOOL "Build the oci driver as a plugin rather than embedding") set (USE_PDAL_PLUGIN_MRSID FALSE CACHE BOOL "Build the MrSID driver as a plugin rather than embedding") set (USE_PDAL_PLUGIN_CARIS FALSE CACHE BOOL "Build the Caris driver as a plugin rather than embedding") +set (USE_PDAL_PLUGIN_NITRO FALSE CACHE BOOL "Build the NITF writer as a plugin rather than embedding") #------------------------------------------------------------------------------ diff --git a/cmake/modules/FindNitro.cmake b/cmake/modules/FindNitro.cmake index 38a463f185..4b6617db3f 100644 --- a/cmake/modules/FindNitro.cmake +++ b/cmake/modules/FindNitro.cmake @@ -45,11 +45,8 @@ FIND_LIBRARY(NITRO_CPP_LIBRARY /usr/lib /usr/local/lib) - message(STATUS "cpplib: ${NITRO_CPP_LIBRARY}") - message(STATUS "clib: ${NITRO_C_LIBRARY}") - SET(NITRO_FOUND 1) - SET(NITRO_LIBRARIES ${NITRO_CPP_LIBRARY} ${NITRO_C_LIBRARY}) +SET(NITRO_LIBRARIES ${NITRO_CPP_LIBRARY} ${NITRO_C_LIBRARY}) IF(NITRO_INCLUDE_DIR) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index e8f9acb174..5a3d5c7fc4 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -578,6 +578,12 @@ target_link_libraries(${APPS_CPP_DEPENDENCIES} ${ORACLE_LIBRARY}) endif() endif() +if (WITH_NITRO) +if (NOT USE_PDAL_PLUGIN_NITRO) +target_link_libraries(${APPS_CPP_DEPENDENCIES} ${NITRO_LIBRARIES}) +endif() +endif() + if (WIN32) target_link_libraries(${APPS_CPP_DEPENDENCIES} LINK_PUBLIC general ${PDAL_LIB_NAME} @@ -607,8 +613,7 @@ else() ${P2G_LIBRARY} ${GEOS_LIBRARY} ${FLANN_LIBRARIES} - ${HEXER_LIBRARY} - ${NITRO_LIBRARIES}) + ${HEXER_LIBRARY}) endif() message(STATUS "Using boost lib: ${Boost_LIBRARIES}") diff --git a/src/StageFactory.cpp b/src/StageFactory.cpp index 0bd946b966..296d8bdde9 100644 --- a/src/StageFactory.cpp +++ b/src/StageFactory.cpp @@ -66,6 +66,12 @@ #endif #endif +#ifdef PDAL_HAVE_NITRO +#ifndef USE_PDAL_PLUGIN_NITF +#include +#endif +#endif + #ifdef PDAL_HAVE_P2G #include #endif @@ -195,6 +201,11 @@ MAKE_WRITER_CREATOR(SociWriter, pdal::drivers::soci::Writer) #endif #endif +#ifdef PDAL_HAVE_NITRO +#ifndef USE_PDAL_PLUGIN_NITF +MAKE_WRITER_CREATOR(NitfWriter, pdal::drivers::nitf::Writer) +#endif +#endif StageFactory::StageFactory() { @@ -255,7 +266,8 @@ std::string StageFactory::inferWriterDriver(const std::string& filename, pdal::O drivers["laz"] = "drivers.las.writer"; drivers["xyz"] = "drivers.text.writer"; drivers["txt"] = "drivers.text.writer"; - + drivers["ntf"] = "drivers.nitf.writer"; + if (boost::algorithm::iequals(filename, "STDOUT")) { return drivers["txt"]; @@ -473,6 +485,12 @@ void StageFactory::registerKnownWriters() #endif #endif +#ifdef PDAL_HAVE_NITRO +#ifndef USE_PDAL_PLUGIN_NITF + REGISTER_WRITER(NitfWriter, pdal::drivers::nitf::Writer); +#endif +#endif + } void StageFactory::loadPlugins() diff --git a/test/data/pipeline/pipeline_nitf.xml b/test/data/pipeline/pipeline_nitf.xml new file mode 100644 index 0000000000..6ed802d887 --- /dev/null +++ b/test/data/pipeline/pipeline_nitf.xml @@ -0,0 +1,21 @@ + + + + + + + + + + + + +