File: meson.build

package info (click to toggle)
libdisplay-info 0.3.0-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 1,460 kB
  • sloc: ansic: 10,055; python: 294; sh: 131; makefile: 3
file content (104 lines) | stat: -rw-r--r-- 2,287 bytes parent folder | download
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
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
project(
	'libdisplay-info',
	'c',
	version: '0.3.0',
	license: 'MIT',
	meson_version: '>= 0.57.0',
	default_options: [
		'c_std=c11',
		'warning_level=3',
		'wrap_mode=nodownload',
	],
)

version = meson.project_version().split('-')[0]
version_major = version.split('.')[0]
version_minor = version.split('.')[1]
assert(version_major == '0')

dep_hwdata = dependency('hwdata', required: false, native: true)
if dep_hwdata.found()
	hwdata_dir = dep_hwdata.get_variable(pkgconfig: 'pkgdatadir')
	pnp_ids = files(hwdata_dir / 'pnp.ids')
else
	pnp_ids = files('/usr/share/hwdata/pnp.ids')
endif

gen_search_table = find_program('tool/gen-search-table.py')
pnp_id_table = custom_target(
	'pnp-id-table.c',
	command: [ gen_search_table, pnp_ids, '@OUTPUT@', 'pnp_id_table' ],
	output: 'pnp-id-table.c',
)

cc = meson.get_compiler('c')

math = cc.find_library('m', required: false)

add_project_arguments(['-D_POSIX_C_SOURCE=200809L'], language: 'c')

add_project_arguments(cc.get_supported_arguments([
	'-Wundef',
	'-Wmissing-prototypes',
	'-Walloca',
	'-Wdeclaration-after-statement',
	'-Wconversion',

	'-Wno-unused-parameter',
	'-Wno-missing-field-initializers',

	'-Werror=implicit',
]), language: 'c')

symbols_file = 'libdisplay-info.map'
symbols_flag = '-Wl,--version-script,@0@'.format(meson.current_source_dir() / symbols_file)

di_lib = library(
	'display-info',
	[
		'cta.c',
		'cta-vic-table.c',
		'cvt.c',
		'displayid.c',
		'displayid2.c',
		'dmt-table.c',
		'edid.c',
		'gtf.c',
		'hdmi-vic-table.c',
		'info.c',
		'log.c',
		'memory-stream.c',
		pnp_id_table,
	],
	include_directories: include_directories('include'),
	dependencies: [math],
	link_args: symbols_flag,
	link_depends: symbols_file,
	install: true,
	version: version,
	soversion: version_minor,
)

install_subdir(
	'include/libdisplay-info',
	install_dir: get_option('includedir'),
)

pkgconfig = import('pkgconfig')
pkgconfig.generate(
	di_lib,
	filebase: 'libdisplay-info',
	name: 'libdisplay-info',
	url: 'https://gitlab.freedesktop.org/emersion/libdisplay-info',
	description: 'EDID and DisplayID library',
)

di_dep = declare_dependency(
	link_with: di_lib,
	include_directories: include_directories('include'),
)

meson.override_dependency('libdisplay-info', di_dep)

subdir('di-edid-decode')
subdir('test')