[dpdk-dev] [PATCH 04/17] build: add DPDK libraries to build
Van Haaren, Harry
harry.van.haaren at intel.com
Mon Sep 4 16:08:50 CEST 2017
> From: dev [mailto:dev-bounces at dpdk.org] On Behalf Of Bruce Richardson
> Sent: Friday, September 1, 2017 11:04 AM
> To: dev at dpdk.org
> Cc: Richardson, Bruce <bruce.richardson at intel.com>
> Subject: [dpdk-dev] [PATCH 04/17] build: add DPDK libraries to build
>
> Add non-EAL libraries to DPDK build. The compat lib is a special case,
> along with the previously-added EAL, but all other libs can be build using
> the same set of commands, where the individual meson.build files only need
> to specify their dependencies, source files, header files and ABI versions.
>
> Signed-off-by: Bruce Richardson <bruce.richardson at intel.com>
<snip>
In librte_acl/meson.build:
> +version = 2
> +sources = files('acl_bld.c', 'acl_gen.c', 'acl_run_scalar.c',
> + 'rte_acl.c', 'tb_mem.c')
> +headers = files('rte_acl.h', 'rte_acl_osdep.h')
> +
> +if arch_subdir == 'x86'
> + sources += files('acl_run_sse.c')
> +
> + # compile AVX2 version if either:
> + # a. we have AVX supported in minimum instruction set baseline
> + # b. it's not minimum instruction set, but supported by compiler
> + #
> + # in former case, just add avx2 C file to files list
> + # in latter case, compile c file to static lib, using correct compiler
> + # flags, and then have the .o file from static lib linked into main lib.
> + if dpdk_conf.has('RTE_MACHINE_CPUFLAG_AVX2')
> + sources += files('acl_run_avx2.c')
> + cflags += '-DCC_AVX2_SUPPORT'
> + elif cc.has_argument('-mavx2')
> + avx2_tmplib = static_library('avx2_tmp',
> + 'acl_run_avx2.c',
> + dependencies: rte_eal,
> + c_args: '-mavx2')
> + objs += avx2_tmplib.extract_objects('acl_run_avx2.c')
> + cflags += '-DCC_AVX2_SUPPORT'
> + endif
> +
> +endif
In future this could be split out to some sort of AVX helper, to avoid it
becoming copy/paste prone to detect AVX features from libraries.
<huge snip of almost all libraries meson.build files>
> --- a/lib/meson.build
> +++ b/lib/meson.build
> @@ -29,4 +29,71 @@
> # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
> # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
>
> +# special case for eal, not a simple lib, and compat, just a header
> subdir('librte_eal')
> +subdir('librte_compat')
> +
> +# process all libraries equally, as far as possible
> +# "core" libs first, then others alphebetically as far as possible
> +# NOTE: for speed of meson runs, the dependencies in the subdirectories
> +# sometimes skip deps that would be implied by others, e.g. if mempool is
> +# given as a dep, no need to mention ring. This is especially true for the
> +# core libs which are widely reused, so their deps are kept to a minimum.
> +libraries = ['ring', 'mempool', 'mbuf', 'net', 'ether', # core
> + 'metrics', # bitrate/latency stats depends on this
> + 'hash', # efd depends on this
> + 'kvargs', # cryptodev depends on this
> + 'acl', 'bitratestats', 'cfgfile', 'cmdline', 'cryptodev',
> + 'distributor', 'efd', 'eventdev', 'gro', 'ip_frag', 'jobstats',
> + 'kni', 'latencystats', 'lpm', 'meter', 'power', 'pdump',
> + 'reorder', 'sched', 'timer', 'vhost',
> + # add pkt framework libs which use other libs from above
> + 'port', 'table', 'pipeline']
> +
> +foreach l:libraries
> + build = true
> + name = l
> + version = 1
> + sources = []
> + headers = []
> + cflags = []
> + objs = [] # other object files to link against, used e.g. for instruction-
> + # optimized versions of code
Nitpick: comment above could be moved to be before the objs[] line, consistent like below.
I'll send a patch once this stuff is in next-build :D
> + # use "deps" for internal DPDK dependencies, and "ext_deps" for
> + # external package/library requirements
> + deps = ['eal']
> + ext_deps = []
> +
> + dir_name = 'librte_' + l
> + subdir(dir_name)
> +
> + if build
> + dpdk_conf.set('RTE_LIBRTE_' + name.to_upper(), 1)
> + install_headers(headers)
> +
> + dep_objs = ext_deps
> + foreach d:deps
> + dep_objs += [get_variable('dep_rte_' + d)]
> + endforeach
> +
> + version_map = '@0@/@1@/rte_ at 2@_version.map'.format(
> + meson.current_source_dir(), dir_name, name)
> + libname = 'rte_' + name
> + lib = library(libname,
> + sources,
> + objects: objs,
> + c_args: cflags,
> + dependencies: dep_objs,
> + include_directories: include_directories(dir_name),
> + link_args: '-Wl,--version-script=' + version_map,
> + link_depends: version_map,
> + version: '@0 at .1'.format(version),
> + install: true)
> + dep = declare_dependency(link_with: lib,
> + include_directories: include_directories(dir_name),
> + dependencies: dep_objs)
> + set_variable('dep_' + libname, dep)
> +
> + dpdk_libraries = [lib] + dpdk_libraries
> + endif
> +endforeach
> --
> 2.13.5
Reviewed-by: Harry van Haaren <harry.van.haaren at intel.com>
More information about the dev
mailing list