print_usage(char *exec_name, FILE *f)
{
fprintf(f,
-"Usage: %s [options] -- [clang args | input file]\n"
+"Usage: %s [options] -- [clang args]\n"
"Options:\n"
" -h --help Print this help.\n"
" -e, --entrypoint <name> Specify the entry-point name.\n"
" -p, --platform <name> Specify the target platform name.\n"
" --prefix <prefix> Prefix for variable names in generated C code.\n"
" -o, --out <filename> Specify the output filename.\n"
+" -i, --in <filename> Specify one input filename. Accepted multiple times.\n"
" -s, --spv <filename> Specify the output filename for spirv.\n"
" -v, --verbose Print more information during compilation.\n"
, exec_name);
util_dynarray_init(&spirv_ptr_objs, mem_ctx);
int ch;
- while ((ch = getopt_long(argc, argv, "he:p:s:o:v", long_options, NULL)) != -1)
+ while ((ch = getopt_long(argc, argv, "he:p:s:i:o:v", long_options, NULL)) != -1)
{
switch (ch)
{
case 'o':
outfile = optarg;
break;
+ case 'i':
+ util_dynarray_append(&input_files, char *, optarg);
+ break;
case 's':
spv_outfile = optarg;
break;
}
for (int i = optind; i < argc; i++) {
- if (argv[i][0] == '-')
- util_dynarray_append(&clang_args, char *, argv[i]);
- else
- util_dynarray_append(&input_files, char *, argv[i]);
+ util_dynarray_append(&clang_args, char *, argv[i]);
}
if (util_dynarray_num_elements(&input_files, char *) == 0) {
input_args += [ lib_file ]
endforeach
endif
+ prepended_input_args = []
+ foreach input_arg : input_args
+ prepended_input_args += ['--in', input_arg]
+ endforeach
outfile = kernel_prefix + '.h'
grl_compiled_cl_kernels += custom_target(
outfile,
output : outfile,
command : [
prog_intel_clc, '-p', platform, '--prefix', kernel_prefix,
- '-e', entrypoint, input_args, '-o', '@OUTPUT@', '--',
+ '-e', entrypoint, prepended_input_args, '-o', '@OUTPUT@', '--',
'-cl-std=cl2.0', '-D__OPENCL_VERSION__=200',
'-DMAX_HW_SIMD_WIDTH=16', '-DMAX_WORKGROUP_SIZE=16',
'-I' + join_paths(meson.current_source_dir(), 'gpu'),
'-I' + join_paths(meson.current_source_dir(), 'include'),
- '-include' + 'opencl-c.h', # added to bypass build failure from clang15
+ '-include', 'opencl-c.h', # added to bypass build failure from clang15
# without modifying grl source code, remove
# if fixed there
],