Files
dimma/README.md
T

170 lines
4.0 KiB
Markdown

# 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](https://odin-lang.org/) (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:
```bash
cd odin
odin build main.odin -build-mode:exe -target:. -out:../build/dimma
```
**With raylib/raygui:**
```bash
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:
```bash
cd go
go build -o ../build/go-updater ./
```
For cross-compilation:
```bash
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):**
```bash
chmod +x scripts/*.sh
./scripts/build-all.sh
```
**Windows (PowerShell):**
```powershell
.\scripts\build-all.ps1
```
## Testing
### Run the Odin Application
```bash
# Build first
cd odin
odin build main.odin -build-mode:exe -out:../build/dimma
# Then run
./scripts/run.sh
```
### Test the Auto-Updater
```bash
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:
```bash
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:
```bash
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]