[retro-gtk/wip/aplazas/meson] build: Add Meson support
- From: Adrien Plazas <aplazas src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [retro-gtk/wip/aplazas/meson] build: Add Meson support
- Date: Fri, 27 Oct 2017 06:51:13 +0000 (UTC)
commit 447cdd417a0779f3fc073b8d36a40f396a9101a6
Author: Adrien Plazas <kekun plazas laposte net>
Date: Thu Sep 28 10:52:30 2017 +0200
build: Add Meson support
.editorconfig | 5 +
demos/meson.build | 46 ++++++++
flatpak/org.gnome.Retro.DemoSamplesTest.json | 5 +-
meson.build | 22 ++++
retro-gtk/meson.build | 152 ++++++++++++++++++++++++++
retro-gtk/retro-gtk-version.h.in | 81 ++++++++++++++
retro-gtk/retro-gtk.h | 1 +
retro-gtk/retro-module-query.c | 2 +
8 files changed, 311 insertions(+), 3 deletions(-)
---
diff --git a/.editorconfig b/.editorconfig
index c862fe8..14415a2 100644
--- a/.editorconfig
+++ b/.editorconfig
@@ -31,5 +31,10 @@ indent_size = 8
tab_size = 8
indent_style = space
+[meson.build]
+indent_size = 2
+tab_size = 2
+indent_style = space
+
[NEWS]
max_line_length = 72
diff --git a/demos/meson.build b/demos/meson.build
new file mode 100644
index 0000000..70b3a2d
--- /dev/null
+++ b/demos/meson.build
@@ -0,0 +1,46 @@
+# retro_demo_CFLAGS = \
+# $(RETRO_GTK_CFLAGS) \
+# $(GAMEPADS_CFLAGS) \
+# $(UDEV_CFLAGS) \
+# -DGNOMELOCALEDIR=\""$(datadir)/locale"\" \
+# -DGAMES_PLUGINS_DIR=\"$(libdir)/gnome-games/plugins\" \
+# $(NULL)
+
+# retro_demo_CPPFLAGS = \
+# -I$(top_srcdir) \
+# -I$(top_builddir)/retro-gtk \
+# -I$(top_srcdir)/retro-gtk \
+# -DRETRO_GTK_USE_UNSTABLE_API \
+# $(NULL)
+
+# retro_demo_DEPENDENCIES = \
+# $(top_builddir)/retro-gtk/libretro-gtk.la \
+# $(NULL)
+
+# retro_demo_LDADD = \
+# $(RETRO_GTK_LIBS) \
+# $(top_builddir)/retro-gtk/libretro-gtk.la \
+# $(NULL)
+
+demos = files([
+ 'retro-demo.c',
+])
+
+retro_demo_deps = [
+ retro_gtk_deps,
+]
+
+retro_demo_c_args = [
+ '-DRETRO_GTK_COMPILATION',
+ '-DRETRO_GTK_USE_UNSTABLE_API',
+]
+
+executable('retro-demo',
+ 'retro-demo.c',
+ c_args: retro_demo_c_args,
+ dependencies: retro_demo_deps,
+ # link_with: [ retro_gtk_lib, ],
+ # include_directories: [ include_directories('.'), ],
+ gui_app: true,
+ install: true,
+)
diff --git a/flatpak/org.gnome.Retro.DemoSamplesTest.json b/flatpak/org.gnome.Retro.DemoSamplesTest.json
index f6c12cd..5e64f30 100644
--- a/flatpak/org.gnome.Retro.DemoSamplesTest.json
+++ b/flatpak/org.gnome.Retro.DemoSamplesTest.json
@@ -56,9 +56,8 @@
},
{
"name": "retro-gtk",
- "config-opts": [
- "--disable-static"
- ],
+ "buildsystem": "meson",
+ "builddir": true,
"sources": [
{
"type": "git",
diff --git a/meson.build b/meson.build
new file mode 100644
index 0000000..f74a668
--- /dev/null
+++ b/meson.build
@@ -0,0 +1,22 @@
+project('retro-gtk','c',
+ version: '0.13.1',
+ meson_version: '>= 0.40.0',
+)
+
+libdir = get_option ('libdir')
+libretrodir = join_paths (libdir, 'libretro')
+
+config_h = configuration_data()
+config_h.set_quoted ('RETRO_PLUGIN_PATH', ':'.join ([libretrodir, libdir]))
+
+configure_file(
+ output: 'retro-gtk-config.h',
+ configuration: config_h,
+)
+
+add_project_arguments([
+ '-I' + meson.build_root(),
+], language: 'c')
+
+subdir('retro-gtk')
+subdir('demos')
diff --git a/retro-gtk/meson.build b/retro-gtk/meson.build
new file mode 100644
index 0000000..ad1cf29
--- /dev/null
+++ b/retro-gtk/meson.build
@@ -0,0 +1,152 @@
+api_version = '0.14'
+
+retro_gtk_sources = [
+ 'retro-analog-id.c',
+ 'retro-analog-index.c',
+ 'retro-cairo-display.c',
+ 'retro-controller.c',
+ 'retro-controller-iterator.c',
+ 'retro-controller-type.c',
+ 'retro-core.c',
+ 'retro-core-descriptor.c',
+ 'retro-core-view.c',
+ 'retro-core-view-controller.c',
+ 'retro-environment.c',
+ 'retro-game-info.c',
+ 'retro-input-descriptor.c',
+ 'retro-joypad-id.c',
+ 'retro-keyboard-key.c',
+ 'retro-lightgun-id.c',
+ 'retro-log.c',
+ 'retro-main-loop.c',
+ 'retro-memory-type.c',
+ 'retro-module.c',
+ 'retro-module-iterator.c',
+ 'retro-module-query.c',
+ 'retro-mouse-id.c',
+ 'retro-option.c',
+ 'retro-options.c',
+ 'retro-pa-player.c',
+ 'retro-pixdata.c',
+ 'retro-pixel-format.c',
+ 'retro-pointer-id.c',
+ 'retro-rumble-effect.c',
+ 'retro-video-filter.c',
+]
+
+retro_gtk_headers = [
+ 'retro-analog-id.h',
+ 'retro-analog-index.h',
+ 'retro-controller.h',
+ 'retro-controller-iterator.h',
+ 'retro-controller-type.h',
+ 'retro-core-descriptor.h',
+ 'retro-core.h',
+ 'retro-core-view.h',
+ 'retro-gtk.h',
+ 'retro-joypad-id.h',
+ 'retro-lightgun-id.h',
+ 'retro-log.h',
+ 'retro-main-loop.h',
+ 'retro-memory-type.h',
+ 'retro-module-iterator.h',
+ 'retro-module-query.h',
+ 'retro-mouse-id.h',
+ 'retro-pixdata.h',
+ 'retro-pointer-id.h',
+ 'retro-rumble-effect.h',
+ 'retro-video-filter.h',
+]
+
+# dist headers
+# 'libretro-environment.h',
+# 'retro-cairo-display.h',
+# 'retro-controller-iterator-private.h',
+# 'retro-core-private.h',
+# 'retro-core-view-controller.h',
+# 'retro-disk-control-callback.h',
+# 'retro-game-info.h',
+# 'retro-input-descriptor.h',
+# 'retro-keyboard-key.h',
+# 'retro-module.h',
+# 'retro-option.h',
+# 'retro-options.h',
+# 'retro-pa-player.h',
+# 'retro-pixdata-private.h',
+# 'retro-pixel-format.h',
+# 'retro-rotation.h',
+# 'retro-system-av-info.h',
+# 'retro-system-info.h',
+# 'retro-variable.h',
+
+version_split = meson.project_version().split('.')
+MAJOR_VERSION = version_split[0]
+MINOR_VERSION = version_split[1]
+MICRO_VERSION = version_split[2]
+
+version_conf = configuration_data()
+version_conf.set('VERSION', meson.project_version())
+version_conf.set('MAJOR_VERSION', MAJOR_VERSION)
+version_conf.set('MINOR_VERSION', MINOR_VERSION)
+version_conf.set('MICRO_VERSION', MICRO_VERSION)
+
+configure_file(
+ input: 'retro-gtk-version.h.in',
+ output: 'retro-gtk-version.h',
+ configuration: version_conf,
+ install: true,
+ install_dir: join_paths(get_option('includedir'), 'retro-gtk')
+)
+
+retro_gtk_c_args = [
+ '-DRETRO_GTK_COMPILATION',
+ '-DG_LOG_DOMAIN="Retro"',
+ # '-DRETRO_GTK_BINARY_VERSION="@0@"'.format(retro_gtk_binary_version),
+ # '-DRETRO_GTK_DATA_PREFIX="@0@"'.format(retro_gtk_prefix),
+
+ # '-DPROJECT_NAME=\""retro"\"',
+ '-DPROJECT_API_VERSION="@0@"'.format(api_version),
+ # '-DPROJECT_DIR_NAME="@0@"'.format(), \""retro-1.0"\" \
+ # '-DPROJECT_PLUGINS_DIR="@0@"'.format(), \""$(libdir)/retro-1.0/plugins"\" \
+ # '-DRETRO_PLUGIN_PATH="@0@"'.format(), \""$(libdir)/retro-1.0/plugins:$(libdir)/libretro:$(libdir)"\" \
+]
+
+retro_gtk_deps = [
+ dependency('gio-2.0', version: '>= 2.50'),
+ dependency('gtk+-3.0'),
+ dependency('gmodule-2.0'),
+ dependency('libpulse-simple'),
+]
+
+retro_gtk_lib = shared_library('retro-gtk-' + api_version,
+ retro_gtk_sources,
+ c_args: retro_gtk_c_args,
+ dependencies: retro_gtk_deps,
+ install: true,
+)
+
+# libgtk = shared_library('gtk-4',
+# soversion: gtk_soversion,
+# sources: [typefuncs, gtk_sources, gtkmarshal_h, gtkprivatetypebuiltins_h],
+# c_args: gtk_cargs + common_cflags,
+# include_directories: [confinc, gdkinc, gskinc, gtkinc],
+# dependencies: gtk_deps + [libgdk_dep, libgsk_dep],
+# link_with: [libgdk, libgsk, ],
+# link_whole: included_input_modules,
+# link_args: common_ldflags,
+# install: true)
+
+install_headers(retro_gtk_headers, subdir: 'retro-gtk')
+
+pkg = import('pkgconfig')
+
+pkg.generate(
+ description: 'A shared library for ...',
+ libraries: retro_gtk_lib,
+ name: 'retro-gtk',
+ filebase: 'retro-gtk-' + api_version,
+ version: meson.project_version(),
+ subdirs: 'retro-gtk',
+ requires: 'glib-2.0',
+ install_dir: join_paths(get_option('libdir'), 'pkgconfig')
+)
diff --git a/retro-gtk/retro-gtk-version.h.in b/retro-gtk/retro-gtk-version.h.in
new file mode 100644
index 0000000..4b46d59
--- /dev/null
+++ b/retro-gtk/retro-gtk-version.h.in
@@ -0,0 +1,81 @@
+// This file is part of retro-gtk. License: GPL-3.0+.
+
+#ifndef RETRO_GTK_VERSION_H
+#define RETRO_GTK_VERSION_H
+
+#if !defined(__RETRO_GTK_INSIDE__) && !defined(RETRO_GTK_COMPILATION)
+# error "Only <retro-gtk.h> can be included directly."
+#endif
+
+/**
+ * SECTION:retro-gtkversion
+ * @short_description: retro-gtk version checking
+ *
+ * retro-gtk provides macros to check the version of the library
+ * at compile-time
+ */
+
+/**
+ * RETRO_GTK_MAJOR_VERSION:
+ *
+ * retro-gtk major version component (e.g. 1 if %RETRO_GTK_VERSION is 1.2.3)
+ */
+#define RETRO_GTK_MAJOR_VERSION (@MAJOR_VERSION@)
+
+/**
+ * RETRO_GTK_MINOR_VERSION:
+ *
+ * retro-gtk minor version component (e.g. 2 if %RETRO_GTK_VERSION is 1.2.3)
+ */
+#define RETRO_GTK_MINOR_VERSION (@MINOR_VERSION@)
+
+/**
+ * RETRO_GTK_MICRO_VERSION:
+ *
+ * retro-gtk micro version component (e.g. 3 if %RETRO_GTK_VERSION is 1.2.3)
+ */
+#define RETRO_GTK_MICRO_VERSION (@MICRO_VERSION@)
+
+/**
+ * RETRO_GTK_VERSION
+ *
+ * retro-gtk version.
+ */
+#define RETRO_GTK_VERSION (@VERSION@)
+
+/**
+ * RETRO_GTK_VERSION_S:
+ *
+ * retro-gtk version, encoded as a string, useful for printing and
+ * concatenation.
+ */
+#define RETRO_GTK_VERSION_S "@VERSION@"
+
+#define RETRO_GTK_ENCODE_VERSION(major,minor,micro) \
+ ((major) << 24 | (minor) << 16 | (micro) << 8)
+
+/**
+ * RETRO_GTK_VERSION_HEX:
+ *
+ * retro-gtk version, encoded as an hexadecimal number, useful for
+ * integer comparisons.
+ */
+#define RETRO_GTK_VERSION_HEX \
+ (RETRO_GTK_ENCODE_VERSION (RETRO_GTK_MAJOR_VERSION, RETRO_GTK_MINOR_VERSION,
RETRO_GTK_MICRO_VERSION))
+
+/**
+ * RETRO_GTK_CHECK_VERSION:
+ * @major: required major version
+ * @minor: required minor version
+ * @micro: required micro version
+ *
+ * Compile-time version checking. Evaluates to %TRUE if the version
+ * of retro-gtk is greater than the required one.
+ */
+#define RETRO_GTK_CHECK_VERSION(major,minor,micro) \
+ (RETRO_GTK_MAJOR_VERSION > (major) || \
+ (RETRO_GTK_MAJOR_VERSION == (major) && RETRO_GTK_MINOR_VERSION > (minor)) || \
+ (RETRO_GTK_MAJOR_VERSION == (major) && RETRO_GTK_MINOR_VERSION == (minor) && \
+ RETRO_GTK_MICRO_VERSION >= (micro)))
+
+#endif /* RETRO_GTK_VERSION_H */
diff --git a/retro-gtk/retro-gtk.h b/retro-gtk/retro-gtk.h
index 9d0266a..64b161b 100644
--- a/retro-gtk/retro-gtk.h
+++ b/retro-gtk/retro-gtk.h
@@ -16,6 +16,7 @@
#include "retro-core.h"
#include "retro-core-descriptor.h"
#include "retro-core-view.h"
+#include "retro-gtk-version.h"
#include "retro-joypad-id.h"
#include "retro-lightgun-id.h"
#include "retro-log.h"
diff --git a/retro-gtk/retro-module-query.c b/retro-gtk/retro-module-query.c
index d98cec4..097389c 100644
--- a/retro-gtk/retro-module-query.c
+++ b/retro-gtk/retro-module-query.c
@@ -2,6 +2,8 @@
#include "retro-module-query.h"
+#include "../retro-gtk-config.h"
+
struct _RetroModuleQuery
{
GObject parent_instance;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]