[retro-gtk] Create shared/ dir



commit e4f98ce788841115d344b78bb801f7a4dbdbb411
Author: Alexander Mikhaylenko <alexm gnome org>
Date:   Wed Jan 8 01:47:31 2020 +0500

    Create shared/ dir
    
    Move the parts of the code that will be shared between the library and the
    runner process there.

 .gitlab-ci.yml                                     |  4 ++--
 meson.build                                        |  2 ++
 retro-gtk/meson.build                              | 20 ++++++--------------
 shared/meson.build                                 | 16 ++++++++++++++++
 {retro-gtk => shared}/retro-controller-codes.c     |  0
 {retro-gtk => shared}/retro-controller-codes.h     |  0
 {retro-gtk => shared}/retro-controller-type.c      |  0
 {retro-gtk => shared}/retro-controller-type.h      |  0
 {retro-gtk => shared}/retro-input-private.h        |  0
 {retro-gtk => shared}/retro-input.c                |  0
 {retro-gtk => shared}/retro-input.h                |  0
 {retro-gtk => shared}/retro-keyboard-key-private.h |  0
 {retro-gtk => shared}/retro-memory-type.c          |  0
 {retro-gtk => shared}/retro-memory-type.h          |  0
 {retro-gtk => shared}/retro-pixel-format-private.h |  0
 {retro-gtk => shared}/retro-pixel-format.c         |  0
 {retro-gtk => shared}/retro-rumble-effect.c        |  0
 {retro-gtk => shared}/retro-rumble-effect.h        |  0
 18 files changed, 26 insertions(+), 16 deletions(-)
---
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 5222955..0490621 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -8,13 +8,13 @@ api-visibility:
   stage: lint
   script:
     # Check that private headers aren't included in public ones.
-    - if grep "include.*private.h" $(ls retro-gtk/*.h | grep -v private);
+    - if grep "include.*private.h" $(ls retro-gtk/*.h shared/*.h | grep -v private);
       then
         echo "Private headers shouldn't be included in public ones.";
         exit 1;
       fi
     # Check that retro-gtk.h contains all the public headers.
-    - for header in $(ls retro-gtk | grep \.h$ | grep -v private | grep -v retro-gtk.h);
+    - for header in $(ls retro-gtk shared | grep \.h$ | grep -v private | grep -v retro-gtk.h);
       do
         if ! grep -q "$header" retro-gtk/retro-gtk.h;
         then
diff --git a/meson.build b/meson.build
index 88f74da..e693fab 100644
--- a/meson.build
+++ b/meson.build
@@ -14,6 +14,7 @@ libdir = join_paths(prefix, get_option('libdir'))
 libretrodir = join_paths(libdir, 'libretro')
 
 confinc = include_directories('.')
+shared_inc = include_directories('shared')
 
 retro_gtk_version = meson.project_version()
 retro_gtk_api_version = '1'
@@ -40,6 +41,7 @@ configure_file(
   configuration: config_h,
 )
 
+subdir('shared')
 subdir('retro-gtk')
 if get_option('build-tests')
   subdir('tests')
diff --git a/retro-gtk/meson.build b/retro-gtk/meson.build
index 4130f43..90a21fe 100644
--- a/retro-gtk/meson.build
+++ b/retro-gtk/meson.build
@@ -6,12 +6,11 @@ retro_gtk_resources = gnome.compile_resources(
 )
 
 retro_gtk_sources = [
+  shared_sources,
   retro_gtk_resources,
   'retro-cairo-display.c',
   'retro-controller.c',
-  'retro-controller-codes.c',
   'retro-controller-iterator.c',
-  'retro-controller-type.c',
   'retro-core.c',
   'retro-core-descriptor.c',
   'retro-core-view.c',
@@ -20,13 +19,11 @@ retro_gtk_sources = [
   'retro-game-info.c',
   'retro-gl-display.c',
   'retro-glsl-filter.c',
-  'retro-input.c',
   'retro-input-descriptor.c',
   'retro-keyboard.c',
   'retro-key-joypad-mapping.c',
   'retro-log.c',
   'retro-main-loop-source.c',
-  'retro-memory-type.c',
   'retro-module.c',
   'retro-module-iterator.c',
   'retro-module-query.c',
@@ -35,33 +32,27 @@ retro_gtk_sources = [
   'retro-pa-player.c',
   'retro-pixbuf.c',
   'retro-pixdata.c',
-  'retro-pixel-format.c',
-  'retro-rumble-effect.c',
   'retro-video-filter.c',
 ]
 
 retro_gtk_main_header = 'retro-gtk.h'
 
 retro_gtk_headers = [
+  shared_headers,
   retro_gtk_main_header,
   'retro-controller.h',
-  'retro-controller-codes.h',
   'retro-controller-iterator.h',
-  'retro-controller-type.h',
   'retro-core.h',
   'retro-core-descriptor.h',
   'retro-core-view.h',
-  'retro-input.h',
   'retro-key-joypad-mapping.h',
   'retro-log.h',
-  'retro-memory-type.h',
   'retro-module-iterator.h',
   'retro-module-query.h',
   'retro-option.h',
   'retro-option-iterator.h',
   'retro-pixbuf.h',
   'retro-pixdata.h',
-  'retro-rumble-effect.h',
   'retro-video-filter.h',
 ]
 
@@ -107,7 +98,7 @@ retro_gtk_lib = shared_library(
   retro_gtk_sources,
   c_args: retro_gtk_c_args,
   dependencies: retro_gtk_deps,
-  include_directories: confinc,
+  include_directories: [ confinc, shared_inc ],
   install: true,
   soversion: 0,
 )
@@ -118,7 +109,8 @@ retro_gtk_dep_sources = [
 
 if get_option('introspection')
   retro_gtk_gir_args = [
-     '--quiet',
+    '--quiet',
+    '-DRETRO_GTK_COMPILATION',
     '-DRETRO_GTK_USE_UNSTABLE_API',
   ]
 
@@ -168,7 +160,7 @@ retro_gtk_inc = include_directories('.')
 retro_gtk_dep = declare_dependency(
   link_with: retro_gtk_lib,
   sources: retro_gtk_dep_sources,
-  include_directories: [ confinc, retro_gtk_inc ],
+  include_directories: [ confinc, shared_inc, retro_gtk_inc ],
   dependencies: retro_gtk_deps,
 )
 
diff --git a/shared/meson.build b/shared/meson.build
new file mode 100644
index 0000000..bb52b13
--- /dev/null
+++ b/shared/meson.build
@@ -0,0 +1,16 @@
+shared_sources = files([
+  'retro-controller-codes.c',
+  'retro-controller-type.c',
+  'retro-input.c',
+  'retro-memory-type.c',
+  'retro-pixel-format.c',
+  'retro-rumble-effect.c',
+])
+
+shared_headers = files([
+  'retro-controller-codes.h',
+  'retro-controller-type.h',
+  'retro-input.h',
+  'retro-memory-type.h',
+  'retro-rumble-effect.h',
+])
diff --git a/retro-gtk/retro-controller-codes.c b/shared/retro-controller-codes.c
similarity index 100%
rename from retro-gtk/retro-controller-codes.c
rename to shared/retro-controller-codes.c
diff --git a/retro-gtk/retro-controller-codes.h b/shared/retro-controller-codes.h
similarity index 100%
rename from retro-gtk/retro-controller-codes.h
rename to shared/retro-controller-codes.h
diff --git a/retro-gtk/retro-controller-type.c b/shared/retro-controller-type.c
similarity index 100%
rename from retro-gtk/retro-controller-type.c
rename to shared/retro-controller-type.c
diff --git a/retro-gtk/retro-controller-type.h b/shared/retro-controller-type.h
similarity index 100%
rename from retro-gtk/retro-controller-type.h
rename to shared/retro-controller-type.h
diff --git a/retro-gtk/retro-input-private.h b/shared/retro-input-private.h
similarity index 100%
rename from retro-gtk/retro-input-private.h
rename to shared/retro-input-private.h
diff --git a/retro-gtk/retro-input.c b/shared/retro-input.c
similarity index 100%
rename from retro-gtk/retro-input.c
rename to shared/retro-input.c
diff --git a/retro-gtk/retro-input.h b/shared/retro-input.h
similarity index 100%
rename from retro-gtk/retro-input.h
rename to shared/retro-input.h
diff --git a/retro-gtk/retro-keyboard-key-private.h b/shared/retro-keyboard-key-private.h
similarity index 100%
rename from retro-gtk/retro-keyboard-key-private.h
rename to shared/retro-keyboard-key-private.h
diff --git a/retro-gtk/retro-memory-type.c b/shared/retro-memory-type.c
similarity index 100%
rename from retro-gtk/retro-memory-type.c
rename to shared/retro-memory-type.c
diff --git a/retro-gtk/retro-memory-type.h b/shared/retro-memory-type.h
similarity index 100%
rename from retro-gtk/retro-memory-type.h
rename to shared/retro-memory-type.h
diff --git a/retro-gtk/retro-pixel-format-private.h b/shared/retro-pixel-format-private.h
similarity index 100%
rename from retro-gtk/retro-pixel-format-private.h
rename to shared/retro-pixel-format-private.h
diff --git a/retro-gtk/retro-pixel-format.c b/shared/retro-pixel-format.c
similarity index 100%
rename from retro-gtk/retro-pixel-format.c
rename to shared/retro-pixel-format.c
diff --git a/retro-gtk/retro-rumble-effect.c b/shared/retro-rumble-effect.c
similarity index 100%
rename from retro-gtk/retro-rumble-effect.c
rename to shared/retro-rumble-effect.c
diff --git a/retro-gtk/retro-rumble-effect.h b/shared/retro-rumble-effect.h
similarity index 100%
rename from retro-gtk/retro-rumble-effect.h
rename to shared/retro-rumble-effect.h


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