aboutsummaryrefslogtreecommitdiff
path: root/client/libacron/meson.build
blob: 0773348528ec60c4c53b9e022aed2c347cc8e735 (plain)
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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
project('libac', 'c',
  version : '1.0',
  license : 'GPL-2.0-only',
  default_options : [
    'c_std=gnu11', # c11 won't have ssize_t
    'b_lundef=false'
    ]
)

xtra_link_args = []
xtra_c_args = [ '-D_POSIX_C_SOURCE=200809L' ]
if get_option('debug') == true
  xtra_c_args += '-DDEBUG'
endif

if meson.get_compiler('c').get_id() != 'msvc'
  xtra_c_args += '-fvisibility=hidden'
endif

install_headers([
    'include/common.h',
    'include/events.h',
    'include/ids.h',
    'include/incl.h',
    'include/libac.h',
    'include/net.h',
    'include/requests.h'
  ],
  subdir : 'libac'
)

libac_sources = [
  'ids.c',
  'library.c',
  'net.c',
  'private/helpers.c',
  'private/log.c',
  'private/serializer.c',
  'wic/src/http_parser.c',
  'wic/src/wic.c'
]

inc = include_directories('include', 'private', 'wic/include')

jsonc_dep = dependency('json-c',
  fallback : [ 'json-c', 'json_c_dep' ],
  default_options: [ 'default_library=static' ]
)

cc = meson.get_compiler('c')
m_dep = cc.find_library('m', required : false)

libac = library('ac',
  libac_sources,
  version : '1.0',
  soversion : '0',
  include_directories : inc,
  dependencies : [ jsonc_dep, m_dep ],
  link_args : xtra_link_args,
  c_args : xtra_c_args,
  install : true
)

pkg_mod = import('pkgconfig')
pkg_mod.generate(
  libraries : libac,
  version : '1.0',
  name : 'libac',
  filebase : 'ac',
  description : 'Acron client library',
  subdirs : 'libac'
)

libac_dep = declare_dependency(
  include_directories : inc,
  link_with : libac,
  dependencies : [ jsonc_dep, m_dep ]
)

# Warnings
if get_option('debug') == true
  message('Debug build')
  if get_option('b_sanitize') == 'none'
    message('Make sure to use -Db_sanitize=address to enable ASAN for debug builds.')
  endif
endif