Files
dimma/README.md
T

4.0 KiB

Dimma

A cross-platform desktop application built with Odin (raylib + raygui) and Go (auto-updater).

Project Structure

dimma/
├── odin/              # Odin source code (GUI application)
│   ├── main.odin      # Main application entry point
│   ├── raylib.odin    # raylib C interop bindings
│   ├── raygui.odin    # raygui C interop bindings
│   ├── build.odin     # Odin build script
│   └── odin.json      # Odin project configuration
├── go/                # Go source code (auto-updater)
│   ├── main.go        # Auto-updater CLI
│   ├── go.mod         # Go module definition
│   ├── build.sh       # Unix build script
│   └── build.ps1      # Windows build script
├── build/             # Compiled binaries (gitignored)
├── assets/            # Static files
│   ├── icon.png       # Application icon
│   └── version.txt    # Current version file
├── scripts/           # Build/utility scripts
│   ├── build-all.sh   # Build all platforms (Unix)
│   ├── build-all.ps1  # Build all platforms (Windows)
│   ├── run.sh         # Run script (Unix)
│   └── run.ps1        # Run script (Windows)
├── .gitignore
└── README.md

Prerequisites

Odin

  • Odin compiler (latest stable, e.g., odin dev-2024-11)
  • raylib and raygui installed system-wide or via submodules
  • C compiler (gcc/clang) for raylib compilation

Go

  • Go 1.21+

Dependencies

  • raylib (for Odin GUI)
  • raygui (for Odin GUI)

Build Instructions

Odin (GUI Application)

Navigate to the odin/ directory and build:

cd odin
odin build main.odin -build-mode:exe -target:. -out:../build/dimma

With raylib/raygui:

odin build main.odin \
    -build-mode:exe \
    -target:. \
    -out:../build/dimma \
    -raylib:include-path:/path/to/raylib/include \
    -raylib:lib-path:/path/to/raylib/lib \
    -raylib:static

Go (Auto-Updater)

Navigate to the go/ directory and build:

cd go
go build -o ../build/go-updater ./

For cross-compilation:

GOOS=linux GOARCH=amd64 go build -o ../build/go-updater-linux-amd64 ./
GOOS=windows GOARCH=amd64 go build -o ../build/go-updater-windows-amd64.exe ./
GOOS=darwin GOARCH=amd64 go build -o ../build/go-updater-darwin-amd64 ./

Cross-Platform Build

Use the scripts in scripts/ directory:

Unix (Linux/macOS):

chmod +x scripts/*.sh
./scripts/build-all.sh

Windows (PowerShell):

.\scripts\build-all.ps1

Testing

Run the Odin Application

# Build first
cd odin
odin build main.odin -build-mode:exe -out:../build/dimma

# Then run
./scripts/run.sh

Test the Auto-Updater

cd go
go run main.go --check

This will:

  1. Fetch the latest version from https://gitea.sanplex.xyz/Sansan/dimma/releases/latest
  2. Compare it to the hardcoded version v0.1.0
  3. Print "Update available: {version}" or "Up to date"

Cross-Compilation Notes

Odin

Set the target OS and architecture using Odin's -target flag:

odin build main.odin -target:linux_amd64 -build-mode:exe
odin build main.odin -target:windows_amd64 -build-mode:exe
odin build main.odin -target:macos_amd64 -build-mode:exe

Go

Use environment variables:

GOOS=linux GOARCH=amd64 go build ./
GOOS=windows GOARCH=amd64 go build ./
GOOS=darwin GOARCH=amd64 go build ./

Version Management

The current version is defined in:

  • assets/version.txt - Plain text version file
  • odin/main.odin - CURRENT_VERSION constant
  • go/main.go - CurrentVersion constant

Update all three files when releasing a new version.

Future Auto-Updater Implementation

The auto-updater will eventually:

  1. Download the new binary from Gitea release assets
  2. Replace the old binary (with appropriate permissions)
  3. Restart the application

The Odin app will spawn the updater process and exit, allowing the updater to replace the binary safely.

License

[License information to be added]