This is a simple Odin project template with SDL2.
If you don't have Odin setup, then check Odin Setup section.
If you want to setup Odin Language Server (OLS), then check OLS Setup section.
If you want SDL3 instead, check Odin SDL3 Template
-
On Windows you need to copy SDL2 library binaries from Odin vendor directory into place where your executable is located, in this template that will be
build/output -
Alternatively you can download SDL2 library binaries from Odin repo into
build/outputby running:.\build.bat get-sdl -
If you want to build SDL2 library binaries yourself, then run build script
.\build.bat build-sdl
-
Install SDL2 through apt
sudo apt update sudo apt install libsdl2-dev -
If you want to build SDL2 library binaries yourself, then
-
Install dependencies
sudo apt update sudo apt install build-essential cmake git gnome-desktop-testing libasound2-dev libaudio-dev libdbus-1-dev libdecor-0-dev libdrm-dev libegl1-mesa-dev libgbm-dev libgl1-mesa-dev libgles2-mesa-dev libibus-1.0-dev libjack-dev libpipewire-0.3-dev libpulse-dev libsndio-dev libudev-dev liburing-dev libwayland-dev libx11-dev libxcursor-dev libxext-dev libxfixes-dev libxi-dev libxkbcommon-dev libxrandr-dev libxss-dev libxtst-dev make ninja-build pkg-config -
Run build script
./build.sh build-sdl
-
# Build executable
./build.bat build
# Build executable in debug mode
./build.bat build-debug
# Build executable and run
./build.bat run
# Build executable and run in debug mode
./build.bat run-debug
Same as Windows, but using build.sh script
For more information check official installation guide
-
Download and install Visual Studio (Desktop development with C++)
-
Clone Odin repository and run build script
git clone https://github.com/odin-lang/Odin.git odin cd odin .\build.bat release # Delete build.bat if you are adding Odin to path del build.bat -
Add Odin directory to path in Environment Variables
-
Install clang
sudo apt install clang -
Clone Odin repository and run build script
git clone https://github.com/odin-lang/Odin.git odin cd odin ./build_odin.sh release -
Add Odin directory to path in
.bashrcecho 'export PATH="$PATH:<PATH_TO_ODIN>"' >> ~/.bashrc # If you have Odin in home directory echo 'export PATH="$PATH:$HOME/odin"' >> ~/.bashrc
OLS is Odin Language Server, for more information check OLS repository
-
Clone OLS repository and run build script
git clone https://github.com/DanielGavin/ols.git cd ols .\build.bat -
Add OLS directory to path in Environment Variables
-
Clone OLS repository and run build script
git clone https://github.com/DanielGavin/ols.git cd ols ./build.sh -
Add OLS directory to path in
.bashrcecho 'export PATH="$PATH:<PATH_TO_OLS>"' >> ~/.bashrc # If you have OLS in home directory echo 'export PATH="$PATH:$HOME/ols"' >> ~/.bashrc
-
Install OLS extension
-
If you have OLS added to path, then set
ols.server.pathtools -
If you don't have OLS added to path, then set
ols.server.pathto actual path of OLS executable -
Set
ODIN_ROOTenvironment variable to path of Odin directory# On Windows Add Odin directory to path in **Environment Variables** # On Linux, if you have OLS in home directory echo 'export ODIN_ROOT="$HOME/odin"' >> ~/.bashrc -
Optionally you can create
ols.jsonfile in project folder to configure OLS, check schema for more info{ "$schema": "https://raw.githubusercontent.com/DanielGavin/ols/master/misc/ols.schema.json", "enable_semantic_tokens": false, "enable_document_symbols": true, "enable_hover": true, "enable_snippets": true, "profile": "default", "profiles": [ { "name": "default", "checker_path": ["source"] }, ] }
-
First you need to have Package Control installed
-
To install, open console by clicking
View > Show Consolein menu bar and run this command:from urllib.request import urlretrieve;urlretrieve(url="https://github.com/wbond/package_control/releases/latest/download/Package.Control.sublime-package", filename=sublime.installed_packages_path() + '/Package Control.sublime-package') -
Open Command Palette and search for
Install Package, then install these packages:OdinandLSP -
To configure OLS, open LSP settings by clicking
Preferences > Package Settings > LSP > Settings -
Paste this into settings
-
This assumes you have OLS executable in path, otherwise set full path yourself in
commandarray -
This has OLS enabled for all projects, set
enabledtofalseif you don't want that{ "clients": { "odin": { "command": [ "ols" ], "enabled": true, "selector": "source.odin", "initializationOptions": { "enable_semantic_tokens": true, "enable_document_symbols": true, "enable_hover": true, "enable_snippets": true, "enable_format": true, } } } }
-
-
To enable OLS for specific projects, you need to have
.sublime-projectfile in your folder -
Open Command Palette and search for
LSP Enable in Project, then selectodin
For debugging you can use RAD Debugger
- Build odin in debug mode and then attach executable to RAD Debugger
- After that you can put breakpoints and run it