From 5e6eee3607a8ed2d3d57f2397e24d215c6af092a Mon Sep 17 00:00:00 2001 From: falkTX Date: Sat, 5 Apr 2025 00:10:33 +0200 Subject: [PATCH] Cleanup, fix build Signed-off-by: falkTX --- CMakeLists.txt | 6 +-- Makefile | 1 + Makefile.plugins.mk | 2 +- cmake/DPF-plugin.cmake | 52 +++++++++++++++----- dgl/Base.hpp | 6 +-- dgl/WebView.hpp | 4 -- dgl/src/pugl.cpp | 2 +- distrho/DistrhoUIMain.cpp | 4 +- distrho/extra/WebView.hpp | 4 -- distrho/extra/WebViewImpl.hpp | 4 +- distrho/src/DistrhoPluginChecks.h | 6 ++- distrho/src/DistrhoPluginJACK.cpp | 4 +- distrho/src/DistrhoUIDSSI.cpp | 4 +- distrho/src/DistrhoUIPrivateData.hpp | 3 +- examples/EmbedExternalUI/DistrhoPluginInfo.h | 6 +-- 15 files changed, 66 insertions(+), 42 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 1cd8d96f..f276fc7f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -34,11 +34,11 @@ if(DPF_LIBRARIES) if(PKG_CONFIG_FOUND) pkg_check_modules(CAIRO "cairo") if(CAIRO_FOUND AND (NOT HAIKU)) - dpf__add_dgl_cairo(TRUE, TRUE) + dpf__add_dgl_cairo(TRUE, TRUE, TRUE) endif() endif() - dpf__add_dgl_external(TRUE) - dpf__add_dgl_opengl(TRUE, TRUE) + dpf__add_dgl_external(TRUE, TRUE) + dpf__add_dgl_opengl(TRUE, TRUE, TRUE) endif() if(DPF_EXAMPLES) diff --git a/Makefile b/Makefile index c43b389f..3b87e196 100644 --- a/Makefile +++ b/Makefile @@ -12,6 +12,7 @@ all: dgl examples gen # needed for some example plugins export USE_FILE_BROWSER = true +export USE_WEB_VIEW = true ifneq ($(CROSS_COMPILING),true) CAN_GENERATE_TTL = true diff --git a/Makefile.plugins.mk b/Makefile.plugins.mk index 7280f788..62af7189 100644 --- a/Makefile.plugins.mk +++ b/Makefile.plugins.mk @@ -287,7 +287,7 @@ HAVE_DGL = false endif endif -ifeq ($(HAVE_DGL)$(LINUX)$(USE_WEB_VIEW),truetruetrue) +ifeq ($(HAVE_DGL)$(LINUX)$(UI_TYPE),truetruewebview) DGL_LIB_SHARED = $(shell $(CC) -print-file-name=Scrt1.o) endif diff --git a/cmake/DPF-plugin.cmake b/cmake/DPF-plugin.cmake index d22dea7e..da75f18c 100644 --- a/cmake/DPF-plugin.cmake +++ b/cmake/DPF-plugin.cmake @@ -121,23 +121,33 @@ function(dpf_add_plugin NAME) set(_dgl_library) if(_dpf_plugin_FILES_UI) if(_dpf_plugin_UI_TYPE STREQUAL "cairo") - dpf__add_dgl_cairo($> $) + dpf__add_dgl_cairo($> + $ + $) set(_dgl_library dgl-cairo) elseif(_dpf_plugin_UI_TYPE STREQUAL "external") - dpf__add_dgl_external($) + dpf__add_dgl_external($ + $) set(_dgl_library dgl-external) elseif(_dpf_plugin_UI_TYPE STREQUAL "opengl") - dpf__add_dgl_opengl($> $) + dpf__add_dgl_opengl($> + $ + $) set(_dgl_library dgl-opengl) elseif(_dpf_plugin_UI_TYPE STREQUAL "opengl3") - dpf__add_dgl_opengl3($> $) + dpf__add_dgl_opengl3($> + $ + $) set(_dgl_library dgl-opengl3) elseif(_dpf_plugin_UI_TYPE STREQUAL "vulkan") - dpf__add_dgl_vulkan($> $) + dpf__add_dgl_vulkan($> + $ + $) set(_dgl_library dgl-vulkan) elseif(_dpf_plugin_UI_TYPE STREQUAL "webview") set(_dpf_plugin_USE_WEB_VIEW TRUE) - dpf__add_dgl_external($) + dpf__add_dgl_external($ + $) set(_dgl_library dgl-external) else() message(FATAL_ERROR "Unrecognized UI type for plugin: ${_dpf_plugin_UI_TYPE}") @@ -661,7 +671,7 @@ endfunction() # # Add the Cairo variant of DGL, if not already available. # -function(dpf__add_dgl_cairo SHARED_RESOURCES USE_FILE_BROWSER) +function(dpf__add_dgl_cairo SHARED_RESOURCES USE_FILE_BROWSER USE_WEB_VIEW) if(TARGET dgl-cairo) return() endif() @@ -710,6 +720,10 @@ function(dpf__add_dgl_cairo SHARED_RESOURCES USE_FILE_BROWSER) target_compile_definitions(dgl-cairo PUBLIC "DGL_USE_FILE_BROWSER") endif() + if(USE_WEB_VIEW) + target_compile_definitions(dgl-cairo PUBLIC "DGL_USE_FILE_BROWSER") + endif() + dpf__add_dgl_system_libs() target_link_libraries(dgl-cairo PRIVATE dgl-system-libs) @@ -730,7 +744,7 @@ endfunction() # # Add the external variant of DGL, if not already available. # -function(dpf__add_dgl_external USE_FILE_BROWSER) +function(dpf__add_dgl_external USE_FILE_BROWSER USE_WEB_VIEW) if(TARGET dgl-external) return() endif() @@ -770,6 +784,10 @@ function(dpf__add_dgl_external USE_FILE_BROWSER) target_compile_definitions(dgl-external PUBLIC "DGL_USE_FILE_BROWSER") endif() + if(USE_WEB_VIEW) + target_compile_definitions(dgl-external PUBLIC "DGL_USE_WEB_VIEW") + endif() + dpf__add_dgl_system_libs() target_compile_definitions(dgl-external PUBLIC "DGL_NO_SHARED_RESOURCES") target_link_libraries(dgl-external PRIVATE dgl-system-libs) @@ -786,7 +804,7 @@ endfunction() # # Add the OpenGL variant of DGL, if not already available. # -function(dpf__add_dgl_opengl SHARED_RESOURCES USE_FILE_BROWSER) +function(dpf__add_dgl_opengl SHARED_RESOURCES USE_FILE_BROWSER USE_WEB_VIEW) if(TARGET dgl-opengl) return() endif() @@ -841,6 +859,10 @@ function(dpf__add_dgl_opengl SHARED_RESOURCES USE_FILE_BROWSER) target_compile_definitions(dgl-opengl PUBLIC "DGL_USE_FILE_BROWSER") endif() + if(USE_WEB_VIEW) + target_compile_definitions(dgl-opengl PUBLIC "DGL_USE_WEB_VIEW") + endif() + dpf__add_dgl_system_libs() target_link_libraries(dgl-opengl PRIVATE dgl-system-libs) @@ -856,7 +878,7 @@ endfunction() # # Add the OpenGL3 variant of DGL, if not already available. # -function(dpf__add_dgl_opengl3 SHARED_RESOURCES USE_FILE_BROWSER) +function(dpf__add_dgl_opengl3 SHARED_RESOURCES USE_FILE_BROWSER USE_WEB_VIEW) if(TARGET dgl-opengl3) return() endif() @@ -911,6 +933,10 @@ function(dpf__add_dgl_opengl3 SHARED_RESOURCES USE_FILE_BROWSER) target_compile_definitions(dgl-opengl3 PUBLIC "DGL_USE_FILE_BROWSER") endif() + if(USE_WEB_VIEW) + target_compile_definitions(dgl-opengl3 PUBLIC "DGL_USE_WEB_VIEW") + endif() + dpf__add_dgl_system_libs() target_link_libraries(dgl-opengl3 PRIVATE dgl-system-libs) @@ -926,7 +952,7 @@ endfunction() # # Add the Vulkan variant of DGL, if not already available. # -function(dpf__add_dgl_vulkan SHARED_RESOURCES USE_FILE_BROWSER) +function(dpf__add_dgl_vulkan SHARED_RESOURCES USE_FILE_BROWSER USE_WEB_VIEW) if(TARGET dgl-vulkan) return() endif() @@ -976,6 +1002,10 @@ function(dpf__add_dgl_vulkan SHARED_RESOURCES USE_FILE_BROWSER) target_compile_definitions(dgl-vulkan PUBLIC "DGL_USE_FILE_BROWSER") endif() + if(USE_WEB_VIEW) + target_compile_definitions(dgl-vulkan PUBLIC "DGL_USE_WEB_VIEW") + endif() + dpf__add_dgl_system_libs() target_link_libraries(dgl-vulkan PRIVATE dgl-system-libs) diff --git a/dgl/Base.hpp b/dgl/Base.hpp index 51e77048..c60a7377 100644 --- a/dgl/Base.hpp +++ b/dgl/Base.hpp @@ -1,6 +1,6 @@ /* * DISTRHO Plugin Framework (DPF) - * Copyright (C) 2012-2024 Filipe Coelho + * Copyright (C) 2012-2025 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 @@ -41,8 +41,8 @@ # error typo detected use DGL_USE_FILE_BROWSER instead of DGL_USE_FILEBROWSER #endif -#ifdef DGL_UI_USE_WEBVIEW -# error typo detected use DGL_UI_USE_WEB_VIEW instead of DGL_UI_USE_WEBVIEW +#ifdef DGL_USE_WEBVIEW +# error typo detected use DGL_USE_WEB_VIEW instead of DGL_USE_WEBVIEW #endif #if defined(DGL_FILE_BROWSER_DISABLED) diff --git a/dgl/WebView.hpp b/dgl/WebView.hpp index 3fb04cce..2c84fafd 100644 --- a/dgl/WebView.hpp +++ b/dgl/WebView.hpp @@ -23,10 +23,6 @@ START_NAMESPACE_DGL #include "../distrho/extra/WebViewImpl.hpp" -#if defined(HAVE_X11) && defined(DISTRHO_OS_LINUX) -int dpf_webview_start(int argc, char* argv[]); -#endif - END_NAMESPACE_DGL #endif // DGL_WEB_VIEW_HPP_INCLUDED diff --git a/dgl/src/pugl.cpp b/dgl/src/pugl.cpp index 6ccd2aa6..1e557148 100644 --- a/dgl/src/pugl.cpp +++ b/dgl/src/pugl.cpp @@ -1,6 +1,6 @@ /* * DISTRHO Plugin Framework (DPF) - * Copyright (C) 2012-2024 Filipe Coelho + * Copyright (C) 2012-2025 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 diff --git a/distrho/DistrhoUIMain.cpp b/distrho/DistrhoUIMain.cpp index 5232fac6..216e0192 100644 --- a/distrho/DistrhoUIMain.cpp +++ b/distrho/DistrhoUIMain.cpp @@ -1,6 +1,6 @@ /* * DISTRHO Plugin Framework (DPF) - * Copyright (C) 2012-2024 Filipe Coelho + * Copyright (C) 2012-2025 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 @@ -66,7 +66,7 @@ # endif #endif -#if defined(HAVE_X11) && defined(DISTRHO_OS_LINUX) && DISTRHO_UI_WEB_VIEW && !DISTRHO_IS_STANDALONE +#if defined(DISTRHO_UI_LINUX_WEBVIEW_START) && !DISTRHO_IS_STANDALONE int main(int argc, char* argv[]) { return DISTRHO_NAMESPACE::dpf_webview_start(argc, argv); diff --git a/distrho/extra/WebView.hpp b/distrho/extra/WebView.hpp index de53c639..fdc65048 100644 --- a/distrho/extra/WebView.hpp +++ b/distrho/extra/WebView.hpp @@ -23,10 +23,6 @@ START_NAMESPACE_DISTRHO #include "WebViewImpl.hpp" -#if defined(HAVE_X11) && defined(DISTRHO_OS_LINUX) -int dpf_webview_start(int argc, char* argv[]); -#endif - END_NAMESPACE_DISTRHO #endif // DISTRHO_WEB_VIEW_HPP_INCLUDED diff --git a/distrho/extra/WebViewImpl.hpp b/distrho/extra/WebViewImpl.hpp index 75a3d27a..40a46dd3 100644 --- a/distrho/extra/WebViewImpl.hpp +++ b/distrho/extra/WebViewImpl.hpp @@ -1,6 +1,6 @@ /* * DISTRHO Plugin Framework (DPF) - * Copyright (C) 2012-2024 Filipe Coelho + * Copyright (C) 2012-2025 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 @@ -18,7 +18,7 @@ # error bad include #endif -#if !defined(DGL_UI_USE_WEB_VIEW) && defined(DISTRHO_UI_WEB_VIEW) && DISTRHO_UI_WEB_VIEW == 0 +#if !defined(DGL_USE_WEB_VIEW) && defined(DISTRHO_UI_WEB_VIEW) && DISTRHO_UI_WEB_VIEW == 0 # error To use WebViews in DPF plugins please set DISTRHO_UI_WEB_VIEW to 1 #endif diff --git a/distrho/src/DistrhoPluginChecks.h b/distrho/src/DistrhoPluginChecks.h index 478e339d..52dc9d76 100644 --- a/distrho/src/DistrhoPluginChecks.h +++ b/distrho/src/DistrhoPluginChecks.h @@ -1,6 +1,6 @@ /* * DISTRHO Plugin Framework (DPF) - * Copyright (C) 2012-2024 Filipe Coelho + * Copyright (C) 2012-2025 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 @@ -286,6 +286,10 @@ static_assert(sizeof(STRINGIFY(DISTRHO_PLUGIN_UNIQUE_ID)) == 5, "The macro DISTR # error DISTRHO_UI_IS_STANDALONE must not be defined #endif +#ifdef DISTRHO_UI_LINUX_WEBVIEW_START +# error DISTRHO_UI_LINUX_WEBVIEW_START must not be defined +#endif + // -------------------------------------------------------------------------------------------------------------------- #endif // DISTRHO_PLUGIN_CHECKS_H_INCLUDED diff --git a/distrho/src/DistrhoPluginJACK.cpp b/distrho/src/DistrhoPluginJACK.cpp index b3e82b09..8b8d2958 100644 --- a/distrho/src/DistrhoPluginJACK.cpp +++ b/distrho/src/DistrhoPluginJACK.cpp @@ -1,6 +1,6 @@ /* * DISTRHO Plugin Framework (DPF) - * Copyright (C) 2012-2024 Filipe Coelho + * Copyright (C) 2012-2025 Filipe Coelho * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -999,7 +999,7 @@ int main(int argc, char* argv[]) } #endif - #if defined(HAVE_X11) && defined(DISTRHO_OS_LINUX) && DISTRHO_UI_WEB_VIEW + #if defined(DISTRHO_UI_LINUX_WEBVIEW_START) if (argc >= 2 && std::strcmp(argv[1], "dpf-ld-linux-webview") == 0) return DISTRHO_NAMESPACE::dpf_webview_start(argc, argv); #endif diff --git a/distrho/src/DistrhoUIDSSI.cpp b/distrho/src/DistrhoUIDSSI.cpp index f2e7b292..2fa65d34 100644 --- a/distrho/src/DistrhoUIDSSI.cpp +++ b/distrho/src/DistrhoUIDSSI.cpp @@ -1,6 +1,6 @@ /* * DISTRHO Plugin Framework (DPF) - * Copyright (C) 2012-2024 Filipe Coelho + * Copyright (C) 2012-2025 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 @@ -387,7 +387,7 @@ int main(int argc, char* argv[]) { USE_NAMESPACE_DISTRHO - #if defined(HAVE_X11) && defined(DISTRHO_OS_LINUX) && DISTRHO_UI_WEB_VIEW + #if defined(DISTRHO_UI_LINUX_WEBVIEW_START) if (argc >= 2 && std::strcmp(argv[1], "dpf-ld-linux-webview") == 0) return DISTRHO_NAMESPACE::dpf_webview_start(argc, argv); #endif diff --git a/distrho/src/DistrhoUIPrivateData.hpp b/distrho/src/DistrhoUIPrivateData.hpp index b409eb37..416f0842 100644 --- a/distrho/src/DistrhoUIPrivateData.hpp +++ b/distrho/src/DistrhoUIPrivateData.hpp @@ -1,6 +1,6 @@ /* * DISTRHO Plugin Framework (DPF) - * Copyright (C) 2012-2024 Filipe Coelho + * Copyright (C) 2012-2025 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 @@ -63,6 +63,7 @@ START_NAMESPACE_DISTRHO /* define webview start */ #if defined(HAVE_X11) && defined(DISTRHO_OS_LINUX) && DISTRHO_UI_WEB_VIEW +# define DISTRHO_UI_LINUX_WEBVIEW_START int dpf_webview_start(int argc, char* argv[]); #endif diff --git a/examples/EmbedExternalUI/DistrhoPluginInfo.h b/examples/EmbedExternalUI/DistrhoPluginInfo.h index 80b0c6a8..620faa5e 100644 --- a/examples/EmbedExternalUI/DistrhoPluginInfo.h +++ b/examples/EmbedExternalUI/DistrhoPluginInfo.h @@ -1,6 +1,6 @@ /* * DISTRHO Plugin Framework (DPF) - * Copyright (C) 2012-2024 Filipe Coelho + * Copyright (C) 2012-2025 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 @@ -33,10 +33,6 @@ #define DISTRHO_UI_DEFAULT_WIDTH 768 #define DISTRHO_UI_DEFAULT_HEIGHT 512 -// #ifdef _WIN32 -// #define WEB_VIEW_USING_CHOC 1 -// #endif - enum Parameters { kParameterWidth = 0, kParameterHeight,