Skip to content

Commit

Permalink
Merge pull request #229 from gucio321/callbacks
Browse files Browse the repository at this point in the history
typedefs generation
  • Loading branch information
gucio321 authored Feb 17, 2024
2 parents 0ab2654 + 76e8b9c commit 20e032b
Show file tree
Hide file tree
Showing 43 changed files with 5,678 additions and 8,179 deletions.
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

0 comments on commit 20e032b

Please sign in to comment.