Skip to content

Commit

Permalink
r.in.pdal: use NoFileWriter class for PDAL > 2.7.0 (fixes #3552) (#3567)
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 behavior.
PDAL/PDAL#4342

---------

Co-authored-by: Nicklas Larsson <n_larsson@yahoo.com>
  • Loading branch information
marisn and nilason committed Apr 14, 2024
1 parent 6e716d6 commit 1adb566
Show file tree
Hide file tree
Showing 4 changed files with 55 additions and 26 deletions.
49 changes: 31 additions & 18 deletions configure
Original file line number Diff line number Diff line change
Expand Up @@ -9377,42 +9377,55 @@ pdal::PointTable table;
return 0;
}
_ACEOF
if ac_fn_cxx_try_link "$LINENO"; then :

if ac_fn_cxx_try_link "$LINENO"
then :
PDAL_LIBS="$PDAL_LIBS"
else

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

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

$as_echo "#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 ()
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
if ac_fn_cxx_try_link "$LINENO"
then :

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

fi
rm -f core conftest.err conftest.$ac_objext \
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 \
rm -f core conftest.err conftest.$ac_objext conftest.beam \
conftest$ac_exeext conftest.$ac_ext

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


$as_echo "#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 @@ -1059,17 +1059,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_TRY_LINK([#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.])
])
])

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}

AC_DEFINE(HAVE_PDAL, 1, [Define to 1 if PDAL is to be used.])
fi

AC_SUBST(PDAL_LIBS)
Expand Down
5 changes: 4 additions & 1 deletion include/grass/config.h.in
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,10 @@
/* Define to 1 if PDAL is to be used. */
#undef HAVE_PDAL

/* define if glXCreateGLXPixmap exists */
/* Define to 1 if PDAL NoFilenameWriter is present. */
#undef HAVE_PDAL_NOFILENAMEWRITER

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

/* Define to 1 if you have the <png.h> header file. */
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 1adb566

Please sign in to comment.