aboutsummaryrefslogtreecommitdiff
path: root/meson.build
blob: d80f275adf90774f50fc3306e8e5b010389f6167 (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
87
project(
  'libjaylink', 'c',
  version: '0.3.1',
  license: ' GPL-3.0-or-later',
  default_options: [
    'c_std=gnu99',
    'warning_level=3',
    'werror=true',
  ]
)

project_description = 'Library to access J-Link devices'
project_url = 'https://gitlab.zapb.de/libjaylink/libjaylink.git'

option_usb = get_option('usb')

include_dirs = include_directories('libjaylink')

libusb = dependency(
  'libusb-1.0',
  version: '>=1.0.16',
  required: option_usb,
)

have_usb = libusb.found()

if have_usb
  add_project_arguments('-DHAVE_LIBUSB', language: 'c')
endif

version = meson.project_version()
version_array = version.split('.')
major_version = version_array[0].to_int()
minor_version = version_array[1].to_int()
version_micro = version_array[2].to_int()

package_version = {
  'major': version_array[0],
  'minor': version_array[1],
  'micro': version_array[2],
}

git = find_program('git', required: false)

if git.found()
  git_tag = run_command([git, 'describe', '--dirty'], check: false).stdout().strip()

  if git_tag != ''
    package_version_string = git_tag
  else
    package_version_string = version
  endif
else
  package_version_string = version
endif

# Libtool interface version of libjaylink. This is not the same as the package
# version. For information about the versioning system of libtool, see:
# http://www.gnu.org/software/libtool/manual/libtool.html#Libtool-versioning

library_version = {
  'current': 2,
  'revision': 0,
  'age': 2,
}

library_version_string = '@0@.@1@.@2@'.format(
  library_version['current'] - library_version['age'],
  library_version['age'],
  library_version['revision'])

subdir('libjaylink')

summary({
    'Package version': package_version_string,
    'Library version': library_version_string,
  },
  section: 'Project details'
)

summary({
    'USB': have_usb,
    'TCP': true
  },
  section: 'Enabled transports',
  bool_yn: true
)