|
|
||
|---|---|---|
| SFML@0fa201c969 | ||
| flac@28e4f0528c | ||
| freetype@920c5502cc | ||
| imgui@97428e8ac9 | ||
| imgui-sfml@5e8f8fb857 | ||
| ogg@e1774cd77f | ||
| premake5 | ||
| vorbis@0657aee69d | ||
| .gitignore | ||
| .gitmodules | ||
| LICENSE | ||
| README.md | ||
| build-flac.lua | ||
| build-freetype.lua | ||
| build-imgui-sfml.lua | ||
| build-imgui.lua | ||
| build-ogg.lua | ||
| build-sfml.lua | ||
| build-vorbis.lua | ||
| example-project.txt | ||
| example-workspace.txt | ||
README.md
Easily add SFML 3 and Dear ImGui to your premake5 projects
This repo contains the repositories for SFML, Dear ImGui, sfml-imgui, flac, vorbis, ogg, and freetype along with premake build scripts.
This allows your project to build these libraries from source and statically link them to your executible.
this makes developing on linux easier as most distros don't have SFML 3 in their package managers.
I have included example-project.txt and example-workspace.txt as examples on how to use this project
How to integrate into your projects
- Add the repository as a submodule and update its submodules
-(optional) replace<directory-path>with the path to the directory you want the repo to be cloned to, leaving this out will place this repo into./imgui-sfml-premake
git submodule add https://gitlab.com/JosephA1997/imgui-sfml-premake.git <directory-path><br>
git submodule update --init --recursive
- Add this to the top of the script that contains the workspace, replace 'path/to' with the directory that you cloned this repo to
local ogg = require("path/to/ogg/build-ogg")
local imgui = require("path/to/build-imgui")
local sfml = require("path/to/sfml/build-sfml")
local flac = require("path/to/flac/build-flac")
local vorbis = require("path/to/vorbis/build-vorbis")
local freetype = require("path/to/freetype/build-freetype")
local imguisfml = require("path/to/imgui-sfml/build-imgui-sfml")
- In the workspace, add these lines
filter"system:linux"
pic"On" -- fix warning when statically linking <relocation against ... in read-only section .text>
filter""
externalwarnings "Off" --turn off build warnings created from sfml, imgui, and it's depedencies
- In the workspace, add these lines to add each dependency as its own project
<target-directory>- the directory where the static library will be placed
<obj-directory>- the directory where object files will be placed
ogg.generateproject(<target-directory>, <obj-directory>)
sfml.generateproject(<target-directory>, <obj-directory>)
flac.generateproject(<target-directory>, <obj-directory>)
imgui.generateproject(<target-directory>, <obj-directory>)
vorbis.generateproject(<target-directory>, <obj-directory>)
freetype.generateproject(<target-directory>, <obj-directory>)
imguisfml.generateproject(<target-directory>, <obj-directory>)
- At the top of each lua file containing a project that needs imgui or sfml, add these lines, replace 'path/to' with the directory that you cloned this repo to. if the project is in the same file as the workspace you can skip this
local sfml = require("path/to/build-sfml")
local imgui = require("path/to/build-imgui")
local imguisfml = require("path/to/build-imgui-sfml")
- Inside of the projects that need sfml or imgui add these lines
-- link order matters on GCC/Clang
imgui.link()
imguisfml.link()
sfml.link()
Bundled Premake Info
I have included premake5 executibles for windows and linux in the premake5 directory. Inside you'll also find modules that add support for the ninja build system and to generate a compile_commands.json file for things like clangd
To use premake on windows
.\path\to\premake5\premake5.exe
And on linux
./path/to/premake5/premake5
To generate ninja build files, use the premake-ninja action
premake5 premake-ninja
To generate compile_commands.json, use the ecc action
premake5 ecc
Credits:
-
SFML (zlib/png license) Copyright (C) Laurent Gomila
-
Dear ImGui (MIT License) Copyright (c) 2014-2025 Omar Cornut
-
imgui-sfml (MIT License)
Copyright (c) 2016 Elias Daler
Copyright (c) 2014-2016 Omar Cornut and ImGui contributors
Copyright (c) 2014 Mischa Aster Alff -
FreeType (The FreeType Project License) Portions of this software are copyright © 2025 The FreeType Project (www.freetype.org). All rights reserved.
-
Ogg, Vorbis, FLAC (BSD-3-Clause) Copyright (c) Xiph.Org Foundation