Commit 7096f1a5 authored by Jiří Techet's avatar Jiří Techet

Build memphis demo in meson and move its resources to separate directory

parent 40cdc17b
Pipeline #56839 passed with stages
in 20 minutes and 18 seconds
......@@ -196,6 +196,7 @@ AC_CONFIG_FILES([Makefile
champlain/champlain-version.h
demos/Makefile
demos/icons/Makefile
demos/memphis/Makefile
docs/Makefile
docs/reference/Makefile
docs/reference/version.xml
......
noinst_PROGRAMS = minimal launcher animated-marker polygons url-marker create-destroy-test
SUBDIRS = icons
SUBDIRS = icons memphis
AM_CPPFLAGS = $(DEPS_CFLAGS) $(WARN_CFLAGS) -I$(top_srcdir)
......@@ -58,5 +58,5 @@ launcher_vala_LDADD = \
$(top_builddir)/champlain/libchamplain-@CHAMPLAIN_API_VERSION@.la
endif
EXTRA_DIST = markers.h launcher.js minimal.py launcher-gtk.py polygons.py keyboard-mapping.py default-rules.xml high-contrast.xml las_palmas.osm schaffhausen.osm
EXTRA_DIST = markers.h launcher.js minimal.py launcher-gtk.py polygons.py keyboard-mapping.py
......@@ -462,11 +462,15 @@ map_source_changed (GtkWidget *widget, ChamplainView *view)
ChamplainMapSource *src;
ChamplainRenderer *image_renderer;
guint tile_size;
gchar *rules_path, *map_path;
rules_path = g_build_path(G_DIR_SEPARATOR_S, "memphis", rules[rules_index], NULL);
map_path = g_build_path(G_DIR_SEPARATOR_S, "memphis", maps[map_index], NULL);
if (g_strcmp0 (id, "memphis-local") == 0)
{
champlain_memphis_renderer_load_rules (CHAMPLAIN_MEMPHIS_RENDERER (renderer), rules[rules_index]);
champlain_file_tile_source_load_map_data (CHAMPLAIN_FILE_TILE_SOURCE (source), maps[map_index]);
champlain_memphis_renderer_load_rules (CHAMPLAIN_MEMPHIS_RENDERER (renderer), rules_path);
champlain_file_tile_source_load_map_data (CHAMPLAIN_FILE_TILE_SOURCE (source), map_path);
gtk_widget_hide (memphis_box);
gtk_widget_set_no_show_all (memphis_box, FALSE);
gtk_widget_set_no_show_all (memphis_local_box, FALSE);
......@@ -475,7 +479,7 @@ map_source_changed (GtkWidget *widget, ChamplainView *view)
}
else if (g_strcmp0 (id, "memphis-network") == 0)
{
champlain_memphis_renderer_load_rules (CHAMPLAIN_MEMPHIS_RENDERER (renderer), rules[rules_index]);
champlain_memphis_renderer_load_rules (CHAMPLAIN_MEMPHIS_RENDERER (renderer), rules_path);
load_network_map_data (CHAMPLAIN_NETWORK_BBOX_TILE_SOURCE (source), view);
gtk_widget_hide (memphis_box);
gtk_widget_set_no_show_all (memphis_box, FALSE);
......@@ -489,6 +493,9 @@ map_source_changed (GtkWidget *widget, ChamplainView *view)
gtk_widget_set_no_show_all (memphis_box, TRUE);
}
g_free (rules_path);
g_free (map_path);
tile_source = CHAMPLAIN_MAP_SOURCE (source);
source_chain = champlain_map_source_chain_new ();
......@@ -540,8 +547,11 @@ map_data_changed (GtkWidget *widget, ChamplainView *view)
if (g_strcmp0 (champlain_map_source_get_id (tile_source), "memphis-local") == 0)
{
champlain_file_tile_source_load_map_data (CHAMPLAIN_FILE_TILE_SOURCE (tile_source), maps[map_index]);
gchar *map_path = g_build_path(G_DIR_SEPARATOR_S, "memphis", maps[map_index], NULL);
champlain_file_tile_source_load_map_data (CHAMPLAIN_FILE_TILE_SOURCE (tile_source), map_path);
reload_tiles ();
g_free (map_path);
}
}
......@@ -562,11 +572,13 @@ rules_changed (GtkWidget *widget, ChamplainView *view)
if (strncmp (champlain_map_source_get_id (tile_source), "memphis", 7) == 0)
{
ChamplainMemphisRenderer *renderer;
gchar *rules_path = g_build_path(G_DIR_SEPARATOR_S, "memphis", file, NULL);
renderer = CHAMPLAIN_MEMPHIS_RENDERER (champlain_map_source_get_renderer (CHAMPLAIN_MAP_SOURCE (tile_source)));
champlain_memphis_renderer_load_rules (renderer, file);
champlain_memphis_renderer_load_rules (renderer, rules_path);
load_rules_into_gui (view);
reload_tiles ();
g_free (rules_path);
}
}
......
EXTRA_DIST = default-rules.xml high-contrast.xml las_palmas.osm schaffhausen.osm
libchamplain_memphis_data = [
'default-rules.xml',
'high-contrast.xml',
'las_palmas.osm',
'schaffhausen.osm',
]
custom_target(
'libchamplain_memphis_data',
input: libchamplain_memphis_data,
output: libchamplain_memphis_data,
command: ['cp', '@INPUT@', '@OUTDIR@'],
build_by_default: true,
)
......@@ -22,6 +22,7 @@ foreach demo: libchamplain_demos
endforeach
subdir('icons')
subdir('memphis')
if build_gtk_widgetry == true
libchamplain_gtk_demos = [
......@@ -68,3 +69,24 @@ if generate_vapi == true and build_gtk_widgetry == true
)
endforeach
endif
if build_with_memphis == true and build_gtk_widgetry == true
libchamplain_memphis_demos = [
['local-rendering', 'local-rendering.c'],
]
foreach demo: libchamplain_memphis_demos
demo_name = demo.get(0)
demo_sources = demo.get(1)
executable(
demo_name,
demo_sources,
install: false,
dependencies: [
libchamplain_dep,
libchamplain_gtk_dep,
]
)
endforeach
endif
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment