forked from OpenVisualCloud/Media-Transport-Library
-
Notifications
You must be signed in to change notification settings - Fork 0
/
meson.build
67 lines (53 loc) · 2.01 KB
/
meson.build
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
# SPDX-License-Identifier: BSD-3-Clause
# Copyright 2022 Intel Corporation
project('mtl', 'c', default_options: ['buildtype=release'],
# Fallback to "more" for Windows
version: run_command(find_program('cat', 'more'), files('VERSION'), check: true).stdout().strip(),
)
exec_env = host_machine.system()
set_variable('is_windows', exec_env == 'windows')
message('BUILD Enviroment: ' + exec_env)
# enable BSD_SOURCE
add_global_arguments('-D_DEFAULT_SOURCE', language : 'c')
# get external variables
add_global_arguments('-D__MTL_GIT__="'+ run_command('git', 'describe', '--abbrev=8', '--dirty', '--always').stdout().strip() + '"', language : 'c')
add_global_arguments('-D__MTL_LIB_BUILD__="' + meson.project_version() + '"', language : 'c')
if get_option('enable_kni') == true
add_global_arguments('-DMTL_HAS_KNI', language : 'c')
endif
if get_option('disable_pcapng') == true
add_global_arguments('-DMTL_DISABLE_PCAPNG', language : 'c')
endif
if is_windows
if get_option('enable_tap') == true
add_global_arguments('-DMTL_HAS_TAP', language : 'c')
endif
endif
mtl_conf = configuration_data()
# parse mtl config
# parse build config
prj_ver = meson.project_version().split('.')
mtl_conf.set('MTL_VERSION_MAJOR', prj_ver.get(0).to_int())
mtl_conf.set('MTL_VERSION_MINOR', prj_ver.get(1).to_int())
mtl_conf.set('MTL_VERSION_LAST', prj_ver.get(2).to_int())
# parse compiler config
cc_ver = meson.get_compiler('c').get_id() + '-' + meson.get_compiler('c').version()
mtl_conf.set_quoted('MTL_COMPILER', cc_ver)
# build config file
build_cfg = 'mtl_build_config.h'
configure_file(output: build_cfg, configuration: mtl_conf, install_dir: 'include/mtl')
mtl_lib = []
# add include directory
mtl_include_dir = [ include_directories('.', 'include'), ]
# install header files
subdir('include')
# build library
subdir('lib')
pkg = import('pkgconfig')
pkg.generate(
name : meson.project_name(),
version : meson.project_version(),
libraries : mtl_lib,
filebase : meson.project_name(),
description : 'Media Transport Library based on DPDK'
)