Skip to content

Commit 3cb34fb

Browse files
Tyler Retzlafftmonjalo
authored andcommitted
build: set 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. Signed-off-by: Tyler Retzlaff <[email protected]> Acked-by: Bruce Richardson <[email protected]>
1 parent c9f57bb commit 3cb34fb

File tree

2 files changed

+11
-2
lines changed

2 files changed

+11
-2
lines changed

config/meson.build

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -180,8 +180,6 @@ if not is_ms_compiler
180180
endif
181181

182182
toolchain = cc.get_id()
183-
dpdk_conf.set_quoted('RTE_TOOLCHAIN', toolchain)
184-
dpdk_conf.set('RTE_TOOLCHAIN_' + toolchain.to_upper().underscorify(), 1)
185183

186184
dpdk_conf.set('RTE_ARCH_64', cc.sizeof('void *') == 8)
187185
dpdk_conf.set('RTE_ARCH_32', cc.sizeof('void *') == 4)

config/rte_config.h

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,17 @@
1414

1515
#include <rte_build_config.h>
1616

17+
#if defined(__clang__)
18+
#define RTE_TOOLCHAIN "clang"
19+
#define RTE_TOOLCHAIN_CLANG 1
20+
#elif defined(__GNUC__)
21+
#define RTE_TOOLCHAIN "gcc"
22+
#define RTE_TOOLCHAIN_GCC 1
23+
#elif defined(_MSC_VER)
24+
#define RTE_TOOLCHAIN "msvc"
25+
#define RTE_TOOLCHAIN_MSVC 1
26+
#endif
27+
1728
/* legacy defines */
1829
#ifdef RTE_EXEC_ENV_LINUX
1930
#define RTE_EXEC_ENV_LINUXAPP 1

0 commit comments

Comments
 (0)