Ferruh Yigit d1a0489930 event/dlb2: fix Meson build
"meson setup" fails when '-Werror' compiler flag is enabled [1].
This is not a build error in the driver but a build error in meson
during "meson setup" stage.

This issue exists for a while but meson takes it as a warning and
ignores it unless '-Werror' compiler flag is provided.
Although it doesn't cause build error without '-Werror', relevant code
should be broken functionally, this patch fixes that too.

Build file using a variable to detect if macro defined, but that
variable is not set, looks like copy/paste error.
Replacing variable with hardcoded macro name.

[1]
Reproduced via `meson -Dc_args='-Werror' build`
in file 'build/meson-logs/meson-log.txt'

``
Running compile:
Working directory:  /tmp/tmpfrnw2x8z
Command line:  ccache cc /tmp/tmpfrnw2x8z/testfile.c -pipe -E -P
		-Werror -D_FILE_OFFSET_BITS=64 -P -O0 -march=native
Code:
        #ifndef dev/qat_crypto_pmd_gen4.c
        # define dev/qat_crypto_pmd_gen4.c
        #endif
        "MESON_GET_DEFINE_DELIMITER"
dev/qat_crypto_pmd_gen4.c
Compiler stdout:
         "MESON_GET_DEFINE_DELIMITER"
/qat_crypto_pmd_gen4.c/qat_crypto_pmd_gen4.c

Compiler stderr:
 /tmp/tmpfrnw2x8z/testfile.c:3:20:
    error: extra tokens at end of #ifndef directive [-Werror]
    3 |         #ifndef dev/qat_crypto_pmd_gen4.c
      |                    ^
/tmp/tmpfrnw2x8z/testfile.c:4:18:
    error: ISO C99 requires whitespace after the macro name [-Werror]
    4 |         # define dev/qat_crypto_pmd_gen4.c
      |                  ^~~
cc1: all warnings being treated as errors

drivers/event/dlb2/meson.build:41:10:
ERROR: Could not get define 'dev/qat_crypto_pmd_gen4.c'
``

Fixes: d0ce87e41cdc ("event/dlb2: support single 512B write of 4 QEs")
Cc: stable@dpdk.org

Reported-by: Luca Boccassi <bluca@debian.org>
Signed-off-by: Ferruh Yigit <ferruh.yigit@amd.com>
2022-11-07 15:20:11 +01:00

68 lines
1.9 KiB
Meson

# SPDX-License-Identifier: BSD-3-Clause
# Copyright(c) 2019-2020 Intel Corporation
if not is_linux or not dpdk_conf.has('RTE_ARCH_X86_64')
build = false
reason = 'only supported on x86_64 Linux'
subdir_done()
endif
sources = files(
'dlb2.c',
'dlb2_iface.c',
'dlb2_xstats.c',
'pf/dlb2_main.c',
'pf/dlb2_pf.c',
'pf/base/dlb2_resource.c',
'rte_pmd_dlb2.c',
'dlb2_selftest.c',
)
# compile AVX512 version if:
# we are building 64-bit binary (checked above) AND binutils
# can generate proper code
if binutils_ok
# compile AVX512 version if either:
# a. we have AVX512VL supported in minimum instruction set
# baseline
# b. it's not minimum instruction set, but supported by
# compiler
#
# in former case, just add avx512 C file to files list
# in latter case, compile c file to static lib, using correct
# compiler flags, and then have the .o file from static lib
# linked into main lib.
# check if all required flags already enabled (variant a).
dlb2_avx512_on = false
if cc.get_define('__AVX512VL__', args: machine_args) != ''
dlb2_avx512_on = true
endif
if dlb2_avx512_on == true
sources += files('dlb2_avx512.c')
cflags += '-DCC_AVX512_SUPPORT'
elif cc.has_multi_arguments('-mavx512vl')
cflags += '-DCC_AVX512_SUPPORT'
avx512_tmplib = static_library('avx512_tmp',
'dlb2_avx512.c',
dependencies: [static_rte_eal, static_rte_eventdev],
c_args: cflags + ['-mavx512vl'])
objs += avx512_tmplib.extract_objects('dlb2_avx512.c')
else
sources += files('dlb2_sse.c')
endif
else
sources += files('dlb2_sse.c')
endif
headers = files('rte_pmd_dlb2.h')
deps += ['mbuf', 'mempool', 'ring', 'pci', 'bus_pci']