@@ -10,29 +10,25 @@ Build Instructions 👨🏼💻
10
10
![ Screenshot] ( logo/emscripten.png )
11
11
12
12
## Getting Started 👈
13
+
14
+ > [ !TIP]
15
+ > The build process assumes some familiarity with building C++ based projects using
16
+ > toolchains and tools such as GCC, MSVS, Emscripten💩 and CMake.
17
+
18
+ > [ !TIP]
19
+ > You'll need to have Qt5 in order to build the Editor.
20
+
21
+
22
+ ### Build Steps:
13
23
1 . First build the engine and editor for your target platform.
14
24
2 . If you want to deploy / package your game for web then build the engine for HTML5/WASM
15
25
3 . If you want to work on the engine itself it's advisory to also run the (unit) tests.
16
26
17
- <i >
18
- <strong >
19
- The build process assumes some familiarity with building C++ based projects using
20
- toolchains and tools such as GCC, MSVS, Emscripten💩 and CMake.
21
- <br ><br >
22
- You'll need to have Qt5 in order to build the Editor.
23
- </strong >
24
- </i >
25
-
26
- * If you're using Linux you can get Qt from your distribution's repositories.
27
- * ` sudo pacman -S qt5-base `
28
- * If you're using Windows you'll need to download a prebuilt Qt5 package (installer) from the Qt Company's website.<br >
29
- You can try the link below. If that doesn't work you'll need an account with the Qt Company
30
- * http://download.qt.io/official_releases/qt/5.15/5.15.2/single/qt-everywhere-src-5.15.2.zip
31
-
32
27
33
28
## Step 1) Building the Editor & Engine for Desktop Windows 🪟
34
29
35
- These build instructions are for MSVS 2019 Community Edition 64bit build.
30
+ > [ !IMPORTANT]
31
+ > These build instructions are for MSVS 2019 Community Edition 64bit build.
36
32
37
33
<details ><summary >How to install dependencies</summary >
38
34
@@ -45,8 +41,10 @@ These build instructions are for MSVS 2019 Community Edition 64bit build.
45
41
46
42
47
43
- Install prebuilt Qt 5.15.2<br >
44
+ If the link doesn't work you'll need to create an account with the Qt company<br >
45
+ and download the installer for the LGPL version (they like to hide this) from their site.<br >
48
46
http://download.qt.io/official_releases/qt/5.15/5.15.2/single/qt-everywhere-src-5.15.2.zip
49
-
47
+
50
48
51
49
- Install Conan package manager (VERSION 2)<br >
52
50
https://docs.conan.io/en/latest/installation.html
@@ -78,11 +76,9 @@ These build instructions are for MSVS 2019 Community Edition 64bit build.
78
76
79
77
<details ><summary >How to build the project in DEBUG [OPTIONAL]</summary >
80
78
81
- <br ><i >
82
- Note that on MSVS the library interfaces change between debug/release build configs. (e.g. iterator debug levels).
83
- This means that in order to link to 3rd party libraries the debug versions of those libraries must be used.
84
- </i >
85
- </br >
79
+ > Note that on MSVS the library interfaces change between debug/release build configs. (e.g. iterator debug levels).
80
+ > This means that in order to link to 3rd party libraries the debug versions of those libraries must be used.
81
+
86
82
87
83
- Open ` Developer Command Prompt for VS 2019 `
88
84
@@ -126,7 +122,7 @@ Install these packages:
126
122
- CMake build tool
127
123
- Conan💩💩 package manager (VERSION 2)
128
124
- On Archlinux you can use 'yay' to install conan + its dependencies from AUR*
129
- - See below for installing yay + conan💩💩
125
+ - See below for installing yay + conan💩💩
130
126
- Git version control system
131
127
- Qt5 application framework
132
128
@@ -229,24 +225,21 @@ you can try edit ~/.conan/settings.yaml. Search for the GCC versions and edit th
229
225
230
226
</details >
231
227
232
-
233
-
234
228
## Step 2) Building the Engine for HTML5/WASM 💩
235
229
236
- <strong >
237
- <i >HTML5/WASM build is only required if you want to build and package your game for the web.<br >
238
- If you just want to try the editor or build native games you don't need this.
239
- </i >
240
- </strong >
241
- <br ><br >
230
+ > [ !NOTE]
231
+ > HTML5/WASM build is only required if you want to build and package your game for the web.<br >
232
+ > If you just want to try the editor or build native games you don't need this.
233
+
234
+ <br >
242
235
Some notes about building to HTML5/WASM.
243
236
244
237
* Building to HTML5/WASM is currently supported only for the engine but not the editor.
245
- * Current Emscripten💩 version is 3.1.10 . Using other version will likely break things.
238
+ * Current Emscripten💩 version is 3.1.50 . Using other version will likely break things.
246
239
* Building to HTML5/WASM will produce the required JS and WASM files to run games in the browser,<br >
247
240
but you still need to build the editor in order to develop the game and package it.<br >
248
- * When you package your game through the editor, the HTML5/WASM game files are copied by the editor<br >
249
- during the packaging process in order to produce the final deployable game package.
241
+ * When you package your game with the editor, the HTML5/WASM game files are copied by the editor<br >
242
+ during the packaging process in order to produce the final deployable game package.
250
243
251
244
<details ><summary >How to build on Linux 🐧</summary >
252
245
@@ -256,16 +249,16 @@ Some notes about building to HTML5/WASM.
256
249
$ git clone https://github.com/emscripten-core/emsdk.git
257
250
$ cd emsdk
258
251
$ git pull
259
- $ ./emsdk install 3.1.10
260
- $ ./emsdk activate 3.1.10
252
+ $ ./emsdk install 3.1.50
253
+ $ ./emsdk activate 3.1.50
261
254
$ source ./emsdk_env.sh
262
255
```
263
256
- Check your Emscripten💩 installation
264
257
```
265
258
$ which emcc
266
259
$ /home/user/emsdk/upstream/emscripten/emcc
267
260
$ emcc --version
268
- $ emcc (Emscripten gcc/clang-like replacement + linker emulating GNU ld) 3.0.0 (3fd52e107187b8a169bb04a02b9f982c8a075205 )
261
+ $ emcc (Emscripten gcc/clang-like replacement + linker emulating GNU ld) 3.1.50 (047b82506d6b471873300a5e4d1e690420b582d0 )
269
262
```
270
263
- Build the DETONATOR 2D engine into a WASM blob. Make sure that you have the Emscripten💩 tools in your path,
271
264
i.e. you have sourced emsdk_env.sh in your current shell.
@@ -294,8 +287,8 @@ Some notes about building to HTML5/WASM.
294
287
$ git clone https://github.com/emscripten-core/emsdk.git
295
288
$ cd emsdk
296
289
$ git pull
297
- $ emsdk.bat install 3.1.10
298
- $ emsdk.bat activate 3.1.10
290
+ $ emsdk.bat install 3.1.50
291
+ $ emsdk.bat activate 3.1.50
299
292
$ emsdk_env.bat
300
293
```
301
294
- Check your Emscripten💩 and Ninja🥷 installation
@@ -304,7 +297,7 @@ Some notes about building to HTML5/WASM.
304
297
$ C:\coding\detonator\emsdk\upstream\emscripten\emcc
305
298
$ C:\coding\detonator\emsdk\upstream\emscripten\emcc.bat
306
299
$ emcc --version
307
- $ emcc (Emscripten gcc/clang-like replacement + linker emulating GNU ld) 3.1.10 (c3fe57af0504fe24fc4ba697feb8c204f3c80022 )
300
+ $ emcc (Emscripten gcc/clang-like replacement + linker emulating GNU ld) 3.1.50 (047b82506d6b471873300a5e4d1e690420b582d0 )
308
301
$ where ninja
309
302
$ C:\coding\detonator\emsdk\ninja.exe
310
303
$ ninja --version
@@ -327,7 +320,7 @@ Some notes about building to HTML5/WASM.
327
320
328
321
<details ><summary >Build troubleshooting 💩</summary >
329
322
330
- Windows: Emscripten💩 3.0.0 build fails with
323
+ Windows: Emscripten💩 3.0.0 build fails with
331
324
332
325
```
333
326
error: undefined symbol: _get_daylight (referenced by tzset_impl__deps: ['_get_daylight','_get_timezone','_get_tzname'], referenced by tzset__deps: ['tzset_impl'], referenced by localtime_r__deps: ['tzset'], referenced by __localtime_r__deps: ['localtime_r'], referenced by top-level compiled C/C++ code)
@@ -341,44 +334,51 @@ warning: __get_tzname may need to be added to EXPORTED_FUNCTIONS if it arrives f
341
334
* https://github.com/emscripten-core/emscripten/issues/15958
342
335
* Current fix is to upgrade to Emscripten💩 3.1.10
343
336
344
- Build fails with
337
+ Build fails with
345
338
```
346
339
wasm-ld: error: --shared-memory is disallowed by ldo.c.o because it was not compiled with 'atomics' or 'bulk-memory' features.
347
340
```
348
341
349
342
* https://github.com/emscripten-core/emsdk/issues/790
350
343
* This is trying to communicate that something was built without thread support when thread support should be enabled.<br >
351
344
In other words trying to mix + match translation units / libs built with different build configuration.
352
- * Make sure to double check the build flags including ` third_party/CMakeLists.txt `
345
+ * Make sure to double check the build flags including ` third_party/CMakeLists.txt `
353
346
354
347
</details >
355
348
356
349
If your build was successful there should now be ` GameEngine.js ` , ` GameEngine.wasm ` and ` GameEngine.worker.js ` files in the editor's ` dist ` folder.<br >
357
350
358
351
### Step 2.1) Deploying the Game for the Web 💩
359
352
360
- When you package your game for the web the editor will copy all the required files to your chosen output directory.
353
+ When you package your game for the web the editor will copy all the required files to your chosen output directory.
361
354
362
355
* GameEngine.js
363
356
* GameEngine.wasm
364
357
* GameEngine.worker.js
365
358
* FILESYSTEM
366
- * FILESYSTEM.js
367
- * game.html
359
+ * FILESYSTEM.js
360
+ * game.html
368
361
369
362
These 6 files are then all the files that you need to deploy/copy over to your web server.<br ><br >
370
- <i >Hint: You can rename ` game.html ` to whatever you want, for example ` my-amazing-game.html ` . Just don't change the names of any other files</i >
371
-
363
+
364
+ > [ !TIP] <br >
365
+ > You can rename ` game.html ` to whatever you want, for example ` my-amazing-game.html ` . Just don't change the names of any other files
366
+
367
+
372
368
<details ><summary >1. Configure Your Web Server</summary >
373
369
374
- <strong ><i >You must enable the correct web policies💩 in order to enable SharedArrayBuffer💩 in order to enable threads !! </i >💩💩</strong ><br >
375
- <strong ><i >Without SharedArrayBuffer web worker threads can't run and the engine cannot work. </i >💩💩</strong ><br >
376
- https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/SharedArrayBuffer
370
+ <br >
377
371
378
- You must set the HTTP ` Cross-Origin-Opener-Policy ` to ` same-origin ` and ` Cross-Origin-Embedder-Policy ` to ` require-corp ` .<br >
372
+ > [ !IMPORTANT] <br >
373
+ > You must enable the correct web policies💩 in order to enable SharedArrayBuffer💩 in order to enable threads !! 💩💩<br >
374
+ > Without SharedArrayBuffer web worker threads can't run and the engine cannot work. 💩💩<br >
375
+ > https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/SharedArrayBuffer
379
376
380
- You can achieve this with a ` .htaccess ` file.<br >
381
377
378
+ > [ !IMPORTANT] <br >
379
+ > You must set the HTTP ` Cross-Origin-Opener-Policy ` to ` same-origin ` <br >
380
+ > You must set the HTTP ` Cross-Origin-Embedder-Policy ` to ` require-corp ` <br >
381
+ > You can achieve this with a ` .htaccess ` file.<br >
382
382
383
383
```
384
384
Header set Access-Control-Allow-Origin "https://your-domain.com"
@@ -387,10 +387,13 @@ Header set Cross-Origin-Resource-Policy "same-site"
387
387
Header set Cross-Origin-Opener-Policy "same-origin"
388
388
Header set Access-Control-Allow-Headers "range"
389
389
```
390
+
390
391
</details >
391
392
392
393
<details ><summary >2. Deploy Your Game to Your Web Server</summary >
393
394
395
+ <br >
396
+
394
397
Copy the following files to your webserver using ` sftp ` or similar mechanism.<br >
395
398
You'll find these in your package output folder after the successful completion of your game packaging
396
399
in the editor.
@@ -507,15 +510,15 @@ to indicate completion.
507
510
508
511
Download the yay package from AUR<br >
509
512
https://aur.archlinux.org/packages/yay
510
-
513
+
511
514
WARNING! BOTH YAY AND CONAN💩💩 WILL LIKELY HAVE MISSING DEPENDENCIES
512
515
513
516
install missing yay dependencies
514
517
```
515
518
$ sudo pacman -S debugedit
516
519
```
517
520
518
- build yay
521
+ build yay
519
522
```
520
523
$ cd yay
521
524
$ makepkg
@@ -530,8 +533,8 @@ use yay to install Conan💩💩
530
533
```
531
534
$ yay -S conan
532
535
$ yay -S python-patch-ng
533
- $ ...
536
+ $ ...
534
537
$ conan --version
535
538
$ Conan version 2.6.0
536
- $
539
+ $
537
540
```
0 commit comments