build: set rte toolchain macros from predefined macros
PATCH 1/1 build: set rte toolchain macros from predefined macros
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.
--- config/meson.build | 2 -- config/rte_config.h | 11 +++++++++++ 2 files changed, 11 insertions(+), 2 deletions(-)
config/meson.build +0 -2
@@ -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)
config/rte_config.h +11 -0
@@ -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
Signature · 1 line
1.8.3.1
PATCH v2 1/1 build: set rte toolchain macros from predefined macros
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.
---
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(-)
config/meson.build +0 -2
@@ -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)
config/rte_config.h +11 -0
@@ -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
Signature · 1 line
1.8.3.1
Quoted 9 lines · Tyler Retzlaff
Stop writing
RTE_TOOLCHAIN_XXXmacros torte_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_XXXmacros as appropriate each timerte_config.his preprocessed.Signed-off-by Tyler Retzlaff <[email protected]>
I don't see an issue with doing this.
Quoted 47 lines
---
v2:
* use defined(macro) to correctly test for predefined macrosconfig/meson.build | 2 -- config/rte_config.h | 11 +++++++++++ 2 files changed, 11 insertions(+), 2 deletions(-)config/meson.build +0
-2@@ -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)config/rte_config.h +11
-0@@ -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 1Signature · 1 line
1.8.3.1
Thomas Monjalon
Applied08/01/2024 12:18, Bruce Richardson:
Quoted 9 lines · Tyler Retzlaff
Quoted 8 lines
Stop writing
RTE_TOOLCHAIN_XXXmacros torte_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_XXXmacros as appropriate each timerte_config.his preprocessed.
Quoted 5 lines
Quoted 1 line
Signed-off-by Tyler Retzlaff <[email protected]>I don't see an issue with doing this.
Acked-by Bruce Richardson <[email protected]>
Applied, thanks.