File: meson.build

package info (click to toggle)
zim-tools 2.1.0-1
  • links: PTS, VCS
  • area: main
  • in suites: bullseye, sid
  • size: 624 kB
  • sloc: cpp: 4,534; python: 72; makefile: 3
file content (65 lines) | stat: -rw-r--r-- 2,356 bytes parent folder | download | duplicates (2)
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
project('zim-tools', ['c', 'cpp'],
  version : '2.1.0',
  license : 'GPLv3+',
  default_options : ['c_std=c11', 'cpp_std=c++11', 'werror=true'])

add_global_arguments(['-Werror', '-Wall'], language:'cpp')

add_global_arguments('-DVERSION="@0@"'.format(meson.project_version()), language : 'cpp')

static_linkage = get_option('static-linkage')
if static_linkage
  add_global_link_arguments('-static-libstdc++', '--static', language:'cpp')
endif

libzim_dep = dependency('libzim', version : '>=6.3.0', static:static_linkage)

compiler = meson.get_compiler('cpp')
find_library_in_compiler = meson.version().version_compare('>=0.31.0')
rt_dep = dependency('rt', required:false)
docopt_dep = dependency('docopt', static:static_linkage)

with_writer = target_machine.system() != 'windows'

if with_writer
  thread_dep = dependency('threads')
  zlib_dep = dependency('zlib', static:static_linkage)
  gumbo_dep = dependency('gumbo', static:static_linkage)

  magic_include_path = ''
  magic_prefix_install = get_option('magic-install-prefix')
  if magic_prefix_install == ''
    if compiler.has_header('magic.h')
      if find_library_in_compiler
        magic_lib = compiler.find_library('magic')
      else
        magic_lib = find_library('magic')
      endif
      magic_dep = declare_dependency(link_args:['-lmagic'])
    else
      error('magic.h not found')
    endif
  else
    if not find_library_in_compiler
      error('For custom magic_prefix_install you need a meson version >=0.31.0')
    endif
    magic_include_path = magic_prefix_install + '/include'
    magic_include_args = ['-I'+magic_include_path]
    if compiler.has_header('magic.h', args:magic_include_args)
      magic_include_dir = include_directories(magic_include_path, is_system:true)
      magic_lib_path = join_paths(magic_prefix_install, get_option('libdir'))
      magic_lib = compiler.find_library('magic', dirs:magic_lib_path, required:false)
      if not magic_lib.found()
        magic_lib_path = join_paths(magic_prefix_install, 'lib')
        magic_lib = compiler.find_library('magic', dirs:magic_lib_path)
      endif
      magic_link_args = ['-L'+magic_lib_path, '-lmagic']
      magic_dep = declare_dependency(include_directories:magic_include_dir, link_args:magic_link_args)
    else
      error('magic.h not found')
    endif
  endif
endif

subdir('src')
subdir('test')