Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

typedefs generation #229

Merged
merged 69 commits into from
Feb 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
69 commits
Select commit Hold shift + click to select a range
2ee3c03
codegen: read typedefs_dict.json file
gucio321 Sep 26, 2023
6f6f9ed
gengo: add IsCallbackTypedef and test for it
gucio321 Sep 26, 2023
5f02161
proceed typedefs
gucio321 Sep 27, 2023
b14e614
codegen: make it write down typedefs file
gucio321 Sep 27, 2023
4ea591c
codgen: implement CType; remove extra_types
gucio321 Sep 27, 2023
d9441ba
gngo: check if typedef should be skipped as struct
gucio321 Sep 27, 2023
bba94c2
add missing continue
gucio321 Sep 27, 2023
c0e4626
regenerate code
gucio321 Sep 27, 2023
9ea53a8
codegen: skip some types; update
gucio321 Sep 27, 2023
0f967f9
regenerate code
gucio321 Sep 27, 2023
e1fbece
gengo: don't duplicate types
gucio321 Sep 27, 2023
2e2e669
regenerate code
gucio321 Sep 27, 2023
894b086
gengo: check if type shouldn't be skipped
gucio321 Sep 27, 2023
506db5a
regenerate code
gucio321 Sep 27, 2023
c5e6e27
codegen: try to fix build errors
gucio321 Oct 4, 2023
f9452c8
codegen: fix newXFromC in typedefs
gucio321 Oct 4, 2023
cf73291
fix return type
gucio321 Oct 4, 2023
49920ec
codegen: fix name of newXFromC in opaque structs
gucio321 Oct 4, 2023
72fe85d
typedefs: skip pointer types
gucio321 Oct 4, 2023
830a7c0
add continue...
gucio321 Oct 4, 2023
4fcf112
codegen: check if type is poiner on ints go identifier (not c)
gucio321 Oct 4, 2023
7d2df8f
regenerate code
gucio321 Oct 8, 2023
ba1e520
fix receiver types
gucio321 Oct 8, 2023
6830344
Revert "fix receiver types"
gucio321 Oct 8, 2023
312b782
codegen: fix non-pointer types generation
gucio321 Oct 8, 2023
f810de5
codegen: fix
gucio321 Oct 8, 2023
cf393dd
codegen: change structs generation engine
gucio321 Nov 7, 2023
38f5d8e
codegen: fix generation of typedefs
gucio321 Nov 8, 2023
9b552ea
regenerate code
gucio321 Nov 8, 2023
c2f8090
codgene: fix generation of known typedefs of pointer type
gucio321 Nov 8, 2023
c2e29fe
regenerate code; update makefile
gucio321 Nov 8, 2023
c28be52
codegen: fix typedefs generation
gucio321 Nov 8, 2023
16acc34
regenerate code
gucio321 Nov 8, 2023
e0ff49b
fix bug in glfw_backend.go
gucio321 Nov 8, 2023
1336dc5
update texture.go
gucio321 Nov 8, 2023
fd3ee9f
hotfix in glfw_backend.go
gucio321 Nov 8, 2023
8f5169c
makefile: run goimport on typedefs.go
gucio321 Nov 8, 2023
396d976
codegen: add missing arg type for ImColor
gucio321 Nov 8, 2023
27ef9de
codegen: fix build crash
gucio321 Nov 9, 2023
b58dedb
regenerate code
gucio321 Nov 10, 2023
642fd5b
codegen: rename imNodes functions correctly
gucio321 Nov 14, 2023
66fbf4d
regenerate code
gucio321 Nov 14, 2023
a801fa8
change wrapper of void*
gucio321 Nov 30, 2023
26b2743
regenerate code
gucio321 Dec 20, 2023
c97b33e
fix build
gucio321 Nov 30, 2023
2de5e33
codegen: use export data to CData field
gucio321 Nov 30, 2023
9bc0016
regenerate code
gucio321 Nov 30, 2023
6feb3d0
fix test
gucio321 Dec 1, 2023
6a2c655
sdl: fix windows
gucio321 Dec 20, 2023
d668d35
texture: fix build error
gucio321 Dec 20, 2023
260c729
fix sdl args
gucio321 Dec 21, 2023
2a4ea03
codegen: change type of void* arguments to uintptr_t
gucio321 Jan 6, 2024
45709b4
codegen: add comments
gucio321 Feb 1, 2024
9da039d
Merge remote-tracking branch 'upstream/main' into callbacks
gucio321 Feb 14, 2024
57676e1
gencpp: fix bug when some wrappers were not generated
gucio321 Feb 14, 2024
2d88787
codegen: regenerate code
gucio321 Feb 14, 2024
53808fa
codegen: fix typedefs generation with new void* rules
gucio321 Feb 15, 2024
1c4d9f5
regenerate code
gucio321 Feb 15, 2024
c513fe7
codegen: convert return type to unintptr
gucio321 Feb 16, 2024
2fb2b55
suppress warning
gucio321 Feb 16, 2024
229ff31
regenerte code
gucio321 Feb 16, 2024
bc5a435
typedefs: generate functions with callback arguments correctly
gucio321 Feb 16, 2024
d43c3d9
regenerate code
gucio321 Feb 16, 2024
942ee40
codegen: generate functions with void* return type correctly (sometim…
gucio321 Feb 17, 2024
2fad3e7
codegen: fix header generation for void* return type
gucio321 Feb 17, 2024
7b9ba2a
regenerate code
gucio321 Feb 17, 2024
6f29f8d
codegen: replace NULL with 0
gucio321 Feb 17, 2024
87cdde1
Regenerate code
gucio321 Feb 17, 2024
76e8b9c
codegen: remove gengo_structs.go
gucio321 Feb 17, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 9 additions & 7 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -17,18 +17,20 @@ setup:
# $2: include path (of header file)
# $3: definitions.json filepath
# $4: structs_and_enums.json filepath
# $5: additional agruments to codegen call (e.g. -r option)
# $5: typedefs_dict.json filepath
# $6: additional agruments to codegen call (e.g. -r option)
define generate
@echo "Generating for $(1)"
./codegen -p $(1) -i $(2) -d $(3) -e $(4) $(5)
./codegen -p $(1) -i $(2) -d $(3) -e $(4) -t $(5) $(6)
go run mvdan.cc/gofumpt@latest -w $(1)_enums.go
go run mvdan.cc/gofumpt@latest -w $(1)_structs.go
go run mvdan.cc/gofumpt@latest -w $(1)_funcs.go
go run mvdan.cc/gofumpt@latest -w $(1)_typedefs.go
go run golang.org/x/tools/cmd/goimports@latest -w $(1)_funcs.go
go run golang.org/x/tools/cmd/goimports@latest -w $(1)_typedefs.go
endef

define cimgui
$(call generate,cimgui,cimgui/cimgui.h,cimgui/cimgui_templates/definitions.json,cimgui/cimgui_templates/structs_and_enums.json)
$(call generate,cimgui,cimgui/cimgui.h,cimgui/cimgui_templates/definitions.json,cimgui/cimgui_templates/structs_and_enums.json, cimgui/cimgui_templates/typedefs_dict.json)
endef

## cimgui: generate cimgui binding
Expand All @@ -37,7 +39,7 @@ cimgui: setup
$(call cimgui)

define cimplot
$(call generate,cimplot,cimgui/cimplot.h,cimgui/cimplot_templates/definitions.json,cimgui/cimplot_templates/structs_and_enums.json,-r cimgui/cimgui_templates/structs_and_enums.json)
$(call generate,cimplot,cimgui/cimplot.h,cimgui/cimplot_templates/definitions.json,cimgui/cimplot_templates/structs_and_enums.json,cimgui/cimplot_templates/typedefs_dict.json,-r cimgui/cimgui_templates/structs_and_enums.json -rt cimgui/cimgui_templates/typedefs_dict.json)
endef

## cimplot: generate implot binding
Expand All @@ -46,7 +48,7 @@ cimplot: setup
$(call cimplot)

define cimnodes
$(call generate,cimnodes,cimgui/cimnodes.h,cimgui/cimnodes_templates/definitions.json,cimgui/cimnodes_templates/structs_and_enums.json,-r cimgui/cimgui_templates/structs_and_enums.json)
$(call generate,cimnodes,cimgui/cimnodes.h,cimgui/cimnodes_templates/definitions.json,cimgui/cimnodes_templates/structs_and_enums.json,cimgui/cimnodes_templates/typedefs_dict.json,-r cimgui/cimgui_templates/structs_and_enums.json -rt cimgui/cimgui_templates/typedefs_dict.json)
endef

## cimnodes: generate imnodes binding
Expand All @@ -55,7 +57,7 @@ cimnodes: setup
$(call cimnodes)

define cimmarkdown
$(call generate,cimmarkdown,cimgui/cimmarkdown.h,cimgui/cimmarkdown_templates/definitions.json,cimgui/cimmarkdown_templates/structs_and_enums.json,-r cimgui/cimgui_templates/structs_and_enums.json)
$(call generate,cimmarkdown,cimgui/cimmarkdown.h,cimgui/cimmarkdown_templates/definitions.json,cimgui/cimmarkdown_templates/structs_and_enums.json,cimgui/cimmarkdown_templates/typedefs_dict.json,-r cimgui/cimgui_templates/structs_and_enums.json -rt cimgui/cimgui_templates/typedefs_dict.json)
endef

## cimmarkdown: generate immarkdown binding
Expand Down
2 changes: 1 addition & 1 deletion cimgui.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package imgui
// #cgo CPPFLAGS: -DCIMGUI_DEFINE_ENUMS_AND_STRUCTS
// #cgo CXXFLAGS: --std=c++11
// #cgo amd64,linux LDFLAGS: ${SRCDIR}/lib/linux/x64/cimgui.a
// #cgo linux CXXFLAGS: -Wno-changes-meaning -fpermissive
// #cgo linux CXXFLAGS: -Wno-changes-meaning -Wno-invalid-conversion -fpermissive
// #cgo amd64,windows LDFLAGS: -L${SRCDIR}/lib/windows/x64 -l:cimgui.a
// #cgo amd64,darwin LDFLAGS: ${SRCDIR}/lib/macos/x64/cimgui.a
// #cgo arm64,darwin LDFLAGS: ${SRCDIR}/lib/macos/arm64/cimgui.a
Expand Down
Loading
Loading