aboutsummaryrefslogtreecommitdiff
path: root/subprojects/d2tk/pugl/examples/meson.build
blob: d455faf0c5c9effdb98e5c920ef381e5fd812d11 (plain)
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
data_dir = get_option('prefix') / get_option('datadir') / 'pugl-0'
example_args = ['-DPUGL_DATA_DIR="@0@"'.format(data_dir)]

gl_examples = [
  'pugl_cxx_demo.cpp',
  'pugl_embed_demo.c',
  'pugl_print_events.c',
  'pugl_shader_demo.c',
  'pugl_window_demo.c',
]

cairo_examples = [
  'pugl_cairo_demo.c'
]

vulkan_examples = [
  'pugl_vulkan_cxx_demo.cpp',
  'pugl_vulkan_demo.c',
]

includes = [
  '.',
  '..',
  '../bindings/cxx/include',
  '../include',
]

subdir('shaders')

# Build GL examples
if opengl_dep.found()
  foreach example : gl_examples
    source = [example]
    target = example.split('.')[0]
    dependencies = [gl_backend_dep]

    if target == 'pugl_shader_demo'
      source += ['file_utils.c', 'glad/glad.c']
      dependencies += [dl_dep]
    elif target == 'pugl_print_events'
      dependencies += [stub_backend_dep]
    endif

    executable(target, source,
               include_directories: include_directories(includes),
               c_args: example_args,
               cpp_args: example_args,
               dependencies: dependencies)
  endforeach
endif

# Build Cairo examples
if cairo_dep.found()
  foreach example : cairo_examples
    target = example.split('.')[0]
    executable(target, example,
               include_directories: include_directories(includes),
               c_args: example_args,
               dependencies: [pugl_dep, cairo_backend_dep])
  endforeach
endif

# Build Vulkan examples
if vulkan_dep.found()
  foreach example : vulkan_examples
    source = [example]
    target = example.split('.')[0]
    dependencies = [dl_dep, vulkan_backend_dep]

    if target == 'pugl_vulkan_cxx_demo'
      source += ['file_utils.c']
    endif

    executable(target, source,
               include_directories: include_directories(includes),
               c_args: example_args,
               cpp_args: example_args,
               dependencies: dependencies)
  endforeach
endif