|
| 1 | +diff --git a/drivers/meson.build b/drivers/meson.build |
| 2 | +index 1d8123b00c..2de654692d 100644 |
| 3 | +--- a/drivers/meson.build |
| 4 | ++++ b/drivers/meson.build |
| 5 | +@@ -126,14 +126,15 @@ foreach subpath:subdirs |
| 6 | + if not build |
| 7 | + break |
| 8 | + endif |
| 9 | +- if not is_variable('shared_rte_' + d) |
| 10 | ++ if get_option('default_library') == 'static' and is_variable('static_rte_' + d) |
| 11 | ++ static_deps += [get_variable('static_rte_' + d)] |
| 12 | ++ elif get_option('default_library') == 'shared' and is_variable('shared_rte_' + d) |
| 13 | ++ shared_deps += [get_variable('shared_rte_' + d)] |
| 14 | ++ else |
| 15 | + build = false |
| 16 | + reason = 'missing internal dependency, "@0@"'.format(d) |
| 17 | + message('Disabling @1@ [@2@]: missing internal dependency "@0@"' |
| 18 | + .format(d, name, 'drivers/' + drv_path)) |
| 19 | +- else |
| 20 | +- shared_deps += [get_variable('shared_rte_' + d)] |
| 21 | +- static_deps += [get_variable('static_rte_' + d)] |
| 22 | + endif |
| 23 | + endforeach |
| 24 | + endif |
| 25 | +@@ -158,6 +159,7 @@ foreach subpath:subdirs |
| 26 | + |
| 27 | + install_headers(headers) |
| 28 | + |
| 29 | ++ if get_option('default_library') == 'static' |
| 30 | + # generate pmdinfo sources by building a temporary |
| 31 | + # lib and then running pmdinfogen on the contents of |
| 32 | + # that lib. The final lib reuses the object files and |
| 33 | +@@ -220,6 +222,13 @@ foreach subpath:subdirs |
| 34 | + endif |
| 35 | + endif |
| 36 | + |
| 37 | ++ static_dep = declare_dependency( |
| 38 | ++ include_directories: includes, |
| 39 | ++ dependencies: static_deps) |
| 40 | ++ dpdk_drivers += static_lib |
| 41 | ++ set_variable('static_@0@'.format(lib_name), static_dep) |
| 42 | ++ |
| 43 | ++ else |
| 44 | + shared_lib = shared_library(lib_name, sources, |
| 45 | + objects: objs, |
| 46 | + include_directories: includes, |
| 47 | +@@ -237,14 +246,10 @@ foreach subpath:subdirs |
| 48 | + shared_dep = declare_dependency(link_with: shared_lib, |
| 49 | + include_directories: includes, |
| 50 | + dependencies: shared_deps) |
| 51 | +- static_dep = declare_dependency( |
| 52 | +- include_directories: includes, |
| 53 | +- dependencies: static_deps) |
| 54 | ++ set_variable('shared_@0@'.format(lib_name), shared_dep) |
| 55 | + |
| 56 | +- dpdk_drivers += static_lib |
| 57 | ++ endif |
| 58 | + |
| 59 | +- set_variable('shared_@0@'.format(lib_name), shared_dep) |
| 60 | +- set_variable('static_@0@'.format(lib_name), static_dep) |
| 61 | + dependency_name = ''.join(lib_name.split('rte_')) |
| 62 | + if developer_mode |
| 63 | + message('drivers/@0@: Defining dependency "@1@"'.format( |
| 64 | +diff --git a/drivers/net/octeontx/base/meson.build b/drivers/net/octeontx/base/meson.build |
| 65 | +index 8e5e8c1b55..39593cd8a6 100644 |
| 66 | +--- a/drivers/net/octeontx/base/meson.build |
| 67 | ++++ b/drivers/net/octeontx/base/meson.build |
| 68 | +@@ -10,7 +10,7 @@ sources = [ |
| 69 | + depends = ['ethdev', 'mempool_octeontx'] |
| 70 | + static_objs = [] |
| 71 | + foreach d: depends |
| 72 | +- if not is_variable('shared_rte_' + d) |
| 73 | ++ if get_option('default_library') == 'shared' and not is_variable('shared_rte_' + d) |
| 74 | + subdir_done() |
| 75 | + endif |
| 76 | + static_objs += get_variable('static_rte_' + d) |
| 77 | +diff --git a/lib/meson.build b/lib/meson.build |
| 78 | +index 24adbe44c9..e614ec57af 100644 |
| 79 | +--- a/lib/meson.build |
| 80 | ++++ b/lib/meson.build |
| 81 | +@@ -146,14 +146,15 @@ foreach l:libraries |
| 82 | + if not build |
| 83 | + break |
| 84 | + endif |
| 85 | +- if not is_variable('shared_rte_' + d) |
| 86 | ++ if get_option('default_library') == 'static' |
| 87 | ++ static_deps += [get_variable('static_rte_' + d)] |
| 88 | ++ elif is_variable('shared_rte_' + d) |
| 89 | ++ shared_deps += [get_variable('shared_rte_' + d)] |
| 90 | ++ else |
| 91 | + build = false |
| 92 | + reason = 'missing internal dependency, "@0@"'.format(d) |
| 93 | + message('Disabling @1@ [@2@]: missing internal dependency "@0@"' |
| 94 | + .format(d, name, 'lib/' + l)) |
| 95 | +- else |
| 96 | +- shared_deps += [get_variable('shared_rte_' + d)] |
| 97 | +- static_deps += [get_variable('static_rte_' + d)] |
| 98 | + endif |
| 99 | + endforeach |
| 100 | + |
| 101 | +@@ -185,6 +186,7 @@ foreach l:libraries |
| 102 | + endif |
| 103 | + cflags += '-DRTE_LOG_DEFAULT_LOGTYPE=lib.' + l |
| 104 | + |
| 105 | ++ if get_option('default_library') == 'static' |
| 106 | + # first build static lib |
| 107 | + static_lib = static_library(libname, |
| 108 | + sources, |
| 109 | +@@ -246,6 +248,10 @@ foreach l:libraries |
| 110 | + output: name + '.sym_chk') |
| 111 | + endif |
| 112 | + |
| 113 | ++ dpdk_static_libraries = [static_lib] + dpdk_static_libraries |
| 114 | ++ set_variable('static_rte_' + name, static_dep) |
| 115 | ++ |
| 116 | ++ else |
| 117 | + shared_lib = shared_library(libname, |
| 118 | + sources, |
| 119 | + objects: objs, |
| 120 | +@@ -262,10 +268,10 @@ foreach l:libraries |
| 121 | + dependencies: shared_deps) |
| 122 | + |
| 123 | + dpdk_libraries = [shared_lib] + dpdk_libraries |
| 124 | +- dpdk_static_libraries = [static_lib] + dpdk_static_libraries |
| 125 | +- |
| 126 | + set_variable('shared_rte_' + name, shared_dep) |
| 127 | +- set_variable('static_rte_' + name, static_dep) |
| 128 | ++ |
| 129 | ++ endif |
| 130 | ++ |
| 131 | + if developer_mode |
| 132 | + message('lib/@0@: Defining dependency "@1@"'.format(l, name)) |
| 133 | + endif |
0 commit comments