* [PATCH] build: set rte toolchain macros from predefined macros
@ 2024-01-02 23:27 Tyler Retzlaff
2024-01-03 0:11 ` [PATCH v2] " Tyler Retzlaff
0 siblings, 1 reply; 4+ messages in thread
From: Tyler Retzlaff @ 2024-01-02 23:27 UTC (permalink / raw)
To: dev; +Cc: Bruce Richardson, Tyler Retzlaff
Stop writing RTE_TOOLCHAIN_XXX macros to rte_build_config.h. When an
application builds it doesn't necessarily use the same toolchain that
DPDK was built with.
Instead evaluate toolchain predefined macros and define
RTE_TOOLCHAIN_XXX macros as appropriate each time rte_config.h is
preprocessed.
Signed-off-by: Tyler Retzlaff <roretzla@linux.microsoft.com>
---
config/meson.build | 2 --
config/rte_config.h | 11 +++++++++++
2 files changed, 11 insertions(+), 2 deletions(-)
diff --git a/config/meson.build b/config/meson.build
index a9ccd56..0c3550e 100644
--- a/config/meson.build
+++ b/config/meson.build
@@ -180,8 +180,6 @@ if not is_ms_compiler
endif
toolchain = cc.get_id()
-dpdk_conf.set_quoted('RTE_TOOLCHAIN', toolchain)
-dpdk_conf.set('RTE_TOOLCHAIN_' + toolchain.to_upper().underscorify(), 1)
dpdk_conf.set('RTE_ARCH_64', cc.sizeof('void *') == 8)
dpdk_conf.set('RTE_ARCH_32', cc.sizeof('void *') == 4)
diff --git a/config/rte_config.h b/config/rte_config.h
index da265d7..460fe94 100644
--- a/config/rte_config.h
+++ b/config/rte_config.h
@@ -14,6 +14,17 @@
#include <rte_build_config.h>
+#ifdef __clang__
+#define RTE_TOOLCHAIN "clang"
+#define RTE_TOOLCHAIN_CLANG 1
+#elif __GNUC__
+#define RTE_TOOLCHAIN "gcc"
+#define RTE_TOOLCHAIN_GCC 1
+#elif _MSC_VER
+#define RTE_TOOLCHAIN "msvc"
+#define RTE_TOOLCHAIN_MSVC 1
+#endif
+
/* legacy defines */
#ifdef RTE_EXEC_ENV_LINUX
#define RTE_EXEC_ENV_LINUXAPP 1
--
1.8.3.1
^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH v2] build: set rte toolchain macros from predefined macros
2024-01-02 23:27 [PATCH] build: set rte toolchain macros from predefined macros Tyler Retzlaff
@ 2024-01-03 0:11 ` Tyler Retzlaff
2024-01-08 11:18 ` Bruce Richardson
0 siblings, 1 reply; 4+ messages in thread
From: Tyler Retzlaff @ 2024-01-03 0:11 UTC (permalink / raw)
To: dev; +Cc: Bruce Richardson, Tyler Retzlaff
Stop writing RTE_TOOLCHAIN_XXX macros to rte_build_config.h. When an
application builds it doesn't necessarily use the same toolchain that
DPDK was built with.
Instead evaluate toolchain predefined macros and define
RTE_TOOLCHAIN_XXX macros as appropriate each time rte_config.h is
preprocessed.
Signed-off-by: Tyler Retzlaff <roretzla@linux.microsoft.com>
---
v2:
* use defined(macro) to correctly test for predefined macros
config/meson.build | 2 --
config/rte_config.h | 11 +++++++++++
2 files changed, 11 insertions(+), 2 deletions(-)
diff --git a/config/meson.build b/config/meson.build
index a9ccd56..0c3550e 100644
--- a/config/meson.build
+++ b/config/meson.build
@@ -180,8 +180,6 @@ if not is_ms_compiler
endif
toolchain = cc.get_id()
-dpdk_conf.set_quoted('RTE_TOOLCHAIN', toolchain)
-dpdk_conf.set('RTE_TOOLCHAIN_' + toolchain.to_upper().underscorify(), 1)
dpdk_conf.set('RTE_ARCH_64', cc.sizeof('void *') == 8)
dpdk_conf.set('RTE_ARCH_32', cc.sizeof('void *') == 4)
diff --git a/config/rte_config.h b/config/rte_config.h
index da265d7..d743a5c 100644
--- a/config/rte_config.h
+++ b/config/rte_config.h
@@ -14,6 +14,17 @@
#include <rte_build_config.h>
+#if defined(__clang__)
+#define RTE_TOOLCHAIN "clang"
+#define RTE_TOOLCHAIN_CLANG 1
+#elif defined(__GNUC__)
+#define RTE_TOOLCHAIN "gcc"
+#define RTE_TOOLCHAIN_GCC 1
+#elif defined(_MSC_VER)
+#define RTE_TOOLCHAIN "msvc"
+#define RTE_TOOLCHAIN_MSVC 1
+#endif
+
/* legacy defines */
#ifdef RTE_EXEC_ENV_LINUX
#define RTE_EXEC_ENV_LINUXAPP 1
--
1.8.3.1
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH v2] build: set rte toolchain macros from predefined macros
2024-01-03 0:11 ` [PATCH v2] " Tyler Retzlaff
@ 2024-01-08 11:18 ` Bruce Richardson
2024-02-19 1:51 ` Thomas Monjalon
0 siblings, 1 reply; 4+ messages in thread
From: Bruce Richardson @ 2024-01-08 11:18 UTC (permalink / raw)
To: Tyler Retzlaff; +Cc: dev
On Tue, Jan 02, 2024 at 04:11:15PM -0800, Tyler Retzlaff wrote:
> Stop writing RTE_TOOLCHAIN_XXX macros to rte_build_config.h. When an
> application builds it doesn't necessarily use the same toolchain that
> DPDK was built with.
>
> Instead evaluate toolchain predefined macros and define
> RTE_TOOLCHAIN_XXX macros as appropriate each time rte_config.h is
> preprocessed.
>
> Signed-off-by: Tyler Retzlaff <roretzla@linux.microsoft.com>
I don't see an issue with doing this.
Acked-by: Bruce Richardson <bruce.richardson@intel.com>
> ---
>
> v2:
> * use defined(macro) to correctly test for predefined macros
>
> config/meson.build | 2 --
> config/rte_config.h | 11 +++++++++++
> 2 files changed, 11 insertions(+), 2 deletions(-)
>
> diff --git a/config/meson.build b/config/meson.build
> index a9ccd56..0c3550e 100644
> --- a/config/meson.build
> +++ b/config/meson.build
> @@ -180,8 +180,6 @@ if not is_ms_compiler
> endif
>
> toolchain = cc.get_id()
> -dpdk_conf.set_quoted('RTE_TOOLCHAIN', toolchain)
> -dpdk_conf.set('RTE_TOOLCHAIN_' + toolchain.to_upper().underscorify(), 1)
>
> dpdk_conf.set('RTE_ARCH_64', cc.sizeof('void *') == 8)
> dpdk_conf.set('RTE_ARCH_32', cc.sizeof('void *') == 4)
> diff --git a/config/rte_config.h b/config/rte_config.h
> index da265d7..d743a5c 100644
> --- a/config/rte_config.h
> +++ b/config/rte_config.h
> @@ -14,6 +14,17 @@
>
> #include <rte_build_config.h>
>
> +#if defined(__clang__)
> +#define RTE_TOOLCHAIN "clang"
> +#define RTE_TOOLCHAIN_CLANG 1
> +#elif defined(__GNUC__)
> +#define RTE_TOOLCHAIN "gcc"
> +#define RTE_TOOLCHAIN_GCC 1
> +#elif defined(_MSC_VER)
> +#define RTE_TOOLCHAIN "msvc"
> +#define RTE_TOOLCHAIN_MSVC 1
> +#endif
> +
> /* legacy defines */
> #ifdef RTE_EXEC_ENV_LINUX
> #define RTE_EXEC_ENV_LINUXAPP 1
> --
> 1.8.3.1
>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH v2] build: set rte toolchain macros from predefined macros
2024-01-08 11:18 ` Bruce Richardson
@ 2024-02-19 1:51 ` Thomas Monjalon
0 siblings, 0 replies; 4+ messages in thread
From: Thomas Monjalon @ 2024-02-19 1:51 UTC (permalink / raw)
To: Tyler Retzlaff; +Cc: dev, Bruce Richardson
08/01/2024 12:18, Bruce Richardson:
> On Tue, Jan 02, 2024 at 04:11:15PM -0800, Tyler Retzlaff wrote:
> > Stop writing RTE_TOOLCHAIN_XXX macros to rte_build_config.h. When an
> > application builds it doesn't necessarily use the same toolchain that
> > DPDK was built with.
> >
> > Instead evaluate toolchain predefined macros and define
> > RTE_TOOLCHAIN_XXX macros as appropriate each time rte_config.h is
> > preprocessed.
> >
> > Signed-off-by: Tyler Retzlaff <roretzla@linux.microsoft.com>
>
> I don't see an issue with doing this.
>
> Acked-by: Bruce Richardson <bruce.richardson@intel.com>
Applied, thanks.
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2024-02-19 1:51 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-01-02 23:27 [PATCH] build: set rte toolchain macros from predefined macros Tyler Retzlaff
2024-01-03 0:11 ` [PATCH v2] " Tyler Retzlaff
2024-01-08 11:18 ` Bruce Richardson
2024-02-19 1:51 ` Thomas Monjalon
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).