xref: /dpdk/drivers/net/sfc/meson.build (revision c0db99c5329b13f17617a7a73a7530c2a59ac79a)
1# SPDX-License-Identifier: BSD-3-Clause
2#
3# Copyright(c) 2019-2021 Xilinx, Inc.
4# Copyright(c) 2016-2019 Solarflare Communications Inc.
5#
6# This software was jointly developed between OKTET Labs (under contract
7# for Solarflare) and Solarflare Communications, Inc.
8
9if is_windows
10    build = false
11    reason = 'not supported on Windows'
12    subdir_done()
13endif
14
15if (arch_subdir != 'x86' and arch_subdir != 'arm') or (not dpdk_conf.get('RTE_ARCH_64'))
16    build = false
17    reason = 'only supported on x86_64 and aarch64'
18    subdir_done()
19endif
20
21extra_flags = []
22
23# Strict-aliasing rules are violated by rte_eth_link to uint64_t casts
24extra_flags += '-Wno-strict-aliasing'
25
26# Enable more warnings
27extra_flags += [
28        '-Wdisabled-optimization',
29]
30
31# Compiler and version dependent flags
32extra_flags += [
33        '-Waggregate-return',
34        '-Wbad-function-cast',
35]
36
37foreach flag: extra_flags
38    if cc.has_argument(flag)
39        cflags += flag
40    endif
41endforeach
42
43# for gcc and old Clang compiles we need -latomic for 128-bit atomic ops
44atomic_check_code = '''
45int main(void)
46{
47    __int128 a = 0;
48    __int128 b;
49
50    b = __atomic_load_n(&a, __ATOMIC_RELAXED);
51    __atomic_store(&b, &a, __ATOMIC_RELAXED);
52    __atomic_store_n(&b, a, __ATOMIC_RELAXED);
53    return 0;
54}
55'''
56if not cc.links(atomic_check_code)
57    libatomic_dep = cc.find_library('atomic', required: false)
58    if not libatomic_dep.found()
59        build = false
60        reason = 'missing dependency, "libatomic"'
61        subdir_done()
62    endif
63
64    # libatomic could be half-installed when above check finds it but
65    # linkage fails
66    if not cc.links(atomic_check_code, dependencies: libatomic_dep)
67        build = false
68        reason = 'broken dependency, "libatomic"'
69        subdir_done()
70    endif
71    ext_deps += libatomic_dep
72endif
73
74deps += ['common_sfc_efx', 'bus_pci', 'hash']
75sources = files(
76        'sfc_ethdev.c',
77        'sfc_kvargs.c',
78        'sfc.c',
79        'sfc_mcdi.c',
80        'sfc_sriov.c',
81        'sfc_sw_stats.c',
82        'sfc_intr.c',
83        'sfc_ev.c',
84        'sfc_port.c',
85        'sfc_rx.c',
86        'sfc_tx.c',
87        'sfc_tso.c',
88        'sfc_filter.c',
89        'sfc_switch.c',
90        'sfc_tbls.c',
91        'sfc_tbl_meta.c',
92        'sfc_tbl_meta_cache.c',
93        'sfc_mae.c',
94        'sfc_mae_counter.c',
95        'sfc_mae_ct.c',
96        'sfc_flow.c',
97        'sfc_flow_rss.c',
98        'sfc_flow_tunnel.c',
99        'sfc_dp.c',
100        'sfc_ef10_rx.c',
101        'sfc_ef10_essb_rx.c',
102        'sfc_ef10_tx.c',
103        'sfc_ef100_rx.c',
104        'sfc_ef100_tx.c',
105        'sfc_service.c',
106        'sfc_repr_proxy.c',
107        'sfc_repr.c',
108        'sfc_nic_dma.c',
109)
110