Created
March 10, 2020 09:04
-
-
Save jonathanBieler/a68adf591027b32c91c10c3de88a0673 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using Clang | |
import Clang, Clang.cindex | |
#include("gtk_get_set_gen.jl") | |
extension(f::String) = splitext(f)[2] | |
filename(f::String) = splitext(f)[1] | |
include_path = "/Users/bieler/Downloads/SDL2-2.0.5/include/" | |
include_path = "/Users/bieler/Desktop/tmp/SDL2-2.0.8/include" | |
#headers = readdir(include_path) | |
#headers = filter(f->extension(f)==".h",headers) | |
cd("/Users/bieler/.julia/v0.6/SDL/gen") | |
mkpath("out") | |
## | |
header = "SDL_ttf.h" | |
header = "SDL_image.h" | |
context = wrap_c.init(; | |
output_file = joinpath("out", string(filename(header),".jl")), | |
header_library = x -> filename(header), | |
common_file = joinpath("out", string(filename(header),"_h.jl")), | |
clang_diagnostics=true | |
) | |
context.options.wrap_structs = true | |
wrap_c.wrap_c_headers(context, [joinpath(include_path,header)] ) | |
## | |
#for header in headers | |
# | |
# warn(header) | |
# | |
# context = wrap_c.init(; | |
# output_file = joinpath("out", string(filename(header),".jl")), | |
# header_library = x -> filename(header), | |
# common_file = joinpath("out", string(filename(header),"_h.jl")), | |
# clang_diagnostics=true | |
# ) | |
# context.options.wrap_structs = true | |
# wrap_c.wrap_c_headers(context, [joinpath(include_path,header)] ) | |
# | |
#end | |
## | |
using Clang.wrap_c | |
context = wrap_c.init(; output_file="test.jl", header_library=x->"SDL", common_file="SDL_h.jl", clang_diagnostics=true) | |
context.options.wrap_structs = true | |
wrap_c.wrap_c_headers(context, [header]) | |
## | |
args = [] | |
sdl_h = cindex.parse_header(header, diagnostics=true) | |
body = Expr(:block) | |
count_fcns = gen_get_set(body, sdl_h) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment