aboutsummaryrefslogtreecommitdiff
path: root/contrib/meson/meson/meson.build
blob: 9e8b8c699856c138c06b42a0392f59c94ff60256 (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
# #############################################################################
# Copyright (c) 2018-present        lzutao <taolzu(at)gmail.com>
# Copyright (c) 2022-present        Tristan Partin <tristan(at)partin.io>
# All rights reserved.
#
# This source code is licensed under both the BSD-style license (found in the
# LICENSE file in the root directory of this source tree) and the GPLv2 (found
# in the COPYING file in the root directory of this source tree).
# #############################################################################

cc = meson.get_compiler('c')

pkgconfig = import('pkgconfig')

lz4_source_root = '../../..'

lz4_version = meson.project_version()

lz4_h_file = lz4_source_root / 'lib/lz4.h'
GetLz4LibraryVersion_py = find_program('GetLz4LibraryVersion.py')
lz4_version = run_command(GetLz4LibraryVersion_py, lz4_h_file, check: true).stdout().strip()
message('Project version is now: @0@'.format(lz4_version))

add_project_arguments('-DXXH_NAMESPACE=LZ4_', language: 'c')

if get_option('debug')
  add_project_arguments(cc.get_supported_arguments([
        '-Wcast-qual',
        '-Wcast-align',
        '-Wshadow',
        '-Wswitch-enum',
        '-Wdeclaration-after-statement',
        '-Wstrict-prototypes',
        '-Wundef',
        '-Wpointer-arith',
        '-Wstrict-aliasing=1',
        '-DLZ4_DEBUG=@0@'.format(get_option('debug-level')),
      ]
    ),
    language: 'c',
  )
endif

if get_option('memory-usage') > 0
  add_project_arguments(
    '-DLZ4_MEMORY_USAGE=@0@'.format(get_option('memory-usage')),
    language: 'c'
  )
endif

subdir('lib')

if get_option('programs')
  subdir('programs')
endif

if get_option('tests')
  subdir('tests')
endif

if get_option('contrib')
  subdir('contrib')
endif

if get_option('examples')
  subdir('examples')
endif