Use meson to build port_info_app 43/73843/1
authorLuc Provoost <luc.provoost@gmail.com>
Wed, 1 Feb 2023 16:00:58 +0000 (17:00 +0100)
committerLuc Provoost <luc.provoost@gmail.com>
Wed, 1 Feb 2023 16:00:58 +0000 (17:00 +0100)
Adding a meson.build file for the port_info_app. This application is a
dpdk app that queries the dpdk ports for its MAC address. That MAC
address will then be stored in rapid.env. If needed, it will then be
used by PROX e.g. in l2 test cases.
The app is only used if the vim parameter in the rapid.env file is set
to kubernetes. In case of OpenStack, the MAC address is obtained through
the heatclient API, see stackdeployment.py for more details.

Signed-off-by: Luc Provoost <luc.provoost@gmail.com>
Change-Id: Iba2b0b98748807a0d33374644b75b4ea1bfb91cc

VNFs/DPPD-PROX/helper-scripts/rapid/port_info/meson.build [new file with mode: 0644]

diff --git a/VNFs/DPPD-PROX/helper-scripts/rapid/port_info/meson.build b/VNFs/DPPD-PROX/helper-scripts/rapid/port_info/meson.build
new file mode 100644 (file)
index 0000000..f2efd66
--- /dev/null
@@ -0,0 +1,101 @@
+##
+##
+## Licensed under the Apache License, Version 2.0 (the "License");
+## you may not use this file except in compliance with the License.
+## You may obtain a copy of the License at
+##
+##         http://www.apache.org/licenses/LICENSE-2.0
+##
+## Unless required by applicable law or agreed to in writing, software
+## distributed under the License is distributed on an "AS IS" BASIS,
+## WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+## See the License for the specific language governing permissions and
+## limitations under the License.
+##
+
+project('port-info', 'C',
+        version:
+        run_command(['git', 'describe',
+                     '--abbrev=8', '--dirty', '--always']).stdout().strip(),
+        license: 'Apache',
+        default_options: ['buildtype=release', 'c_std=gnu99'],
+        meson_version: '>= 0.47'
+)
+
+cc = meson.get_compiler('c')
+
+# Configure options for prox
+# Grab the DPDK version here "manually" as it is not available in the dpdk_dep
+# object
+dpdk_version = run_command('pkg-config', '--modversion', 'libdpdk').stdout()
+
+
+cflags = [
+        '-DPROGRAM_NAME="port_info_app"',
+        '-fno-stack-protector',
+        '-DGRE_TP',
+        '-D_GNU_SOURCE']        # for PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP
+
+# Add configured cflags to arguments
+foreach arg: cflags
+        add_project_arguments(arg, language: 'c')
+endforeach
+
+# enable warning flags if they are supported by the compiler
+warning_flags = [
+        '-Wno-unused',
+        '-Wno-unused-parameter',
+        '-Wno-unused-result',
+        '-Wno-deprecated-declarations']
+
+foreach arg: warning_flags
+        if cc.has_argument(arg)
+                add_project_arguments(arg, language: 'c')
+        endif
+endforeach
+
+has_sym_args = [
+        [ 'HAVE_LIBEDIT_EL_RFUNC_T', 'histedit.h',
+        'el_rfunc_t' ],
+]
+config = configuration_data()
+foreach arg:has_sym_args
+        config.set(arg[0], cc.has_header_symbol(arg[1], arg[2]))
+endforeach
+configure_file(output : 'libedit_autoconf.h', configuration : config)
+
+# All other dependencies
+dpdk_dep = dependency('libdpdk', required: true)
+tinfo_dep = dependency('tinfo', required: false)
+threads_dep = dependency('threads', required: true)
+pcap_dep = dependency('pcap', required: true)
+libedit_dep = dependency('libedit', required: true)
+math_dep = cc.find_library('m', required : false)
+dl_dep = cc.find_library('dl', required : true)
+
+deps = [dpdk_dep,
+        tinfo_dep,
+        threads_dep,
+        pcap_dep,
+        libedit_dep,
+        math_dep,
+        dl_dep]
+
+# Explicitly add these to the dependency list
+deps += [cc.find_library('rte_bus_pci', required: true)]
+deps += [cc.find_library('rte_bus_vdev', required: true)]
+
+if dpdk_version.version_compare('<20.11.0')
+deps += [cc.find_library('rte_pmd_ring', required: true)]
+else
+deps += [cc.find_library('rte_net_ring', required: true)]
+endif
+
+sources = files(
+        'port_info.c')
+
+executable('port_info_app',
+        sources,
+        c_args: cflags,
+        dependencies: deps,
+        install: true)