meson.build 2.6 KB
Newer Older
1
# XXX: gi-docgen needs a deps file
2
expand_content_md_files = [
Emmanuele Bassi's avatar
Emmanuele Bassi committed
3
  'overview.md',
4
5
6
7
  'broadway.md',
  'osx.md',
  'wayland.md',
  'windows.md',
8
  'x11.md',
9
  'getting_started.md',
Emmanuele Bassi's avatar
Emmanuele Bassi committed
10
  'initialization.md',
11
  'resources.md',
12
13
14
  'building.md',
  'compiling.md',
  'running.md',
15
16
17
18
  'migrating-2to4.md',
  'migrating-3to4.md',
  'actions.md',
  'input-handling.md',
19
20
  'drawing-model.md',
  'css-overview.md',
21
  'css-properties.md',
22
  'section-accessibility.md',
23
24
  'section-text-widget.md',
  'section-tree-widget.md',
25
  'section-list-widget.md',
26
  'question_index.md',
27
  'visual_index.md'
28
29
]

30
31
32
33
gtk_images = []

subdir('images')

34
if get_option('gtk_doc')
35
36
37
38
39
40
41
42
  gtk4_toml = configure_file(
    input: 'gtk4.toml.in',
    output: 'gtk4.toml',
    configuration: toml_conf,
    install: true,
    install_dir: docs_dir / 'gtk4',
  )

43
44
45
46
47
48
  custom_target('gtk4-doc',
    input: [ gtk4_toml, gtk_gir[0] ],
    output: 'gtk4',
    command: [
      gidocgen,
      'generate',
49
      gidocgen_common_args,
50
51
52
      '--add-include-path=@0@'.format(meson.current_build_dir() / '../../../gtk'),
      '--config=@INPUT0@',
      '--output-dir=@OUTPUT@',
53
      '--content-dir=@0@'.format(meson.current_build_dir()),
54
55
      '--content-dir=@0@'.format(meson.current_source_dir()),
      '@INPUT1@',
56
    ],
57
    depends: [ gdk_gir[0], gsk_gir[0] ] + gtk_images,
58
59
    depend_files: [ expand_content_md_files ],
    build_by_default: true,
60
61
    install: true,
    install_dir: docs_dir,
62
  )
63
endif
64

65
rst2man = find_program('rst2man', 'rst2man.py', required: false)
66
67
if get_option('man-pages') and not rst2man.found()
  error('No rst2man found, but man pages were explicitly enabled')
68
69
endif

70
71
72
73
if get_option('man-pages') and rst2man.found()
  rst_files = [
    [ 'gtk4-broadwayd', '1' ],
    [ 'gtk4-builder-tool', '1' ],
74
75
76
77
78
79
    [ 'gtk4-encode-symbolic-svg', '1', ],
    [ 'gtk4-launch', '1', ],
    [ 'gtk4-query-settings', '1', ],
    [ 'gtk4-update-icon-cache', '1', ],
  ]

80
  if get_option('demos')
81
    rst_files += [
82
83
84
85
      [ 'gtk4-demo', '1', ],
      [ 'gtk4-demo-application', '1', ],
      [ 'gtk4-widget-factory', '1', ],
      [ 'gtk4-icon-browser', '1', ],
86
      [ 'gtk4-node-editor', '1', ],
87
88
89
    ]
  endif

90
91
92
93
94
95
96
97
98
99
  rst2man_flags = [
    '--syntax-highlight=none',
  ]

  foreach rst: rst_files
    man_name = rst[0]
    man_section = rst.get(1, '1')

    custom_target('man-@0@'.format(man_name),
      input: '@0@.rst'.format(man_name),
100
101
      output: '@0@.@1@'.format(man_name, man_section),
      command: [
102
103
        rst2man,
        rst2man_flags,
104
105
        '@INPUT@',
      ],
106
      capture: true,
107
      install: true,
108
      install_dir: get_option('mandir') / 'man@0@'.format(man_section),
109
    )
110
111
  endforeach
endif