Skip to content

Commit

Permalink
PDAL: use NoFileWriter class for PDAL > 2.7.0 (fixes OSGeo#3552)
Browse files Browse the repository at this point in the history
Starting from PDAL 2.7.0 filename is mandatory for Writer class, but
there is a NoFileWriter class that maintains old behaviour.
PDAL/PDAL#4342
  • Loading branch information
marisn committed Apr 7, 2024
1 parent d32dfb5 commit 5d0732c
Show file tree
Hide file tree
Showing 4 changed files with 49 additions and 22 deletions.
41 changes: 26 additions & 15 deletions configure
Original file line number Diff line number Diff line change
Expand Up @@ -10473,42 +10473,53 @@ pdal::PointTable table;
_ACEOF
if ac_fn_cxx_try_link "$LINENO"
then :

PDAL_LIBS="$PDAL_LIBS"
else $as_nop

as_fn_error $? "*** Unable to locate suitable (>=1.7.1) PDAL library." "$LINENO" 5

fi
rm -f core conftest.err conftest.$ac_objext conftest.beam \
conftest$ac_exeext conftest.$ac_ext


printf "%s\n" "#define HAVE_PDAL 1" >>confdefs.h


{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether to use PDAL NoFilenameWriter" >&5
printf %s "checking whether to use PDAL NoFilenameWriter... " >&6; }
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
#include <pdal/PointTable.hpp>
#include <pdal/Streamable.hpp>
class St:public pdal::Streamable {};
#include <pdal/Writer.hpp>
class St:public pdal::NoFilenameWriter {};
int
main (void)
{
pdal::PointTable table;
class NFWTest : public pdal::NoFilenameWriter {};
;
return 0;
}
_ACEOF
if ac_fn_cxx_try_link "$LINENO"
then :
PDAL_LIBS="$PDAL_LIBS"
else $as_nop

as_fn_error $? "*** Unable to locate suitable (>=1.7.1) PDAL library." "$LINENO" 5

fi
rm -f core conftest.err conftest.$ac_objext conftest.beam \
conftest$ac_exeext conftest.$ac_ext
printf "%s\n" "#define HAVE_PDAL_NOFILENAMEWRITER 1" >>confdefs.h

{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5
printf "%s\n" "yes" >&6; }

else $as_nop
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5
printf "%s\n" "no" >&6; }
fi
rm -f core conftest.err conftest.$ac_objext conftest.beam \
conftest$ac_exeext conftest.$ac_ext

LIBS=${ac_save_libs}
CFLAGS=${ac_save_cflags}


printf "%s\n" "#define HAVE_PDAL 1" >>confdefs.h

fi


Expand Down
22 changes: 15 additions & 7 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -1076,17 +1076,25 @@ else
CFLAGS="$CFLAGS $PDAL_CFLAGS"
AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <pdal/PointTable.hpp>
#include <pdal/Streamable.hpp>
class St:public pdal::Streamable {};]], [[pdal::PointTable table;]])],[],[
AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <pdal/PointTable.hpp>
#include <pdal/Streamable.hpp>
class St:public pdal::Streamable {};]], [[pdal::PointTable table;]])],[PDAL_LIBS="$PDAL_LIBS"],[
class St:public pdal::Streamable {};]], [[pdal::PointTable table;]])],
[PDAL_LIBS="$PDAL_LIBS"],[
AC_MSG_ERROR([*** Unable to locate suitable (>=1.7.1) PDAL library.])
])
])
LIBS=${ac_save_libs}
CFLAGS=${ac_save_cflags}

AC_DEFINE(HAVE_PDAL, 1, [Define to 1 if PDAL exists.])

AC_MSG_CHECKING(whether to use PDAL NoFilenameWriter)
AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <pdal/Writer.hpp>
class St:public pdal::NoFilenameWriter {};]], [[
class NFWTest : public pdal::NoFilenameWriter {};
]])],
[
AC_DEFINE(HAVE_PDAL_NOFILENAMEWRITER, 1, [Define to 1 if PDAL NoFilenameWriter is present.])
AC_MSG_RESULT(yes)
],[AC_MSG_RESULT(no)])

LIBS=${ac_save_libs}
CFLAGS=${ac_save_cflags}
fi

AC_SUBST(PDAL_LIBS)
Expand Down
3 changes: 3 additions & 0 deletions include/grass/config.h.in
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,9 @@
/* Define to 1 if PDAL exists. */
#undef HAVE_PDAL

/* Define to 1 if PDAL >2.7.0 Writters should be used */
#undef HAVE_PDAL_NOFILENAMEWRITER

/* Define to 1 if glXCreateGLXPixmap exists. */
#undef HAVE_PIXMAPS

Expand Down
5 changes: 5 additions & 0 deletions raster/r.in.pdal/grassrasterwriter.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,12 @@ extern "C" {
#include <pdal/Writer.hpp>

/* Binning code wrapped as a PDAL Writer class */
#ifdef HAVE_PDAL_NOFILENAMEWRITER
class GrassRasterWriter : public pdal::NoFilenameWriter,
public pdal::Streamable {
#else
class GrassRasterWriter : public pdal::Writer, public pdal::Streamable {
#endif
public:
GrassRasterWriter() : n_processed(0) {}

Expand Down

0 comments on commit 5d0732c

Please sign in to comment.