DPDK patches and discussions
 help / color / mirror / Atom feed
From: Bruce Richardson <bruce.richardson@intel.com>
To: dev@dpdk.org
Cc: Bruce Richardson <bruce.richardson@intel.com>
Subject: [dpdk-dev] [RFC PATCH] build for DPDK with meson and ninja
Date: Wed,  7 Jun 2017 11:47:43 +0100	[thread overview]
Message-ID: <20170607104743.275149-2-bruce.richardson@intel.com> (raw)
In-Reply-To: <20170607104743.275149-1-bruce.richardson@intel.com>

to use, need to have meson >= 0.4 and ninja-build packages installed.

Then do the following in main DPDK directory:

meson build
cd build
ninja
sudo ninja install

This will compile up some DPDK libs, the FVL PMD and testpmd and install
them in /usr/local/. [On Fedora you will need to add /usr/local/lib64 to
your ld path, it's not there by default.]
Then you can run testpmd as e.g.

sudo /usr/local/bin/dpdk-testpmd -c F00000 -- --rxd=512 --txd=512 --rxq=2 --txq=2
---
 .gitignore                                         |  2 +
 app/meson.build                                    |  1 +
 app/test-pmd/meson.build                           | 20 +++++++
 config/meson.build                                 |  5 ++
 config/rte_config.h                                | 20 +++++++
 drivers/mempool/meson.build                        |  2 +
 drivers/mempool/ring/meson.build                   |  9 +++
 drivers/mempool/stack/meson.build                  |  9 +++
 drivers/meson.build                                |  2 +
 drivers/net/i40e/meson.build                       | 61 +++++++++++++++++++
 drivers/net/meson.build                            |  1 +
 lib/librte_acl/meson.build                         | 44 ++++++++++++++
 lib/librte_cmdline/meson.build                     | 30 ++++++++++
 lib/librte_compat/meson.build                      |  4 ++
 lib/librte_eal/common/arch/x86/meson.build         |  1 +
 lib/librte_eal/common/arch/x86_64                  |  1 +
 lib/librte_eal/common/eal_common_cpuflags.c        |  1 +
 lib/librte_eal/common/include/arch/x86/meson.build | 16 +++++
 lib/librte_eal/common/include/arch/x86_64          |  1 +
 lib/librte_eal/common/include/meson.build          | 36 +++++++++++
 lib/librte_eal/common/include/rte_common.h         |  1 +
 lib/librte_eal/common/include/rte_eal.h            |  2 +-
 lib/librte_eal/linuxapp/eal/eal.c                  |  6 +-
 lib/librte_eal/linuxapp/eal/eal_pci_uio.c          |  9 +--
 lib/librte_eal/linuxapp/eal/meson.build            | 57 ++++++++++++++++++
 lib/librte_eal/linuxapp/meson.build                |  1 +
 lib/librte_eal/meson.build                         | 10 ++++
 lib/librte_ether/meson.build                       | 16 +++++
 lib/librte_hash/meson.build                        | 21 +++++++
 lib/librte_kvargs/meson.build                      | 10 ++++
 lib/librte_mbuf/meson.build                        | 10 ++++
 lib/librte_mbuf/rte_mbuf.h                         |  1 +
 lib/librte_mempool/meson.build                     | 10 ++++
 lib/librte_metrics/meson.build                     | 10 ++++
 lib/librte_net/meson.build                         | 19 ++++++
 lib/librte_ring/meson.build                        | 10 ++++
 lib/meson.build                                    | 12 ++++
 meson.build                                        | 70 ++++++++++++++++++++++
 meson_options.txt                                  |  2 +
 test/meson.build                                   |  1 +
 test/test/meson.build                              | 23 +++++++
 test/test/test.c                                   | 17 +++---
 42 files changed, 568 insertions(+), 16 deletions(-)
 create mode 100644 app/meson.build
 create mode 100644 app/test-pmd/meson.build
 create mode 100644 config/meson.build
 create mode 100644 config/rte_config.h
 create mode 100644 drivers/mempool/meson.build
 create mode 100644 drivers/mempool/ring/meson.build
 create mode 100644 drivers/mempool/stack/meson.build
 create mode 100644 drivers/meson.build
 create mode 100644 drivers/net/i40e/meson.build
 create mode 100644 drivers/net/meson.build
 create mode 100644 lib/librte_acl/meson.build
 create mode 100644 lib/librte_cmdline/meson.build
 create mode 100644 lib/librte_compat/meson.build
 create mode 100644 lib/librte_eal/common/arch/x86/meson.build
 create mode 120000 lib/librte_eal/common/arch/x86_64
 create mode 100644 lib/librte_eal/common/include/arch/x86/meson.build
 create mode 120000 lib/librte_eal/common/include/arch/x86_64
 create mode 100644 lib/librte_eal/common/include/meson.build
 create mode 100644 lib/librte_eal/linuxapp/eal/meson.build
 create mode 100644 lib/librte_eal/linuxapp/meson.build
 create mode 100644 lib/librte_eal/meson.build
 create mode 100644 lib/librte_ether/meson.build
 create mode 100644 lib/librte_hash/meson.build
 create mode 100644 lib/librte_kvargs/meson.build
 create mode 100644 lib/librte_mbuf/meson.build
 create mode 100644 lib/librte_mempool/meson.build
 create mode 100644 lib/librte_metrics/meson.build
 create mode 100644 lib/librte_net/meson.build
 create mode 100644 lib/librte_ring/meson.build
 create mode 100644 lib/meson.build
 create mode 100644 meson.build
 create mode 100644 meson_options.txt
 create mode 100644 test/meson.build
 create mode 100644 test/test/meson.build

diff --git a/.gitignore b/.gitignore
index 6df5ba0..e474259 100644
--- a/.gitignore
+++ b/.gitignore
@@ -12,3 +12,5 @@ GPATH
 GRTAGS
 tags
 TAGS
+build
+x86_64-native-linuxapp-gcc
diff --git a/app/meson.build b/app/meson.build
new file mode 100644
index 0000000..b6d9882
--- /dev/null
+++ b/app/meson.build
@@ -0,0 +1 @@
+subdir('test-pmd')
diff --git a/app/test-pmd/meson.build b/app/test-pmd/meson.build
new file mode 100644
index 0000000..bd6874b
--- /dev/null
+++ b/app/test-pmd/meson.build
@@ -0,0 +1,20 @@
+executable('dpdk-testpmd',
+	sources: [
+	'cmdline.c',
+	'cmdline_flow.c',
+	'config.c',
+	'csumonly.c',
+	'flowgen.c',
+	'icmpecho.c',
+	'ieee1588fwd.c',
+	'iofwd.c',
+	'macfwd.c',
+	'macswap.c',
+	'parameters.c',
+	'rxonly.c',
+	'testpmd.c',
+	'txonly.c'
+	],
+	dependencies: [rte_eal, rte_ring, rte_mempool, rte_cmdline,
+		rte_mbuf, rte_net, rte_ether, rte_acl, rte_metrics],
+	install: true)
diff --git a/config/meson.build b/config/meson.build
new file mode 100644
index 0000000..40af994
--- /dev/null
+++ b/config/meson.build
@@ -0,0 +1,5 @@
+dpdk_conf.set('RTE_EAL_PMD_PATH',
+	'"@0@/dpdk/drivers"'.format(get_option('prefix')))
+
+configure_file(output: 'rte_build_config.h',
+		configuration: dpdk_conf)
diff --git a/config/rte_config.h b/config/rte_config.h
new file mode 100644
index 0000000..c99f9e5
--- /dev/null
+++ b/config/rte_config.h
@@ -0,0 +1,20 @@
+#include <rte_build_config.h>
+
+#define RTE_CACHE_LINE_SIZE 64
+#define RTE_MAX_LCORE 128
+#define RTE_MAX_NUMA_NODES 8
+#define RTE_MAX_MEMSEG 256
+#define RTE_MAX_MEMZONE 2048
+#define RTE_MAX_TAILQ 32
+#define RTE_LOG_LEVEL RTE_LOG_INFO
+#define RTE_MEMPOOL_CACHE_MAX_SIZE 512
+#define RTE_PKTMBUF_HEADROOM 128
+#define RTE_MBUF_DEFAULT_MEMPOOL_OPS "ring_mp_mc"
+#define RTE_ETHDEV_QUEUE_STAT_CNTRS 16
+#define RTE_MAX_QUEUES_PER_PORT 1024
+#define RTE_MAX_ETHPORTS 32
+#define RTE_EAL_VFIO 1
+#define RTE_LIBRTE_I40E_ITR_INTERVAL -1
+#define RTE_LIBRTE_I40E_QUEUE_NUM_PER_VM 4
+#define RTE_LIBRTE_I40E_QUEUE_NUM_PER_PF 64
+#define RTE_LIBRTE_I40E_QUEUE_NUM_PER_VF 4
diff --git a/drivers/mempool/meson.build b/drivers/mempool/meson.build
new file mode 100644
index 0000000..7a4feb6
--- /dev/null
+++ b/drivers/mempool/meson.build
@@ -0,0 +1,2 @@
+subdir('ring')
+subdir('stack')
diff --git a/drivers/mempool/ring/meson.build b/drivers/mempool/ring/meson.build
new file mode 100644
index 0000000..1c17a97
--- /dev/null
+++ b/drivers/mempool/ring/meson.build
@@ -0,0 +1,9 @@
+
+sources = ['rte_mempool_ring.c']
+
+mempool_ring_lib = library('rte_mempool_ring', sources,
+	dependencies: [rte_eal, rte_mempool, rte_ring],
+	install: true,
+	install_dir: 'dpdk/drivers')
+rte_mempool_ring = declare_dependency(link_with: mempool_ring_lib,
+	include_directories: include_directories('.'))
diff --git a/drivers/mempool/stack/meson.build b/drivers/mempool/stack/meson.build
new file mode 100644
index 0000000..18b4315
--- /dev/null
+++ b/drivers/mempool/stack/meson.build
@@ -0,0 +1,9 @@
+
+sources = ['rte_mempool_stack.c']
+
+mempool_stack_lib = library('rte_mempool_stack', sources,
+	dependencies: [rte_eal, rte_mempool, rte_ring],
+	install: true,
+	install_dir: 'dpdk/drivers')
+rte_mempool_stack = declare_dependency(link_with: mempool_stack_lib,
+	include_directories: include_directories('.'))
diff --git a/drivers/meson.build b/drivers/meson.build
new file mode 100644
index 0000000..9eb35ae
--- /dev/null
+++ b/drivers/meson.build
@@ -0,0 +1,2 @@
+subdir('mempool')
+subdir('net')
diff --git a/drivers/net/i40e/meson.build b/drivers/net/i40e/meson.build
new file mode 100644
index 0000000..524de3a
--- /dev/null
+++ b/drivers/net/i40e/meson.build
@@ -0,0 +1,61 @@
+i40e_cflags = ['-DPF_DRIVER',
+	'-DVF_DRIVER',
+	'-DINTEGRATED_VF',
+	'-DX722_A0_SUPPORT']
+
+sources = [
+	'i40e_ethdev.c',
+	'i40e_rxtx.c',
+	'i40e_ethdev_vf.c',
+	'i40e_pf.c',
+	'i40e_fdir.c',
+	'i40e_flow.c',
+	'rte_pmd_i40e.c'
+	]
+
+base_sources = [
+	'base/i40e_adminq.c',
+	'base/i40e_common.c',
+	'base/i40e_dcb.c',
+	'base/i40e_diag.c',
+	'base/i40e_hmc.c',
+	'base/i40e_lan_hmc.c',
+	'base/i40e_nvm.c'
+	]
+
+objs = []
+
+if (host_machine.cpu_family() == 'x86') or (host_machine.cpu_family() == 'x86_64')
+	if dpdk_conf.has('RTE_MACHINE_CPUFLAG_SSE4_1')
+		sources += 'i40e_rxtx_vec_sse.c'
+	else
+		sse_tmplib = static_library('sse_tmp',
+			'i40e_rxtx_vec_sse.c',
+			dependencies: rte_eal,
+			c_args: '-msse4.1')
+		objs += sse_tmplib.extract_objects('i40e_rxtx_vec_sse.c')
+	endif
+endif
+
+install_headers('rte_pmd_i40e.h')
+
+base_lib = static_library('i40e_base', base_sources,
+	dependencies: rte_eal,
+	c_args: [i40e_cflags, '-Wno-sign-compare',
+			'-Wno-unused-value',
+			'-Wno-format',
+			'-Wno-unused-but-set-variable'])
+
+i40e_lib = library('rte_pmd_i40e', sources,
+	include_directories: include_directories('base'),
+	objects: objs,
+	dependencies: [rte_eal, rte_net,
+			rte_mbuf, rte_ether,
+			rte_mempool, rte_ring,
+			rte_hash, rte_kvargs],
+	link_with: base_lib,
+	c_args: i40e_cflags,
+	install: true,
+	install_dir: 'dpdk/drivers')
+i40e_pmd = declare_dependency(link_with: ring_lib,
+	include_directories: include_directories('.'))
diff --git a/drivers/net/meson.build b/drivers/net/meson.build
new file mode 100644
index 0000000..d8afe53
--- /dev/null
+++ b/drivers/net/meson.build
@@ -0,0 +1 @@
+subdir('i40e')
diff --git a/lib/librte_acl/meson.build b/lib/librte_acl/meson.build
new file mode 100644
index 0000000..59fb0e5
--- /dev/null
+++ b/lib/librte_acl/meson.build
@@ -0,0 +1,44 @@
+sources = ['tb_mem.c',
+	'rte_acl.c',
+	'acl_bld.c',
+	'acl_gen.c',
+	'acl_run_scalar.c']
+
+objs = []
+flags = ''
+
+if (host_machine.cpu_family() == 'x86') or (host_machine.cpu_family() == 'x86_64')
+
+	if dpdk_conf.has('RTE_MACHINE_CPUFLAG_SSE4_2')
+		sources += 'acl_run_sse.c'
+	else
+		sse_tmplib = static_library('sse_tmp',
+			'acl_run_sse.c',
+			dependencies: rte_eal,
+			c_args: '-msse4.2')
+		objs += sse_tmplib.extract_objects('acl_run_sse.c')
+	endif
+
+	if dpdk_conf.has('RTE_MACHINE_CPUFLAG_AVX2')
+		sources += 'acl_run_avx2.c'
+		flags += '-DCC_AVX2_SUPPORT'
+	elif cc.has_argument('-mavx2')
+		avx2_tmplib = static_library('avx2_tmp',
+			'acl_run_avx2.c',
+			dependencies: rte_eal,
+			c_args: '-mavx2')
+		objs += avx2_tmplib.extract_objects('acl_run_avx2.c')
+		flags += '-DCC_AVX2_SUPPORT'
+	endif
+endif
+
+install_headers('rte_acl.h', 'rte_acl_osdep.h')
+
+acl_lib = library('rte_acl', sources,
+	objects: objs,
+	c_args: flags,
+	dependencies: rte_eal,
+	install: true)
+
+rte_acl = declare_dependency(link_with: acl_lib,
+	include_directories: include_directories('.'))
diff --git a/lib/librte_cmdline/meson.build b/lib/librte_cmdline/meson.build
new file mode 100644
index 0000000..71acf10
--- /dev/null
+++ b/lib/librte_cmdline/meson.build
@@ -0,0 +1,30 @@
+sources = [ 'cmdline.c',
+	'cmdline_cirbuf.c',
+	'cmdline_parse.c',
+	'cmdline_parse_etheraddr.c',
+	'cmdline_parse_ipaddr.c',
+	'cmdline_parse_num.c',
+	'cmdline_parse_portlist.c',
+	'cmdline_parse_string.c',
+	'cmdline_rdline.c',
+	'cmdline_socket.c',
+	'cmdline_vt100.c']
+
+install_headers('cmdline.h',
+	'cmdline_parse.h',
+	'cmdline_parse_num.h',
+	'cmdline_parse_ipaddr.h',
+	'cmdline_parse_etheraddr.h',
+	'cmdline_parse_string.h',
+	'cmdline_rdline.h',
+	'cmdline_vt100.h',
+	'cmdline_socket.h',
+	'cmdline_cirbuf.h',
+	'cmdline_parse_portlist.h')
+
+cmdline_lib = library('rte_cmdline', sources, dependencies: rte_eal,
+		install: true)
+rte_cmdline = declare_dependency(link_with: cmdline_lib,
+	include_directories: include_directories('.'))
+
+dpdk_conf.set('RTE_LIBRTE_CMDLINE', 1)
diff --git a/lib/librte_compat/meson.build b/lib/librte_compat/meson.build
new file mode 100644
index 0000000..a526a3e
--- /dev/null
+++ b/lib/librte_compat/meson.build
@@ -0,0 +1,4 @@
+
+install_headers('rte_compat.h')
+
+rte_compat = declare_dependency(include_directories: include_directories('.'))
diff --git a/lib/librte_eal/common/arch/x86/meson.build b/lib/librte_eal/common/arch/x86/meson.build
new file mode 100644
index 0000000..459a3fb
--- /dev/null
+++ b/lib/librte_eal/common/arch/x86/meson.build
@@ -0,0 +1 @@
+arch_common = files('rte_spinlock.c', 'rte_cpuflags.c')
diff --git a/lib/librte_eal/common/arch/x86_64 b/lib/librte_eal/common/arch/x86_64
new file mode 120000
index 0000000..ef2bea7
--- /dev/null
+++ b/lib/librte_eal/common/arch/x86_64
@@ -0,0 +1 @@
+x86/
\ No newline at end of file
diff --git a/lib/librte_eal/common/eal_common_cpuflags.c b/lib/librte_eal/common/eal_common_cpuflags.c
index 9a2d080..2fb62dd 100644
--- a/lib/librte_eal/common/eal_common_cpuflags.c
+++ b/lib/librte_eal/common/eal_common_cpuflags.c
@@ -33,6 +33,7 @@
 
 #include <stdio.h>
 
+#include <rte_config.h>
 #include <rte_common.h>
 #include <rte_cpuflags.h>
 
diff --git a/lib/librte_eal/common/include/arch/x86/meson.build b/lib/librte_eal/common/include/arch/x86/meson.build
new file mode 100644
index 0000000..ba08290
--- /dev/null
+++ b/lib/librte_eal/common/include/arch/x86/meson.build
@@ -0,0 +1,16 @@
+install_headers(
+	'rte_atomic_32.h',
+	'rte_atomic_64.h',
+	'rte_atomic.h',
+	'rte_byteorder_32.h',
+	'rte_byteorder_64.h',
+	'rte_byteorder.h',
+	'rte_cpuflags.h',
+	'rte_cycles.h',
+	'rte_io.h',
+	'rte_memcpy.h',
+	'rte_prefetch.h',
+	'rte_rtm.h',
+	'rte_rwlock.h',
+	'rte_spinlock.h',
+	'rte_vect.h')
diff --git a/lib/librte_eal/common/include/arch/x86_64 b/lib/librte_eal/common/include/arch/x86_64
new file mode 120000
index 0000000..ef2bea7
--- /dev/null
+++ b/lib/librte_eal/common/include/arch/x86_64
@@ -0,0 +1 @@
+x86/
\ No newline at end of file
diff --git a/lib/librte_eal/common/include/meson.build b/lib/librte_eal/common/include/meson.build
new file mode 100644
index 0000000..224bcb5
--- /dev/null
+++ b/lib/librte_eal/common/include/meson.build
@@ -0,0 +1,36 @@
+common_headers = [
+	'rte_alarm.h',
+	'rte_branch_prediction.h',
+	'rte_bus.h',
+	'rte_common.h',
+	'rte_debug.h',
+	'rte_devargs.h',
+	'rte_dev.h',
+	'rte_eal.h',
+	'rte_eal_memconfig.h',
+	'rte_errno.h',
+	'rte_hexdump.h',
+	'rte_interrupts.h',
+	'rte_keepalive.h',
+	'rte_launch.h',
+	'rte_lcore.h',
+	'rte_log.h',
+	'rte_malloc.h',
+	'rte_malloc_heap.h',
+	'rte_memory.h',
+	'rte_memzone.h',
+	'rte_pci_dev_feature_defs.h',
+	'rte_pci_dev_features.h',
+	'rte_pci.h',
+	'rte_per_lcore.h',
+	'rte_random.h',
+	'rte_string_fns.h',
+	'rte_tailq.h',
+	'rte_time.h',
+	'rte_vdev.h',
+	'rte_version.h']
+
+install_headers(common_headers)
+install_subdir('generic', install_dir : 'include')
+
+subdir('arch/@0@'.format(host_machine.cpu_family()))
diff --git a/lib/librte_eal/common/include/rte_common.h b/lib/librte_eal/common/include/rte_common.h
index e057f6e..bebe05a 100644
--- a/lib/librte_eal/common/include/rte_common.h
+++ b/lib/librte_eal/common/include/rte_common.h
@@ -50,6 +50,7 @@ extern "C" {
 #include <ctype.h>
 #include <errno.h>
 #include <limits.h>
+#include <rte_config.h>
 
 #ifndef typeof
 #define typeof __typeof__
diff --git a/lib/librte_eal/common/include/rte_eal.h b/lib/librte_eal/common/include/rte_eal.h
index abf020b..c8b8800 100644
--- a/lib/librte_eal/common/include/rte_eal.h
+++ b/lib/librte_eal/common/include/rte_eal.h
@@ -43,8 +43,8 @@
 #include <stdint.h>
 #include <sched.h>
 
-#include <rte_per_lcore.h>
 #include <rte_config.h>
+#include <rte_per_lcore.h>
 
 #ifdef __cplusplus
 extern "C" {
diff --git a/lib/librte_eal/linuxapp/eal/eal.c b/lib/librte_eal/linuxapp/eal/eal.c
index 7c78f2d..8dbb819 100644
--- a/lib/librte_eal/linuxapp/eal/eal.c
+++ b/lib/librte_eal/linuxapp/eal/eal.c
@@ -50,9 +50,6 @@
 #include <sys/mman.h>
 #include <sys/queue.h>
 #include <sys/stat.h>
-#if defined(RTE_ARCH_X86)
-#include <sys/io.h>
-#endif
 
 #include <rte_common.h>
 #include <rte_debug.h>
@@ -78,6 +75,9 @@
 #include <rte_version.h>
 #include <rte_atomic.h>
 #include <malloc_heap.h>
+#if defined(RTE_ARCH_X86)
+#include <sys/io.h>
+#endif
 
 #include "eal_private.h"
 #include "eal_thread.h"
diff --git a/lib/librte_eal/linuxapp/eal/eal_pci_uio.c b/lib/librte_eal/linuxapp/eal/eal_pci_uio.c
index fa10329..3359267 100644
--- a/lib/librte_eal/linuxapp/eal/eal_pci_uio.c
+++ b/lib/librte_eal/linuxapp/eal/eal_pci_uio.c
@@ -41,16 +41,17 @@
 #include <sys/sysmacros.h>
 #include <linux/pci_regs.h>
 
-#if defined(RTE_ARCH_X86)
-#include <sys/io.h>
-#endif
-
+#include <rte_config.h>
 #include <rte_log.h>
 #include <rte_pci.h>
 #include <rte_eal_memconfig.h>
 #include <rte_common.h>
 #include <rte_malloc.h>
 
+#if defined(RTE_ARCH_X86)
+#include <sys/io.h>
+#endif
+
 #include "eal_filesystem.h"
 #include "eal_pci_init.h"
 
diff --git a/lib/librte_eal/linuxapp/eal/meson.build b/lib/librte_eal/linuxapp/eal/meson.build
new file mode 100644
index 0000000..4b5932a
--- /dev/null
+++ b/lib/librte_eal/linuxapp/eal/meson.build
@@ -0,0 +1,57 @@
+local_inc = include_directories('include')
+
+sources = ['eal_alarm.c',
+		'eal_debug.c',
+		'eal_hugepage_info.c',
+		'eal_interrupts.c',
+		'eal_lcore.c',
+		'eal_log.c',
+		'eal_pci_uio.c',
+		'eal_pci_vfio.c',
+		'eal_thread.c',
+		'eal_timer.c',
+		'eal_vfio.c',
+		'eal_vfio_mp_sync.c',
+		'eal.c',
+		'eal_memory.c',
+		'eal_pci.c',
+		'../../common/eal_common_bus.c',
+		'../../common/eal_common_cpuflags.c',
+		'../../common/eal_common_devargs.c',
+		'../../common/eal_common_dev.c',
+		'../../common/eal_common_errno.c',
+		'../../common/eal_common_hexdump.c',
+		'../../common/eal_common_launch.c',
+		'../../common/eal_common_lcore.c',
+		'../../common/eal_common_log.c',
+		'../../common/eal_common_memory.c',
+		'../../common/eal_common_memzone.c',
+		'../../common/eal_common_options.c',
+		'../../common/eal_common_pci.c',
+		'../../common/eal_common_pci_uio.c',
+		'../../common/eal_common_proc.c',
+		'../../common/eal_common_string_fns.c',
+		'../../common/eal_common_tailqs.c',
+		'../../common/eal_common_thread.c',
+		'../../common/eal_common_timer.c',
+		'../../common/eal_common_vdev.c',
+		'../../common/malloc_elem.c',
+		'../../common/malloc_heap.c',
+		'../../common/rte_keepalive.c',
+		'../../common/rte_malloc.c',
+		arch_common
+]
+
+if dpdk_conf.has('LIB_LIBRTE_EAL_XEN_DOM')
+	sources += ['eal_xen_memory.c']
+endif
+
+eal_lib = library('rte_eal', sources,
+			dependencies: dependency('threads'),
+			include_directories : [global_inc, eal_inc, local_inc],
+			c_args: '-D_GNU_SOURCE',
+			link_args: '-ldl',
+			install: true
+)
+
+rte_eal = declare_dependency(link_with: eal_lib, include_directories: [global_inc, eal_inc, local_inc])
diff --git a/lib/librte_eal/linuxapp/meson.build b/lib/librte_eal/linuxapp/meson.build
new file mode 100644
index 0000000..086b27c
--- /dev/null
+++ b/lib/librte_eal/linuxapp/meson.build
@@ -0,0 +1 @@
+subdir('eal')
diff --git a/lib/librte_eal/meson.build b/lib/librte_eal/meson.build
new file mode 100644
index 0000000..7d51d74
--- /dev/null
+++ b/lib/librte_eal/meson.build
@@ -0,0 +1,10 @@
+eal_inc = include_directories('common', 'common/include', 'common/include/arch/@0@'.format(host_machine.cpu_family()))
+
+# build architecture specific code
+subdir('common/arch/@0@'.format(host_machine.cpu_family()))
+
+# build linuxapp or bsdapp code
+subdir('@0@app'.format(host_machine.system().to_lower()))
+
+# add headers to "install" target
+subdir('common/include')
diff --git a/lib/librte_ether/meson.build b/lib/librte_ether/meson.build
new file mode 100644
index 0000000..762316d
--- /dev/null
+++ b/lib/librte_ether/meson.build
@@ -0,0 +1,16 @@
+
+sources = ['rte_ethdev.c', 'rte_flow.c']
+
+install_headers('rte_ethdev.h',
+	'rte_ethdev_pci.h',
+	'rte_ethdev_vdev.h',
+	'rte_eth_ctrl.h',
+	'rte_dev_info.h',
+	'rte_flow.h',
+	'rte_flow_driver.h')
+
+ether_lib = library('rte_ether', sources,
+	dependencies: [rte_eal, rte_ring, rte_mempool, rte_net, rte_mbuf],
+	install: true)
+rte_ether = declare_dependency(link_with: ether_lib,
+	include_directories: include_directories('.'))
diff --git a/lib/librte_hash/meson.build b/lib/librte_hash/meson.build
new file mode 100644
index 0000000..ad7e9b4
--- /dev/null
+++ b/lib/librte_hash/meson.build
@@ -0,0 +1,21 @@
+
+sources = ['rte_cuckoo_hash.c', 'rte_fbk_hash.c']
+
+headers = ['rte_cmp_arm64.h',
+	'rte_cmp_x86.h',
+	'rte_crc_arm64.h',
+	'rte_cuckoo_hash.h',
+	'rte_cuckoo_hash_x86.h',
+	'rte_fbk_hash.h',
+	'rte_hash_crc.h',
+	'rte_hash.h',
+	'rte_jhash.h',
+	'rte_thash.h']
+
+install_headers(headers)
+
+hash_lib = library('rte_hash', sources,
+	dependencies: [rte_eal, rte_ring, rte_compat],
+	install: true)
+rte_hash = declare_dependency(link_with: hash_lib,
+	include_directories: include_directories('.'))
diff --git a/lib/librte_kvargs/meson.build b/lib/librte_kvargs/meson.build
new file mode 100644
index 0000000..f72a1de
--- /dev/null
+++ b/lib/librte_kvargs/meson.build
@@ -0,0 +1,10 @@
+
+sources = ['rte_kvargs.c']
+
+install_headers('rte_kvargs.h')
+
+kvargs_lib = library('rte_kvargs', sources,
+	dependencies: rte_eal,
+	install: true)
+rte_kvargs = declare_dependency(link_with: kvargs_lib,
+	include_directories: include_directories('.'))
diff --git a/lib/librte_mbuf/meson.build b/lib/librte_mbuf/meson.build
new file mode 100644
index 0000000..c8ed03e
--- /dev/null
+++ b/lib/librte_mbuf/meson.build
@@ -0,0 +1,10 @@
+
+sources = ['rte_mbuf.c', 'rte_mbuf_ptype.c']
+
+install_headers('rte_mbuf.h', 'rte_mbuf_ptype.h')
+
+mbuf_lib = library('rte_mbuf', sources,
+	dependencies: [rte_eal, rte_mempool, rte_ring],
+	install: true)
+rte_mbuf = declare_dependency(link_with: mbuf_lib,
+	include_directories: include_directories('.'))
diff --git a/lib/librte_mbuf/rte_mbuf.h b/lib/librte_mbuf/rte_mbuf.h
index 1cb0310..d4d803c 100644
--- a/lib/librte_mbuf/rte_mbuf.h
+++ b/lib/librte_mbuf/rte_mbuf.h
@@ -61,6 +61,7 @@
  */
 
 #include <stdint.h>
+#include <rte_config.h>
 #include <rte_common.h>
 #include <rte_mempool.h>
 #include <rte_memory.h>
diff --git a/lib/librte_mempool/meson.build b/lib/librte_mempool/meson.build
new file mode 100644
index 0000000..1dc37ad
--- /dev/null
+++ b/lib/librte_mempool/meson.build
@@ -0,0 +1,10 @@
+
+sources = ['rte_mempool.c', 'rte_mempool_ops.c']
+
+install_headers('rte_mempool.h')
+
+mempool_lib = library('rte_mempool', sources,
+	dependencies: [rte_eal, rte_ring],
+	install: true)
+rte_mempool = declare_dependency(link_with: mempool_lib,
+	include_directories: include_directories('.'))
diff --git a/lib/librte_metrics/meson.build b/lib/librte_metrics/meson.build
new file mode 100644
index 0000000..f6b5e19
--- /dev/null
+++ b/lib/librte_metrics/meson.build
@@ -0,0 +1,10 @@
+
+sources = ['rte_metrics.c']
+
+install_headers('rte_metrics.h')
+
+metrics_lib = library('rte_metrics', sources,
+	dependencies: rte_eal,
+	install: true)
+rte_metrics = declare_dependency(link_with: metrics_lib,
+	include_directories: include_directories('.'))
diff --git a/lib/librte_net/meson.build b/lib/librte_net/meson.build
new file mode 100644
index 0000000..043a2f2
--- /dev/null
+++ b/lib/librte_net/meson.build
@@ -0,0 +1,19 @@
+
+sources = ['rte_net.c', 'rte_net_crc.c']
+
+install_headers('rte_ip.h',
+	'rte_tcp.h',
+	'rte_udp.h',
+	'rte_sctp.h',
+	'rte_icmp.h',
+	'rte_arp.h',
+	'rte_ether.h',
+	'rte_gre.h',
+	'rte_net.h',
+	'rte_net_crc.h')
+
+net_lib = library('rte_net', sources,
+	dependencies: [rte_eal, rte_mbuf, rte_ring, rte_mempool],
+	install: true)
+rte_net = declare_dependency(link_with: net_lib,
+	include_directories: include_directories('.'))
diff --git a/lib/librte_ring/meson.build b/lib/librte_ring/meson.build
new file mode 100644
index 0000000..d225c09
--- /dev/null
+++ b/lib/librte_ring/meson.build
@@ -0,0 +1,10 @@
+
+sources = ['rte_ring.c']
+
+install_headers('rte_ring.h')
+
+ring_lib = library('rte_ring', sources,
+	dependencies: rte_eal,
+	install: true)
+rte_ring = declare_dependency(link_with: ring_lib,
+	include_directories: include_directories('.'))
diff --git a/lib/meson.build b/lib/meson.build
new file mode 100644
index 0000000..bd60bf2
--- /dev/null
+++ b/lib/meson.build
@@ -0,0 +1,12 @@
+subdir('librte_eal')
+subdir('librte_ring')
+subdir('librte_mempool')
+subdir('librte_acl')
+subdir('librte_cmdline')
+subdir('librte_mbuf')
+subdir('librte_net')
+subdir('librte_ether')
+subdir('librte_compat')
+subdir('librte_hash')
+subdir('librte_kvargs')
+subdir('librte_metrics')
diff --git a/meson.build b/meson.build
new file mode 100644
index 0000000..215ee05
--- /dev/null
+++ b/meson.build
@@ -0,0 +1,70 @@
+project('DPDK', 'C', 
+	version: '17.02.0',
+	license: 'BSD')
+
+error_opts = ['-Wall', '-Wextra', '-Werror', '-Wfatal-errors',
+		'-Wno-unused-result']
+add_project_arguments(error_opts, language: 'c')
+
+optimization_opts = ['-O3']
+add_project_arguments(optimization_opts, language: 'c')
+
+rte_machine = get_option('machine')
+march_opt = '-march=@0@'.format(rte_machine)
+add_project_arguments(march_opt, language: 'c')
+
+global_inc = include_directories('config')
+
+dpdk_conf = configuration_data()
+dpdk_conf.set('RTE_MACHINE', rte_machine)
+if get_option('enable-xen-dom0')
+	dpdk_conf.set('RTE_LIBRTE_XEN_DOM0', 1)
+endif
+
+cc = meson.get_compiler('c')
+compile_time_cpuflags = []
+if (host_machine.cpu_family() == 'x86') or (host_machine.cpu_family() == 'x86_64')
+	dpdk_conf.set('RTE_ARCH_X86', 1)
+	if (host_machine.cpu_family() == 'x86_64')
+		dpdk_conf.set('RTE_ARCH_X86_64', 1)
+		dpdk_conf.set('RTE_ARCH', 'x86_64')
+		dpdk_conf.set('RTE_ARCH_64', 1)
+	else
+		dpdk_conf.set('RTE_ARCH_I686', 1)
+		dpdk_conf.set('RTE_ARCH', 'i686')
+	endif
+
+	if cc.get_define('__SSE4_1__', args: march_opt) != ''
+		dpdk_conf.set('RTE_MACHINE_CPUFLAG_SSE4_1', 1)
+		compile_time_cpuflags += ['RTE_CPUFLAG_SSE4_1']
+	endif
+	if cc.get_define('__SSE4_2__', args: march_opt) != ''
+		dpdk_conf.set('RTE_MACHINE_CPUFLAG_SSE4_2', 1)
+		compile_time_cpuflags += ['RTE_CPUFLAG_SSE4_2']
+	endif
+	if cc.get_define('__AES__', args: march_opt) != ''
+		dpdk_conf.set('RTE_MACHINE_CPUFLAG_AES', 1)
+		compile_time_cpuflags += ['RTE_CPUFLAG_AES']
+	endif
+	if cc.get_define('__PCLMUL__', args: march_opt) != ''
+		dpdk_conf.set('RTE_MACHINE_CPUFLAG_PCLMULQDQ', 1)
+		compile_time_cpuflags += ['RTE_CPUFLAG_PCLMULQDQ']
+	endif
+	if cc.get_define('__AVX__', args: march_opt) != ''
+		dpdk_conf.set('RTE_MACHINE_CPUFLAG_AVX', 1)
+		compile_time_cpuflags += ['RTE_CPUFLAG_AVX']
+	endif
+	if cc.get_define('__AVX2__', args: march_opt) != ''
+		dpdk_conf.set('RTE_MACHINE_CPUFLAG_AVX2', 1)
+		compile_time_cpuflags += ['RTE_CPUFLAG_AVX2']
+	endif
+endif
+dpdk_conf.set('RTE_COMPILE_TIME_CPUFLAGS', ','.join(compile_time_cpuflags))
+
+subdir('lib')
+subdir('drivers')
+subdir('test')
+subdir('app')
+
+# should be last to write out all config values set when parsing other meson files
+subdir('config')
diff --git a/meson_options.txt b/meson_options.txt
new file mode 100644
index 0000000..52d7e54
--- /dev/null
+++ b/meson_options.txt
@@ -0,0 +1,2 @@
+option('enable-xen-dom0', type : 'boolean', value : false, description : 'enable Xen Dom0 Support')
+option('machine', type : 'string', value : 'native', description : 'set the target machine type')
diff --git a/test/meson.build b/test/meson.build
new file mode 100644
index 0000000..a600d0c
--- /dev/null
+++ b/test/meson.build
@@ -0,0 +1 @@
+subdir('test')
diff --git a/test/test/meson.build b/test/test/meson.build
new file mode 100644
index 0000000..cc85408
--- /dev/null
+++ b/test/test/meson.build
@@ -0,0 +1,23 @@
+executable('dpdk-test',
+	sources: [
+		'commands.c',
+		'packet_burst_generator.c',
+		'test.c',
+		'test_acl.c',
+		'test_cmdline.c',
+		'test_cmdline_cirbuf.c',
+		'test_cmdline_etheraddr.c',
+		'test_cmdline_ipaddr.c',
+		'test_cmdline_lib.c',
+		'test_cmdline_num.c',
+		'test_cmdline_portlist.c',
+		'test_cmdline_string.c',
+		'test_cpuflags.c',
+		'test_mp_secondary.c',
+		'test_pmd_perf.c',
+		'test_ring.c',
+		'test_ring_perf.c'
+	],
+	dependencies: [rte_eal, rte_ring, rte_mempool, rte_cmdline,
+		rte_mbuf, rte_net, rte_ether, rte_acl],
+	install: true)
diff --git a/test/test/test.c b/test/test/test.c
index c561eb5..671d915 100644
--- a/test/test/test.c
+++ b/test/test/test.c
@@ -41,14 +41,7 @@
 #include <ctype.h>
 #include <sys/queue.h>
 
-#ifdef RTE_LIBRTE_CMDLINE
-#include <cmdline_rdline.h>
-#include <cmdline_parse.h>
-#include <cmdline_socket.h>
-#include <cmdline.h>
-extern cmdline_parse_ctx_t main_ctx[];
-#endif
-
+#include <rte_config.h>
 #include <rte_memory.h>
 #include <rte_memzone.h>
 #include <rte_eal.h>
@@ -58,6 +51,14 @@ extern cmdline_parse_ctx_t main_ctx[];
 #ifdef RTE_LIBRTE_TIMER
 #include <rte_timer.h>
 #endif
+#ifdef RTE_LIBRTE_CMDLINE
+#include <cmdline_rdline.h>
+#include <cmdline_parse.h>
+#include <cmdline_socket.h>
+#include <cmdline.h>
+extern cmdline_parse_ctx_t main_ctx[];
+#endif
+
 
 #include "test.h"
 
-- 
2.9.4

  reply	other threads:[~2017-06-07 11:16 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-06-07 10:47 [dpdk-dev] [RFC PATCH] replace DPDK config and build system Bruce Richardson
2017-06-07 10:47 ` Bruce Richardson [this message]
     [not found]   ` <CGME20170607143643eucas1p10bce80dca22034efc6402d5944a6a0ed@eucas1p1.samsung.com>
2017-06-07 14:36     ` [dpdk-dev] [dpdk-dev,RFC] build for DPDK with meson and ninja Ilya Maximets
2017-06-07 14:51       ` Bruce Richardson
2017-06-07 18:12   ` [dpdk-dev] [RFC PATCH] " Jerin Jacob
2017-06-08  8:43     ` Bruce Richardson
2017-06-08  7:20   ` Shreyansh Jain
2017-06-08  8:48     ` Bruce Richardson
2017-06-07 13:08 ` [dpdk-dev] [RFC PATCH] replace DPDK config and build system Van Haaren, Harry
     [not found]   ` <1496841784.25214.6.camel@gmail.com>
2017-06-07 13:27     ` Bruce Richardson
2017-06-07 23:26 ` Stephen Hemminger
2017-06-08  8:59   ` Bruce Richardson
2017-06-08 16:26     ` Stephen Hemminger
2017-06-08 18:07       ` Christian Ehrhardt
2017-06-08 18:21         ` Wiles, Keith
2017-06-09  9:05         ` Bruce Richardson
2017-06-09 18:06           ` Wiles, Keith
2017-06-20 13:34             ` Morten Brørup
2017-06-20 13:41               ` Bruce Richardson
2017-06-20 14:25                 ` Morten Brørup
2017-06-20 14:43                   ` Bruce Richardson
2017-06-22 17:14 ` Neil Horman
2017-06-22 20:27   ` Bruce Richardson

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20170607104743.275149-2-bruce.richardson@intel.com \
    --to=bruce.richardson@intel.com \
    --cc=dev@dpdk.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).