meson.build 1.92 KB
Newer Older
1
project('zathura-pdf-mupdf', 'c',
Sebastian Ramacher's avatar
Sebastian Ramacher committed
2
  version: '0.3.5',
3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
  meson_version: '>=0.43',
  default_options: 'c_std=c11'
)

version = meson.project_version()
version_array = version.split('.')

cc = meson.get_compiler('c')

prefix = get_option('prefix')
datadir = get_option('datadir')
metainfodir = join_paths(datadir, 'metainfo')
desktopdir = join_paths(datadir, 'applications')

# required dependencies
Sebastian Ramacher's avatar
Sebastian Ramacher committed
18
zathura = dependency('zathura', version: '>=0.3.9')
19 20 21 22
girara = dependency('girara-gtk3')
glib = dependency('glib-2.0')
cairo = dependency('cairo')
mupdf = cc.find_library('mupdf')
Leonardo Taccari's avatar
Leonardo Taccari committed
23
mupdfthird = cc.find_library('mupdf-third')
24

25 26 27 28 29 30
build_dependencies = [
  zathura,
  girara,
  glib,
  cairo,
  mupdf,
31
  mupdfthird
32
]
33

34 35
if get_option('link-external')
  libjpeg = dependency('libjpeg')
36
  libjbig2dec = cc.find_library('jbig2dec')
37 38 39 40 41 42 43 44 45
  libopenjp2 = dependency('libopenjp2')

  build_dependencies += [
    libjpeg,
    libjbig2dec,
    libopenjp2
  ]
endif

Sebastian Ramacher's avatar
Sebastian Ramacher committed
46 47 48 49 50 51
if get_option('plugindir') == ''
  plugindir = zathura.get_pkgconfig_variable('plugindir')
else
  plugindir = get_option('plugindir')
endif

52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71
# defines
defines = [
  '-DVERSION_MAJOR=@0@'.format(version_array[0]),
  '-DVERSION_MINOR=@0@'.format(version_array[1]),
  '-DVERSION_REV=@0@'.format(version_array[2]),
  '-D_DEFAULT_SOURCE',
]

# compile flags
flags = [
  '-Wall',
  '-Wextra',
  '-pedantic',
  '-Werror=implicit-function-declaration',
  '-Werror=vla',
  '-fvisibility=hidden'
]
flags = cc.get_supported_arguments(flags)

sources = files(
72 73 74 75 76 77 78 79 80 81
  'zathura-pdf-mupdf/document.c',
  'zathura-pdf-mupdf/image.c',
  'zathura-pdf-mupdf/index.c',
  'zathura-pdf-mupdf/links.c',
  'zathura-pdf-mupdf/page.c',
  'zathura-pdf-mupdf/plugin.c',
  'zathura-pdf-mupdf/render.c',
  'zathura-pdf-mupdf/search.c',
  'zathura-pdf-mupdf/select.c',
  'zathura-pdf-mupdf/utils.c'
82 83 84 85 86 87 88
)

pdf = shared_module('pdf-mupdf',
  sources,
  dependencies: build_dependencies,
  c_args: defines + flags,
  install: true,
89
  install_dir: plugindir
90 91 92
)

subdir('data')