-
Notifications
You must be signed in to change notification settings - Fork 273
add code generation README #228
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
Merged
bashbaug
merged 2 commits into
KhronosGroup:main
from
bashbaug:update-script-requirements
Apr 13, 2023
Merged
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,38 @@ | ||
| # OpenCL Header Code Generation | ||
|
|
||
| ## Introduction | ||
|
|
||
| In order to ease maintenance and enable faster development in the OpenCL headers, the OpenCL headers for extensions are generated from the OpenCL XML machine readable grammar. | ||
| Currently, header generation is only enabled for the OpenCL headers for extensions, and the OpenCL headers for core APIs are still authored manually. | ||
|
|
||
| ## Dependencies | ||
|
|
||
| The OpenCL headers are generated using Python [Mako Templates](https://www.makotemplates.org/). | ||
|
|
||
| In most cases, after installing Python for your platform, Mako may be installed using: | ||
|
|
||
| ```sh | ||
| $ pip install Mako | ||
| ``` | ||
|
|
||
| ## Making Changes | ||
|
|
||
| Most changes only require modifications to the Mako templates. | ||
| Small changes modifying syntax or layout are simple and straightforward. | ||
| Occasionally, more complicated changes will be required, say when a new API is added that is unlike any previous API or when a new extension header file is needed, but this should be rare. | ||
|
|
||
| The Python script should only need to be modified if additional information needs to be propagated from the XML file into the Mako template itself. | ||
|
|
||
| ## Generating Headers | ||
|
|
||
| The script to generate headers requires the `cl.xml` machine readable grammar. | ||
| The latest version of `cl.xml` may be found in the Khronos OpenCL-Docs repo [here](https://github.com/KhronosGroup/OpenCL-Docs/blob/main/xml/cl.xml). | ||
|
|
||
| The easiest way to generate new headers is by using the `headers_generate` target. | ||
| For example, from a directory used to build the headers, simply execute: | ||
|
|
||
| ```sh | ||
| $ cmake --build . --target headers_generate | ||
| ``` | ||
|
|
||
| The `cl.xml` file used to generate headers with the header generation target may be provided by setting the CMake variable `OPENCL_HEADERS_XML_PATH` to the full path to `cl.xml`. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1 +1 @@ | ||
| Mako==1.1.0 | ||
| Mako>=1.2.2 | ||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.