common/cnxk: support NIX stats
[dpdk.git] / config / meson.build
index c02802c..3268cf6 100644 (file)
@@ -70,21 +70,22 @@ else
        machine = get_option('machine')
 endif
 
-# machine type 'default' is special, it defaults to the per arch agreed common
-# minimal baseline needed for DPDK.
+# machine type 'generic' is special, it selects the per arch agreed common
+# minimal baseline needed for DPDK. Machine type 'default' is also supported
+# with the same meaning for backwards compatibility.
 # That might not be the most optimized, but the most portable version while
 # still being able to support the CPU features required for DPDK.
 # This can be bumped up by the DPDK project, but it can never be an
 # invariant like 'native'
-if machine == 'default'
+if machine == 'default' or machine == 'generic'
        if host_machine.cpu_family().startswith('x86')
-               # matches the old pre-meson build systems default
+               # matches the old pre-meson build systems generic machine
                machine = 'corei7'
        elif host_machine.cpu_family().startswith('arm')
                machine = 'armv7-a'
        elif host_machine.cpu_family().startswith('aarch')
-               # arm64 manages defaults in config/arm/meson.build
-               machine = 'default'
+               # arm64 manages generic config in config/arm/meson.build
+               machine = 'generic'
        elif host_machine.cpu_family().startswith('ppc')
                machine = 'power8'
        endif
@@ -125,11 +126,8 @@ if cc.find_library('m', required : false).found()
        dpdk_extra_ldflags += '-lm'
 endif
 
-# for linux link against dl, for bsd execinfo
 if is_linux
        link_lib = 'dl'
-elif is_freebsd
-       link_lib = 'execinfo'
 else
        link_lib = ''
 endif
@@ -142,12 +140,19 @@ endif
 
 # check for libraries used in multiple places in DPDK
 has_libnuma = 0
-numa_dep = cc.find_library('numa', required: false)
-if numa_dep.found() and cc.has_header('numaif.h')
-       dpdk_conf.set10('RTE_HAS_LIBNUMA', true)
-       has_libnuma = 1
-       add_project_link_arguments('-lnuma', language: 'c')
-       dpdk_extra_ldflags += '-lnuma'
+find_libnuma = true
+if meson.is_cross_build() and not meson.get_cross_property('numa', true)
+       # don't look for libnuma if explicitly disabled in cross build
+       find_libnuma = false
+endif
+if find_libnuma
+       numa_dep = cc.find_library('numa', required: false)
+       if numa_dep.found() and cc.has_header('numaif.h')
+               dpdk_conf.set10('RTE_HAS_LIBNUMA', true)
+               has_libnuma = 1
+               add_project_link_arguments('-lnuma', language: 'c')
+               dpdk_extra_ldflags += '-lnuma'
+       endif
 endif
 
 has_libfdt = 0
@@ -159,8 +164,14 @@ if fdt_dep.found() and cc.has_header('fdt.h')
        dpdk_extra_ldflags += '-lfdt'
 endif
 
+libexecinfo = cc.find_library('libexecinfo', required: false)
+if libexecinfo.found() and cc.has_header('execinfo.h')
+       add_project_link_arguments('-lexecinfo', language: 'c')
+       dpdk_extra_ldflags += '-lexecinfo'
+endif
+
 # check for libbsd
-libbsd = dependency('libbsd', required: false)
+libbsd = dependency('libbsd', required: false, method: 'pkg-config')
 if libbsd.found()
        dpdk_conf.set('RTE_USE_LIBBSD', 1)
 endif
@@ -253,10 +264,25 @@ compile_time_cpuflags = []
 subdir(arch_subdir)
 dpdk_conf.set('RTE_COMPILE_TIME_CPUFLAGS', ','.join(compile_time_cpuflags))
 
+# apply cross-specific options
+if meson.is_cross_build()
+       # configure RTE_MAX_LCORE and RTE_MAX_NUMA_NODES from cross file
+       cross_max_lcores = meson.get_cross_property('max_lcores', 0)
+       if cross_max_lcores != 0
+               message('Setting RTE_MAX_LCORE from cross file')
+               dpdk_conf.set('RTE_MAX_LCORE', cross_max_lcores)
+       endif
+       cross_max_numa_nodes = meson.get_cross_property('max_numa_nodes', 0)
+       if cross_max_numa_nodes != 0
+               message('Setting RTE_MAX_NUMA_NODES from cross file')
+               dpdk_conf.set('RTE_MAX_NUMA_NODES', cross_max_numa_nodes)
+       endif
+endif
+
 # set the install path for the drivers
 dpdk_conf.set_quoted('RTE_EAL_PMD_PATH', eal_pmd_path)
 
-install_headers(['rte_config.h', 'rte_compatibility_defines.h'],
+install_headers(['rte_config.h'],
                subdir: get_option('include_subdir_arch'))
 
 # enable VFIO only if it is linux OS
@@ -279,6 +305,11 @@ if is_windows
                add_project_arguments('-D__USE_MINGW_ANSI_STDIO', language: 'c')
        endif
 
+       # Disable secure CRT deprecated warnings for clang
+       if cc.get_id() == 'clang'
+               add_project_arguments('-D_CRT_SECURE_NO_WARNINGS', language: 'c')
+       endif
+
        add_project_link_arguments('-lws2_32', language: 'c')
 
        # Contrary to docs, VirtualAlloc2() is exported by mincore.lib
@@ -303,3 +334,12 @@ if get_option('b_lto')
                add_project_link_arguments('-Wno-lto-type-mismatch', language: 'c')
        endif
 endif
+
+if get_option('default_library') == 'both'
+       error( '''
+    Unsupported value "both" for "default_library" option.
+
+    NOTE: DPDK always builds both shared and static libraries.  Please set
+    "default_library" to either "static" or "shared" to select default linkage
+    for apps and any examples.''')
+endif