Compare commits
No commits in common. "c5f24004d511b63b2f8a4b02c7ce947ff83d00ce" and "4b416772fd1bf397b81fa003110e1e39460cc5ba" have entirely different histories.
c5f24004d5
...
4b416772fd
96
README.md
96
README.md
|
|
@ -1,96 +0,0 @@
|
||||||
# Easily add [SFML 3](https://github.com/SFML/SFML) and [Dear ImGui](https://github.com/ocornut/imgui) to your premake5 projects
|
|
||||||
<br> 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.
|
|
||||||
<br><br> I have included `example-project.txt` and `example-workspace.txt` as examples on how to use this project
|
|
||||||
|
|
||||||
## How to integrate into your projects
|
|
||||||
1. Add the repository as a submodule and update its submodules
|
|
||||||
<br> -(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
|
|
||||||
```
|
|
||||||
2. Add this to the top of the script that contains the workspace, replace 'path/to' with the directory that you cloned this repo to
|
|
||||||
```lua
|
|
||||||
local ogg = require("path/to/premake-scripts/build-ogg")
|
|
||||||
local imgui = require("path/to/premake-scripts/build-imgui")
|
|
||||||
local sfml = require("path/to/premake-scripts/sfml/build-sfml")
|
|
||||||
local flac = require("path/to/premake-scripts/flac/build-flac")
|
|
||||||
local vorbis = require("path/to/premake-scripts/vorbis/build-vorbis")
|
|
||||||
local freetype = require("path/to/premake-scripts/freetype/build-freetype")
|
|
||||||
local imguisfml = require("path/to/premake-scripts/imgui-sfml/build-imgui-sfml")
|
|
||||||
```
|
|
||||||
3. In the workspace, add these lines
|
|
||||||
```lua
|
|
||||||
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
|
|
||||||
```
|
|
||||||
4. In the workspace, add these lines to add each dependency as its own project
|
|
||||||
<br> `<target-directory>` - the directory where the static library will be placed
|
|
||||||
<br> `<obj-directory>` - the directory where object files will be placed
|
|
||||||
```lua
|
|
||||||
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>)
|
|
||||||
```
|
|
||||||
5. 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
|
|
||||||
```lua
|
|
||||||
local sfml = require("path/to/premake-scripts/build-sfml")
|
|
||||||
local imgui = require("path/to/premake-scripts/build-imgui")
|
|
||||||
local imguisfml = require("path/to/premake-scripts/build-imgui-sfml")
|
|
||||||
```
|
|
||||||
6. Inside of the projects that need sfml or imgui add these lines
|
|
||||||
```lua
|
|
||||||
-- 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
|
|
||||||
<br><br>
|
|
||||||
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
|
|
||||||
```
|
|
||||||
<br>
|
|
||||||
Credits:
|
|
||||||
|
|
||||||
* [SFML](https://github.com/SFML/SFML) (zlib/png license)
|
|
||||||
Copyright (C) Laurent Gomila
|
|
||||||
|
|
||||||
* [Dear ImGui](https://github.com/ocornut/imgui) (MIT License)
|
|
||||||
Copyright (c) 2014-2025 Omar Cornut
|
|
||||||
|
|
||||||
* [imgui-sfml](https://github.com/SFML/imgui-sfml/) (MIT License)
|
|
||||||
<br>Copyright (c) 2016 Elias Daler
|
|
||||||
<br>Copyright (c) 2014-2016 Omar Cornut and ImGui contributors
|
|
||||||
<br>Copyright (c) 2014 Mischa Aster Alff
|
|
||||||
|
|
||||||
* [FreeType](https://github.com/freetype/freetype) (The FreeType Project License)
|
|
||||||
Portions of this software are copyright © 2025 The FreeType Project (www.freetype.org). All rights reserved.
|
|
||||||
|
|
||||||
* [Ogg](https://github.com/xiph/ogg), [Vorbis](), [FLAC]() (BSD-3-Clause)
|
|
||||||
Copyright (c) Xiph.Org Foundation
|
|
||||||
|
|
@ -2,9 +2,9 @@ local m = {}
|
||||||
|
|
||||||
local scriptdir = path.getabsolute(path.getdirectory(_SCRIPT))
|
local scriptdir = path.getabsolute(path.getdirectory(_SCRIPT))
|
||||||
|
|
||||||
local sfml = require("path/to/premake-scripts/build-sfml")
|
local sfml = require("path/to/build-sfml")
|
||||||
local imguisfml = require("path/to/premake-scripts/build-imgui-sfml")
|
local imguisfml = require("path/to/build-imgui-sfml")
|
||||||
local imgui = require("path/to/premake-scripts/build-imgui")
|
local imgui = require("path/to/build-imgui")
|
||||||
|
|
||||||
function m.generateproject(bindir, intdir)
|
function m.generateproject(bindir, intdir)
|
||||||
project "example"
|
project "example"
|
||||||
|
|
|
||||||
|
|
@ -1,12 +1,12 @@
|
||||||
local ogg = require("path/to/premake-scripts/ogg/build-ogg")
|
local ogg = require("path/to/ogg/build-ogg")
|
||||||
local imgui = require("path/to/premake-scripts/build-imgui")
|
local sfml = require("path/to/sfml/build-sfml")
|
||||||
local sfml = require("path/to/premake-scripts/sfml/build-sfml")
|
local flac = require("path/to/flac/build-flac")
|
||||||
local flac = require("path/to/premake-scripts/flac/build-flac")
|
local imgui = require("path/to/build-imgui")
|
||||||
local vorbis = require("path/to/premake-scripts/vorbis/build-vorbis")
|
local vorbis = require("path/to/vorbis/build-vorbis")
|
||||||
local freetype = require("path/to/premake-scripts/freetype/build-freetype")
|
local freetype = require("path/to/freetype/build-freetype")
|
||||||
local imguisfml = require("path/to/premake-scripts/imgui-sfml/build-imgui-sfml")
|
local imguisfml = require("path/to/imgui-sfml/build-imgui-sfml")
|
||||||
|
|
||||||
local exampleproject = require("path/to/premake-scripts/project")
|
local exampleproject = require("path/to/project")
|
||||||
|
|
||||||
-- assuming you are using the modules I provided with premake
|
-- assuming you are using the modules I provided with premake
|
||||||
require ("ecc/ecc")
|
require ("ecc/ecc")
|
||||||
|
|
@ -26,7 +26,7 @@ workspace "Example"
|
||||||
pic"On" -- fix warning when statically linking <relocation against ... in read-only section .text>
|
pic"On" -- fix warning when statically linking <relocation against ... in read-only section .text>
|
||||||
filter""
|
filter""
|
||||||
|
|
||||||
externalwarnings "Off" --turn off build warnings created from sfml, imgui, and it's depedencies
|
externalwarnings "Off" --turn off build warnings created from sfml and it's depedencies
|
||||||
|
|
||||||
filter "configurations:debug"
|
filter "configurations:debug"
|
||||||
symbols "on"
|
symbols "on"
|
||||||
|
|
@ -50,7 +50,6 @@ workspace "Example"
|
||||||
ogg.generateproject(liboutdir, intdir)
|
ogg.generateproject(liboutdir, intdir)
|
||||||
sfml.generateproject(liboutdir, intdir)
|
sfml.generateproject(liboutdir, intdir)
|
||||||
flac.generateproject(liboutdir, intdir)
|
flac.generateproject(liboutdir, intdir)
|
||||||
imgui.generateproject(liboutdir, intdir)
|
|
||||||
vorbis.generateproject(liboutdir, intdir)
|
vorbis.generateproject(liboutdir, intdir)
|
||||||
freetype.generateproject(liboutdir, intdir)
|
freetype.generateproject(liboutdir, intdir)
|
||||||
imguisfml.generateproject(liboutdir, intdir)
|
imguisfml.generateproject(liboutdir, intdir)
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue