Fix wasm ci (#391)

* Update wasm-build.yml

* Set embed_rendererbackends with wasm

* wasm fixes

* Fix CI

* Update wasm-build.yml

* More wasm fixes

* Final fixes
This commit is contained in:
Jérôme Leclercq 2023-02-05 15:03:48 +01:00 committed by GitHub
parent a8b003224d
commit 20f70533c0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 16 additions and 23 deletions

View File

@ -59,7 +59,7 @@ jobs:
- name: Setup emscripten
uses: mymindstorm/setup-emsdk@v11
with:
version: 1.38.40
version: 3.1.31
actions-cache-folder: emsdk-cache-${{ matrix.mode }}-${{ matrix.kind }}
# Cache xmake dependencies
@ -71,16 +71,12 @@ jobs:
# Setup compilation mode and install project dependencies
- name: Configure xmake and install dependencies
run: xmake config --plat=wasm --arch=${{ matrix.arch }} --mode=${{ matrix.mode }} --ccache=n --assimp=n --ffmpeg=n --shadernodes=n --tests=y --yes
run: xmake config --plat=wasm --arch=${{ matrix.arch }} --mode=${{ matrix.mode }} --ccache=n --assimp=n --embed_rendererbackends=y --embed_plugins=y --link_openal=y --ffmpeg=n --shadernodes=n --tests=y --yes
# Build the engine
- name: Build Nazara
run: xmake --yes
# Setup installation configuration
- name: Configure xmake for installation
run: xmake config --plat=wasm --arch=${{ matrix.arch }} --mode=${{ matrix.mode }} --ccache=n --assimp=n --ffmpeg=n --shadernodes=n --tests=y --yes
# Install the result files
- name: Install Nazara
run: xmake install -vo package

View File

@ -4,6 +4,7 @@ Windows | [![Windows build status](https://github.com/NazaraEngine/NazaraEngine/
MSYS2 (MinGW64) | [![Windows build status](https://github.com/NazaraEngine/NazaraEngine/actions/workflows/msys2-build.yml/badge.svg)](https://github.com/NazaraEngine/NazaraEngine/actions/workflows/msys2-build.yml)
Linux | [![Linux build status](https://github.com/NazaraEngine/NazaraEngine/actions/workflows/linux-build.yml/badge.svg)](https://github.com/NazaraEngine/NazaraEngine/actions/workflows/linux-build.yml)
macOS | [![macOS build status](https://github.com/NazaraEngine/NazaraEngine/actions/workflows/macos-build.yml/badge.svg)](https://github.com/NazaraEngine/NazaraEngine/actions/workflows/macos-build.yml)
Emscripten | [![Emscripten build status](https://github.com/NazaraEngine/NazaraEngine/actions/workflows/wasm-build.yml/badge.svg)](https://github.com/NazaraEngine/NazaraEngine/actions/workflows/wasm-build.yml)
# Nazara Engine

View File

@ -50,8 +50,8 @@ namespace Nz
std::vector<std::string> ParseDevices(const char* deviceString);
DynLib m_library;
bool m_isLoaded;
bool m_hasCaptureSupport;
bool m_isLoaded;
};
}

View File

@ -17,16 +17,17 @@
#include <stdexcept>
#ifdef NAZARA_RENDERER_EMBEDDEDBACKENDS
#include <Nazara/OpenGLRenderer/OpenGLRenderer.hpp>
#ifndef NAZARA_PLATFORM_WEB
#include <Nazara/VulkanRenderer/VulkanRenderer.hpp>
#endif
#include <Nazara/Renderer/Debug.hpp>
#ifdef NAZARA_PLATFORM_WEB
#include <Nazara/OpenGLRenderer/OpenGLRenderer.hpp>
#endif
#include <Nazara/Renderer/Debug.hpp>
#ifdef NAZARA_COMPILER_MSVC
#define NazaraRendererPrefix ""
#else
@ -81,7 +82,6 @@ namespace Nz
void Renderer::LoadBackend(const Config& config)
{
#ifndef NAZARA_PLATFORM_WEB
constexpr std::array<const char*, RenderAPICount> rendererPaths = {
NazaraRendererPrefix "NazaraDirect3DRenderer" NazaraRendererDebugSuffix, // Direct3D
NazaraRendererPrefix "NazaraMantleRenderer" NazaraRendererDebugSuffix, // Mantle
@ -128,7 +128,10 @@ namespace Nz
};
RegisterImpl(RenderAPI::OpenGL, [] { return 50; }, [] { return std::make_unique<OpenGLRenderer>(); });
#ifndef NAZARA_PLATFORM_WEB
RegisterImpl(RenderAPI::Vulkan, [] { return 100; }, [] { return std::make_unique<VulkanRenderer>(); });
#endif
#else
auto RegisterImpl = [&](RenderAPI api, auto ComputeScore)
{
@ -148,7 +151,10 @@ namespace Nz
};
RegisterImpl(RenderAPI::OpenGL, [] { return 50; });
#ifndef NAZARA_PLATFORM_WEB
RegisterImpl(RenderAPI::Vulkan, [] { return 100; });
#endif
#endif
std::sort(implementations.begin(), implementations.end(), [](const auto& lhs, const auto& rhs) { return lhs.score > rhs.score; });
@ -206,16 +212,6 @@ namespace Nz
m_rendererLib = std::move(chosenLib);
#endif
#else
std::unique_ptr<Nz::OpenGLRenderer> impl = std::make_unique<Nz::OpenGLRenderer>();
if (!impl || !impl->Prepare({}))
{
NazaraError("Failed to create renderer implementation");
}
m_rendererImpl = std::move(impl);
#endif
NazaraDebug("Using " + m_rendererImpl->QueryAPIString() + " as renderer");
}

View File

@ -189,7 +189,7 @@ NazaraModules = modules
includes("xmake/**.lua")
option("compile_shaders", { description = "Compile nzsl shaders into an includable binary version", default = true })
option("embed_rendererbackends", { description = "Embed renderer backend code into NazaraRenderer instead of loading them dynamically", default = false })
option("embed_rendererbackends", { description = "Embed renderer backend code into NazaraRenderer instead of loading them dynamically", default = is_plat("wasm") or false })
option("embed_resources", { description = "Turn builtin resources into includable headers", default = true })
option("embed_plugins", { description = "Embed enabled plugins code as static libraries", default = is_plat("wasm") or false })
option("link_openal", { description = "Link OpenAL in the executable instead of dynamically loading it", default = is_plat("wasm") or false })