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

Split module to separated packages #319

Merged
merged 49 commits into from
Sep 24, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
49 commits
Select commit Hold shift + click to select a range
aeb1be7
codegen: add extra flags to specify ref package
gucio321 Sep 19, 2024
e6ea536
makefile: split code to separated packages
gucio321 Sep 19, 2024
8746b12
remove autogenerated code
gucio321 Sep 19, 2024
dcaaa0e
regenerate code
gucio321 Sep 19, 2024
51754b4
codegen: update go package header
gucio321 Sep 19, 2024
aabf849
regenerate code
gucio321 Sep 19, 2024
558b0ca
makefile: autocopy cflags.go
gucio321 Sep 19, 2024
1e21432
remove leftover files
gucio321 Sep 19, 2024
949addb
codegen: fix C include paths
gucio321 Sep 19, 2024
e20ab5b
regenerate code
gucio321 Sep 19, 2024
83812d0
templates: update cflags.go paths
gucio321 Sep 19, 2024
8a2117a
regenerate code
gucio321 Sep 19, 2024
745386c
move extra types to appropiate packages
gucio321 Sep 19, 2024
1468e33
backend: update import paths
gucio321 Sep 19, 2024
12b04a4
remove imgui cimplot include
gucio321 Sep 19, 2024
7387246
makefie: split everything into separated packages
gucio321 Sep 19, 2024
d06fb8c
regenerate code
gucio321 Sep 19, 2024
51fe61d
make imgui and backend compile correctly
gucio321 Sep 19, 2024
87890e5
implot: update extra types paths
gucio321 Sep 19, 2024
8fafdde
codegen: add special function for prefixing go type names
gucio321 Sep 19, 2024
1623878
correct package header
gucio321 Sep 19, 2024
c5c9cb8
codegen: prefix type with package name in arg wrapper
gucio321 Sep 19, 2024
764cc34
regenerate code
gucio321 Sep 19, 2024
8190aa5
examples: update code
gucio321 Sep 19, 2024
09b8700
codegen: add package name prefix to arg wrapper types
gucio321 Sep 19, 2024
a2efda7
regenerate code
gucio321 Sep 19, 2024
e0f71db
codegen: correct arguments_wrapper"
gucio321 Sep 19, 2024
205dfd1
regenerate code
gucio321 Sep 19, 2024
3394bc0
codegen: work on return wrapper to add package correctly"
gucio321 Sep 19, 2024
69650e4
regenerate code
gucio321 Sep 19, 2024
36a7fbc
move internal/datautils -> datautils
gucio321 Sep 20, 2024
636583e
update data paths
gucio321 Sep 20, 2024
09ec92d
codegen: use datautils version of Vector
gucio321 Sep 20, 2024
8014eb9
regenerate code'
gucio321 Sep 20, 2024
313d03b
regenerate code
gucio321 Sep 20, 2024
5635b6a
fixes in datautils
gucio321 Sep 20, 2024
1d0af14
codegen: add package to return types
gucio321 Sep 20, 2024
86a13e0
regenerate code
gucio321 Sep 20, 2024
b4e0a0b
export WrappableType and other methods
gucio321 Sep 20, 2024
d18025a
codegen: update stuff
gucio321 Sep 20, 2024
5faec69
update cdoe and deps
gucio321 Sep 20, 2024
8803657
codegen: add final fixes
gucio321 Sep 20, 2024
9213df9
regenerate code
gucio321 Sep 20, 2024
478291f
backend: update sdlbackend
gucio321 Sep 20, 2024
ed65424
ebitenbackend: fix import paths
gucio321 Sep 20, 2024
39d98ca
change way WrappableType works
gucio321 Sep 21, 2024
fe36716
regenerate code
gucio321 Sep 21, 2024
07b9002
examples/ebiten: fix code
gucio321 Sep 21, 2024
4dbb506
remove imcolor
gucio321 Sep 21, 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
36 changes: 20 additions & 16 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -14,24 +14,28 @@ setup:

# Parameters:
# $1: prefix
# $2: include path (of header file)
# $3: definitions.json filepath
# $4: structs_and_enums.json filepath
# $5: typedefs_dict.json filepath
# $6: additional agruments to codegen call (e.g. -r option)
# $2: go package name
# $3: include path (of header file)
# $4: definitions.json filepath
# $5: structs_and_enums.json filepath
# $6: typedefs_dict.json filepath
# $7: additional agruments to codegen call (e.g. -r option)
define generate
@echo "Generating for $(1)"
./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)_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
go run golang.org/x/tools/cmd/goimports@latest -w $(1)_enums.go
mkdir -p $(2)
cat templates/cflags.go |sed -e "s/^package.*/package $(2)/g" > $(2)/cflags.go
cd $(2); \
../codegen -p $(1) -pkg $(2) -i ../$(3) -d ../$(4) -e ../$(5) -t ../$(6) $(7)
go run mvdan.cc/gofumpt@latest -w $(2)/$(1)_enums.go
go run mvdan.cc/gofumpt@latest -w $(2)/$(1)_funcs.go
go run mvdan.cc/gofumpt@latest -w $(2)/$(1)_typedefs.go
go run golang.org/x/tools/cmd/goimports@latest -w $(2)/$(1)_funcs.go
go run golang.org/x/tools/cmd/goimports@latest -w $(2)/$(1)_typedefs.go
go run golang.org/x/tools/cmd/goimports@latest -w $(2)/$(1)_enums.go
endef

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

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

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

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

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

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

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

## cimmarkdown: generate immarkdown binding
Expand Down
8 changes: 4 additions & 4 deletions backend/backend.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@ package backend
// extern void dropCallback(void*, int, char**);
// extern void keyCallback(void*, int, int, int, int);
// extern void sizeCallback(void*, int, int);
// #include "../extra_types.h"
// #include "../cimgui_wrapper.h"
// #include "../cimgui_typedefs.h"
// #include "../imgui/extra_types.h"
// #include "../imgui/cimgui_wrapper.h"
// #include "../imgui/cimgui_typedefs.h"
import "C"

import (
Expand All @@ -19,7 +19,7 @@ import (
"image"
"unsafe"

imgui "github.com/AllenDang/cimgui-go"
"github.com/AllenDang/cimgui-go/imgui"
)

type voidCallbackFunc func()
Expand Down
2 changes: 1 addition & 1 deletion backend/ebiten-backend/cimgui_backend_impl.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ import (
"image"
"unsafe"

imgui "github.com/AllenDang/cimgui-go"
"github.com/AllenDang/cimgui-go/backend"
"github.com/AllenDang/cimgui-go/imgui"
"github.com/hajimehoshi/ebiten/v2"
)

Expand Down
2 changes: 1 addition & 1 deletion backend/ebiten-backend/ebiten_api.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import (
"runtime"
"slices"

imgui "github.com/AllenDang/cimgui-go"
"github.com/AllenDang/cimgui-go/imgui"
"github.com/hajimehoshi/ebiten/v2"
"github.com/hajimehoshi/ebiten/v2/ebitenutil"
"github.com/hajimehoshi/ebiten/v2/inpututil"
Expand Down
2 changes: 1 addition & 1 deletion backend/ebiten-backend/ebiten_backend.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ package ebitenbackend
import (
"runtime"

imgui "github.com/AllenDang/cimgui-go"
"github.com/AllenDang/cimgui-go/backend"
"github.com/AllenDang/cimgui-go/imgui"
"github.com/hajimehoshi/ebiten/v2"
)

Expand Down
27 changes: 0 additions & 27 deletions backend/ebiten-backend/imcolor/convert.go

This file was deleted.

2 changes: 1 addition & 1 deletion backend/ebiten-backend/keymap.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package ebitenbackend

import (
imgui "github.com/AllenDang/cimgui-go"
"github.com/AllenDang/cimgui-go/imgui"
"github.com/hajimehoshi/ebiten/v2"
"github.com/hajimehoshi/ebiten/v2/inpututil"
)
Expand Down
2 changes: 1 addition & 1 deletion backend/ebiten-backend/render.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ import (
"image"
"unsafe"

imgui "github.com/AllenDang/cimgui-go"
"github.com/AllenDang/cimgui-go/backend/ebiten-backend/internal/native"
"github.com/AllenDang/cimgui-go/imgui"
"github.com/hajimehoshi/ebiten/v2"
)

Expand Down
2 changes: 1 addition & 1 deletion backend/ebiten-backend/txcache.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package ebitenbackend

import (
imgui "github.com/AllenDang/cimgui-go"
"github.com/AllenDang/cimgui-go/imgui"
"github.com/hajimehoshi/ebiten/v2"
)

Expand Down
4 changes: 2 additions & 2 deletions backend/glfwbackend/glfw_backend.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@ import (
"image/draw"
"unsafe"

imgui "github.com/AllenDang/cimgui-go"
"github.com/AllenDang/cimgui-go/backend"
"github.com/AllenDang/cimgui-go/internal/datautils"
"github.com/AllenDang/cimgui-go/datautils"
"github.com/AllenDang/cimgui-go/imgui"
)

type voidCallbackFunc func()
Expand Down
4 changes: 2 additions & 2 deletions backend/glfwbackend/glfw_backend.h
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
#pragma once

#include "../../cimgui_wrapper.h"
#include "../../imgui/cimgui_wrapper.h"
#include "../../thirdparty/glfw/include/GLFW/glfw3.h" // Will drag system OpenGL headers
#include "../../extra_types.h"
#include "../../imgui/extra_types.h"

#ifdef __cplusplus
extern "C" {
Expand Down
4 changes: 2 additions & 2 deletions backend/sdlbackend/sdl_backend.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@ import (
"image/draw"
"unsafe"

imgui "github.com/AllenDang/cimgui-go"
"github.com/AllenDang/cimgui-go/backend"
"github.com/AllenDang/cimgui-go/internal/datautils"
"github.com/AllenDang/cimgui-go/datautils"
"github.com/AllenDang/cimgui-go/imgui"
)

type voidCallbackFunc func()
Expand Down
4 changes: 2 additions & 2 deletions backend/sdlbackend/sdl_backend.h
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
#pragma once

#include "../../cimgui_wrapper.h"
#include "../../imgui/cimgui_wrapper.h"
#include "../../thirdparty/SDL/include/SDL.h" // Will drag system OpenGL headers
#include "../../extra_types.h"
#include "../../imgui/extra_types.h"

#ifdef __cplusplus
extern "C" {
Expand Down
2 changes: 1 addition & 1 deletion backend/texture.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import (
"path/filepath"
"runtime"

imgui "github.com/AllenDang/cimgui-go"
"github.com/AllenDang/cimgui-go/imgui"
)

type Texture struct {
Expand Down
10 changes: 0 additions & 10 deletions cimgui.go

This file was deleted.

23 changes: 0 additions & 23 deletions cimgui_test.go

This file was deleted.

Loading
Loading