From patchwork Tue Dec 19 10:52:21 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bruce Richardson X-Patchwork-Id: 32408 X-Patchwork-Delegate: bruce.richardson@intel.com Return-Path: X-Original-To: patchwork@dpdk.org Delivered-To: patchwork@dpdk.org Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id C9B581B014; Tue, 19 Dec 2017 11:52:36 +0100 (CET) Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) by dpdk.org (Postfix) with ESMTP id 502E61B013 for ; Tue, 19 Dec 2017 11:52:35 +0100 (CET) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga005.jf.intel.com ([10.7.209.41]) by fmsmga101.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 19 Dec 2017 02:52:34 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.45,426,1508828400"; d="scan'208";a="185436238" Received: from silpixa00399126.ir.intel.com (HELO silpixa00399126.ger.corp.intel.com) ([10.237.223.223]) by orsmga005.jf.intel.com with ESMTP; 19 Dec 2017 02:52:33 -0800 From: Bruce Richardson To: dev@dpdk.org Cc: bluca@debian.org, jerin.jacob@caviumnetworks.com, hemant.agrawal@nxp.com, Bruce Richardson Date: Tue, 19 Dec 2017 10:52:21 +0000 Message-Id: <20171219105222.198664-2-bruce.richardson@intel.com> X-Mailer: git-send-email 2.14.3 In-Reply-To: <20171219105222.198664-1-bruce.richardson@intel.com> References: <20171219105222.198664-1-bruce.richardson@intel.com> Subject: [dpdk-dev] [PATCH 1/2] build: remove architecture flag as default C flag X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" Any flags added to the project args are automatically added to all builds, both native and cross-compiled. This is not what we want for the -march flag as a valid -march for the cross-compile is not valid for pmdinfogen which is a native-build tool. Instead we store the march flag as a variable, and add it to the default cflags for all libs, drivers, examples, etc. This will allow pmdinfogen to compile successfully in a cross-compilation environment. Signed-off-by: Bruce Richardson --- app/test-pmd/meson.build | 1 + buildtools/pmdinfogen/meson.build | 3 +-- config/meson.build | 8 ++++++-- drivers/meson.build | 2 +- drivers/net/i40e/meson.build | 2 +- drivers/net/ixgbe/meson.build | 2 +- examples/meson.build | 2 +- lib/meson.build | 2 +- meson.build | 2 +- 9 files changed, 14 insertions(+), 10 deletions(-) diff --git a/app/test-pmd/meson.build b/app/test-pmd/meson.build index b1820c77d..bef044c82 100644 --- a/app/test-pmd/meson.build +++ b/app/test-pmd/meson.build @@ -73,6 +73,7 @@ endif executable('dpdk-testpmd', sources, + c_args: machine_arg, link_whole: link_libs, dependencies: dep_objs, install_rpath: join_paths(get_option('prefix'), driver_install_path), diff --git a/buildtools/pmdinfogen/meson.build b/buildtools/pmdinfogen/meson.build index 1f4836013..026d9745b 100644 --- a/buildtools/pmdinfogen/meson.build +++ b/buildtools/pmdinfogen/meson.build @@ -34,5 +34,4 @@ pmdinfogen_inc += include_directories('../../lib/librte_pci') pmdinfogen = executable('pmdinfogen', 'pmdinfogen.c', include_directories: pmdinfogen_inc, - native: true, - c_args: cflags) + native: true) diff --git a/config/meson.build b/config/meson.build index d7fb64422..d9a8e9f2c 100644 --- a/config/meson.build +++ b/config/meson.build @@ -30,9 +30,13 @@ # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. # set the machine type and cflags for it -machine = get_option('machine') +if meson.is_cross_build() + machine = host_machine.cpu() +else + machine = get_option('machine') +endif dpdk_conf.set('RTE_MACHINE', machine) -add_project_arguments('-march=@0@'.format(machine), language: 'c') +machine_arg = '-march=' + machine # use pthreads add_project_link_arguments('-pthread', language: 'c') diff --git a/drivers/meson.build b/drivers/meson.build index bb9a23523..da74e6c6b 100644 --- a/drivers/meson.build +++ b/drivers/meson.build @@ -50,7 +50,7 @@ foreach class:driver_classes version = 1 sources = [] objs = [] - cflags = [] + cflags = [machine_arg] includes = [include_directories(drv_path)] # set up internal deps. Drivers can append/override as necessary deps = std_deps diff --git a/drivers/net/i40e/meson.build b/drivers/net/i40e/meson.build index dc5e59d19..376e83a02 100644 --- a/drivers/net/i40e/meson.build +++ b/drivers/net/i40e/meson.build @@ -29,7 +29,7 @@ # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -cflags = ['-DPF_DRIVER', +cflags += ['-DPF_DRIVER', '-DVF_DRIVER', '-DINTEGRATED_VF', '-DX722_A0_SUPPORT'] diff --git a/drivers/net/ixgbe/meson.build b/drivers/net/ixgbe/meson.build index 648494ee1..59ed1d7af 100644 --- a/drivers/net/ixgbe/meson.build +++ b/drivers/net/ixgbe/meson.build @@ -29,7 +29,7 @@ # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -cflags = ['-DRTE_LIBRTE_IXGBE_BYPASS'] +cflags += ['-DRTE_LIBRTE_IXGBE_BYPASS'] subdir('base') objs = [base_objs] diff --git a/examples/meson.build b/examples/meson.build index d5397cdd0..bd20f9f61 100644 --- a/examples/meson.build +++ b/examples/meson.build @@ -37,7 +37,7 @@ endif foreach example: get_option('examples').split(',') name = example sources = [] - cflags = [] + cflags = [machine_arg] ext_deps = [] includes = [include_directories(example)] deps = ['eal', 'mempool', 'net', 'mbuf', 'ethdev', 'cmdline'] diff --git a/lib/meson.build b/lib/meson.build index d12816f55..4826699f1 100644 --- a/lib/meson.build +++ b/lib/meson.build @@ -59,7 +59,7 @@ foreach l:libraries sources = [] headers = [] includes = [] - cflags = [] + cflags = [machine_arg] objs = [] # other object files to link against, used e.g. for # instruction-set optimized versions of code diff --git a/meson.build b/meson.build index 04eea721d..5249a4d48 100644 --- a/meson.build +++ b/meson.build @@ -93,5 +93,5 @@ pkg.generate(name: meson.project_name(), ['-Wl,-Bdynamic'] + dpdk_extra_ldflags, description: 'The Data Plane Development Kit (DPDK)', subdirs: [get_option('include_subdir_arch'), '.'], - extra_cflags: ['-include "rte_config.h"', '-march=@0@'.format(machine)] + extra_cflags: ['-include "rte_config.h"', machine_arg] )