#scope_file;

#run {
   set_build_options_dc(.{ do_output = false });

   #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";
   }

   print("generating bindings\n");

   opts: Generate_Bindings_Options;
   opts.add_generator_command         = false;
   opts.generate_library_declarations = false;

   array_add(*opts.strip_prefixes, "LUA_", "lua_", "lua");
   array_add(*opts.extra_clang_arguments, "-x", "c");
   array_add(*opts.libpaths, out_base);
   array_add(*opts.libnames, tprint("luajit-5.1.%", lib_ext));
   array_add(*opts.source_files,
      "./lib/lua.h",
      "./lib/luaconf.h",
      "./lib/luajit.h",
      "./lib/lualib.h",
      "./lib/lauxlib.h",
   );

   assert(generate_bindings(opts, "luajit.jai"));
}

#import "File";
#import "Basic";
#import "String";
#import "Compiler";
#import "BuildCpp";
#import "Bindings_Generator";
