meson.build 4.28 KB
Newer Older
1
project(
2
  'gnome-disk-utility', 'c',
Kai Lüke's avatar
Kai Lüke committed
3
  version: '3.32.0',
4
  license: 'GPL2.0',
5
  default_options: 'buildtype=debugoptimized',
6
  meson_version: '>= 0.47.0'
7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22
)

gdu_name = 'gnome-disk-utility'
gdu_version = meson.project_version()

gdu_prefix = get_option('prefix')
gdu_bindir = join_paths(gdu_prefix, get_option('bindir'))
gdu_datadir = join_paths(gdu_prefix, get_option('datadir'))
gdu_libexecdir = join_paths(gdu_prefix, get_option('libexecdir'))
gdu_localedir = join_paths(gdu_prefix, get_option('localedir'))
gdu_mandir = join_paths(gdu_prefix, get_option('mandir'))
gdu_sysconfdir = join_paths(gdu_prefix, get_option('sysconfdir'))

cc = meson.get_compiler('c')

config_h = configuration_data()
23 24
config_h.set_quoted('PACKAGE_VERSION', gdu_version)
config_h.set_quoted('GETTEXT_PACKAGE', gdu_name)
25 26

# compiler flags
27
compiler_flags = []
28

29
if get_option('buildtype').contains('debug')
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
  test_cflags = [
    '-fno-strict-aliasing',
    '-Wcast-align',
    '-Wdeclaration-after-statement',
    '-Wformat=2',
    '-Winit-self',
    '-Winline',
    '-Wmissing-declarations',
    '-Wmissing-format-attribute',
    '-Wmissing-include-dirs',
    '-Wmissing-noreturn',
    '-Wmissing-prototypes',
    '-Wnested-externs',
    '-Wno-error=missing-field-initializers',
    '-Wno-error=unused-parameter',
    '-Wno-missing-field-initializers',
    '-Wno-unused-parameter',
    '-Wold-style-definition',
    '-Wpacked',
    '-Wredundant-decls',
    '-Wshadow',
    '-Wsign-compare',
    '-Wstrict-aliasing',
    '-Wstrict-prototypes',
    '-Wswitch-default',
    '-Wswitch-enum',
    '-Wundef',
    '-Wunused-but-set-variable',
    '-Wwrite-strings'
  ]

61
  compiler_flags += cc.get_supported_arguments(test_cflags)
62 63
endif

64
add_project_arguments(compiler_flags, language: 'c')
65 66 67

gmodule_dep = dependency('gmodule-2.0')
gio_unix_dep = dependency('gio-unix-2.0', version: '>= 2.31.0')
68
udisk_dep = dependency('udisks2', version: '>= 2.7.6')
69 70 71 72 73 74 75 76 77
gtk_dep = dependency('gtk+-3.0', version: '>= 3.16.0')
libsecret_dep = dependency('libsecret-1', version: '>= 0.7')
pwquality_dep = dependency('pwquality', version: '>= 1.0.0')
libcanberra_dep = dependency('libcanberra-gtk3', version: '>= 0.1')
dvdread_dep = dependency('dvdread', version: '>= 4.2.0')
libnotify_dep = dependency('libnotify', version: '>= 0.7')
liblzma_dep = dependency('liblzma', version: '>= 5.0.5')
m_dep = cc.find_library('m')

78
# *** Check for logind ***
79 80
if get_option('logind') == 'libsystemd'
  logind_dep = dependency('libsystemd', version: '>= 209')
81
endif
82 83
if get_option('logind') == 'libelogind'
  logind_dep = dependency('libelogind', version: '>= 209')
84
endif
85 86
enable_logind = get_option('logind') != 'none'
config_h.set('HAVE_LOGIND', enable_logind,
87
             description: 'Define to 1 if logind API is available')
88 89 90 91 92 93 94 95 96 97 98 99 100

gnome = import('gnome')
i18n = import('i18n')

po_dir = join_paths(meson.source_root(), 'po')

top_inc = include_directories('.', 'src')

subdir('src/libgdu')
subdir('src/disks')
subdir('src/disk-image-mounter')

# *** gnome-settings-daemon plug-in ***
101
enable_gsd_plugin = get_option('gsd_plugin')
102 103 104 105 106 107 108 109
if enable_gsd_plugin
  subdir('src/notify')
endif

subdir('data')
subdir('po')
subdir('doc/man')

110 111 112 113 114
configure_file(
  output: 'config.h',
  configuration: config_h
)

115 116 117 118
meson.add_install_script(
  'meson_post_install.py',
  gdu_datadir
)
119 120 121 122 123 124 125 126 127 128

output = '\n        gnome-disk-utility ' + gdu_version + '\n'
output += '        =========================\n\n'
output += '        prefix:                     ' + gdu_prefix + '\n'
output += '        bindir:                     ' + gdu_bindir + '\n'
output += '        datadir:                    ' + gdu_datadir + '\n'
output += '        libexecdir:                 ' + gdu_libexecdir + '\n'
output += '        localedir:                  ' + gdu_localedir + '\n'
output += '        mandir:                     ' + gdu_mandir + '\n'
output += '        sysconfdir:                 ' + gdu_sysconfdir + '\n\n'
129
output += '        Use logind:                 ' + enable_logind.to_string() + '\n'
130 131
output += '        Build g-s-d plug-in:        ' + enable_gsd_plugin.to_string() + '\n\n'
output += '        compiler:                   ' + cc.get_id() + '\n'
132
output += '        cflags:                     ' + ' '.join(compiler_flags) + '\n\n'
133
output += '        (Change with: meson configure BUILDDIR -D logind=libsystemd|libelogind|none -D gsd_plugin=true|false)\n\n'
134
message(output)