From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 416E343034; Fri, 11 Aug 2023 15:32:02 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 1514940F16; Fri, 11 Aug 2023 15:32:02 +0200 (CEST) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by mails.dpdk.org (Postfix) with ESMTP id 34F8C40E03 for ; Fri, 11 Aug 2023 15:32:00 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1691760719; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=owAIMlEFa3SqqbNepEuiOROkNYZRzL8zsymQVWFW+2c=; b=iEsOfgU7HPMN8A7QB9bJ9Od+mN4TpcEYgdHFsvwLUF9L4CbqMxZhzg4B9blxpLEjGDqya2 cVXUjLCdik98ZZuMh3SwQkO/0WiK2axGmOXfmYClrOljmS5F164uG/XymM/FRE13kVuKBm 2qUtOS8SCeXoewDGyHbASrc7L2hwTJE= Received: from mail-lf1-f69.google.com (mail-lf1-f69.google.com [209.85.167.69]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-98-bEwPugD4NziTwzCseKHrRQ-1; Fri, 11 Aug 2023 09:31:56 -0400 X-MC-Unique: bEwPugD4NziTwzCseKHrRQ-1 Received: by mail-lf1-f69.google.com with SMTP id 2adb3069b0e04-4fe8a28a1aaso2085808e87.0 for ; Fri, 11 Aug 2023 06:31:56 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1691760715; x=1692365515; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=owAIMlEFa3SqqbNepEuiOROkNYZRzL8zsymQVWFW+2c=; b=jP2mIWc7nbqjvsdon1J5RTo5YLX/nNW/uqo+iuy8HHEfo1dapbCJPMErEA0lL4UhZT pdo1PTPfwzI/zRuym1lxXzwWoMJXsUwutILrx0z1ORlc6ge9aC8oCqfZLsmR7kLImMZg 9GDLJdabRLo133swHNOwET7sy9o5gTcVdohlm7blgKl/GJxk0My6RvmBaRenldktJsk+ M87JMEagB2q+J8mfsyJOsY1mWPJXjzDktYd5zOIN4lDcivrAxb/mKDBTzhYEXBt1YCKo CTTW0u2UFR6w3Nf+DKpMSlOdAm8wNbT6nwUU3PZDAl1z8HdLz64SwniKAlJokH9ZkHuQ wI4Q== X-Gm-Message-State: AOJu0Yz+pSj7PjYcn6Y7Cr9E6PeV1Xad4PUsLhQky76RYDLzER0AS8Er EHPRjdK9Pmr3RsmQRjpenK3AlzFwlF04hpjKYrW2DJqxQXLw7M6B4p3zaNbZ8Xmy5jU92+P/PtX 4wjJvykJ/4hmnSHOgu2E= X-Received: by 2002:a05:6512:1194:b0:4f5:a181:97b8 with SMTP id g20-20020a056512119400b004f5a18197b8mr1701839lfr.25.1691760714911; Fri, 11 Aug 2023 06:31:54 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHk73yqfudYkQ4Be8w1ukIufCeG/AMjGw7VLp1dTb0FI0/7udpLens01z5XB0fIHaNn52+hcgf5EtwYv+3Hgio= X-Received: by 2002:a05:6512:1194:b0:4f5:a181:97b8 with SMTP id g20-20020a056512119400b004f5a18197b8mr1701812lfr.25.1691760714435; Fri, 11 Aug 2023 06:31:54 -0700 (PDT) MIME-Version: 1.0 References: <1674674707-3094-1-git-send-email-roretzla@linux.microsoft.com> <1682453329-20435-1-git-send-email-roretzla@linux.microsoft.com> <1682453329-20435-2-git-send-email-roretzla@linux.microsoft.com> In-Reply-To: <1682453329-20435-2-git-send-email-roretzla@linux.microsoft.com> From: David Marchand Date: Fri, 11 Aug 2023 15:31:42 +0200 Message-ID: Subject: Re: [PATCH v3 1/4] build: unblock the use of the MSVC compiler To: Tyler Retzlaff , bruce.richardson@intel.com Cc: dev@dpdk.org, thomas@monjalon.net X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org On Tue, Apr 25, 2023 at 10:08=E2=80=AFPM Tyler Retzlaff wrote: > > Detect when MSVC toolset is available and tweak toolchain arguments > where the meson build system offers no abstraction. > > Signed-off-by: Tyler Retzlaff > Acked-by: Bruce Richardson > --- > buildtools/meson.build | 10 +++++++--- > config/meson.build | 21 ++++++++++++++------- > config/x86/meson.build | 8 +++++--- > lib/meson.build | 13 ++++++++++--- > 4 files changed, 36 insertions(+), 16 deletions(-) > > diff --git a/buildtools/meson.build b/buildtools/meson.build > index e1c600e..838c39f 100644 > --- a/buildtools/meson.build > +++ b/buildtools/meson.build > @@ -4,7 +4,9 @@ > pkgconf =3D find_program('pkg-config', 'pkgconf', required: false) > check_symbols =3D find_program('check-symbols.sh') I don't expect check-symbols.sh to work if objdump is not available. > ldflags_ibverbs_static =3D find_program('options-ibverbs-static.sh') > -objdump =3D find_program('objdump', 'llvm-objdump') > +if cc.get_id() !=3D 'msvc' > + objdump =3D find_program('objdump', 'llvm-objdump') > +endif Looking at objdump users in meson, I only see the avx512 stuff. The avx512 check is only called under a gcc check in config/x86/meson.build, so I would move both definitions (and potentially the script itself) under config/x86. Something like: https://patchwork.dpdk.org/project/dpdk/patch/20230811131024.2285366-1-davi= d.marchand@redhat.com/ > > python3 =3D import('python').find_installation(required: false) > if python3.found() > @@ -18,8 +20,10 @@ map_to_win_cmd =3D py3 + files('map_to_win.py') > sphinx_wrapper =3D py3 + files('call-sphinx-build.py') > get_cpu_count_cmd =3D py3 + files('get-cpu-count.py') > get_numa_count_cmd =3D py3 + files('get-numa-count.py') > -binutils_avx512_check =3D (py3 + files('binutils-avx512-check.py') + > - [objdump] + cc.cmd_array()) > +if cc.get_id() !=3D 'msvc' > + binutils_avx512_check =3D (py3 + files('binutils-avx512-check.py') + > + [objdump] + cc.cmd_array()) > +endif > > # select library and object file format > pmdinfo =3D py3 + files('gen-pmdinfo-cfile.py') + [meson.current_build_d= ir()] > diff --git a/config/meson.build b/config/meson.build > index fa730a1..9a3f499 100644 > --- a/config/meson.build > +++ b/config/meson.build > @@ -16,7 +16,8 @@ endforeach > > # MS linker requires special treatment. > # TODO: use cc.get_linker_id() with Meson >=3D 0.54 > -is_ms_linker =3D is_windows and (cc.get_id() =3D=3D 'clang') > +is_ms_compiler =3D is_windows and (cc.get_id() =3D=3D 'msvc') > +is_ms_linker =3D is_windows and (cc.get_id() =3D=3D 'clang' or is_ms_com= piler) > > # set the major version, which might be used by drivers and libraries > # depending on the configuration options > @@ -130,11 +131,13 @@ dpdk_conf.set('RTE_MACHINE', cpu_instruction_set) > machine_args =3D [] > > # ppc64 does not support -march=3D at all, use -mcpu and -mtune for that This comment can be moved in the block too. > -if host_machine.cpu_family().startswith('ppc') > - machine_args +=3D '-mcpu=3D' + cpu_instruction_set > - machine_args +=3D '-mtune=3D' + cpu_instruction_set > -else > - machine_args +=3D '-march=3D' + cpu_instruction_set > +if not is_ms_compiler > + if host_machine.cpu_family().startswith('ppc') > + machine_args +=3D '-mcpu=3D' + cpu_instruction_set > + machine_args +=3D '-mtune=3D' + cpu_instruction_set > + else > + machine_args +=3D '-march=3D' + cpu_instruction_set > + endif > endif > > toolchain =3D cc.get_id() > @@ -253,7 +256,11 @@ if cc.get_id() =3D=3D 'clang' and dpdk_conf.get('RTE= _ARCH_64') =3D=3D false > endif > > # add -include rte_config to cflags > -add_project_arguments('-include', 'rte_config.h', language: 'c') > +if is_ms_compiler > + add_project_arguments('/FI', 'rte_config.h', language: 'c') > +else > + add_project_arguments('-include', 'rte_config.h', language: 'c') > +endif > > # enable extra warnings and disable any unwanted warnings > # -Wall is added by default at warning level 1, and -Wextra > diff --git a/config/x86/meson.build b/config/x86/meson.build > index 54345c4..11f0bcc 100644 > --- a/config/x86/meson.build > +++ b/config/x86/meson.build > @@ -25,9 +25,11 @@ if cc.has_argument('-mavx512f') > endif > > # we require SSE4.2 for DPDK Are there requirements we announce for MSVC builds? In any case, please move this comment in the block. > -if cc.get_define('__SSE4_2__', args: machine_args) =3D=3D '' > - message('SSE 4.2 not enabled by default, explicitly enabling') > - machine_args +=3D '-msse4' > +if not is_ms_compiler > + if cc.get_define('__SSE4_2__', args: machine_args) =3D=3D '' > + message('SSE 4.2 not enabled by default, explicitly enabling') > + machine_args +=3D '-msse4' > + endif > endif > > base_flags =3D ['SSE', 'SSE2', 'SSE3','SSSE3', 'SSE4_1', 'SSE4_2'] > diff --git a/lib/meson.build b/lib/meson.build > index dc8aa4a..40c632a 100644 > --- a/lib/meson.build > +++ b/lib/meson.build > @@ -241,9 +241,16 @@ foreach l:libraries > output: '@0@_exports.def'.format(libname)) > lk_deps +=3D [def_file] > > - lk_args =3D ['-Wl,/def:' + def_file.full_path()] > - if meson.version().version_compare('<0.54.0') > - lk_args +=3D ['-Wl,/implib:lib\\librte_' + l + '.dll.a'] > + if is_ms_compiler > + lk_args =3D ['/def:' + def_file.full_path()] > + if meson.version().version_compare('<0.54.0') > + lk_args +=3D ['/implib:lib\\librte_' + l + '.dll.a'] > + endif > + else > + lk_args =3D ['-Wl,/def:' + def_file.full_path()] > + if meson.version().version_compare('<0.54.0') > + lk_args +=3D ['-Wl,/implib:lib\\librte_' + l + '.dll.a'] > + endif > endif > else > if is_windows > -- > 1.8.3.1 > --=20 David Marchand