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

Add script to make a copy of headers in include/level_zero #261

Closed

Conversation

Maetveis
Copy link
Contributor

This is to allow users consuming the headers from a
clone of the repository to be able to refer to the api headers
the same way as it would be if the level-zero headers were installed.
As in after running this script the following will compile

#include <level_zero/ze_api.h>

when <path-to-repo>/include is part of the include directory.

Symlinks or alternatively wrapper header files could be added that would
forward to the previous location, but I stuck with copies, since the
files are generated anyway and any solution outside of full copies might
have corner cases. (Symlinks are not always supported on windows,
the build system might be grepping in the contents of the header etc.).

This PR also does not deprecate the current location of the headers.

This is to allow users consuming the headers from a
clone of the repository to be able to refer to the api headers
the same way as it would be if the level-zero headers were installed.
As in after running this script the following will compile
```c++
 #include <level_zero/ze_api.h>
```
when `<path-to-repo>/include` is part of the include directory.

Symlinks or alternatively wrapper header files could be added that would
forward to the previous location, but I stuck with copies, since the
files are generated anyway and any solution outside of full copies might
have corner cases. (Symlinks are not always supported on windows,
the build system might be grepping in the contents of the header etc.).

This PR also does not deprecate the current location of the headers.

The copies of the files will be checked in the next commit.

Signed-off-by: gergely.meszaros <gergely.meszaros@intel.com>
Signed-off-by: gergely.meszaros <gergely.meszaros@intel.com>
@rwmcguir
Copy link
Contributor

Unsure why any of this would be needed. All you really need to do is create a simple symlink yourself if you want this feature.

~/src/level-zero/include$ ln -s ../include ./level-zero
~/src/level-zero/include$ ls -al level-zero
.... Mar 20 14:46 level-zero -> ../include
~/src/level-zero/include$ ls level-zero/
layers level-zero loader ze_api.h ze_ddi_common.h ze_ddi.h ze.py zes_api.h zes_ddi.h zes.py zet_api.h zet_ddi.h zet.py

Problem solved, no addition to the repo

~/src/level-zero$ cat test.c
#include <level-zero/ze_api.h>
void main(void)
{ return; }

~/src/level-zero$ gcc test.c
test.c:1:10: fatal error: level-zero/ze_api.h: No such file or directory
1 | #include <level-zero/ze_api.h>
| ^~~~~~~~~~~~~~~~~~~~~
compilation terminated.
~/src/level-zero$ gcc test.c -I./include/
SUCCESS

@nrspruit nrspruit closed this Mar 25, 2025
@nrspruit
Copy link
Contributor

This change is rejected, we don't want to be making such a change when a workaround can be added in the user's environment.

@Maetveis Maetveis deleted the headers_in_consistent_loc branch March 25, 2025 19:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants