a1ad792b806e5699cf3e92083bfe0c0ea7b09d44
[dpdk.git] / drivers / net / sfc / meson.build
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
9 if is_windows
10     build = false
11     reason = 'not supported on Windows'
12     subdir_done()
13 endif
14
15 if (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()
19 endif
20
21 extra_flags = []
22
23 # Strict-aliasing rules are violated by rte_eth_link to uint64_t casts
24 extra_flags += '-Wno-strict-aliasing'
25
26 # Enable more warnings
27 extra_flags += [
28         '-Wdisabled-optimization',
29 ]
30
31 # Compiler and version dependent flags
32 extra_flags += [
33         '-Waggregate-return',
34         '-Wbad-function-cast',
35 ]
36
37 foreach flag: extra_flags
38     if cc.has_argument(flag)
39         cflags += flag
40     endif
41 endforeach
42
43 # for gcc and old Clang compiles we need -latomic for 128-bit atomic ops
44 atomic_check_code = '''
45 int 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 '''
56 if 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
72 endif
73
74 deps += ['common_sfc_efx', 'bus_pci']
75 sources = files(
76         'sfc_ethdev.c',
77         'sfc_kvargs.c',
78         'sfc.c',
79         'sfc_mcdi.c',
80         'sfc_sriov.c',
81         'sfc_intr.c',
82         'sfc_ev.c',
83         'sfc_port.c',
84         'sfc_rx.c',
85         'sfc_tx.c',
86         'sfc_tso.c',
87         'sfc_filter.c',
88         'sfc_switch.c',
89         'sfc_mae.c',
90         'sfc_mae_counter.c',
91         'sfc_flow.c',
92         'sfc_dp.c',
93         'sfc_ef10_rx.c',
94         'sfc_ef10_essb_rx.c',
95         'sfc_ef10_tx.c',
96         'sfc_ef100_rx.c',
97         'sfc_ef100_tx.c',
98         'sfc_service.c',
99 )