39 lines
1.6 KiB
Plaintext
39 lines
1.6 KiB
Plaintext
// Makes bindings.jai from include/onnxruntime_c_api.h: the OrtApi function table and every type it
|
|
// uses. No functions are bound to a library: module.jai loads onnxruntime at run time and finds its
|
|
// one export, OrtGetApiBase, so a program runs (without OCR) when onnxruntime is not there.
|
|
//
|
|
// jai generate.jai (after jai fetch.jai, which puts the header in include/)
|
|
|
|
#run,stallable {
|
|
set_build_options_dc(.{do_output = false});
|
|
if !generate() compiler_set_workspace_status(.FAILED);
|
|
}
|
|
|
|
generate :: () -> bool {
|
|
here := trim_right(path_strip_filename(#file), "/\\");
|
|
set_working_directory(here);
|
|
|
|
options: Generate_Bindings_Options;
|
|
{
|
|
using options;
|
|
array_add(*source_files, "include/onnxruntime_c_api.h");
|
|
array_add(*include_paths, "include");
|
|
array_add(*extra_clang_arguments, "-x", "c");
|
|
generate_library_declarations = false; // nothing is linked; see module.jai
|
|
// No libraries are named, so the default SYMBOLS_WITH_UNKNOWN_FOREIGN_LIBS strip drops OrtGetApiBase
|
|
// and the other exports: module.jai finds OrtGetApiBase at run time.
|
|
// The table and its types are all prefixed Ort; keep the names as the C API documents them.
|
|
strip_enum_prefixes = false;
|
|
auto_detect_enum_prefixes = false;
|
|
// Every declaration in onnxruntime's own headers; the system ones they include are skipped.
|
|
array_add(*path_fragments_to_treat_as_non_system_paths, "onnxruntime");
|
|
}
|
|
return generate_bindings(options, "bindings.jai");
|
|
}
|
|
|
|
#import "Basic";
|
|
#import "Compiler";
|
|
#import "File";
|
|
#import "String";
|
|
#import "Bindings_Generator";
|