build: add infrastructure for meson and ninja builds
[dpdk.git] / config / x86 / meson.build
1 #   BSD LICENSE
2 #
3 #   Copyright(c) 2017 Intel Corporation.
4 #   All rights reserved.
5 #
6 #   Redistribution and use in source and binary forms, with or without
7 #   modification, are permitted provided that the following conditions
8 #   are met:
9 #
10 #     * Redistributions of source code must retain the above copyright
11 #       notice, this list of conditions and the following disclaimer.
12 #     * Redistributions in binary form must reproduce the above copyright
13 #       notice, this list of conditions and the following disclaimer in
14 #       the documentation and/or other materials provided with the
15 #       distribution.
16 #     * Neither the name of Intel Corporation nor the names of its
17 #       contributors may be used to endorse or promote products derived
18 #       from this software without specific prior written permission.
19 #
20 #   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
21 #   "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
22 #   LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
23 #   A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
24 #   OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
25 #   SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
26 #   LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
27 #   DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
28 #   THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
29 #   (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
30 #   OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31
32 # for checking defines we need to use the correct compiler flags
33 march_opt = '-march=@0@'.format(machine)
34
35 # we require SSE4.2 for DPDK
36 sse_errormsg = '''SSE4.2 instruction set is required for DPDK.
37 Please set the machine type to "nehalem" or "corei7" or higher value'''
38
39 if cc.get_define('__SSE4_2__', args: march_opt) == ''
40         error(sse_errormsg)
41 endif
42
43 dpdk_conf.set('RTE_ARCH_X86', 1)
44 if (host_machine.cpu_family() == 'x86_64')
45         dpdk_conf.set('RTE_ARCH_X86_64', 1)
46         dpdk_conf.set('RTE_ARCH', 'x86_64')
47         dpdk_conf.set('RTE_ARCH_64', 1)
48 else
49         dpdk_conf.set('RTE_ARCH_I686', 1)
50         dpdk_conf.set('RTE_ARCH', 'i686')
51 endif
52
53 if cc.get_define('__AES__', args: march_opt) != ''
54         dpdk_conf.set('RTE_MACHINE_CPUFLAG_AES', 1)
55         compile_time_cpuflags += ['RTE_CPUFLAG_AES']
56 endif
57 if cc.get_define('__PCLMUL__', args: march_opt) != ''
58         dpdk_conf.set('RTE_MACHINE_CPUFLAG_PCLMULQDQ', 1)
59         compile_time_cpuflags += ['RTE_CPUFLAG_PCLMULQDQ']
60 endif
61 if cc.get_define('__AVX__', args: march_opt) != ''
62         dpdk_conf.set('RTE_MACHINE_CPUFLAG_AVX', 1)
63         compile_time_cpuflags += ['RTE_CPUFLAG_AVX']
64 endif
65 if cc.get_define('__AVX2__', args: march_opt) != ''
66         dpdk_conf.set('RTE_MACHINE_CPUFLAG_AVX2', 1)
67         compile_time_cpuflags += ['RTE_CPUFLAG_AVX2']
68 endif
69
70 dpdk_conf.set('RTE_CACHE_LINE_SIZE', 64)