+ if get_option('per_library_versions')
+ lib_version = '@0@.1'.format(version)
+ so_version = '@0@'.format(version)
+ else
+ prj_ver = meson.project_version().split('.')
+ lib_version = '@0@.@1@'.format(
+ prj_ver.get(0), prj_ver.get(1))
+ so_version = lib_version
+ endif
+
+ # first build static lib
+ static_lib = static_library(libname,
+ sources,
+ objects: objs,
+ c_args: cflags,
+ dependencies: static_deps,
+ include_directories: includes,
+ install: true)
+ static_dep = declare_dependency(link_with: static_lib,
+ include_directories: includes,
+ dependencies: static_deps)
+
+ # then use pre-build objects to build shared lib
+ sources = []
+ objs += static_lib.extract_all_objects()
+ version_map = '@0@/@1@/rte_@2@_version.map'.format(
+ meson.current_source_dir(), dir_name, name)
+ shared_lib = shared_library(libname,
+ sources,
+ objects: objs,
+ c_args: cflags,
+ dependencies: shared_deps,
+ include_directories: includes,
+ link_args: '-Wl,--version-script=' + version_map,
+ link_depends: version_map,
+ version: lib_version,
+ soversion: so_version,
+ install: true)
+ shared_dep = declare_dependency(link_with: shared_lib,
+ include_directories: includes,
+ dependencies: shared_deps)
+
+ dpdk_libraries = [shared_lib] + dpdk_libraries
+ endif # sources.length() > 0
+
+ set_variable('shared_' + libname, shared_dep)
+ set_variable('static_' + libname, static_dep)
+ endif # if build