On Fri, Apr 12, 2024 at 03:52:12PM -0700, Tyler Retzlaff wrote:
> MSVC is the only compiler that can produce usable shared libraries for
> DPDK on Windows because of the use of exported TLS variables.
> 
> Disable building of shared libraries with LLVM and MinGW so that
> remaining __declspec macros needed for the functional libraries built by
> MSVC can be used without triggering errors in LLVM and MinGW builds.
> 
> For Windows only install the default_library type to avoid confusion.
> Windows builds cannot build both shared and static in a single pass so
> install only the functional variant.
> 
> Signed-off-by: Tyler Retzlaff <roret...@linux.microsoft.com>
> ---
>  app/meson.build                       |  6 +++
>  config/meson.build                    | 20 ++++++++++
>  drivers/meson.build                   | 64 +++++++++++++++----------------
>  drivers/net/octeontx/base/meson.build |  2 +-
>  examples/meson.build                  |  6 +++
>  lib/meson.build                       | 72 
> +++++++++++++++--------------------
>  6 files changed, 94 insertions(+), 76 deletions(-)
> 
<snip>
> -
> -        # create a dependency object and add it to the global dictionary so
> -        # testpmd or other built-in apps can find it if necessary
> -        shared_dep = declare_dependency(link_with: shared_lib,
> -                include_directories: includes,
> -                dependencies: shared_deps)
> +        if is_shared_enabled
> +            shared_lib = shared_library(lib_name, sources,
> +                    objects: objs,
> +                    include_directories: includes,
> +                    dependencies: shared_deps,
> +                    c_args: cflags,
> +                    link_args: lk_args,
> +                    link_depends: lk_deps,
> +                    version: abi_version,
> +                    soversion: so_version,
> +                    install: install_shared,
> +                    install_dir: driver_install_path)
> +
> +            # create a dependency object and add it to the global dictionary 
> so
> +            # testpmd or other built-in apps can find it if necessary
> +            shared_dep = declare_dependency(link_with: shared_lib,
> +                    include_directories: includes,
> +                    dependencies: shared_deps)
> +
> +        else
> +            shared_dep = {}
> +        endif

Very minor nit, but it's generally easier to follow code where you put the
short leg of the condition first, and then the longer leg. Having the short
leg (in this case the one-line) first means the reader has no difficulty
remembering what the original condition was, once they get to the "else".
The longer leg requires more attention and having it last means the reader
doesn't need to worry about maintaining the context of the "if" in memory.
[To a certain extent this is just user-preference, so feel free to ignore
this comment if it's too much work! :-)]

>          static_dep = declare_dependency(
>                  include_directories: includes,
>                  dependencies: static_deps)
> diff --git a/drivers/net/octeontx/base/meson.build 
> b/drivers/net/octeontx/base/meson.build
> index 8e5e8c1..a793c19 100644
> --- a/drivers/net/octeontx/base/meson.build
> +++ b/drivers/net/octeontx/base/meson.build
> @@ -10,7 +10,7 @@ sources = [
>  depends = ['ethdev', 'mempool_octeontx']
>  static_objs = []
>  foreach d: depends
> -    if not is_variable('shared_rte_' + d)
> +    if not is_variable('static_rte_' + d)

Since we have empty objects defined for the shared vars in the no-shared
case, you can drop this change.

>          subdir_done()
>      endif
>      static_objs += get_variable('static_rte_' + d)
<snip>

Reply via email to