Skip to content

Commit ce4a18e

Browse files
committed
zephyr: namespace the generated version.h
Zephyr's build time generated `version.h` is now in the `zephyr` to provide proper namespace, update the includes of this module accordingly. Signed-off-by: Yong Cong Sin <ycsin@meta.com>
1 parent 5081044 commit ce4a18e

File tree

7 files changed

+42
-0
lines changed

7 files changed

+42
-0
lines changed

app/Kconfig

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
# SPDX-License-Identifier: BSD-3-Clause
2+
#
3+
# Copyright(c) 2023 Meta
4+
#
5+
# Author: Yong Cong Sin <ycsin@meta.com>
6+
7+
menu "Compatibility"
8+
9+
config SOF_COMPAT_INCLUDES
10+
bool "Use legacy include path"
11+
default n
12+
help
13+
Use legacy Zephyr generated include paths,
14+
i.e. `#include <version.h> instead of:
15+
`#include <zephyr/version.h>`
16+
17+
endmenu
18+
19+
source "Kconfig"

app/prj.conf

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,3 +57,6 @@ CONFIG_HEAP_MEM_POOL_SIZE=2048
5757
CONFIG_LLEXT=y
5858
CONFIG_LLEXT_STORAGE_WRITABLE=y
5959
CONFIG_MODULES=y
60+
61+
# To be able to use Zephyr legacy include paths
62+
CONFIG_SOF_COMPAT_INCLUDES=y

src/init/init.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,11 @@
4040
#include <zephyr/logging/log_ctrl.h>
4141
#include <user/abi_dbg.h>
4242
#include <sof_versions.h>
43+
#ifdef CONFIG_SOF_COMPAT_INCLUDES
4344
#include <version.h>
45+
#else
46+
#include <zephyr/version.h>
47+
#endif
4448
#endif
4549
#include <sof/lib/ams.h>
4650

src/trace/dma-trace.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,11 @@
3030
#include <sof_versions.h>
3131

3232
#ifdef __ZEPHYR__
33+
#ifdef CONFIG_SOF_COMPAT_INCLUDES
3334
#include <version.h>
35+
#else
36+
#include <zephyr/version.h>
37+
#endif
3438
#endif
3539

3640
#include <errno.h>

zephyr/lib/alloc.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,11 @@
2323
#include <zephyr/init.h>
2424
#include <zephyr/kernel.h>
2525
#include <zephyr/pm/policy.h>
26+
#ifdef CONFIG_SOF_COMPAT_INCLUDES
2627
#include <version.h>
28+
#else
29+
#include <zephyr/version.h>
30+
#endif
2731
#include <zephyr/sys/__assert.h>
2832
#include <zephyr/cache.h>
2933

zephyr/lib/cpu.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,11 @@
1717
#include <rtos/alloc.h>
1818

1919
/* Zephyr includes */
20+
#ifdef CONFIG_SOF_COMPAT_INCLUDES
2021
#include <version.h>
22+
#else
23+
#include <zephyr/version.h>
24+
#endif
2125
#include <zephyr/kernel.h>
2226
#include <zephyr/kernel/smp.h>
2327
#include <zephyr/device.h>

zephyr/wrapper.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,11 @@
2828
#include <zephyr/kernel_structs.h>
2929
#include <zephyr/kernel.h>
3030
#include <zephyr/pm/policy.h>
31+
#ifdef CONFIG_SOF_COMPAT_INCLUDES
3132
#include <version.h>
33+
#else
34+
#include <zephyr/version.h>
35+
#endif
3236
#include <zephyr/sys/__assert.h>
3337
#include <zephyr/logging/log_ctrl.h>
3438
#include <zephyr/logging/log.h>

0 commit comments

Comments
 (0)