jc/thirdparty/remotery/generate.jai
2025-05-21 22:41:52 -06:00

41 lines
1.2 KiB
Text

#scope_file;
#run {
set_build_options_dc(.{ do_output = false });
print("building library\n");
#if OS == {
case .WINDOWS;
lib_ext :: "dll";
out_base :: "win";
case .MACOS;
lib_ext :: "dylib";
out_base :: "mac";
case .LINUX;
lib_ext :: "so";
out_base :: "linux";
}
out_path := tprint("%/%", out_base, "remotery");
assert(build_cpp(out_path, "lib/Remotery.c", type = .DYNAMIC_LIBRARY));
assert(build_cpp(out_path, "lib/Remotery.c", type = .STATIC_LIBRARY));
print("generating bindings\n");
opts: Generate_Bindings_Options;
opts.add_generator_command = false;
opts.generate_library_declarations = false;
array_add(*opts.strip_prefixes, "rmt_", "RMT_", "rmt", "RMT", "_rmt", "_RMT");
array_add(*opts.extra_clang_arguments, "-x", "c");
array_add(*opts.libpaths, out_base);
array_add(*opts.libnames, tprint("remotery.%", lib_ext));
array_add(*opts.source_files, "./lib/remotery.h");
assert(generate_bindings(opts, "remotery.jai"));
}
#import "File";
#import "Basic";
#import "String";
#import "Compiler";
#import "BuildCpp";
#import "Bindings_Generator";