Skip to content

Commit 4238e1c

Browse files
committed
Merge branch 'develop'
2 parents d47aaad + bb5c311 commit 4238e1c

27 files changed

+350
-204
lines changed

.github/workflows/cmake.yml

Lines changed: 32 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,6 @@ on:
88
branches:
99
- '*'
1010

11-
env:
12-
BUILD_TYPE: Release
13-
1411
jobs:
1512
ubuntu-22-04:
1613
strategy:
@@ -87,78 +84,61 @@ jobs:
8784
suffix: _15
8885
target: ${{ matrix.target }}
8986

90-
cmake_win32:
87+
msvc-win32:
9188
runs-on: windows-2022
9289
steps:
93-
- name: Set environment
90+
- uses: actions/checkout@v4
91+
with:
92+
submodules: recursive
93+
- name: Configure
9494
run: |
95-
echo "release_arch=Win32" >> "${Env:GITHUB_ENV}"
96-
echo "vcpkg_triplet=x86-windows-static" >> "${Env:GITHUB_ENV}"
97-
echo "vcpkg_git_commit_id=a3db16a4475b963cacf0260068c497fb72c8f3c0" >> "${Env:GITHUB_ENV}"
98-
- name: Restore from cache and install vcpkg
99-
uses: lukka/run-vcpkg@v6
95+
cmake -S . -B build -G"Visual Studio 17 2022" -A"Win32" -DCMAKE_BUILD_TYPE="Release"
96+
- name: Build
97+
run: cmake --build build --config "Release" -j 2
98+
- name: Show built files
99+
working-directory: build/bin
100+
run: tree
101+
- uses: actions/upload-artifact@v4
100102
with:
101-
setupOnly: true
102-
vcpkgTriplet: ${{env.vcpkg_triplet}}
103-
vcpkgGitCommitId: ${{env.vcpkg_git_commit_id}}
104-
#- name: Install packages
105-
# run: |
106-
# & "${Env:VCPKG_ROOT}/vcpkg" install "cairo:${Env:vcpkg_triplet}"
103+
name: msvc-win32
104+
path: build/bin/
105+
106+
msvc-win64:
107+
runs-on: windows-2022
108+
steps:
107109
- uses: actions/checkout@v4
108110
with:
109111
submodules: recursive
110-
- name: Create Build Environment
111-
working-directory: ${{runner.workspace}}
112-
run: cmake -E make_directory build
113112
- name: Configure CMake
114-
working-directory: ${{runner.workspace}}/build
115113
run: |
116-
cmake "${Env:GITHUB_WORKSPACE}" -G"Visual Studio 17 2022" -A"${Env:release_arch}" -DCMAKE_BUILD_TYPE="${Env:BUILD_TYPE}" -DVCPKG_TARGET_TRIPLET="${Env:vcpkg_triplet}" -DCMAKE_TOOLCHAIN_FILE="${Env:VCPKG_INSTALLATION_ROOT}/scripts/buildsystems/vcpkg.cmake"
114+
cmake -S . -B build -G"Visual Studio 17 2022" -A"x64" -DCMAKE_BUILD_TYPE="Release"
117115
- name: Build all
118-
working-directory: ${{runner.workspace}}/build
119-
run: cmake --build . --config "${Env:BUILD_TYPE}" -j 2
116+
working-directory: build
117+
run: cmake --build . --config "Release" -j 2
120118
- name: Show built files
121-
working-directory: ${{runner.workspace}}/build/bin
119+
working-directory: build/bin
122120
run: tree
123121
- uses: actions/upload-artifact@v4
124122
with:
125-
name: Win32 artifacts
126-
path: ${{runner.workspace}}/build/bin/
123+
name: msvc-win64
124+
path: build/bin/
127125

128-
cmake_win64:
129-
runs-on: windows-2022
126+
msvc-arm64:
127+
runs-on: windows-11-arm
130128
steps:
131-
- name: Set environment
132-
run: |
133-
echo "release_arch=x64" >> "${Env:GITHUB_ENV}"
134-
echo "vcpkg_triplet=x64-windows-static" >> "${Env:GITHUB_ENV}"
135-
echo "vcpkg_git_commit_id=a3db16a4475b963cacf0260068c497fb72c8f3c0" >> "${Env:GITHUB_ENV}"
136-
- name: Restore from cache and install vcpkg
137-
uses: lukka/run-vcpkg@v6
138-
with:
139-
setupOnly: true
140-
vcpkgTriplet: ${{env.vcpkg_triplet}}
141-
vcpkgGitCommitId: ${{env.vcpkg_git_commit_id}}
142-
#- name: Install packages
143-
# run: |
144-
# & "${Env:VCPKG_ROOT}/vcpkg" install "cairo:${Env:vcpkg_triplet}"
145129
- uses: actions/checkout@v4
146130
with:
147131
submodules: recursive
148-
- name: Create Build Environment
149-
working-directory: ${{runner.workspace}}
150-
run: cmake -E make_directory build
151132
- name: Configure CMake
152-
working-directory: ${{runner.workspace}}/build
153133
run: |
154-
cmake "${Env:GITHUB_WORKSPACE}" -G"Visual Studio 17 2022" -A"${Env:release_arch}" -DCMAKE_BUILD_TYPE="${Env:BUILD_TYPE}" -DVCPKG_TARGET_TRIPLET="${Env:vcpkg_triplet}" -DCMAKE_TOOLCHAIN_FILE="${Env:VCPKG_INSTALLATION_ROOT}/scripts/buildsystems/vcpkg.cmake"
134+
cmake -S . -B build -G"Visual Studio 17 2022" -A"ARM64" -DCMAKE_BUILD_TYPE="Release"
155135
- name: Build all
156-
working-directory: ${{runner.workspace}}/build
157-
run: cmake --build . --config "${Env:BUILD_TYPE}" -j 2
136+
working-directory: build
137+
run: cmake --build . --config "Release" -j 2
158138
- name: Show built files
159-
working-directory: ${{runner.workspace}}/build/bin
139+
working-directory: build/bin
160140
run: tree
161141
- uses: actions/upload-artifact@v4
162142
with:
163-
name: Win64 artifacts
164-
path: ${{runner.workspace}}/build/bin/
143+
name: msvc-arm64
144+
path: build/bin/

Makefile.base.mk

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -668,13 +668,9 @@ endif
668668

669669
ifeq ($(USE_GLES2),true)
670670
BUILD_CXX_FLAGS += -DDGL_USE_OPENGL3 -DDGL_USE_GLES -DDGL_USE_GLES2
671-
endif
672-
673-
ifeq ($(USE_GLES3),true)
671+
else ifeq ($(USE_GLES3),true)
674672
BUILD_CXX_FLAGS += -DDGL_USE_OPENGL3 -DDGL_USE_GLES -DDGL_USE_GLES3
675-
endif
676-
677-
ifeq ($(USE_OPENGL3),true)
673+
else ifeq ($(USE_OPENGL3),true)
678674
BUILD_CXX_FLAGS += -DDGL_USE_OPENGL3
679675
endif
680676

Makefile.plugins.mk

Lines changed: 20 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -205,8 +205,12 @@ UI_TYPE = none
205205
endif
206206

207207
ifeq ($(UI_TYPE),)
208+
ifeq ($(WASM),true)
209+
UI_TYPE = gles2
210+
else
208211
UI_TYPE = opengl
209212
endif
213+
endif
210214

211215
ifeq ($(UI_TYPE),generic)
212216
ifeq ($(HAVE_OPENGL),true)
@@ -315,7 +319,7 @@ HAVE_DGL = false
315319
endif
316320
endif
317321

318-
ifeq ($(HAVE_DGL)$(LINUX)$(UI_TYPE),truetruewebview)
322+
ifeq ($(HAVE_DGL)$(LINUX)$(USE_WEB_VIEW),truetruetrue)
319323
DGL_LIB_SHARED = $(shell $(CC) -print-file-name=Scrt1.o)
320324
endif
321325

@@ -368,6 +372,18 @@ ifeq ($(WINDOWS)$(HAVE_DGL),truetrue)
368372
JACK_LIBS += -Wl,-subsystem,windows
369373
endif
370374

375+
ifeq ($(WASM),true)
376+
MAPI_EXT = -mapi.js
377+
MAPI_SHARED = \
378+
-sEXPORT_NAME="$(MAPI_MODULE_NAME)" \
379+
-sEXPORTED_RUNTIME_METHODS=['addFunction','lengthBytesUTF8','stringToUTF8','UTF8ToString'] \
380+
-sMAIN_MODULE=2 \
381+
-sMODULARIZE=1
382+
else
383+
MAPI_EXT = $(LIB_EXT)
384+
MAPI_SHARED = $(SHARED)
385+
endif
386+
371387
ifeq ($(MACOS_APP_BUNDLE),true)
372388
jack = $(TARGET_DIR)/$(NAME).app/Contents/MacOS/$(NAME)
373389
jackfiles = $(TARGET_DIR)/$(NAME).app/Contents/Info.plist
@@ -382,7 +398,7 @@ ladspa_dsp = $(TARGET_DIR)/$(NAME)-ladspa$(LIB_EXT)
382398
lv2 = $(TARGET_DIR)/$(NAME).lv2/$(NAME)$(LIB_EXT)
383399
lv2_dsp = $(TARGET_DIR)/$(NAME).lv2/$(NAME)_dsp$(LIB_EXT)
384400
lv2_ui = $(TARGET_DIR)/$(NAME).lv2/$(NAME)_ui$(LIB_EXT)
385-
mapi = $(TARGET_DIR)/$(NAME)$(LIB_EXT)
401+
mapi = $(TARGET_DIR)/$(NAME)$(MAPI_EXT)
386402
static = $(TARGET_DIR)/$(NAME).a
387403
vst2 = $(TARGET_DIR)/$(VST2_FILENAME)
388404
ifneq ($(VST3_FILENAME),)
@@ -434,7 +450,7 @@ SYMBOLS_LADSPA = -sEXPORTED_FUNCTIONS="['ladspa_descriptor']"
434450
SYMBOLS_LV2 = -sEXPORTED_FUNCTIONS="['lv2_descriptor','lv2_generate_ttl','lv2ui_descriptor']"
435451
SYMBOLS_LV2DSP = -sEXPORTED_FUNCTIONS="['lv2_descriptor','lv2_generate_ttl']"
436452
SYMBOLS_LV2UI = -sEXPORTED_FUNCTIONS="['lv2ui_descriptor']"
437-
SYMBOLS_MAPI = -sEXPORTED_FUNCTIONS="['mapi_create','mapi_process','mapi_set_parameter','mapi_set_state','mapi_destroy']"
453+
SYMBOLS_MAPI = -sEXPORTED_FUNCTIONS="['_mapi_create','_mapi_process','_mapi_set_parameter','_mapi_set_state','_mapi_destroy']"
438454
SYMBOLS_VST2 = -sEXPORTED_FUNCTIONS="['VSTPluginMain']"
439455
SYMBOLS_VST3 = -sEXPORTED_FUNCTIONS="['GetPluginFactory','ModuleEntry','ModuleExit']"
440456
else ifeq ($(WINDOWS),true)
@@ -823,7 +839,7 @@ mapi: $(mapi)
823839
$(mapi): $(OBJS_DSP) $(BUILD_DIR)/DistrhoPluginMain_MAPI.cpp.o
824840
-@mkdir -p $(shell dirname $@)
825841
@echo "Creating MAPI for $(NAME)"
826-
$(SILENT)$(CXX) $^ $(BUILD_CXX_FLAGS) $(LINK_FLAGS) $(EXTRA_LIBS) $(EXTRA_DSP_LIBS) $(EXTRA_UI_LIBS) $(DGL_LIBS) $(SHARED) $(SYMBOLS_MAPI) -o $@
842+
$(SILENT)$(CXX) $^ $(BUILD_CXX_FLAGS) $(LINK_FLAGS) $(EXTRA_LIBS) $(EXTRA_DSP_LIBS) $(EXTRA_UI_LIBS) $(DGL_LIBS) $(MAPI_SHARED) $(SYMBOLS_MAPI) -o $@
827843

828844
# ---------------------------------------------------------------------------------------------------------------------
829845
# Export

cmake/DPF-plugin.cmake

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -582,6 +582,10 @@ function(dpf__build_lv2 NAME HAS_UI MONOLITHIC EXTRA_UI_LINK_OPTS)
582582
OUTPUT_NAME "${NAME}_dsp"
583583
PREFIX "")
584584

585+
# helper property for custom outside handling
586+
set_target_properties("${NAME}" PROPERTIES
587+
LV2_BUNDLE "${PROJECT_BINARY_DIR}/bin/${NAME}.lv2")
588+
585589
if(HAS_UI)
586590
if(MONOLITHIC)
587591
dpf__add_ui_main("${NAME}-lv2" "lv2" "${HAS_UI}")
@@ -674,8 +678,15 @@ function(dpf__determine_vst3_package_architecture OUTPUT_VARIABLE)
674678
endif()
675679

676680
# transform the processor name to a format that VST3 recognizes
681+
# see https://steinbergmedia.github.io/vst3_dev_portal/pages/Technical+Documentation/Locations+Format/Plugin+Format.html
677682
if(vst3_system_arch MATCHES "^(x86_64|amd64|AMD64|x64|X64)$")
678683
set(vst3_package_arch "x86_64")
684+
elseif(vst3_system_arch MATCHES "^(ARM)$")
685+
set(vst3_package_arch "arm")
686+
elseif(vst3_system_arch MATCHES "^(ARM64)$")
687+
set(vst3_package_arch "arm64")
688+
elseif(vst3_system_arch MATCHES "^(ARM64EC)$")
689+
set(vst3_package_arch "arm64x")
679690
elseif(vst3_system_arch MATCHES "^(i.86|x86|X86)$")
680691
if(WIN32)
681692
set(vst3_package_arch "x86")

dgl/Application.hpp

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,10 +83,21 @@ BUILD_CONFIG_SENTINEL(fail_to_link_is_mismatch_dgl_no_shared_resources_off)
8383
class DISTRHO_API Application
8484
{
8585
public:
86+
/**
87+
Type of application to setup, either "classic" or "modern".
88+
89+
What this means depends on the OS.
90+
*/
91+
enum Type {
92+
kTypeAuto,
93+
kTypeClassic,
94+
kTypeModern,
95+
};
96+
8697
/**
8798
Constructor for standalone or plugin application.
8899
*/
89-
Application(bool isStandalone = true);
100+
Application(bool isStandalone = true, Type type = kTypeAuto);
90101

91102
/**
92103
Constructor for a standalone application.
@@ -141,6 +152,12 @@ class DISTRHO_API Application
141152
*/
142153
double getTime() const;
143154

155+
/**
156+
Return the application type, either kTypeClassic or kTypeModern.
157+
This function never return kTypeAuto.
158+
*/
159+
Type getType() const noexcept;
160+
144161
/**
145162
Add a callback function to be triggered on every idle cycle.
146163
You can add more than one, and remove them at anytime with removeIdleCallback().

dgl/Makefile

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -171,8 +171,13 @@ all: $(TARGETS)
171171
cairo: $(BUILD_DIR)/libdgl-cairo.a
172172
gles2: $(BUILD_DIR)/libdgl-gles2.a
173173
gles3: $(BUILD_DIR)/libdgl-gles3.a
174+
ifeq ($(WASM),true)
175+
opengl: gles2
176+
opengl3: gles3
177+
else
174178
opengl: $(BUILD_DIR)/libdgl-opengl.a
175179
opengl3: $(BUILD_DIR)/libdgl-opengl3.a
180+
endif
176181
stub: $(BUILD_DIR)/libdgl-stub.a
177182
vulkan: $(BUILD_DIR)/libdgl-vulkan.a
178183
web: $(BUILD_DIR)/libdgl-web.a

dgl/OpenGL.hpp

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -249,6 +249,18 @@ class OpenGLImage : public ImageBase
249249
*/
250250
void drawAt(const GraphicsContext& context, const Point<int>& pos) override;
251251

252+
#ifdef DGL_USE_GLES
253+
/**
254+
Get the image format.
255+
*/
256+
ImageFormat getFormat() const noexcept;
257+
258+
/**
259+
Get the raw image data.
260+
*/
261+
const char* getRawData() const noexcept;
262+
#endif
263+
252264
/**
253265
TODO document this.
254266
*/
@@ -312,6 +324,10 @@ class OpenGLImage : public ImageBase
312324
bool setupCalled;
313325
bool textureInit;
314326
GLuint textureId;
327+
#ifdef DGL_USE_GLES
328+
mutable char* convertedData;
329+
mutable const char* rawDataLast;
330+
#endif
315331
};
316332

317333
// --------------------------------------------------------------------------------------------------------------------

dgl/src/Application.cpp

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -98,8 +98,8 @@ static void app_idle(void* const app)
9898
}
9999
#endif
100100

101-
Application::Application(const bool isStandalone)
102-
: pData(new PrivateData(isStandalone))
101+
Application::Application(const bool isStandalone, const Type type)
102+
: pData(new PrivateData(isStandalone, type))
103103
{
104104
// build config sentinels
105105
#ifdef DPF_DEBUG
@@ -126,7 +126,7 @@ Application::Application(const bool isStandalone)
126126
}
127127

128128
Application::Application(int argc, char* argv[])
129-
: pData(new PrivateData(true))
129+
: pData(new PrivateData(true, kTypeAuto))
130130
{
131131
#if defined(HAVE_X11) && defined(DISTRHO_OS_LINUX) && defined(DGL_USE_WEB_VIEW)
132132
if (argc >= 2 && std::strcmp(argv[1], "dpf-ld-linux-webview") == 0)
@@ -213,6 +213,11 @@ double Application::getTime() const
213213
return pData->getTime();
214214
}
215215

216+
Application::Type Application::getType() const noexcept
217+
{
218+
return pData->isModern ? kTypeModern : kTypeClassic;
219+
}
220+
216221
void Application::addIdleCallback(IdleCallback* const callback)
217222
{
218223
DISTRHO_SAFE_ASSERT_RETURN(callback != nullptr,)

dgl/src/ApplicationPrivateData.cpp

Lines changed: 5 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/*
22
* DISTRHO Plugin Framework (DPF)
3-
* Copyright (C) 2012-2024 Filipe Coelho <falktx@falktx.com>
3+
* Copyright (C) 2012-2025 Filipe Coelho <falktx@falktx.com>
44
*
55
* Permission to use, copy, modify, and/or distribute this software for any purpose with
66
* or without fee is hereby granted, provided that the above copyright notice and this
@@ -53,13 +53,14 @@ const char* Application::getClassName() const noexcept
5353

5454
// --------------------------------------------------------------------------------------------------------------------
5555

56-
Application::PrivateData::PrivateData(const bool standalone)
56+
Application::PrivateData::PrivateData(const bool standalone, const Type type)
5757
: world(puglNewWorld(standalone ? PUGL_PROGRAM : PUGL_MODULE,
58-
standalone ? PUGL_WORLD_THREADS : 0x0)),
58+
(standalone ? PUGL_WORLD_THREADS : 0))),
59+
isModern(false),
5960
isStandalone(standalone),
61+
isStarting(true),
6062
isQuitting(false),
6163
isQuittingInNextCycle(false),
62-
isStarting(true),
6364
needsRepaint(false),
6465
visibleWindows(0),
6566
mainThreadHandle(getCurrentThreadHandle()),
@@ -68,16 +69,11 @@ Application::PrivateData::PrivateData(const bool standalone)
6869
{
6970
DISTRHO_SAFE_ASSERT_RETURN(world != nullptr,);
7071

71-
#ifdef DGL_USING_SDL
72-
SDL_Init(SDL_INIT_EVENTS|SDL_INIT_TIMER|SDL_INIT_VIDEO);
73-
#else
74-
puglSetWorldHandle(world, this);
7572
#ifdef __EMSCRIPTEN__
7673
puglSetWorldString(world, PUGL_CLASS_NAME, "canvas");
7774
#else
7875
puglSetWorldString(world, PUGL_CLASS_NAME, DISTRHO_MACRO_AS_STRING(DGL_NAMESPACE));
7976
#endif
80-
#endif
8177
}
8278

8379
Application::PrivateData::~PrivateData()
@@ -88,12 +84,8 @@ Application::PrivateData::~PrivateData()
8884
windows.clear();
8985
idleCallbacks.clear();
9086

91-
#ifdef DGL_USING_SDL
92-
SDL_Quit();
93-
#else
9487
if (world != nullptr)
9588
puglFreeWorld(world);
96-
#endif
9789
}
9890

9991
// --------------------------------------------------------------------------------------------------------------------

0 commit comments

Comments
 (0)