[v2,01/10] build: add generic support for base code in drivers
Checks
Commit Message
Add support to the drivers meson.build file for base code files with
extra cflags for compilation. This should remove the need for custom
logic in each driver.
In future, we may want to move the base code handling down the file a
little in order to get lock checking. However, this lock checking is not
done currently on base code builds, so not all drivers can safely pass
these checks. Therefore, we handle the base code files before we add on
the extra lock annotation flags.
Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
---
drivers/meson.build | 20 ++++++++++++++++++++
1 file changed, 20 insertions(+)
@@ -145,7 +145,13 @@ foreach subpath:subdirs
pkgconfig_extra_libs = []
testpmd_sources = []
require_iova_in_mbuf = true
+ # for handling base code files which may need extra cflags
+ base_sources = []
+ base_cflags = []
+ if fs.is_dir(drv_path / 'base')
+ includes += include_directories(drv_path / 'base')
+ endif
if name.contains('/')
name = name.split('/')[1]
endif
@@ -216,6 +222,20 @@ foreach subpath:subdirs
continue
endif
+ # not all drivers base code is lock annotation safe, so do base code builds before
+ # adding on the lock annotation flags. NOTE: If no custom cflags, the lock annotation
+ # checks will be done though.
+ if base_cflags != []
+ base_lib = static_library(lib_name + '_base_lib',
+ base_sources,
+ dependencies: static_deps,
+ include_directories: includes,
+ c_args: cflags + base_cflags)
+ objs += base_lib.extract_objects(base_sources)
+ else
+ sources += base_sources
+ endif
+
enabled_drivers += name
lib_name = '_'.join(['rte', class, name])
cflags += '-DRTE_LOG_DEFAULT_LOGTYPE=' + '.'.join([log_prefix, name])