bu5hm4n pushed a commit to branch feature/meson.

http://git.enlightenment.org/core/efl.git/commit/?id=966b360e1a1133946a6ace5a3497c994ccab5926

commit 966b360e1a1133946a6ace5a3497c994ccab5926
Author: Marcel Hollerbach <[email protected]>
Date:   Wed Dec 27 21:03:32 2017 +0000

    meson: here comes ecore_x
---
 meson.build                 |   3 +-
 meson_options.txt           |  24 +++++++++
 src/lib/ecore_x/meson.build | 127 ++++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 153 insertions(+), 1 deletion(-)

diff --git a/meson.build b/meson.build
index 9d7bb628d8..e7f34ab531 100644
--- a/meson.build
+++ b/meson.build
@@ -93,7 +93,8 @@ subprojects = [
 ['ecore_avahi' , false,  true, false, false, []],
 ['ecore_con' , false,  true,  true, false, ['http-parser']],
 ['ecore_file' , false,  true, false, false, []],
-['ecore_input', false,  true, false, false, []]
+['ecore_input', false,  true, false, false, []],
+['ecore_x', false,  true, false, false, []],
 ]
 
 
diff --git a/meson_options.txt b/meson_options.txt
index fa7f073c75..c7419428bf 100644
--- a/meson_options.txt
+++ b/meson_options.txt
@@ -81,3 +81,27 @@ option('network-backend',
   value : 'none',
   description : 'connman support' 
 )
+
+option('xpresent',
+  type : 'boolean',
+  value : false,
+  description : 'xpresent support' 
+)
+
+option('xgesture',
+  type : 'boolean',
+  value : false,
+  description : 'xgesture support' 
+)
+
+option('xi2',
+  type : 'boolean',
+  value : true,
+  description : 'xi2 support' 
+)
+
+option('xi22',
+  type : 'boolean',
+  value : false,
+  description : 'xi22 support' 
+)
diff --git a/src/lib/ecore_x/meson.build b/src/lib/ecore_x/meson.build
new file mode 100644
index 0000000000..49fe3110a6
--- /dev/null
+++ b/src/lib/ecore_x/meson.build
@@ -0,0 +1,127 @@
+ecore_x_deps = []
+
+ecore_x_header_src = [
+  'Ecore_X.h',
+  'Ecore_X_Atoms.h',
+  'Ecore_X_Cursor.h'
+]
+
+ecore_x_src = [
+  'ecore_x_atoms_decl.h',
+  'ecore_x.c',
+  'ecore_x_dnd.c',
+  'ecore_x_sync.c',
+  'ecore_x_randr.c',
+  'ecore_x_fixes.c',
+  'ecore_x_damage.c',
+  'ecore_x_composite.c',
+  'ecore_x_error.c',
+  'ecore_x_events.c',
+  'ecore_x_icccm.c',
+  'ecore_x_keygrab.c',
+  'ecore_x_netwm.c',
+  'ecore_x_mwm.c',
+  'ecore_x_e.c',
+  'ecore_x_selection.c',
+  'ecore_x_window.c',
+  'ecore_x_window_prop.c',
+  'ecore_x_window_shape.c',
+  'ecore_x_pixmap.c',
+  'ecore_x_present.c',
+  'ecore_x_gc.c',
+  'ecore_x_xinerama.c',
+  'ecore_x_screensaver.c',
+  'ecore_x_dpms.c',
+  'ecore_x_drawable.c',
+  'ecore_x_cursor.c',
+  'ecore_x_test.c',
+  'ecore_x_atoms.c',
+  'ecore_x_region.c',
+  'ecore_x_image.c',
+  'ecore_x_xi2.c',
+  'ecore_x_vsync.c',
+  'ecore_x_gesture.c',
+  'ecore_x_private.h'
+]
+
+ecore_x_checks = [
+  ['Xcomposite', 'Xcomposite.h', 'Xcomposite', 'XCompositeQueryExtension'],
+  ['Xdamage', 'Xdamage.h', 'Xdamage', 'XDamageSubtract'],
+  ['Xdpms', 'dpms.h', 'Xext', 'DPMSQueryExtension'],
+  ['Xfixes', 'Xfixes.h', 'Xfixes', 'XFixesExpandRegion'],
+  ['Xinerama', 'Xinerama.h', 'Xinerama', 'XineramaQueryScreens'],
+  ['Xrandr', 'Xrandr.h', 'Xrandr', 'XRRGetScreenResourcesCurrent'],
+  ['Xrender', 'Xrender.h', 'Xrender', 'XRenderFindVisualFormat'],
+  ['Xtest', 'XTest.h', 'Xtst', 'XTestFakeKeyEvent'],
+  ['Xss', 'scrnsaver.h', 'Xss', 'XScreenSaverSelectInput'],
+]
+
+if get_option('xpresent')
+  ecore_x_checks += [['Xpresent', 'Xpresent.h', 'Xpresent', 
'XPresentQueryExtension']]
+endif
+
+if get_option('xgesture')
+  ecore_x_checks += [['Xgesture', 'gesture.h', 'Xgesture', 
'XGestureQueryExtension']]
+endif
+
+if get_option('xi2')
+  ecore_x_checks += [['Xi2', 'XInput2.h', 'Xi', 'XIQueryDevice']]
+endif
+
+if get_option('xi22')
+  ecore_x_checks += [['Xi2_2', 'XInput2.h', 'Xi','XIGrabTouchBegin']]
+endif
+
+x11 = dependency('x11', required: false)
+if x11.found() == false
+  x11 = cc.find_library('x11', required: true)
+endif
+
+foreach ecore_x_check : ecore_x_checks
+  x_lib = cc.find_library(ecore_x_check[2], 
+    dependencies : [x11],
+    required: false
+  )
+
+  if cc.compiles('''
+#include <X11/Xlib.h>
+#include <X11/extensions/'''+ecore_x_check[1]+'''>
+int main () {
+    #ifndef '''+ecore_x_check[3]+'''
+        '''+ecore_x_check[3]+''';
+    #endif
+}
+    ''',
+      dependencies : [x_lib, x11]
+    ) == true
+    config_h.set('ECORE_'+ecore_x_check[0].to_upper(), '1')
+  else
+    error('extension '+ecore_x_check[0]+' not found for X11')
+  endif
+  ecore_x_deps += x_lib 
+endforeach
+
+ecore_x_deps += x11
+# there are a few special cases
+cc.has_header_symbol('X11/XKBlib.h', 'XkbSetDetectableAutoRepeat',
+  dependencies : x11
+)
+config_h.set('ECORE_XKB', '1')
+
+ecore_x_lib = library('ecore_x',
+    ecore_x_src, pub_eo_file_target,
+    dependencies: [ecore, dl, m, ecore_input, ecore_x_deps],
+    include_directories : config_dir,
+    install: true,
+)
+
+ecore_x = declare_dependency(
+  include_directories: [include_directories('.')],
+  link_with: ecore_x_lib,
+  sources : pub_eo_file_target,
+  dependencies: [eina],
+)
+
+install_headers(ecore_x_header_src,
+  install_dir : dir_package_include,
+)
\ No newline at end of file

-- 


Reply via email to