summaryrefslogtreecommitdiff
path: root/drivers/meson.build
diff options
context:
space:
mode:
authorBruce Richardson <bruce.richardson@intel.com>2017-11-03 17:27:32 +0000
committerBruce Richardson <bruce.richardson@intel.com>2018-01-30 21:58:59 +0100
commit3e5c3d58e1dbbcdc803ca87ebf1d26129645d70a (patch)
tree188606c0ac590f4da9aa92640361b7ad3fb0d468 /drivers/meson.build
parent029ea64575b6ba8b7cac60b9d1ddd08cbbbb3737 (diff)
downloaddpdk-next-eventdev-3e5c3d58e1dbbcdc803ca87ebf1d26129645d70a.zip
dpdk-next-eventdev-3e5c3d58e1dbbcdc803ca87ebf1d26129645d70a.tar.gz
dpdk-next-eventdev-3e5c3d58e1dbbcdc803ca87ebf1d26129645d70a.tar.xz
build: build as both static and shared libs
This patch changes the build process to group all .o files for a driver or library into a static archive first, and then link the .o files together into a shared library. This eliminates the need for separate static or shared object builds when packaging, for instance. The "default_library" configuration option now only affects the apps and examples, which are either linked against the static or shared library versions depending on the value of the option. Signed-off-by: Bruce Richardson <bruce.richardson@intel.com> Acked-by: Luca Boccassi <bluca@debian.org>
Diffstat (limited to 'drivers/meson.build')
-rw-r--r--drivers/meson.build43
1 files changed, 31 insertions, 12 deletions
diff --git a/drivers/meson.build b/drivers/meson.build
index 451abac..c5c5611 100644
--- a/drivers/meson.build
+++ b/drivers/meson.build
@@ -74,11 +74,14 @@ foreach class:driver_classes
endif
# get dependency objs from strings
- dep_objs = []
+ shared_objs = []
+ static_objs = []
foreach d:deps
- dep_objs += [get_variable('dep_rte_' + d)]
+ shared_objs += [get_variable('shared_rte_' + d)]
+ static_objs += [get_variable('static_rte_' + d)]
endforeach
- dep_objs += ext_deps
+ shared_objs += ext_deps
+ static_objs += ext_deps
dpdk_extra_ldflags += pkgconfig_extra_libs
# generate pmdinfo sources
@@ -88,7 +91,7 @@ foreach class:driver_classes
out_filename = '@0@.pmd.c'.format(src.split('/')[-1])
tmp_lib = static_library('tmp_@0@'.format(src.underscorify()),
src, include_directories: includes,
- dependencies: dep_objs,
+ dependencies: static_objs,
c_args: cflags)
sources += custom_target(out_filename,
command: [pmdinfo, tmp_lib.full_path(),
@@ -107,16 +110,27 @@ foreach class:driver_classes
so_version = lib_version
endif
- # now build the driver itself, and add to the drivers list
+ # now build the static driver
lib_name = driver_name_fmt.format(name)
+ static_lib = static_library(lib_name,
+ sources,
+ objects: objs,
+ include_directories: includes,
+ dependencies: static_objs,
+ c_args: cflags,
+ install: true)
+
+ # now build the shared driver
+ sources = []
+ objs += static_lib.extract_all_objects()
version_map = '@0@/@1@/@2@_version.map'.format(
meson.current_source_dir(),
drv_path, lib_name)
- lib = library(lib_name,
+ shared_lib = shared_library(lib_name,
sources,
objects: objs,
include_directories: includes,
- dependencies: dep_objs,
+ dependencies: shared_objs,
c_args: cflags,
link_args: '-Wl,--version-script=' + version_map,
link_depends: version_map,
@@ -125,14 +139,19 @@ foreach class:driver_classes
install: true,
install_dir: driver_install_path)
- dpdk_drivers += lib
-
# create a dependency object and add it to the global dictionary so
# testpmd or other built-in apps can find it if necessary
- set_variable('dep_@0@'.format(lib_name),
- declare_dependency(link_with: lib,
+ shared_dep = declare_dependency(link_with: shared_lib,
+ include_directories: includes,
+ dependencies: shared_objs)
+ static_dep = declare_dependency(link_with: static_lib,
include_directories: includes,
- dependencies: dep_objs))
+ dependencies: static_objs)
+
+ dpdk_drivers += static_lib
+
+ set_variable('shared_@0@'.format(lib_name), shared_dep)
+ set_variable('static_@0@'.format(lib_name), static_dep)
endif # build
endforeach
endforeach