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:
parent
a8b003224d
commit
20f70533c0
|
|
@ -59,7 +59,7 @@ jobs:
|
||||||
- name: Setup emscripten
|
- name: Setup emscripten
|
||||||
uses: mymindstorm/setup-emsdk@v11
|
uses: mymindstorm/setup-emsdk@v11
|
||||||
with:
|
with:
|
||||||
version: 1.38.40
|
version: 3.1.31
|
||||||
actions-cache-folder: emsdk-cache-${{ matrix.mode }}-${{ matrix.kind }}
|
actions-cache-folder: emsdk-cache-${{ matrix.mode }}-${{ matrix.kind }}
|
||||||
|
|
||||||
# Cache xmake dependencies
|
# Cache xmake dependencies
|
||||||
|
|
@ -71,16 +71,12 @@ jobs:
|
||||||
|
|
||||||
# Setup compilation mode and install project dependencies
|
# Setup compilation mode and install project dependencies
|
||||||
- name: Configure xmake and install 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
|
# Build the engine
|
||||||
- name: Build Nazara
|
- name: Build Nazara
|
||||||
run: xmake --yes
|
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
|
# Install the result files
|
||||||
- name: Install Nazara
|
- name: Install Nazara
|
||||||
run: xmake install -vo package
|
run: xmake install -vo package
|
||||||
|
|
|
||||||
|
|
@ -4,6 +4,7 @@ Windows | [ | [](https://github.com/NazaraEngine/NazaraEngine/actions/workflows/msys2-build.yml)
|
MSYS2 (MinGW64) | [](https://github.com/NazaraEngine/NazaraEngine/actions/workflows/msys2-build.yml)
|
||||||
Linux | [](https://github.com/NazaraEngine/NazaraEngine/actions/workflows/linux-build.yml)
|
Linux | [](https://github.com/NazaraEngine/NazaraEngine/actions/workflows/linux-build.yml)
|
||||||
macOS | [](https://github.com/NazaraEngine/NazaraEngine/actions/workflows/macos-build.yml)
|
macOS | [](https://github.com/NazaraEngine/NazaraEngine/actions/workflows/macos-build.yml)
|
||||||
|
Emscripten | [](https://github.com/NazaraEngine/NazaraEngine/actions/workflows/wasm-build.yml)
|
||||||
|
|
||||||
# Nazara Engine
|
# Nazara Engine
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -50,8 +50,8 @@ namespace Nz
|
||||||
std::vector<std::string> ParseDevices(const char* deviceString);
|
std::vector<std::string> ParseDevices(const char* deviceString);
|
||||||
|
|
||||||
DynLib m_library;
|
DynLib m_library;
|
||||||
bool m_isLoaded;
|
|
||||||
bool m_hasCaptureSupport;
|
bool m_hasCaptureSupport;
|
||||||
|
bool m_isLoaded;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -17,16 +17,17 @@
|
||||||
#include <stdexcept>
|
#include <stdexcept>
|
||||||
|
|
||||||
#ifdef NAZARA_RENDERER_EMBEDDEDBACKENDS
|
#ifdef NAZARA_RENDERER_EMBEDDEDBACKENDS
|
||||||
|
|
||||||
#include <Nazara/OpenGLRenderer/OpenGLRenderer.hpp>
|
#include <Nazara/OpenGLRenderer/OpenGLRenderer.hpp>
|
||||||
|
|
||||||
|
#ifndef NAZARA_PLATFORM_WEB
|
||||||
#include <Nazara/VulkanRenderer/VulkanRenderer.hpp>
|
#include <Nazara/VulkanRenderer/VulkanRenderer.hpp>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include <Nazara/Renderer/Debug.hpp>
|
|
||||||
|
|
||||||
#ifdef NAZARA_PLATFORM_WEB
|
|
||||||
#include <Nazara/OpenGLRenderer/OpenGLRenderer.hpp>
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#include <Nazara/Renderer/Debug.hpp>
|
||||||
|
|
||||||
#ifdef NAZARA_COMPILER_MSVC
|
#ifdef NAZARA_COMPILER_MSVC
|
||||||
#define NazaraRendererPrefix ""
|
#define NazaraRendererPrefix ""
|
||||||
#else
|
#else
|
||||||
|
|
@ -81,7 +82,6 @@ namespace Nz
|
||||||
|
|
||||||
void Renderer::LoadBackend(const Config& config)
|
void Renderer::LoadBackend(const Config& config)
|
||||||
{
|
{
|
||||||
#ifndef NAZARA_PLATFORM_WEB
|
|
||||||
constexpr std::array<const char*, RenderAPICount> rendererPaths = {
|
constexpr std::array<const char*, RenderAPICount> rendererPaths = {
|
||||||
NazaraRendererPrefix "NazaraDirect3DRenderer" NazaraRendererDebugSuffix, // Direct3D
|
NazaraRendererPrefix "NazaraDirect3DRenderer" NazaraRendererDebugSuffix, // Direct3D
|
||||||
NazaraRendererPrefix "NazaraMantleRenderer" NazaraRendererDebugSuffix, // Mantle
|
NazaraRendererPrefix "NazaraMantleRenderer" NazaraRendererDebugSuffix, // Mantle
|
||||||
|
|
@ -128,7 +128,10 @@ namespace Nz
|
||||||
};
|
};
|
||||||
|
|
||||||
RegisterImpl(RenderAPI::OpenGL, [] { return 50; }, [] { return std::make_unique<OpenGLRenderer>(); });
|
RegisterImpl(RenderAPI::OpenGL, [] { return 50; }, [] { return std::make_unique<OpenGLRenderer>(); });
|
||||||
|
#ifndef NAZARA_PLATFORM_WEB
|
||||||
RegisterImpl(RenderAPI::Vulkan, [] { return 100; }, [] { return std::make_unique<VulkanRenderer>(); });
|
RegisterImpl(RenderAPI::Vulkan, [] { return 100; }, [] { return std::make_unique<VulkanRenderer>(); });
|
||||||
|
#endif
|
||||||
|
|
||||||
#else
|
#else
|
||||||
auto RegisterImpl = [&](RenderAPI api, auto ComputeScore)
|
auto RegisterImpl = [&](RenderAPI api, auto ComputeScore)
|
||||||
{
|
{
|
||||||
|
|
@ -148,7 +151,10 @@ namespace Nz
|
||||||
};
|
};
|
||||||
|
|
||||||
RegisterImpl(RenderAPI::OpenGL, [] { return 50; });
|
RegisterImpl(RenderAPI::OpenGL, [] { return 50; });
|
||||||
|
#ifndef NAZARA_PLATFORM_WEB
|
||||||
RegisterImpl(RenderAPI::Vulkan, [] { return 100; });
|
RegisterImpl(RenderAPI::Vulkan, [] { return 100; });
|
||||||
|
#endif
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
std::sort(implementations.begin(), implementations.end(), [](const auto& lhs, const auto& rhs) { return lhs.score > rhs.score; });
|
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);
|
m_rendererLib = std::move(chosenLib);
|
||||||
#endif
|
#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");
|
NazaraDebug("Using " + m_rendererImpl->QueryAPIString() + " as renderer");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -189,7 +189,7 @@ NazaraModules = modules
|
||||||
includes("xmake/**.lua")
|
includes("xmake/**.lua")
|
||||||
|
|
||||||
option("compile_shaders", { description = "Compile nzsl shaders into an includable binary version", default = true })
|
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_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("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 })
|
option("link_openal", { description = "Link OpenAL in the executable instead of dynamically loading it", default = is_plat("wasm") or false })
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue