Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[RFC] build: namespace generated headers with zephyr/ #68035

Closed
ycsin opened this issue Jan 24, 2024 · 1 comment · Fixed by #63973
Closed

[RFC] build: namespace generated headers with zephyr/ #68035

ycsin opened this issue Jan 24, 2024 · 1 comment · Fixed by #63973
Assignees
Labels
area: Build System RFC Request For Comments: want input from the community treewide 🧹

Comments

@ycsin
Copy link
Member

ycsin commented Jan 24, 2024

Introduction

Two years ago there was a header migration in #45410 to namespace all the headers in the include directory to include/zephyr, however the build-time generated headers are (still) not namespaced, i.e.:

  • app_version.h
  • cmake_intdef.h
  • core-isa-dM.h
  • devicetree_generated.h
  • driver-validation.h
  • kobj-types-enum.h
  • linker-kobject-prebuilt-data.h
  • mcuboot_version.h
  • offsets.h
  • otype-to-size.h
  • otype-to-str.h
  • strerror_table.h
  • strsignal_table.h
  • syscall_list.h
  • version.h
  • zsr.h
  • Kconfig headers (autoconf.h)
  • and all the syscalls headers

Generated headers, especially version.h, can easily conflict with other libraries & user applications. This RFC is proposing to namespace the generated headers into the zephyr/ directory as well.

Problem description

Some of the generated headers have pretty generic names, i.e.: version.h, and can potentially conflict with other library / user applications. Ideally, all Zephyr's headers, in-tree or generated, should be namespaced with zephyr/.

Proposed change

The generated headers previously in build/zephyr/include/generated/ will now be placed in build/zephyr/include/generated/zephyr/, Zephyr sources that are including these headers will be updated accordingly, i.e.:

#include <version.h>

will be changed to

#include <zephyr/version.h>

Detailed RFC

The task involves modifying CMake files and scripts to output generated headers in the include/generated/zephyr/ directory, updating dependencies on these headers accordingly, changing include paths for in-tree sources, creating a compatibility Kconfig for uninterrupted user application builds, and updating migration and release notes with details on this change and its mitigation steps.

Proposed change (Detailed)

  • Modify CMake files and scripts to output headers to the include/generated/zephyr/ directory
  • Update CMake files and scripts to depend on headers in the include/generated/zephyr/ directory
  • Update in-tree sources' include paths to zephyr/<header.h>
  • Create a compatibility Kconfig so that user applications will still continue to build
  • Update the migration/release notes about the change, and steps to mitigate

Dependencies

External libraries and user applications can be affected, in that case they may use the migration script.

Concerns and Unresolved Questions

Can't think of any

Alternatives

Rely on all external libaries & user applications to namespace their header so that no conflicts can occur.

@ycsin ycsin added the RFC Request For Comments: want input from the community label Jan 24, 2024
@ycsin ycsin linked a pull request Jan 24, 2024 that will close this issue
6 tasks
@henrikbrixandersen
Copy link
Member

Thanks! I'd very much like to see this happen.

@ycsin ycsin changed the title build: namespace generated headers with zephyr/ rfc: build: namespace generated headers with zephyr/ Jan 24, 2024
@ycsin ycsin changed the title rfc: build: namespace generated headers with zephyr/ [RFC] build: namespace generated headers with zephyr/ Jan 24, 2024
@carlescufi carlescufi moved this from Todo to In Progress in Architecture Review Feb 13, 2024
@hakehuang hakehuang removed this from Testing WG May 23, 2024
@github-project-automation github-project-automation bot moved this from In Progress to Done in Architecture Review May 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: Build System RFC Request For Comments: want input from the community treewide 🧹
Projects
Status: Done
Status: Done
Development

Successfully merging a pull request may close this issue.

3 participants