ocl-include
Simple preprocessor that implements #include mechanism for OpenCL source files.
About
OpenCL API doesn't provide mechanism for including header files into the main one, like in C and C++. This crate is a simple preprocessor that handles #include ...
and #pragma once
directives in source files, collects them over filesystem or memory, and gives a single string to the output that could be passed to OpenCL kernel builder.
Documentation
Examples
Let you have main.c
and header.h
files in ./kernels/
folder:
main.c
:
int
header.h
:
static const int RET_CODE = 0;
Filesystem only
The follwong code takes main.c
from the filesystem and includes header.h
into it.
use Path;
use *;
Filesystem and memory
The follwong code takes main.c
source from the memory and includes header.h
into it from the filesystem.
use Path;
use *;
Hooks
Hook is a handler that retrieve files by their names.
The crate contains the following hooks now:
FsHook
: takes files from the filesystem.MemHook
: retrieves the source from the memory.ListHook
: contains a list of other hooks and tries to retrieve source from them subsequently.
License
Licensed under either of
- Apache License, Version 2.0 (LICENSE-APACHE or http://www.apache.org/licenses/LICENSE-2.0)
- MIT license (LICENSE-MIT or http://opensource.org/licenses/MIT)
at your option.
Contribution
Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.