[libshumate/tintou/memphis] Add build-system infrastructure for the memphis library




commit 6ed7c9db5866d2a4e7128e75791871d4e2693c3f
Author: Corentin Noël <corentin noel collabora com>
Date:   Fri Mar 12 10:14:04 2021 +0100

    Add build-system infrastructure for the memphis library

 .gitignore                           |  99 +--------------------
 docs/reference/meson.build           |   4 +
 meson.build                          |   8 ++
 meson_options.txt                    |   6 +-
 shumate/meson.build                  |  13 ++-
 shumate/shumate-memphis-map-source.c | 166 +++++++++++++++++++++++++++++++++++
 shumate/shumate-memphis-map-source.h |  38 ++++++++
 shumate/shumate.h                    |   4 +
 subprojects/memphis.wrap             |   6 ++
 9 files changed, 244 insertions(+), 100 deletions(-)
---
diff --git a/.gitignore b/.gitignore
index f7c04f4..709e397 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,101 +1,4 @@
-Makefile
-Makefile.in
-aclocal.m4
-autom4te.cache
-*.pc
-.deps
-.libs
-*.o
-*.lo
-*.la
-*.stamp
-*.gir
-*.typelib
-*.gi
 *~
 *#*
-*.sw?
-*.pyc
 build
-shumate-gtk/shumate-gtk-marshal.c
-shumate-gtk/shumate-gtk-marshal.h
-shumate-gtk/stamp-marshal
-shumate-gtk/shumate-gtk-enum-types.c
-shumate-gtk/shumate-gtk-enum-types.h
-shumate-gtk/stamp-enum-types
-shumate/shumate-marshal.c
-shumate/shumate-marshal.h
-shumate/stamp-marshal
-shumate/shumate-enum-types.c
-shumate/shumate-enum-types.h
-shumate/stamp-enum-types
-shumate/shumate-version.h
-shumate/shumate-features.h
-compile
-config.guess
-config.h
-config.h.in
-config.log
-config.status
-config.sub
-configure
-demos/animated-marker
-demos/launcher
-demos/launcher-gtk
-demos/polygons
-demos/url-marker
-demos/local-rendering
-demos/minimal
-demos/minimal-gtk
-demos/create-destroy-test
-demos/launcher-vala
-demos/launcher-vala.c
-demos/markers-vala.c
-depcomp
-compile
-docs/reference-gtk/libshumate-gtk-undeclared.txt
-docs/reference-gtk/libshumate-gtk-undocumented.txt
-docs/reference-gtk/libshumate-gtk-unused.txt
-docs/reference-gtk/libshumate-gtk.args
-docs/reference-gtk/libshumate-gtk.hierarchy
-docs/reference-gtk/libshumate-gtk.interfaces
-docs/reference-gtk/libshumate-gtk.prerequisites
-docs/reference-gtk/libshumate-gtk.signals
-docs/reference-gtk/version.xml
-docs/reference-gtk/libshumate-gtk-decl-list.txt
-docs/reference-gtk/libshumate-gtk-decl.txt
-docs/reference-gtk/libshumate-gtk-overrides.txt
-docs/reference-gtk/libshumate-gtk-types.txt
-docs/reference-gtk/html/*.*
-docs/reference-gtk/tmpl/*.*
-docs/reference-gtk/xml/*.*
-docs/reference/version.xml
-docs/reference/libshumate-undeclared.txt
-docs/reference/libshumate-undocumented.txt
-docs/reference/libshumate-unused.txt
-docs/reference/libshumate.args
-docs/reference/libshumate.hierarchy
-docs/reference/libshumate.interfaces
-docs/reference/libshumate.prerequisites
-docs/reference/libshumate.signals
-docs/reference/libshumate-decl-list.txt
-docs/reference/libshumate-decl.txt
-docs/reference/libshumate-overrides.txt
-docs/reference/libshumate-types.txt
-docs/reference/html/*.*
-docs/reference/tmpl/*.*
-docs/reference/xml/*.*
-gtk-doc.make
-install-sh
-libtool
-ltmain.sh
-missing
-stamp-h1
-tags
-INSTALL
-m4/libtool.m4
-m4/ltoptions.m4
-m4/ltsugar.m4
-m4/ltversion.m4
-m4/lt~obsolete.m4
-m4/gtk-doc.m4
\ No newline at end of file
+subprojects/memphis
diff --git a/docs/reference/meson.build b/docs/reference/meson.build
index 4319efe..9b6d8d1 100644
--- a/docs/reference/meson.build
+++ b/docs/reference/meson.build
@@ -15,6 +15,10 @@ libshumate_reference_ignored_h = [
   'shumate.h',
 ]
 
+if not memphis_support
+libshumate_reference_ignored_h += 'shumate-memphis-map-source.h'
+endif
+
 libshumate_reference_source_folders = [
   join_paths(srcdir, 'shumate'),
   join_paths(builddir, 'shumate'),
diff --git a/meson.build b/meson.build
index 6564a49..ee53354 100644
--- a/meson.build
+++ b/meson.build
@@ -100,6 +100,13 @@ if generate_vapi and not vapigen_dep.found()
   generate_vapi = false
 endif
 
+memphis_support = get_option('memphis')
+if memphis_support
+    memphis_dep = dependency('memphis',
+                             fallback : ['memphis', 'memphis_dep'])
+    add_project_arguments('-DHAS_MEMPHIS=1', language: 'c')
+endif
+
 subdir('data')
 
 subdir('shumate')
@@ -121,6 +128,7 @@ summary = [
   '     Documentation: @0@'.format(build_gtk_doc),
   '     Introspection: @0@'.format(generate_gir),
   '          Vala API: @0@'.format(generate_vapi),
+  '   Memphis support: @0@'.format(memphis_support),
   '',
   'Directories:',
   '           prefix: @0@'.format(prefix),
diff --git a/meson_options.txt b/meson_options.txt
index 0ca9148..fec453c 100644
--- a/meson_options.txt
+++ b/meson_options.txt
@@ -11,4 +11,8 @@ option('gtk_doc',
 
 option('demos',
        type: 'boolean', value: false,
-       description: 'Build demonstration programs')
\ No newline at end of file
+       description: 'Build demonstration programs')
+
+option('memphis',
+       type: 'boolean', value: false,
+       description: 'Build memphis support')
diff --git a/shumate/meson.build b/shumate/meson.build
index 37db9a0..98b437e 100644
--- a/shumate/meson.build
+++ b/shumate/meson.build
@@ -67,9 +67,15 @@ libshumate_deps = [
   gtk_dep,
   cairo_dep,
   sqlite_dep,
-  libsoup_dep,
+  libsoup_dep
 ]
 
+if memphis_support
+  libshumate_public_h += 'shumate-memphis-map-source.h'
+  libshumate_sources += 'shumate-memphis-map-source.c'
+  libshumate_deps += memphis_dep
+endif
+
 libshumate_c_args = [
   '-DHAVE_CONFIG_H',
   '-DSHUMATE_COMPILATION',
@@ -225,6 +231,10 @@ libshumate_dep = declare_dependency(
   sources: libshumate_dep_sources,
 )
 
+extra_cflags = []
+if memphis_support
+    extra_cflags += '-DHAS_MEMPHIS=1'
+endif
 libshumate_pc = pkg.generate(
   libshumate_lib,
   name: package_string,
@@ -232,4 +242,5 @@ libshumate_pc = pkg.generate(
   requires: [glib_dep, gobject_dep, gtk_dep],
   subdirs: package_string,
   install_dir: pkgconfigdir,
+  extra_cflags: extra_cflags,
 )
diff --git a/shumate/shumate-memphis-map-source.c b/shumate/shumate-memphis-map-source.c
new file mode 100644
index 0000000..71a10ce
--- /dev/null
+++ b/shumate/shumate-memphis-map-source.c
@@ -0,0 +1,166 @@
+#include "shumate-memphis-map-source.h"
+
+struct _ShumateMemphisMapSource
+{
+  ShumateMapSource parent_instance;
+
+  guint tt;
+};
+
+G_DEFINE_TYPE (ShumateMemphisMapSource, shumate_memphis_map_source, SHUMATE_TYPE_MAP_SOURCE)
+
+enum {
+  PROP_0,
+  N_PROPS
+};
+
+static GParamSpec *properties [N_PROPS];
+
+static const char *
+shumate_memphis_map_source_get_id (ShumateMapSource *map_source)
+{
+  g_return_val_if_fail (SHUMATE_IS_MEMPHIS_MAP_SOURCE (map_source), NULL);
+
+  return "memphis";
+}
+
+static const char *
+shumate_memphis_map_source_get_name (ShumateMapSource *map_source)
+{
+  g_return_val_if_fail (SHUMATE_IS_MEMPHIS_MAP_SOURCE (map_source), NULL);
+
+  return "Memphis";
+}
+
+static const char *
+shumate_memphis_map_source_get_license (ShumateMapSource *map_source)
+{
+  g_return_val_if_fail (SHUMATE_IS_MEMPHIS_MAP_SOURCE (map_source), NULL);
+
+  return "NONE";
+}
+
+static const char *
+shumate_memphis_map_source_get_license_uri (ShumateMapSource *map_source)
+{
+  g_return_val_if_fail (SHUMATE_IS_MEMPHIS_MAP_SOURCE (map_source), NULL);
+
+  return "NONE";
+}
+
+static guint
+shumate_memphis_map_source_get_min_zoom_level (ShumateMapSource *map_source)
+{
+  g_return_val_if_fail (SHUMATE_IS_MEMPHIS_MAP_SOURCE (map_source), 0);
+
+  return 12;
+}
+
+static guint
+shumate_memphis_map_source_get_max_zoom_level (ShumateMapSource *map_source)
+{
+  g_return_val_if_fail (SHUMATE_IS_MEMPHIS_MAP_SOURCE (map_source), 0);
+
+  return 14;
+}
+
+static guint
+shumate_memphis_map_source_get_tile_size (ShumateMapSource *map_source)
+{
+  g_return_val_if_fail (SHUMATE_IS_MEMPHIS_MAP_SOURCE (map_source), 0);
+
+  return 512;
+}
+
+static ShumateMapProjection
+shumate_memphis_map_source_get_projection (ShumateMapSource *map_source)
+{
+  g_return_val_if_fail (SHUMATE_IS_MEMPHIS_MAP_SOURCE (map_source), SHUMATE_MAP_PROJECTION_MERCATOR);
+
+  return SHUMATE_MAP_PROJECTION_MERCATOR;
+}
+
+static void
+shumate_memphis_map_source_fill_tile (ShumateMapSource *map_source,
+                                      ShumateTile      *tile,
+                                      GCancellable     *cancellable)
+{
+
+}
+
+static void
+shumate_memphis_map_source_finalize (GObject *object)
+{
+  ShumateMemphisMapSource *self = (ShumateMemphisMapSource *)object;
+
+  G_OBJECT_CLASS (shumate_memphis_map_source_parent_class)->finalize (object);
+}
+
+static void
+shumate_memphis_map_source_get_property (GObject    *object,
+                                         guint       prop_id,
+                                         GValue     *value,
+                                         GParamSpec *pspec)
+{
+  ShumateMemphisMapSource *self = SHUMATE_MEMPHIS_MAP_SOURCE (object);
+
+  switch (prop_id)
+    {
+    default:
+      G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
+    }
+}
+
+static void
+shumate_memphis_map_source_set_property (GObject      *object,
+                                         guint         prop_id,
+                                         const GValue *value,
+                                         GParamSpec   *pspec)
+{
+  ShumateMemphisMapSource *self = SHUMATE_MEMPHIS_MAP_SOURCE (object);
+
+  switch (prop_id)
+    {
+    default:
+      G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
+    }
+}
+
+static void
+shumate_memphis_map_source_class_init (ShumateMemphisMapSourceClass *klass)
+{
+  GObjectClass *object_class = G_OBJECT_CLASS (klass);
+  ShumateMapSourceClass *map_source_class = SHUMATE_MAP_SOURCE_CLASS (klass);
+
+  object_class->finalize = shumate_memphis_map_source_finalize;
+  object_class->get_property = shumate_memphis_map_source_get_property;
+  object_class->set_property = shumate_memphis_map_source_set_property;
+
+  map_source_class->get_id = shumate_memphis_map_source_get_id;
+  map_source_class->get_name = shumate_memphis_map_source_get_name;
+  map_source_class->get_license = shumate_memphis_map_source_get_license;
+  map_source_class->get_license_uri = shumate_memphis_map_source_get_license_uri;
+  map_source_class->get_min_zoom_level = shumate_memphis_map_source_get_min_zoom_level;
+  map_source_class->get_max_zoom_level = shumate_memphis_map_source_get_max_zoom_level;
+  map_source_class->get_tile_size = shumate_memphis_map_source_get_tile_size;
+  map_source_class->get_projection = shumate_memphis_map_source_get_projection;
+  map_source_class->fill_tile = shumate_memphis_map_source_fill_tile;
+}
+
+static void
+shumate_memphis_map_source_init (ShumateMemphisMapSource *self)
+{
+}
+
+/**
+ * shumate_memphis_map_source_new:
+ *
+ * Create a new #ShumateMemphisMapSource.
+ *
+ * Returns: (transfer full): a newly created #ShumateMemphisMapSource
+ */
+ShumateMemphisMapSource *
+shumate_memphis_map_source_new (void)
+{
+  return g_object_new (SHUMATE_TYPE_MEMPHIS_MAP_SOURCE, NULL);
+}
diff --git a/shumate/shumate-memphis-map-source.h b/shumate/shumate-memphis-map-source.h
new file mode 100644
index 0000000..c27750f
--- /dev/null
+++ b/shumate/shumate-memphis-map-source.h
@@ -0,0 +1,38 @@
+/*
+ * Copyright 2021 Collabora Ltd. (https://www.collabora.com)
+ * Copyright 2021 Corentin Noël <corentin noel collabora com>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
+
+#if !defined (__SHUMATE_SHUMATE_H_INSIDE__) && !defined (SHUMATE_COMPILATION)
+#error "Only <shumate/shumate.h> can be included directly."
+#endif
+
+#ifndef _SHUMATE_MEMPHIS_MAP_SOURCE_H_
+#define _SHUMATE_MEMPHIS_MAP_SOURCE_H_
+
+#include <shumate/shumate-map-source.h>
+
+G_BEGIN_DECLS
+
+#define SHUMATE_TYPE_MEMPHIS_MAP_SOURCE shumate_memphis_map_source_get_type()
+G_DECLARE_FINAL_TYPE (ShumateMemphisMapSource, shumate_memphis_map_source, SHUMATE, MEMPHIS_MAP_SOURCE, 
ShumateMapSource)
+
+ShumateMemphisMapSource *shumate_memphis_map_source_new (void);
+
+G_END_DECLS
+
+#endif
diff --git a/shumate/shumate.h b/shumate/shumate.h
index 78b894f..e02b8e9 100644
--- a/shumate/shumate.h
+++ b/shumate/shumate.h
@@ -49,6 +49,10 @@
 
 #include "shumate/shumate-map-source-chain.h"
 
+#if HAS_MEMPHIS
+#include "shumate/shumate-memphis-map-source.h"
+#endif
+
 #include "shumate/shumate-network-tile-source.h"
 #include "shumate/shumate-error-tile-source.h"
 
diff --git a/subprojects/memphis.wrap b/subprojects/memphis.wrap
new file mode 100644
index 0000000..cc4d205
--- /dev/null
+++ b/subprojects/memphis.wrap
@@ -0,0 +1,6 @@
+[wrap-git]
+directory=memphis
+url=https://github.com/tintou/memphis.git
+push-url=ssh://git github com:tintou/memphis.git
+revision=master
+depth=1


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]