aboutsummaryrefslogtreecommitdiff
path: root/README.md
blob: 2141e3f1971ed6cb980aa4c376de667d6d3462ae (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
# engine

Small graphics engine.

## Binaries

-   windows: [engine-win.zip](https://vimene.fr/engine-win.zip)
-   linux: [engine-linux.tar.xz](https://vimene.fr/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

### 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-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

#### Dependencies

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:

    :::sh
    mkdir build
    cd build
    ../configure --prefix="$(realpath .)" --bindir="$(realpath share/engine)" --with-ncurses
    make
    make install

You should now have an executable in `./share/engine` called `engine`.

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.

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:

    :::sh
    ../configure --prefix="$(realpath .)" --bindir="$(realpath share/engine)" --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 .)" --bindir="$(realpath share/engine)" --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 .)" --bindir="$(realpath share/engine)" --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 .)" --bindir="$(realpath share/engine)" --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 .)" --bindir="$(realpath share/engine)" --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 .)" --bindir="$(realpath share/engine)" \
      --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 .)" --bindir="$(realpath share/engine)" \
      --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 .)" --bindir="$(realpath share/engine)" \
      --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 .)" --bindir="$(realpath share/engine)" \
      --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 .)" --bindir="$(realpath share/engine)" \
      --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.*