1*ec672a92SWill Paznerusing Clang.Generators 2*ec672a92SWill Pazner 3*ec672a92SWill Paznerfunction generate_ceed_bindings(ceed_path) 4*ec672a92SWill Pazner # libCEED include dir and header files 5*ec672a92SWill Pazner include_dir = joinpath(ceed_path, "include") |> normpath 6*ec672a92SWill Pazner header_files = ["ceed/ceed.h", "ceed/cuda.h", "ceed/backend.h"] 7*ec672a92SWill Pazner headers = [joinpath(include_dir, header) for header in header_files] 8*ec672a92SWill Pazner 9*ec672a92SWill Pazner # load options from generator TOML file 10*ec672a92SWill Pazner options = load_options(joinpath(@__DIR__, "generator.toml")) 11*ec672a92SWill Pazner 12*ec672a92SWill Pazner # add compiler flags 13*ec672a92SWill Pazner args = get_default_args() 14*ec672a92SWill Pazner push!(args, "-I$include_dir") 15*ec672a92SWill Pazner 16*ec672a92SWill Pazner # create context 17*ec672a92SWill Pazner ctx = create_context(headers, args, options) 18*ec672a92SWill Pazner 19*ec672a92SWill Pazner # run generator 20*ec672a92SWill Pazner build!(ctx) 21*ec672a92SWill Pazner 22*ec672a92SWill Pazner # remove trailing newline from output file 23*ec672a92SWill Pazner outfile = options["general"]["output_file_path"] 24*ec672a92SWill Pazner write(outfile, readchomp(outfile)) 25*ec672a92SWill Pazner return 26*ec672a92SWill Paznerend 27