From ccf086c39f734a000aa3a2fac034f0620021fbdf Mon Sep 17 00:00:00 2001 From: vimene Date: Thu, 5 Feb 2026 10:31:47 +0100 Subject: added back windows cross-compilation Makefile.am is too ugly, but I don't have a better solution right now. - fused Makefile.am and src/Makefile.am - adding back windows cross-compilation - improved README.md a lot - added configure option to enable debug, which greatly simplifies development when writing shaders - removed dependency on LunarG's Vulkan SDK by having dependency only on Vulkan headers, library and slangc - removed print C++ header because I have an old MinGW which doesn't support it. It will be restored in the future - make every assets path relative to be able to build anywhere and run elsewhere - moved stb_image.h inside source directory instead of making it a dependency, which is more aligned with stb philosophy - moved assets inside source code to make it easy to compile and run the engine - improved configure.ac by checking Vulkan headers version directly in the configure script instead of within C code, which allows us to also do theses checks when cross-compiling --- README.md | 200 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++----- 1 file changed, 184 insertions(+), 16 deletions(-) (limited to 'README.md') diff --git a/README.md b/README.md index 7aef019..8868d0b 100644 --- a/README.md +++ b/README.md @@ -2,31 +2,199 @@ Small graphics engine. +## Binaries + +- windows: [engine-win.zip](https://vimene.fr/engine/engine-win.zip) +- linux: [engine-linux.tar.xz](https://vimene.fr/engine/engine-linux.tar.xz) + +## Usage + + :::text + Usage: ./engine [-htg] [--help] [--term] [--graphical] + -h, --help show usage (this) + -t, --term terminal mode + -g, --graphical graphical mode (default) + +You can press `o` to switch between the hardware and the software renderer. You can close the window +by pressing `escape`. + ## Building -### Dependencies +### Getting the source code + +The repository contains autotools files without generated ones. If you don't want to run autotools, +you can download the source code here: +[engine-source.tar.xz](https://vimene.fr/engine/engine-source.tar.xz) + +Otherwise, you need to install autotools and run the following commands: + + :::sh + git clone https://git.vimene.fr/engine.git + cd engine + ./bootstrap.sh + +### Building for linux -- g++ (GNU C++ Compiler) -- GNU autotools -- criterion -- ncurses -- SDL2 +#### Dependencies -### Actually building +Required: + +- `g++` (GNU C++ Compiler) supporting at least C++23 +- `glfw` +- Vulkan headers and `libvulkan.so` +- `slangc` compiler + +Optional: + +- ncurses (for terminal rendering) + +#### Actually building While inside the directory containing all files: - ./bootstrap.sh - ./configure + :::sh + mkdir build + cd build + ../configure --prefix="$(realpath .)" --with-ncurses make + make install -You can run tests: +You should now have an executable in `./share/engine` called `engine`. - make check +The configure script searches for libraries with `pkgconf` but can be overwriten with environment +variables passed to `configure`. You can also set `PKG_CONFIG_PATH` if you have appropriate +`pkgconf` files different from system ones. -### Running +More precisely, if `glfw` headers or `libglfw3.so` cannot be found, or if you want to use ones other +than the ones given by `pkgconf`, you have to set both `GLFW3_CFLAGS` and `GLFW3_LIBS` in the +`configure` command line, like so: - Usage: ./engine [-htg] [--help] [--term] [--graphical] - -h, --help show usage (this) - -t, --term terminal mode - -g, --graphical graphical mode (default) + :::sh + ../configure --prefix="$(realpath .)" --with-ncurses \ + GLFW3_CFLAGS=-I/path/to/glfw/headers \ + GLFW3_LIBS=-L/path/to/glfw/libs -lglfw3 + +If Vulkan headers or libvulkan.so cannot be found, or if for example you want to use ones given by +LunarG's Vulkan SDK, you have to set both `VULKAN_CFLAGS` and `VULKAN_LIBS` in the `configure` +command line, like so: + + :::sh + ../configure --prefix="$(realpath .)" --with-ncurses \ + VULKAN_CFLAGS=-I/path/to/vulkan/headers \ + VULKAN_LIBS=-L/path/to/vulkan/libs -lvulkan + +If `slangc` cannot be found in path, or if you also want to use the one given by LunarG's Vulkan +SDK, you have to set `SLANGC` to the path of the executable, like so: + + :::sh + ../configure --prefix="$(realpath .)" --with-ncurses \ + SLANGC=/path/to/slangc + +If ncurses headers or libncurses.so cannot be found, or if you want to use ones other than the ones +given by `pkgconf`, you have to set both `NCURSES_CFLAGS` and `NCURSES_LIBS` in the `configure` +command line, like so: + + :::sh + ../configure --prefix="$(realpath .)" --with-ncurses \ + NCURSES_CFLAGS=-I/path/to/ncurses/headers \ + NCURSES_LIBS=-L/path/to/ncurses/libs -lvulkan + +You can, of course, combine as many as you like: + + :::sh + ../configure --prefix="$(realpath .)" --with-ncurses \ + GLFW3_CFLAGS=-I/path/to/glfw/headers \ + GLFW3_LIBS=-L/path/to/glfw/libs -lglfw3 \ + VULKAN_CFLAGS=-I/path/to/vulkan/headers \ + VULKAN_LIBS=-L/path/to/vulkan/libs -lvulkan \ + SLANGC=/path/to/slangc \ + NCURSES_CFLAGS=-I/path/to/ncurses/headers \ + NCURSES_LIBS=-L/path/to/ncurses/libs -lvulkan + +You can also set `PKG_CONFIG_PATH` if you have appropriate `pkgconf` files, different from system +ones, for some or all dependencies. You can find all configure options with `../configure --help`. + +### Building for windows from linux + +#### Dependencies + +Required: + +- MinGW with `g++` (GNU C++ Compiler) supporting at least C++23 +- `glfw` for windows +- Vulkan headers and `vulkan-1.dll` +- `slangc` compiler + +*Note: ncurses is not supported on windows.* + +#### Actually building + +While inside the directory containing all files: + + :::sh + mkdir build + cd build + ../configure --prefix="$(realpath .)" \ + --build x86_64-pc-linux-gnu \ + --host x86_64-w64-mingw32 + make + make install + +The `--build` option must be the one of your system, which for example would not be x86\_64 if you +are building on a system with an ARM CPU. + +You should now have an executable in `./share/engine` called `engine.exe`. + +The configure script searches for libraries with `pkgconf` but can be overwriten with environment +variables passed to `configure`. + +More precisely, if `glfw` headers or `glfw3.a` cannot be found, or if you want to use ones other +than the ones given by `pkgconf`, you have to set both `GLFW3_CFLAGS` and `GLFW3_LIBS` in the +`configure` command line, like so: + + :::sh + ../configure --prefix="$(realpath .)" \ + --build x86_64-pc-linux-gnu \ + --host x86_64-w64-mingw32 \ + GLFW3_CFLAGS=-I/path/to/glfw/headers \ + GLFW3_LIBS=-L/path/to/glfw/libs -lglfw3 + +If Vulkan headers or vulkan-1.dll cannot be found, or if for example you want to use ones given by +LunarG's Vulkan SDK, you have to set both `VULKAN_CFLAGS` and `VULKAN_LIBS` in the `configure` +command line, like so: + + :::sh + ../configure --prefix="$(realpath .)" \ + --build x86_64-pc-linux-gnu \ + --host x86_64-w64-mingw32 \ + VULKAN_CFLAGS=-I/path/to/vulkan/headers \ + VULKAN_LIBS=-L/path/to/vulkan/libs -lvulkan-1 + +If `slangc` cannot be found in path, or if you also want to use the one given by LunarG's Vulkan +SDK, you have to set `SLANGC` to the path of the executable, like so: + + :::sh + ../configure --prefix="$(realpath .)" \ + --build x86_64-pc-linux-gnu \ + --host x86_64-w64-mingw32 \ + SLANGC=/path/to/slangc + +You can, of course, combine as many as you like: + + :::sh + ../configure --prefix="$(realpath .)" \ + --build x86_64-pc-linux-gnu \ + --host x86_64-w64-mingw32 \ + GLFW3_CFLAGS=-I/path/to/glfw/headers \ + GLFW3_LIBS=-L/path/to/glfw/libs -lglfw3 \ + VULKAN_CFLAGS=-I/path/to/vulkan/headers \ + VULKAN_LIBS=-L/path/to/vulkan/libs -lvulkan-1 \ + SLANGC=/path/to/slangc + +You can also set `PKG_CONFIG_PATH` if you have appropriate `pkgconf` files, different from system +ones, for some or all dependencies. You can find all configure options with `../configure --help`. + +To be able to run it from windows, you will need to provide `libstdc++-6.dll` and +`libgcc_s_seh-1.dll` alongside the executable. + +*Note: glfw is statically built with the executable, therefore you don't need to provide it.* -- cgit v1.2.3