mirror of
https://github.com/ocornut/imgui.git
synced 2026-11-07 23:15:52 +01:00
bindings/go/: - imgui_bridge.h/.cpp: Thin C API bridge (extern C) wrapping C++ ImGui - imgui.go: Go cgo package (CreateContext, NewFrame, Begin, Button, SliderFloat, SliderInt, Checkbox, ColorEdit3, Text, Combo, etc.) - go.mod: Module definition - README.md: Full docs with usage, building, and API reference examples/example_golang/: - main.go: Null-mode example showing ImGui from Go - go.mod: Module with replace directive for local bindings - Makefile: Build/run/clean targets Go 1.26.5 verified working on this host. CGO_ENABLED=1 required (plus a C++ compiler like g++ for the bridge compilation).
39 lines
716 B
Makefile
39 lines
716 B
Makefile
# Makefile for the Go ImGui example
|
|
# Requirements: g++ (or clang++), Go 1.21+, CGO_ENABLED=1
|
|
#
|
|
# Usage:
|
|
# make build - Compile the Go example
|
|
# make run - Build and run
|
|
# make clean - Remove build artifacts
|
|
#
|
|
# Copyright (c) 2024 OwlLogics / imgui_xl
|
|
# Licensed under MIT
|
|
|
|
GO = go
|
|
CXX = g++
|
|
IMGUI_DIR = ../..
|
|
BRIDGE_DIR = $(IMGUI_DIR)/bindings/go
|
|
|
|
CGO_ENABLED = 1
|
|
GOFLAGS = -trimpath
|
|
OUTPUT = imgui_go_example
|
|
|
|
.PHONY: all build run clean vet fmt
|
|
|
|
all: build
|
|
|
|
build:
|
|
CGO_ENABLED=$(CGO_ENABLED) $(GO) build -o $(OUTPUT) . 2>&1 || echo "Build requires a C++ compiler (g++ or clang++) on PATH"
|
|
|
|
run: build
|
|
./$(OUTPUT)
|
|
|
|
vet:
|
|
$(GO) vet ./...
|
|
|
|
fmt:
|
|
$(GO) fmt ./...
|
|
|
|
clean:
|
|
rm -f $(OUTPUT) *.o *.exe
|