From 21f0b148db0030f00095b1d0788df0fbc8537714 Mon Sep 17 00:00:00 2001 From: falkTX Date: Sat, 4 May 2024 16:52:27 +0200 Subject: [PATCH] Preparations for web thingies Signed-off-by: falkTX --- dgl/Makefile | 19 +++++++++++++++++++ distrho/DistrhoUI.hpp | 3 +++ distrho/src/DistrhoPluginChecks.h | 12 ++++++++++++ tests/tests.hpp | 4 +++- 4 files changed, 37 insertions(+), 1 deletion(-) diff --git a/dgl/Makefile b/dgl/Makefile index 44e5edaae..09245e6e8 100644 --- a/dgl/Makefile +++ b/dgl/Makefile @@ -112,6 +112,17 @@ endif # --------------------------------------------------------------------------------------------------------------------- +OBJS_web = $(OBJS_common) \ + $(BUILD_DIR)/dgl/Web.cpp.o + +ifeq ($(MACOS),true) +OBJS_web += $(BUILD_DIR)/dgl/pugl.mm.o +else +OBJS_web += $(BUILD_DIR)/dgl/pugl.cpp.o +endif + +# --------------------------------------------------------------------------------------------------------------------- + ifeq ($(HAVE_CAIRO),true) TARGETS += $(BUILD_DIR)/libdgl-cairo.a endif @@ -139,6 +150,7 @@ opengl: $(BUILD_DIR)/libdgl-opengl.a opengl3: $(BUILD_DIR)/libdgl-opengl3.a stub: $(BUILD_DIR)/libdgl-stub.a vulkan: $(BUILD_DIR)/libdgl-vulkan.a +web: $(BUILD_DIR)/libdgl-web.a # --------------------------------------------------------------------------------------------------------------------- @@ -172,6 +184,12 @@ $(BUILD_DIR)/libdgl-vulkan.a: $(OBJS_vulkan) $(SILENT)rm -f $@ $(SILENT)$(AR) crs $@ $^ +$(BUILD_DIR)/libdgl-web.a: $(OBJS_web) + -@mkdir -p $(BUILD_DIR) + @echo "Creating libdgl-web.a" + $(SILENT)rm -f $@ + $(SILENT)$(AR) crs $@ $^ + # Compat name, to be removed soon $(BUILD_DIR)/libdgl.a: $(BUILD_DIR)/libdgl-opengl.a @echo "Symlinking libdgl.a" @@ -270,5 +288,6 @@ debug: -include $(OBJS_opengl3:%.o=%.d) -include $(OBJS_stub:%.o=%.d) -include $(OBJS_vulkan:%.o=%.d) +-include $(OBJS_web:%.o=%.d) # --------------------------------------------------------------------------------------------------------------------- diff --git a/distrho/DistrhoUI.hpp b/distrho/DistrhoUI.hpp index 14b3925ee..0fa2aa4d7 100644 --- a/distrho/DistrhoUI.hpp +++ b/distrho/DistrhoUI.hpp @@ -44,6 +44,9 @@ typedef DGL_NAMESPACE::CairoTopLevelWidget UIWidget; #elif DISTRHO_UI_USE_NANOVG # include "../dgl/NanoVG.hpp" typedef DGL_NAMESPACE::NanoTopLevelWidget UIWidget; +#elif DISTRHO_UI_USE_WEBVIEW +# include "../dgl/Web.hpp" +typedef DGL_NAMESPACE::WebViewWidget UIWidget; #else # include "../dgl/TopLevelWidget.hpp" typedef DGL_NAMESPACE::TopLevelWidget UIWidget; diff --git a/distrho/src/DistrhoPluginChecks.h b/distrho/src/DistrhoPluginChecks.h index 21a3dac6e..0f8703ab6 100644 --- a/distrho/src/DistrhoPluginChecks.h +++ b/distrho/src/DistrhoPluginChecks.h @@ -114,6 +114,10 @@ # define DISTRHO_UI_USE_NANOVG 0 #endif +#ifndef DISTRHO_UI_USE_WEBVIEW +# define DISTRHO_UI_USE_WEBVIEW 0 +#endif + // -------------------------------------------------------------------------------------------------------------------- // Define DISTRHO_PLUGIN_HAS_EMBED_UI if needed @@ -125,6 +129,14 @@ # endif #endif +// -------------------------------------------------------------------------------------------------------------------- +// Define DISTRHO_PLUGIN_WANT_WEBVIEW if needed + +#if DISTRHO_UI_USE_WEBVIEW && !DISTRHO_PLUGIN_WANT_WEBVIEW +# undef DISTRHO_PLUGIN_WANT_WEBVIEW +# define DISTRHO_PLUGIN_WANT_WEBVIEW 1 +#endif + // -------------------------------------------------------------------------------------------------------------------- // Define DISTRHO_UI_URI if needed diff --git a/tests/tests.hpp b/tests/tests.hpp index 334dd1fed..e114f22ef 100644 --- a/tests/tests.hpp +++ b/tests/tests.hpp @@ -1,6 +1,6 @@ /* * DISTRHO Plugin Framework (DPF) - * Copyright (C) 2012-2021 Filipe Coelho + * Copyright (C) 2012-2024 Filipe Coelho * * Permission to use, copy, modify, and/or distribute this software for any purpose with * or without fee is hereby granted, provided that the above copyright notice and this @@ -14,6 +14,8 @@ * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ +#pragma once + #include "dgl/Application.hpp" #include "distrho/extra/Thread.hpp"