Skip to content

Commit 1a8d289

Browse files
MikhailGorobetsTheMostDiligent
authored andcommitted
Added Emscripten support
1 parent 3be74a9 commit 1a8d289

File tree

5 files changed

+166
-10
lines changed

5 files changed

+166
-10
lines changed

.github/workflows/emscripten.yml

Lines changed: 114 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,114 @@
1+
name: Emscripten
2+
3+
on: [push, pull_request]
4+
5+
env:
6+
emscripten_version: "2.0.30"
7+
8+
jobs:
9+
build-win10:
10+
strategy:
11+
matrix:
12+
config: [Debug, Release]
13+
14+
runs-on: windows-latest
15+
name: Windows 10 -> Emscripten, ${{ matrix.config }}
16+
17+
steps:
18+
- name: Clone repository
19+
uses: actions/checkout@v2
20+
with:
21+
submodules: recursive
22+
23+
- name: Configure Ninja
24+
uses: seanmiddleditch/gha-setup-ninja@master
25+
26+
- name: Download and Configure Emscripten SDK
27+
uses: mymindstorm/setup-emsdk@master
28+
with:
29+
version: ${{env.emscripten_version}}
30+
31+
- name: Configure CMake
32+
if: success()
33+
shell: bash
34+
run: |
35+
cd $GITHUB_WORKSPACE/DiligentCore/BuildTools/Scripts/github_actions
36+
./configure_cmake.sh "emscripten" "${{runner.workspace}}" ${{ matrix.config }} "-DDILIGENT_BUILD_CORE_TESTS=ON"
37+
38+
- name: Build
39+
if: success()
40+
working-directory: ${{runner.workspace}}/build
41+
shell: bash
42+
run: cmake --build . -j2
43+
44+
build-linux:
45+
strategy:
46+
matrix:
47+
config: [Debug, Release]
48+
49+
runs-on: ubuntu-latest
50+
name: Linux -> Emscripten, ${{ matrix.config }}
51+
52+
steps:
53+
- name: Clone repository
54+
uses: actions/checkout@v2
55+
with:
56+
submodules: recursive
57+
58+
- name: Configure Ninja
59+
uses: seanmiddleditch/gha-setup-ninja@master
60+
61+
- name: Download and Configure Emscripten SDK
62+
uses: mymindstorm/setup-emsdk@master
63+
with:
64+
version: ${{env.emscripten_version}}
65+
66+
- name: Configure CMake
67+
if: success()
68+
shell: bash
69+
run: |
70+
cd $GITHUB_WORKSPACE/DiligentCore/BuildTools/Scripts/github_actions
71+
chmod +x configure_cmake.sh
72+
./configure_cmake.sh "emscripten" "${{runner.workspace}}" ${{ matrix.config }} "-DDILIGENT_BUILD_CORE_TESTS=ON"
73+
74+
- name: Build
75+
if: success()
76+
working-directory: ${{runner.workspace}}/build
77+
shell: bash
78+
run: cmake --build . -j2
79+
80+
build-macos:
81+
strategy:
82+
matrix:
83+
config: [Debug]
84+
85+
runs-on: macos-latest
86+
name: MacOS -> Emscripten, ${{ matrix.config }}
87+
88+
steps:
89+
- name: Clone repository
90+
uses: actions/checkout@v2
91+
with:
92+
submodules: recursive
93+
94+
- name: Configure Ninja
95+
uses: seanmiddleditch/gha-setup-ninja@master
96+
97+
- name: Download and Configure Emscripten SDK
98+
uses: mymindstorm/setup-emsdk@master
99+
with:
100+
version: ${{env.emscripten_version}}
101+
102+
- name: Configure CMake
103+
if: success()
104+
shell: bash
105+
run: |
106+
cd $GITHUB_WORKSPACE/DiligentCore/BuildTools/Scripts/github_actions
107+
chmod +x configure_cmake.sh
108+
./configure_cmake.sh "emscripten" "${{runner.workspace}}" ${{ matrix.config }} "-DDILIGENT_BUILD_CORE_TESTS=ON"
109+
110+
- name: Build
111+
if: success()
112+
working-directory: ${{runner.workspace}}/build
113+
shell: bash
114+
run: cmake --build . -j2

DiligentFX

README.md

Lines changed: 49 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -19,13 +19,14 @@ It is distributed under [Apache 2.0 license](License.txt) and is free to use.
1919

2020
| Platform | D3D11 | D3D12 | OpenGL/GLES | Vulkan | Metal | Build Status |
2121
| -------------------------------------------------------------------------------------------------------------------------------------------- | ------------------ |------------------- | ------------------ | ------------------------------- | ------------------------------- | -------------------------------- |
22-
| <img src="https://github.com/DiligentGraphics/DiligentCore/blob/master/media/windows-logo.png" width=24 valign="middle"> Windows | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | - | [![Build Status](https://github.com/DiligentGraphics/DiligentEngine/workflows/Windows/badge.svg?branch=master)](https://github.com/DiligentGraphics/DiligentEngine/actions/workflows/windows.yml?query=branch%3Amaster) |
23-
| <img src="https://github.com/DiligentGraphics/DiligentCore/blob/master/media/uwindows-logo.png" width=24 valign="middle"> Universal Windows | :heavy_check_mark: | :heavy_check_mark: | - | - | - | [![Build Status](https://github.com/DiligentGraphics/DiligentEngine/workflows/UWP/badge.svg?branch=master)](https://github.com/DiligentGraphics/DiligentEngine/actions/workflows/uwp.yml?query=branch%3Amaster) |
24-
| <img src="https://github.com/DiligentGraphics/DiligentCore/blob/master/media/linux-logo.png" width=24 valign="middle"> Linux | - | - | :heavy_check_mark: | :heavy_check_mark: | - | [![Build Status](https://github.com/DiligentGraphics/DiligentEngine/workflows/Linux/badge.svg?branch=master)](https://github.com/DiligentGraphics/DiligentEngine/actions/workflows/linux.yml?query=branch%3Amaster) |
25-
| <img src="https://github.com/DiligentGraphics/DiligentCore/blob/master/media/android-logo.png" width=24 valign="middle"> Android | - | - | :heavy_check_mark: | :heavy_check_mark: | - | [![Build Status](https://github.com/DiligentGraphics/DiligentEngine/workflows/Android/badge.svg?branch=master)](https://github.com/DiligentGraphics/DiligentEngine/actions/workflows/android.yml?query=branch%3Amaster) |
26-
| <img src="https://github.com/DiligentGraphics/DiligentCore/blob/master/media/macos-logo.png" width=24 valign="middle"> MacOS | - | - | :heavy_check_mark: | :heavy_check_mark: <sup>1</sup> | :heavy_check_mark: <sup>2</sup> | [![Build Status](https://github.com/DiligentGraphics/DiligentEngine/workflows/MacOS/badge.svg?branch=master)](https://github.com/DiligentGraphics/DiligentEngine/actions/workflows/macos.yml?query=branch%3Amaster) |
27-
| <img src="https://github.com/DiligentGraphics/DiligentCore/blob/master/media/apple-logo.png" width=24 valign="middle"> iOS | - | - | :heavy_check_mark: | :heavy_check_mark: <sup>1</sup> | :heavy_check_mark: <sup>2</sup> | [![Build Status](https://github.com/DiligentGraphics/DiligentEngine/workflows/iOS/badge.svg?branch=master)](https://github.com/DiligentGraphics/DiligentEngine/actions/workflows/ios.yml?query=branch%3Amaster) |
28-
| <img src="https://github.com/DiligentGraphics/DiligentCore/blob/master/media/tvos-logo.png" width=24 valign="middle"> tvOS | - | - | - | :heavy_check_mark: <sup>1</sup> | :heavy_check_mark: <sup>2</sup> | [![Build Status](https://github.com/DiligentGraphics/DiligentEngine/workflows/tvOS/badge.svg?branch=master)](https://github.com/DiligentGraphics/DiligentEngine/actions/workflows/tvos.yml?query=branch%3Amaster) |
22+
| <img src="https://github.com/DiligentGraphics/DiligentCore/blob/master/media/windows-logo.png" width=24 valign="middle"> Windows | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | - | [![Build Status](https://github.com/DiligentGraphics/DiligentEngine/workflows/Windows/badge.svg?branch=master)](https://github.com/DiligentGraphics/DiligentEngine/actions/workflows/windows.yml?query=branch%3Amaster) |
23+
| <img src="https://github.com/DiligentGraphics/DiligentCore/blob/master/media/uwindows-logo.png" width=24 valign="middle"> Universal Windows | :heavy_check_mark: | :heavy_check_mark: | - | - | - | [![Build Status](https://github.com/DiligentGraphics/DiligentEngine/workflows/UWP/badge.svg?branch=master)](https://github.com/DiligentGraphics/DiligentEngine/actions/workflows/uwp.yml?query=branch%3Amaster) |
24+
| <img src="https://github.com/DiligentGraphics/DiligentCore/blob/master/media/linux-logo.png" width=24 valign="middle"> Linux | - | - | :heavy_check_mark: | :heavy_check_mark: | - | [![Build Status](https://github.com/DiligentGraphics/DiligentEngine/workflows/Linux/badge.svg?branch=master)](https://github.com/DiligentGraphics/DiligentEngine/actions/workflows/linux.yml?query=branch%3Amaster) |
25+
| <img src="https://github.com/DiligentGraphics/DiligentCore/blob/master/media/android-logo.png" width=24 valign="middle"> Android | - | - | :heavy_check_mark: | :heavy_check_mark: | - | [![Build Status](https://github.com/DiligentGraphics/DiligentEngine/workflows/Android/badge.svg?branch=master)](https://github.com/DiligentGraphics/DiligentEngine/actions/workflows/android.yml?query=branch%3Amaster) |
26+
| <img src="https://github.com/DiligentGraphics/DiligentCore/blob/master/media/macos-logo.png" width=24 valign="middle"> MacOS | - | - | :heavy_check_mark: | :heavy_check_mark: <sup>1</sup> | :heavy_check_mark: <sup>2</sup> | [![Build Status](https://github.com/DiligentGraphics/DiligentEngine/workflows/MacOS/badge.svg?branch=master)](https://github.com/DiligentGraphics/DiligentEngine/actions/workflows/macos.yml?query=branch%3Amaster) |
27+
| <img src="https://github.com/DiligentGraphics/DiligentCore/blob/master/media/apple-logo.png" width=24 valign="middle"> iOS | - | - | :heavy_check_mark: | :heavy_check_mark: <sup>1</sup> | :heavy_check_mark: <sup>2</sup> | [![Build Status](https://github.com/DiligentGraphics/DiligentEngine/workflows/iOS/badge.svg?branch=master)](https://github.com/DiligentGraphics/DiligentEngine/actions/workflows/ios.yml?query=branch%3Amaster) |
28+
| <img src="https://github.com/DiligentGraphics/DiligentCore/blob/master/media/tvos-logo.png" width=24 valign="middle"> tvOS | - | - | - | :heavy_check_mark: <sup>1</sup> | :heavy_check_mark: <sup>2</sup> | [![Build Status](https://github.com/DiligentGraphics/DiligentEngine/workflows/tvOS/badge.svg?branch=master)](https://github.com/DiligentGraphics/DiligentEngine/actions/workflows/tvos.yml?query=branch%3Amaster) |
29+
| <img src="https://github.com/DiligentGraphics/DiligentCore/blob/master/media/emscripten-logo.png" width=24 valign="middle"> Emscripten | - | - | :heavy_check_mark: | - | - | [![Build Status](https://github.com/DiligentGraphics/DiligentEngine/workflows/Emscripten/badge.svg?branch=master)](https://github.com/DiligentGraphics/DiligentEngine/actions/workflows/emscripten.yml?query=branch%3Amaster) |
2930

3031

3132
<sup>1</sup> Vulkan API is not natively supported on MacOS, iOS and tvOS platforms and requires a Vulkan portability implementation such as [MoltenVK](https://github.com/KhronosGroup/MoltenVK)
@@ -86,6 +87,7 @@ or [gfx-portability](https://github.com/gfx-rs/portability).
8687
- [Android](#build_and_run_android)
8788
- [MacOS](#build_and_run_macos)
8889
- [iOS](#build_and_run_ios)
90+
- [Emscripten](#build_and_run_emscripten)
8991
- [Integrating Diligent Engine with Existing Build System](#build_and_run_integration)
9092
- [Build Options](#build_option)
9193
- [Customizing Build](#build_and_run_customizing)
@@ -395,6 +397,46 @@ for more information about MoltenVK installation and usage.
395397

396398
Last tested LunarG SDK version: 1.2.176.1.
397399

400+
<a name="build_and_run_emscripten"></a>
401+
## Emscripten
402+
Build prerequisites:
403+
404+
* Emscripten SDK 2.0.30
405+
* Ninja 1.10.2
406+
407+
To activate PATH and other environment variables in the current terminal
408+
````bash
409+
source ${PATH_TO_EMSDK}/emsdk/emsdk_env.sh
410+
````
411+
:warning: On Windows, run `${PATH_TO_EMSDK}/emsdk/emsdk_env.bat` instead of `source ${PATH_TO_EMSDK}/emsdk/emsdk_env.sh`
412+
413+
414+
To generate project, run the following CMake command from the engine's root folder:
415+
416+
```cmake
417+
emcmake cmake -S . -B ./build/Emscripten -G "Ninja"
418+
```
419+
420+
To build the engine, run the following command:
421+
422+
```cmake
423+
cmake --build ./build/Emscripten
424+
```
425+
426+
To test emscripten applications, run a basic web server
427+
428+
```bash
429+
cd ./build/Emscripten
430+
python -m http.server
431+
```
432+
433+
Open a browser, and navigate to `http://localhost:8000`
434+
435+
For example, the demo will be available at
436+
```
437+
http://localhost:8000/DiligentSamples/Tutorials/Tutorial01_HelloTriangle/Tutorial01_HelloTriangle.html
438+
```
439+
398440
<a name="build_and_run_integration"></a>
399441
## Integrating Diligent Engine with Existing Build System
400442

0 commit comments

Comments
 (0)