xref: /dpdk/drivers/common/qat/meson.build (revision 85fec6fd)
1# SPDX-License-Identifier: BSD-3-Clause
2# Copyright(c) 2017-2022 Intel Corporation
3
4if is_windows
5    build = false
6    reason = 'not supported on Windows'
7    subdir_done()
8endif
9
10qat_crypto = true
11qat_crypto_path = 'crypto/qat'
12qat_crypto_relpath = '../../' + qat_crypto_path
13qat_compress = true
14qat_compress_path = 'compress/qat'
15qat_compress_relpath = '../../' + qat_compress_path
16
17if disable_drivers.contains(qat_crypto_path)
18    qat_crypto = false
19    dpdk_drvs_disabled += qat_crypto_path
20    set_variable(qat_crypto_path.underscorify() + '_disable_reason',
21            'Explicitly disabled via build config')
22endif
23if disable_drivers.contains(qat_compress_path)
24    qat_compress = false
25    dpdk_drvs_disabled += qat_compress_path
26    set_variable(qat_compress_path.underscorify() + '_disable_reason',
27            'Explicitly disabled via build config')
28endif
29
30libcrypto = dependency('libcrypto', required: false, method: 'pkg-config')
31if qat_crypto and not libcrypto.found()
32    qat_crypto = false
33    dpdk_drvs_disabled += qat_crypto_path
34    set_variable(qat_crypto_path.underscorify() + '_disable_reason',
35            'missing dependency, libcrypto')
36endif
37
38# The driver should not build if both compression and crypto are disabled
39#FIXME common code depends on compression files so check only compress!
40if not qat_compress # and not qat_crypto
41    build = false
42    reason = '' # rely on reason for compress/crypto above
43    subdir_done()
44endif
45
46deps += ['bus_pci', 'cryptodev', 'net', 'compressdev']
47sources += files(
48        'qat_common.c',
49        'qat_qp.c',
50        'qat_device.c',
51        'qat_logs.c',
52        'qat_pf2vf.c',
53        'dev/qat_dev_gen1.c',
54        'dev/qat_dev_gen2.c',
55        'dev/qat_dev_gen3.c',
56        'dev/qat_dev_gen4.c',
57)
58includes += include_directories(
59        'qat_adf',
60        qat_crypto_relpath,
61        qat_compress_relpath,
62)
63
64if qat_compress
65    foreach f: ['qat_comp_pmd.c', 'qat_comp.c',
66            'dev/qat_comp_pmd_gen1.c',
67            'dev/qat_comp_pmd_gen2.c',
68            'dev/qat_comp_pmd_gen3.c',
69            'dev/qat_comp_pmd_gen4.c',
70        ]
71        sources += files(join_paths(qat_compress_relpath, f))
72    endforeach
73endif
74
75if qat_crypto
76    foreach f: ['qat_sym.c', 'qat_sym_session.c',
77            'qat_asym.c', 'qat_crypto.c',
78            'dev/qat_sym_pmd_gen1.c',
79            'dev/qat_asym_pmd_gen1.c',
80            'dev/qat_crypto_pmd_gen2.c',
81            'dev/qat_crypto_pmd_gen3.c',
82            'dev/qat_crypto_pmd_gen4.c',
83        ]
84        sources += files(join_paths(qat_crypto_relpath, f))
85    endforeach
86    deps += ['security']
87    ext_deps += libcrypto
88    cflags += ['-DBUILD_QAT_SYM', '-DBUILD_QAT_ASYM']
89endif
90