meson.build 2.88 KB
Newer Older
Zander Brown's avatar
Zander Brown committed
1
kgx_sources = [
2
  'kgx-application.c',
Zander Brown's avatar
Zander Brown committed
3
  'kgx-application.h',
4
  'fp-vte-util.c',
Zander Brown's avatar
Zander Brown committed
5
  'fp-vte-util.h',
6
  'kgx-terminal.c',
Zander Brown's avatar
Zander Brown committed
7
  'kgx-terminal.h',
8
  'kgx-search-box.c',
Zander Brown's avatar
Zander Brown committed
9
  'kgx-search-box.h',
10 11 12 13
  'kgx-close-dialog.c',
  'kgx-close-dialog.h',
  'kgx-close-dialog-row.c',
  'kgx-close-dialog-row.h',
Zander Brown's avatar
Zander Brown committed
14
  'kgx-window.c',
Zander Brown's avatar
Zander Brown committed
15 16
  'kgx-window.h',
  'kgx-process.h',
Zander Brown's avatar
Zander Brown committed
17 18 19
]

kgx_deps = [
20
  dependency('gio-2.0', version: '>= 2.58'),
21
  dependency('gtk+-3.0', version: '>= 3.24'),
Zander Brown's avatar
Zander Brown committed
22
  dependency('libhandy-0.0', version: '>= 0.0.11', fallback: ['handy', 'libhandy_dep']),
Zander Brown's avatar
Zander Brown committed
23
  cc.find_library('m', required: false),
Zander Brown's avatar
Zander Brown committed
24 25
]

26 27 28 29 30 31 32 33 34 35 36 37
ideal_vte = dependency('vte-2.91', version: '>= 0.57',
                       fallback: ['vte', 'libvte_gtk3_dep'],
                       required: false)

if not ideal_vte.found()
  message('Using old vte, this is only supported for PureOS!')
  add_project_arguments(['-DVTE_PTY_NO_CTTY=0'], language: 'c')
  kgx_deps += [dependency('vte-2.91', version: '>= 0.54.2')]
else
  kgx_deps += [ideal_vte]
endif

38 39 40 41 42 43 44
if get_option('gtop')
  kgx_deps += dependency('libgtop-2.0')
  kgx_sources += 'kgx-process.c'
else
  kgx_sources += 'kgx-process-dummy.c'
endif

Zander Brown's avatar
Zander Brown committed
45 46 47 48 49 50 51
gnome = import('gnome')

kgx_sources += gnome.compile_resources('kgx-resources',
  'kgx.gresource.xml',
  c_name: 'kgx'
)

Zander Brown's avatar
Zander Brown committed
52
kgx_sources += gnome.mkenums_simple('kgx-enums', sources: 'kgx-terminal.h')
Zander Brown's avatar
Zander Brown committed
53

Zander Brown's avatar
Zander Brown committed
54 55 56 57 58 59 60 61
kgx_lib = library ('kgx', kgx_sources, dependencies: kgx_deps)
kgx_inc = include_directories('.')

kgx_dep = declare_dependency (sources: kgx_sources,
                              include_directories: kgx_inc,
                              link_with: kgx_lib,
                              dependencies: kgx_deps)

Zander Brown's avatar
Zander Brown committed
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
if get_option('gir')
  kgx_gir = gnome.generate_gir(
      kgx_lib,
      sources: kgx_sources,
      header: 'kgx.h',
      nsversion: '1.0',
      namespace: 'Kgx',
      symbol_prefix: 'kgx',
      identifier_prefix: 'Kgx',
      includes: [
        'GObject-2.0',
        'Gio-2.0',
        'Atk-1.0',
        'Gdk-3.0',
        'Gtk-3.0',
        'Pango-1.0',
        'Vte-2.91',
      ],
      dependencies: [kgx_dep],
      install: false,
      build_by_default: true,
      # This is bad but we aren't generating a public GIR
      extra_args: '--accept-unprefixed',
  )
  if get_option('vapi')
    kgx_vala_dep = gnome.generate_vapi('Kgx-1.0',
                                       sources: kgx_gir[0],
                                       packages: [
                                          'gio-2.0',
                                          'atk',
                                          'gtk+-3.0',
                                          'pango',
                                          'vte-2.91',
                                       ],
                                       install: false,
    )
  endif
else
  if get_option('vapi')
    error('Can\'t generate VAPI without GIR')
  endif
endif

Zander Brown's avatar
Zander Brown committed
105 106
executable('kgx', 'main.c',
  dependencies: kgx_dep,
Zander Brown's avatar
Zander Brown committed
107 108
  install: true,
)