summaryrefslogtreecommitdiff
path: root/src/lib/ecore_x/meson.build
blob: 9c1f00ddfe5999dd0a4f1b32ac2f6ff062baebcb (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
ecore_x_deps = [ecore, dl, m, ecore_input]
ecore_x_pub_deps = [eina, efl]

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('xinput2')
  ecore_x_checks += [['Xi2', 'XInput2.h', 'Xi', 'XIQueryDevice']]
endif

if get_option('xinput22')
  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

xcb = dependency('xcb', required: false)
if xcb.found() == false
  xcb = cc.find_library('xcb', required: true)
endif

x11_xcb = dependency('x11-xcb', required: false)
if x11_xcb.found() == false
  x11_xcb = cc.find_library('x11-xcb', required: true)
endif

foreach ecore_x_check : ecore_x_checks
  x_lib = cc.find_library(ecore_x_check[2],
    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
ecore_x_deps += xcb
ecore_x_deps += x11_xcb


# there are a few special cases
cc.has_header_symbol('X11/XKBlib.h', 'XkbSetDetectableAutoRepeat',
  dependencies : [x11, xcb]
)
config_h.set('ECORE_XKB', '1')

ecore_x_lib = library('ecore_x',
    ecore_x_src, pub_eo_file_target,
    dependencies: ecore_x_pub_deps + ecore_x_deps,
    include_directories : config_dir,
    install: true,
    version : meson.project_version()
)

ecore_x = declare_dependency(
  include_directories: [include_directories('.')],
  link_with: ecore_x_lib,
  sources : pub_eo_file_target + priv_eo_file_target,
  dependencies: ecore_x_pub_deps,
)

install_headers(ecore_x_header_src,
  install_dir : dir_package_include,
)