Changeset: aedb27571816 for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=aedb27571816
Added Files:
geom/monetdb5/31_sfcgal.mal
geom/monetdb5/sfcgal.c
geom/monetdb5/sfcgal.h
geom/monetdb5/sfcgal.mal
geom/sql/41_sfcgal.sql
Modified Files:
NT/rules.msc
clients/Tests/All
configure.ag
geom/monetdb5/Makefile.ag
geom/sql/Makefile.ag
sql/test/Tests/All
sql/test/leaks/Tests/All
testing/Mtest.py.in
Branch: sfcgal
Log Message:
Added a minimal extension of the geom module that utilizes the SFCGAL library
diffs (truncated from 339 to 300 lines):
diff --git a/NT/rules.msc b/NT/rules.msc
--- a/NT/rules.msc
+++ b/NT/rules.msc
@@ -371,6 +371,11 @@ create_winconfig_conds_new_py:
!ELSE
$(ECHO) HAVE_SHP_FALSE='' >> "$(TOPDIR)\winconfig_conds_new.py"
!ENDIF
+!IFDEF HAVE_SFCGAL
+ $(ECHO) HAVE_SFCGAL_FALSE='#' >> "$(TOPDIR)\winconfig_conds_new.py"
+!ELSE
+ $(ECHO) HAVE_SFCGAL_FALSE='' >> "$(TOPDIR)\winconfig_conds_new.py"
+!ENDIF
!IFDEF HAVE_MONETDB5
$(ECHO) HAVE_MONETDB5_FALSE='#' >> "$(TOPDIR)\winconfig_conds_new.py"
!ELSE
diff --git a/clients/Tests/All b/clients/Tests/All
--- a/clients/Tests/All
+++ b/clients/Tests/All
@@ -1,4 +1,4 @@
exports
-HAVE_FITS&HAVE_GEOM&HAVE_GSL&HAVE_LIBR&!HAVE_LIDAR&HAVE_NETCDF&HAVE_SAMTOOLS&!HAVE_SHP&HAVE_SPHINXCLIENT?MAL-signatures
-!BITS32&!BITS64OID32&HAVE_FITS&HAVE_GEOM&HAVE_GSL&!HAVE_LIDAR&HAVE_NETCDF&HAVE_PCRE&!HAVE_SHP&HAVE_SAMTOOLS?SQL-dump
+HAVE_FITS&HAVE_GEOM&HAVE_GSL&HAVE_LIBR&!HAVE_LIDAR&HAVE_NETCDF&HAVE_SAMTOOLS&!HAVE_SHP&HAVE_SFCGAL&HAVE_SPHINXCLIENT?MAL-signatures
+!BITS32&!BITS64OID32&HAVE_FITS&HAVE_GEOM&HAVE_GSL&!HAVE_LIDAR&HAVE_NETCDF&HAVE_PCRE&!HAVE_SHP&HAVE_SFCGAL&HAVE_SAMTOOLS?SQL-dump
MERCURIAL?malcheck
diff --git a/configure.ag b/configure.ag
--- a/configure.ag
+++ b/configure.ag
@@ -218,6 +218,22 @@ no-auto)
;;
esac
+dft_sfcgal=auto
+AC_ARG_ENABLE(sfcgal,
+ AS_HELP_STRING([--enable-sfcgal],
+ [enable support for SFCGAL based functionality (default=auto)]),
+ have_sfcgal=$enableval,
+ have_sfcgal=$dft_sfcgal)
+case "$enable_geom-$have_sfcgal" in
+no-yes)
+ AC_MSG_ERROR([SFCGAL-based functionality requires the geom module])
+ ;;
+no-auto)
+ have_sfcgal=no
+ disable_sfcgal="(SFCGAL based functionality requires the geom module)"
+ ;;
+esac
+
dft_embedded=no
AC_ARG_ENABLE(embedded,
AS_HELP_STRING([--enable-embedded],
@@ -2764,6 +2780,56 @@ if test "x$have_gdal" = xno; then
fi
AM_CONDITIONAL(HAVE_SHP, test x"$have_shp" != xno )
+
+org_have_sfcgallib=auto
+have_sfcgallib=$org_have_sfcgallib
+SFCGAL_INCS=''
+SFCGAL_LIBS=''
+AC_ARG_WITH(sfcgal,
+ AS_HELP_STRING([--with-sfcgal=DIR],
+ [SFCGAL library is installed in DIR]),
+ have_sfcgallib="$withval")
+case "$have_sfcgal" in
+yes|auto)
+ if test "x$have_sfcgallib" != xno; then
+ case "$have_sfcgallib" in
+ yes|auto)
+ XPATH="$PATH"
+ ;;
+ *)
+ XPATH="$have_sfcgallib/bin"
+ have_sfcgallib=yes
+ ;;
+ esac
+ AC_PATH_PROG(SFCGAL_CONFIG,sfcgal-config,,$XPATH)
+ if test "x$SFCGAL_CONFIG" = x; then
+ if test "x$have_sfcgallib" = "xyes" ; then
+ AC_MSG_ERROR([sfcgal-config not found in
$XPATH])
+ else
+ have_sfcgallib=no
+ why_have_sfcgal="(sfcgal-config not found)"
+ fi
+ fi
+ fi
+ if test "x$have_sfcgallib" != xno; then
+ SFCGAL_INCS="`$SFCGAL_CONFIG --cflags`"
+ SFCGAL_LIBS="`$SFCGAL_CONFIG --libs`"
+ fi
+ if test "x$have_sfcgallib" = xno; then
+ if test "x$enable_sfcgal" = xyes; then
+ AC_MSG_ERROR([SFCGAL library required for SFCGAL-based
functionality])
+ fi
+ # no sfcgal library, so don't compile sfcgal-based functionality
+ have_sfcgal=no
+ disable_sfcgal=${why_have_sfcgal:-"(SFCGAL library required)"}
+ fi
+ ;;
+esac
+AM_CONDITIONAL(HAVE_SFCGAL, test x"$have_sfcgal" != xno )
+AC_SUBST(SFCGAL_INCS)
+AC_SUBST(SFCGAL_LIBS)
+
+
PKG_CHECK_MODULES([atomic_ops], [atomic_ops], [have_atomic_ops="yes"],
[have_atomic_ops="no"; why_have_atomic_ops="(atomic_ops library not
found)"])
if test x"$have_atomic_ops" = x"yes" ; then
@@ -3613,6 +3679,7 @@ for comp in \
'python3 ' \
'readline ' \
'samtools ' \
+ 'sfcgal ' \
'shp ' \
'sphinxclient ' \
'unixodbc ' \
diff --git a/geom/monetdb5/31_sfcgal.mal b/geom/monetdb5/31_sfcgal.mal
new file mode 100644
--- /dev/null
+++ b/geom/monetdb5/31_sfcgal.mal
@@ -0,0 +1,9 @@
+# This Source Code Form is subject to the terms of the Mozilla Public
+# License, v. 2.0. If a copy of the MPL was not distributed with this
+# file, You can obtain one at http://mozilla.org/MPL/2.0/.
+#
+# Copyright 1997 - July 2008 CWI, August 2008 - 2016 MonetDB B.V.
+
+# This loads the SFCGAL module
+library sfcgal;
+include sfcgal;
diff --git a/geom/monetdb5/Makefile.ag b/geom/monetdb5/Makefile.ag
--- a/geom/monetdb5/Makefile.ag
+++ b/geom/monetdb5/Makefile.ag
@@ -10,7 +10,8 @@ INCLUDES = ../lib \
../../common/stream \
../../common/options \
../../monetdb5/mal \
- $(GEOS_INCS) $(PROJ_INCS)
+ $(GEOS_INCS) $(PROJ_INCS) \
+ $(SFCGAL_INCS)
lib__geom = {
MODULE
@@ -35,4 +36,30 @@ headers_autoload = {
SOURCES = 30_geom.mal
}
-EXTRA_DIST = 30_geom.mal geom.mal
+lib__sfcgal = {
+ COND = HAVE_SFCGAL
+ MODULE
+ DIR = libdir/monetdb5
+ SOURCES = sfcgal.h sfcgal.c
+ LIBS = ../lib/libgeom \
+ ../../gdk/libbat \
+ ../../common/stream/libstream \
+ ../../monetdb5/tools/libmonetdb5 \
+ $(SFCGAL_LIBS)
+}
+
+headers_mal_sfcgal = {
+ COND = HAVE_SFCGAL
+ HEADERS = mal
+ DIR = libdir/monetdb5
+ SOURCES = sfcgal.mal
+}
+
+headers_autoload_sfcgal = {
+ COND = HAVE_SFCGAL
+ HEADERS = mal
+ DIR = libdir/monetdb5/autoload
+ SOURCES = 31_sfcgal.mal
+}
+
+EXTRA_DIST = 30_geom.mal 31_geom.mal geom.mal
diff --git a/geom/monetdb5/sfcgal.c b/geom/monetdb5/sfcgal.c
new file mode 100644
--- /dev/null
+++ b/geom/monetdb5/sfcgal.c
@@ -0,0 +1,22 @@
+/*
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * Copyright 1997 - July 2008 CWI, August 2008 - 2016 MonetDB B.V.
+ */
+
+/*
+ * @a Kostis Kyzirakos
+ * @* SFCGAL-based functionality for the geom module
+ */
+
+#include "sfcgal.h"
+
+char *
+msfcgal_version(char **ret)
+{
+ *ret = GDKstrdup(sfcgal_version());
+
+ return MAL_SUCCEED;
+}
diff --git a/geom/monetdb5/sfcgal.h b/geom/monetdb5/sfcgal.h
new file mode 100644
--- /dev/null
+++ b/geom/monetdb5/sfcgal.h
@@ -0,0 +1,41 @@
+/*
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * Copyright 1997 - July 2008 CWI, August 2008 - 2016 MonetDB B.V.
+ */
+
+/*
+ * @a Kostis Kyzirakos
+ */
+
+#include <monetdb_config.h>
+#include "libgeom.h"
+#include "geom.h"
+
+#include <mal.h>
+#include <mal_atom.h>
+#include <mal_exception.h>
+#include <mal_client.h>
+#include <stream.h>
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <math.h>
+#include <time.h>
+
+#include <SFCGAL/capi/sfcgal_c.h>
+
+#ifdef WIN32
+#ifndef LIBGEOM
+#define geom_export extern __declspec(dllimport)
+#else
+#define geom_export extern __declspec(dllexport)
+#endif
+#else
+#define geom_export extern
+#endif
+
+geom_export char * msfcgal_version(char **ret);
diff --git a/geom/monetdb5/sfcgal.mal b/geom/monetdb5/sfcgal.mal
new file mode 100644
--- /dev/null
+++ b/geom/monetdb5/sfcgal.mal
@@ -0,0 +1,11 @@
+# This Source Code Form is subject to the terms of the Mozilla Public
+# License, v. 2.0. If a copy of the MPL was not distributed with this
+# file, You can obtain one at http://mozilla.org/MPL/2.0/.
+#
+# Copyright 1997 - July 2008 CWI, August 2008 - 2016 MonetDB B.V.
+
+module sfcgal;
+
+command version() :str address msfcgal_version
+comment "Returns the version number of the SFCGAL library";
+
diff --git a/geom/sql/41_sfcgal.sql b/geom/sql/41_sfcgal.sql
new file mode 100644
--- /dev/null
+++ b/geom/sql/41_sfcgal.sql
@@ -0,0 +1,7 @@
+-- This Source Code Form is subject to the terms of the Mozilla Public
+-- License, v. 2.0. If a copy of the MPL was not distributed with this
+-- file, You can obtain one at http://mozilla.org/MPL/2.0/.
+--
+-- Copyright 1997 - July 2008 CWI, August 2008 - 2016 MonetDB B.V.
+
+CREATE FUNCTION SFCGAL_VERSION() RETURNS string EXTERNAL NAME sfcgal."version";
diff --git a/geom/sql/Makefile.ag b/geom/sql/Makefile.ag
--- a/geom/sql/Makefile.ag
+++ b/geom/sql/Makefile.ag
@@ -10,4 +10,11 @@ headers_sql = {
SOURCES = 40_geom.sql
}
+headers_sql_sfcgal = {
+ COND = HAVE_SFCGAL
+ HEADERS = sql
+ DIR = libdir/monetdb5/createdb
+ SOURCES = 41_sfcgal.sql
+}
+
EXTRA_DIST_DIR = Tests
diff --git a/sql/test/Tests/All b/sql/test/Tests/All
--- a/sql/test/Tests/All
+++ b/sql/test/Tests/All
@@ -1,4 +1,4 @@
-HAVE_FITS&HAVE_GEOM&HAVE_GSL&!HAVE_LIDAR&!HAVE_SHP&HAVE_NETCDF&HAVE_SAMTOOLS?systemfunctions
+HAVE_FITS&HAVE_GEOM&HAVE_GSL&!HAVE_LIDAR&!HAVE_SHP&!HAVE_SFCGAL&HAVE_NETCDF&HAVE_SAMTOOLS?systemfunctions
example
example-queries
example-drop
_______________________________________________
checkin-list mailing list
[email protected]
https://www.monetdb.org/mailman/listinfo/checkin-list