Header search paths for runtime computation of metal kernels.

Is it possible to set the header include paths when compiling a metal library from source at runtime?

I'm dynamically generating kernel source that I'm compiling at runtime. I want to include some functions I have defined in a header. If I was doing online computation, I can specify include paths using -I /path/to/include using the command.

xcrun metal -c -I /path/to/include example.metal -o example.air

However when I'm online, it doesn't appear possible to define a header search path.

MTLCompileOptions *options = [MTLCompileOptions new];
options.fastMathEnabled = NO;

library = [device newLibraryWithSource:kernel_source
                               options:options
                                 error:&error];

Is there a way to specify a header search path using newLibraryWithSource?

Replies

No. There is no way to specify additional header search paths when compiling from source at runtime.