Overview
Talon provides thetalon init-exe command to set up a cross-platform build environment for creating native executables. This generates Docker configuration files that handle the build process for Linux and Windows targets using the Zig build system.
Prerequisites
- Docker Engine 20.10 or later
- Docker Compose 2.0 or later
- Your Talon project with a main Wren script
Initializing Executable Build
Run the init-exe command
Navigate to your project directory and run:Replace
main.wren with the path to your main Wren script file.Generated Docker Configuration
Dockerfile
The generated Dockerfile uses Alpine Linux and downloads the Zig compiler to build your executable:The project name is automatically detected from your directory name. The
{{{ PROJECT_NAME }}} and {{{ MAIN_FILE }}} placeholders are replaced with your actual values.docker-compose.yml
The Docker Compose file simplifies the build process:Building Your Executable
Build for Windows
The default configuration builds a Windows executable:This creates a
dist/ directory with your Windows .exe file.Build for Linux (optional)
To build for Linux instead, modify the command in Or build directly with Docker:
docker-compose.yml:Build Process Details
Asset Embedding
The build system automatically embeds all.wren files from your project directory:
All Wren script files in your project are embedded into the final executable, making it fully self-contained.
Dependencies
The build automatically includes:- Wren - The Wren scripting language runtime
- Raylib - Graphics and game development library
- Talon - The Talon framework core
Executable Entry Point
The generatedbuild.zig creates a custom entry point:
Supported Targets
| Target | Architecture | Status |
|---|---|---|
| Windows | x86_64 | Full support |
| Linux | x86_64 | Full support |
| macOS | x86_64, arm64 | Requires native build |
Output Structure
After building, your project structure will look like:Troubleshooting
Build fails with “Failed to fetch dependencies”
Ensure your Docker container has internet access to download Zig packages from GitHub.
Wrong architecture built
Verify the-Dtarget flag in your docker-compose.yml matches your intended platform:
- Windows:
-Dtarget=x86_64-windows - Linux:
-Dtarget=x86_64-linux
Large executable size
Use release optimization to reduce size:Next Steps
- Learn about Building for WebAssembly
- Understand the Docker Setup in detail
- Deploy your executable to production environments