A number of DPDK components sometimes expose extra capabilities if other drivers are present, without actually requiring that to be always present. Standardize that design by way of an "optional_deps" variable to be set in meson.build files.
Signed-off-by: Bruce Richardson <[email protected]> --- app/meson.build | 10 ++++++- app/proc-info/meson.build | 4 +-- app/test-bbdev/meson.build | 18 ++++------- app/test-crypto-perf/meson.build | 4 +-- app/test-pmd/meson.build | 50 ++++++++++--------------------- app/test/meson.build | 6 ---- drivers/meson.build | 9 ++++++ drivers/net/intel/ice/meson.build | 7 +++-- lib/meson.build | 10 ++++++- 9 files changed, 55 insertions(+), 63 deletions(-) diff --git a/app/meson.build b/app/meson.build index 7472d925b2..79a0672edc 100644 --- a/app/meson.build +++ b/app/meson.build @@ -63,9 +63,11 @@ foreach app:apps # instruction-set optimized versions of code # use "deps" for internal DPDK dependencies, and "ext_deps" for - # external package/library requirements + # external package/library requirements. Use "optional_deps" for internal + # dependencies to link against only if they are already being built. ext_deps = [] deps = [] + optional_deps = [] if not enable_apps.contains(app) build = false @@ -99,6 +101,12 @@ foreach app:apps endif dep_objs += [get_variable(var_name)] endforeach + foreach d:optional_deps + var_name = get_option('default_library') + '_rte_' + d + if is_variable(var_name) and not deps.contains(d) + dep_objs += [get_variable(var_name)] + endif + endforeach endif if not build diff --git a/app/proc-info/meson.build b/app/proc-info/meson.build index 316253cd5d..60c4eb2a90 100644 --- a/app/proc-info/meson.build +++ b/app/proc-info/meson.build @@ -9,8 +9,6 @@ endif sources = files('main.c') deps += ['ethdev', 'security', 'eventdev'] -if dpdk_conf.has('RTE_LIB_METRICS') - deps += 'metrics' -endif +optional_deps = ['metrics'] cflags += no_wvla_cflag diff --git a/app/test-bbdev/meson.build b/app/test-bbdev/meson.build index f85a20c5b0..c3cdd4d7c5 100644 --- a/app/test-bbdev/meson.build +++ b/app/test-bbdev/meson.build @@ -8,17 +8,11 @@ sources = files( 'test_bbdev_vector.c', ) deps += ['bbdev', 'bus_vdev'] -if dpdk_conf.has('RTE_BASEBAND_FPGA_LTE_FEC') - deps += ['baseband_fpga_lte_fec'] -endif -if dpdk_conf.has('RTE_BASEBAND_FPGA_5GNR_FEC') - deps += ['baseband_fpga_5gnr_fec'] -endif -if dpdk_conf.has('RTE_BASEBAND_ACC') - deps += ['baseband_acc'] -endif -if dpdk_conf.has('RTE_BASEBAND_LA12XX') - deps += ['baseband_la12xx'] -endif +optional_deps = [ + 'baseband_acc', + 'baseband_fpga_5gnr_fec', + 'baseband_fpga_lte_fec', + 'baseband_la12xx', +] cflags += no_wvla_cflag diff --git a/app/test-crypto-perf/meson.build b/app/test-crypto-perf/meson.build index 87dd3bc5f1..76de68bfaf 100644 --- a/app/test-crypto-perf/meson.build +++ b/app/test-crypto-perf/meson.build @@ -20,8 +20,6 @@ sources = files( 'main.c', ) deps += ['cryptodev', 'net', 'security'] -if dpdk_conf.has('RTE_CRYPTO_SCHEDULER') - deps += 'crypto_scheduler' -endif +optional_deps = ['crypto_scheduler'] cflags += no_wvla_cflag diff --git a/app/test-pmd/meson.build b/app/test-pmd/meson.build index 83163a5406..82ec6626f3 100644 --- a/app/test-pmd/meson.build +++ b/app/test-pmd/meson.build @@ -35,42 +35,24 @@ if dpdk_conf.has('RTE_HAS_JANSSON') endif deps += ['ethdev', 'cmdline', 'pci'] -if dpdk_conf.has('RTE_CRYPTO_SCHEDULER') - deps += 'crypto_scheduler' -endif -if dpdk_conf.has('RTE_LIB_BITRATESTATS') - deps += 'bitratestats' -endif +optional_deps = [ + 'bitratestats', + 'bpf', + 'bus_dpaa', + 'crypto_scheduler', + 'gro', + 'gso', + 'latencystats', + 'mempool_dpaa', + 'metrics', + 'net_bnxt', + 'net_dpaa', + 'net_i40e', + 'net_ixgbe', + 'pdump', +] if dpdk_conf.has('RTE_LIB_BPF') sources += files('bpf_cmd.c') - deps += 'bpf' -endif -if dpdk_conf.has('RTE_LIB_GRO') - deps += 'gro' -endif -if dpdk_conf.has('RTE_LIB_GSO') - deps += 'gso' -endif -if dpdk_conf.has('RTE_LIB_LATENCYSTATS') - deps += 'latencystats' -endif -if dpdk_conf.has('RTE_LIB_METRICS') - deps += 'metrics' -endif -if dpdk_conf.has('RTE_LIB_PDUMP') - deps += 'pdump' -endif -if dpdk_conf.has('RTE_NET_BNXT') - deps += 'net_bnxt' -endif -if dpdk_conf.has('RTE_NET_I40E') - deps += 'net_i40e' -endif -if dpdk_conf.has('RTE_NET_IXGBE') - deps += 'net_ixgbe' -endif -if dpdk_conf.has('RTE_NET_DPAA') - deps += ['bus_dpaa', 'mempool_dpaa', 'net_dpaa'] endif # Driver-specific commands are located in driver directories. diff --git a/app/test/meson.build b/app/test/meson.build index 881b919b63..0b2f4fd708 100644 --- a/app/test/meson.build +++ b/app/test/meson.build @@ -259,12 +259,6 @@ foreach f, f_deps : source_file_deps sources += files(f) endif endforeach -# add the optional dependencies -foreach d:optional_deps - if is_variable(def_lib + '_rte_' + d) and d not in deps - deps += d - endif -endforeach cflags += no_wvla_cflag cflags += no_shadow_cflag diff --git a/drivers/meson.build b/drivers/meson.build index 440c3959cf..e75fa983e2 100644 --- a/drivers/meson.build +++ b/drivers/meson.build @@ -174,6 +174,9 @@ foreach subpath:subdirs includes = [include_directories(drv_path)] # set up internal deps. Drivers can append/override as necessary deps = std_deps + # optional_deps: internal dependencies to link against only if they are + # already being built, rather than being always required + optional_deps = [] # ext_deps: Stores external library dependency got # using dependency() (preferred) or find_library(). # For the find_library() case (but not with dependency()) we also @@ -249,6 +252,12 @@ foreach subpath:subdirs static_deps += [get_variable('static_rte_' + d)] endif endforeach + foreach d:optional_deps + if build and is_variable('shared_rte_' + d) and not deps.contains(d) + shared_deps += [get_variable('shared_rte_' + d)] + static_deps += [get_variable('static_rte_' + d)] + endif + endforeach endif if not build diff --git a/drivers/net/intel/ice/meson.build b/drivers/net/intel/ice/meson.build index 322d9597d2..e5ba7ac92c 100644 --- a/drivers/net/intel/ice/meson.build +++ b/drivers/net/intel/ice/meson.build @@ -22,9 +22,10 @@ testpmd_sources = files('ice_testpmd.c') deps += ['hash', 'net'] -if dpdk_conf.has('RTE_NET_IAVF') - deps += 'net_iavf' -else +# link against the iavf driver if it is being built, otherwise build the parts +# of it needed here directly into this driver +optional_deps = ['net_iavf'] +if not dpdk_conf.has('RTE_NET_IAVF') includes += include_directories( '../iavf', '../iavf/base' diff --git a/lib/meson.build b/lib/meson.build index 0c5da21522..87bfb914e8 100644 --- a/lib/meson.build +++ b/lib/meson.build @@ -137,9 +137,11 @@ foreach l:libraries # instruction-set optimized versions of code # use "deps" for internal DPDK dependencies, and "ext_deps" for - # external package/library requirements + # external package/library requirements. Use "optional_deps" for internal + # dependencies to link against only if they are already being built. ext_deps = [] deps = [] + optional_deps = [] if dpdk_conf.has('RTE_LIB_EAL') # eal is standard dependency once built deps += ['eal'] @@ -201,6 +203,12 @@ foreach l:libraries static_deps += [get_variable('static_rte_' + d)] endif endforeach + foreach d:optional_deps + if build and is_variable('shared_rte_' + d) and not deps.contains(d) + shared_deps += [get_variable('shared_rte_' + d)] + static_deps += [get_variable('static_rte_' + d)] + endif + endforeach if not build dpdk_libs_disabled += name -- 2.53.0

