X-Git-Url: http://git.droids-corp.org/?a=blobdiff_plain;f=config%2Fmeson.build;h=7134e80e8ddddeb98dff00307488103dd6dcf5fd;hb=32b4771cd8ef377c039d895d034b3b5e86ee34d2;hp=0b8359404b87ed2ed1200f6d1858dc626458f7c5;hpb=5ffa86a2b4167276212c7f666a8f96fa4f46d3b3;p=dpdk.git diff --git a/config/meson.build b/config/meson.build index 0b8359404b..7134e80e8d 100644 --- a/config/meson.build +++ b/config/meson.build @@ -22,7 +22,8 @@ is_ms_linker = is_windows and (cc.get_id() == 'clang') # depending on the configuration options pver = meson.project_version().split('.') major_version = '@0@.@1@'.format(pver.get(0), pver.get(1)) -abi_version = run_command(find_program('cat', 'more'), abi_version_file).stdout().strip() +abi_version = run_command(find_program('cat', 'more'), abi_version_file, + check: true).stdout().strip() # Libraries have the abi_version as the filename extension # and have the soname be all but the final part of the abi_version. @@ -218,6 +219,11 @@ if libbsd.found() dpdk_conf.set('RTE_USE_LIBBSD', 1) endif +jansson_dep = dependency('jansson', required: false, method: 'pkg-config') +if jansson_dep.found() + dpdk_conf.set('RTE_HAS_JANSSON', 1) +endif + # check for pcap pcap_dep = dependency('libpcap', required: false, method: 'pkg-config') pcap_lib = is_windows ? 'wpcap' : 'pcap' @@ -226,7 +232,7 @@ if not pcap_dep.found() pcap_dep = cc.find_library(pcap_lib, required: false) endif if pcap_dep.found() and cc.has_header('pcap.h', dependencies: pcap_dep) - dpdk_conf.set('RTE_PORT_PCAP', 1) + dpdk_conf.set('RTE_HAS_LIBPCAP', 1) dpdk_extra_ldflags += '-l@0@'.format(pcap_lib) endif @@ -241,10 +247,9 @@ endif add_project_arguments('-include', 'rte_config.h', language: 'c') # enable extra warnings and disable any unwanted warnings +# -Wall is added by default at warning level 1, and -Wextra +# at warning level 2 (DPDK default) warning_flags = [ - # -Wall is added by meson by default, so add -Wextra only - '-Wextra', - # additional warnings in alphabetical order '-Wcast-qual', '-Wdeprecated', @@ -287,8 +292,6 @@ foreach arg: warning_flags endforeach # set other values pulled from the build options -dpdk_conf.set('RTE_MAX_LCORE', get_option('max_lcores')) -dpdk_conf.set('RTE_MAX_NUMA_NODES', get_option('max_numa_nodes')) dpdk_conf.set('RTE_MAX_ETHPORTS', get_option('max_ethports')) dpdk_conf.set('RTE_LIBEAL_USE_HPET', get_option('use_hpet')) dpdk_conf.set('RTE_ENABLE_TRACE_FP', get_option('enable_trace_fp')) @@ -301,7 +304,9 @@ if dpdk_conf.get('RTE_ARCH_64') else # for 32-bit we need smaller reserved memory areas dpdk_conf.set('RTE_MAX_MEM_MB', 2048) endif - +if get_option('mbuf_refcnt_atomic') + dpdk_conf.set('RTE_MBUF_REFCNT_ATOMIC', true) +endif compile_time_cpuflags = [] subdir(arch_subdir) @@ -322,6 +327,51 @@ if meson.is_cross_build() endif endif +max_lcores = get_option('max_lcores') +if max_lcores == 'detect' + # discovery makes sense only for non-cross builds + if meson.is_cross_build() + error('Discovery of max_lcores is not supported for cross-compilation.') + endif + # overwrite the default value with discovered values + max_lcores = run_command(get_cpu_count_cmd, check: true).stdout().to_int() + min_lcores = 2 + # DPDK must be built for at least 2 cores + if max_lcores < min_lcores + message('Found less than @0@ cores, building for @0@ cores'.format(min_lcores)) + max_lcores = min_lcores + else + message('Found @0@ cores'.format(max_lcores)) + endif + dpdk_conf.set('RTE_MAX_LCORE', max_lcores) +elif max_lcores != 'default' + # overwrite the default value from arch_subdir with user input + dpdk_conf.set('RTE_MAX_LCORE', max_lcores.to_int()) +endif + +max_numa_nodes = get_option('max_numa_nodes') +if max_numa_nodes == 'detect' + # discovery makes sense only for non-cross builds + if meson.is_cross_build() + error('Discovery of max_numa_nodes not supported for cross-compilation.') + endif + # overwrite the default value with discovered values + max_numa_nodes = run_command(get_numa_count_cmd).stdout().to_int() + message('Found @0@ numa nodes'.format(max_numa_nodes)) + dpdk_conf.set('RTE_MAX_NUMA_NODES', max_numa_nodes) +elif max_numa_nodes != 'default' + # overwrite the default value from arch_subdir with user input + dpdk_conf.set('RTE_MAX_NUMA_NODES', max_numa_nodes.to_int()) +endif + +# check that CPU and NUMA counts are set +if not dpdk_conf.has('RTE_MAX_LCORE') + error('Number of CPU cores not specified.') +endif +if not dpdk_conf.has('RTE_MAX_NUMA_NODES') + error('Number of NUMA nodes not specified.') +endif + # set the install path for the drivers dpdk_conf.set_quoted('RTE_EAL_PMD_PATH', eal_pmd_path) @@ -368,6 +418,26 @@ if get_option('b_lto') endif endif +if get_option('b_sanitize') == 'address' or get_option('b_sanitize') == 'address,undefined' + if is_windows + error('ASan is not supported on windows') + endif + + if cc.get_id() == 'gcc' + asan_dep = cc.find_library('asan', required: true) + if (not cc.links('int main(int argc, char *argv[]) { return 0; }', + dependencies: asan_dep)) + error('broken dependency, "libasan"') + endif + add_project_link_arguments('-lasan', language: 'c') + dpdk_extra_ldflags += '-lasan' + endif + + if is_linux and dpdk_conf.get('RTE_ARCH_64') + dpdk_conf.set10('RTE_MALLOC_ASAN', true) + endif +endif + if get_option('default_library') == 'both' error( ''' Unsupported value "both" for "default_library" option.