Allow building for platforms without VST3 UI, add wasm CI test
Signed-off-by: falkTX <falktx@falktx.com>
This commit is contained in:
parent
ad7def4bd0
commit
9c1cad5387
|
@ -51,3 +51,36 @@ jobs:
|
|||
run: make -j $(nproc)
|
||||
- name: make posix32
|
||||
run: make posix32 -j $(nproc)
|
||||
|
||||
wasm:
|
||||
runs-on: ubuntu-22.04
|
||||
env:
|
||||
EMSCRIPTEN_VERSION: 3.1.27
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
with:
|
||||
submodules: recursive
|
||||
- name: Set up cache
|
||||
id: cache
|
||||
uses: actions/cache@v3
|
||||
with:
|
||||
path: |
|
||||
~/emsdk
|
||||
key: emsdk-v1
|
||||
- name: Set up dependencies
|
||||
run: |
|
||||
[ -d ~/emsdk ] || git clone https://github.com/emscripten-core/emsdk.git ~/emsdk
|
||||
cd ~/emsdk && ./emsdk install ${{ env.EMSCRIPTEN_VERSION }} && ./emsdk activate ${{ env.EMSCRIPTEN_VERSION }}
|
||||
- name: make
|
||||
env:
|
||||
AR: emar
|
||||
CC: emcc
|
||||
CXX: em++
|
||||
NM: emnm
|
||||
RANLIB: emranlib
|
||||
STRIP: emstrip
|
||||
PKG_CONFIG: false
|
||||
run: |
|
||||
source ~/emsdk/emsdk_env.sh
|
||||
make features
|
||||
make -j $(nproc)
|
||||
|
|
8
Makefile
8
Makefile
|
@ -29,7 +29,13 @@ VERSION := 2.6.0-alpha1
|
|||
|
||||
# ---------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
all: backend discovery bridges-plugin bridges-ui frontend interposer libjack plugin theme
|
||||
TARGETS = backend discovery bridges-ui frontend theme
|
||||
|
||||
ifneq ($(WASM),true)
|
||||
TARGETS += bridges-plugin interposer libjack plugin
|
||||
endif
|
||||
|
||||
all: $(TARGETS)
|
||||
|
||||
# ---------------------------------------------------------------------------------------------------------------------
|
||||
# Binaries (native)
|
||||
|
|
|
@ -1163,7 +1163,13 @@ public:
|
|||
#elif defined(HAVE_X11)
|
||||
fUI.window = CarlaPluginUI::newX11(this, opts.frontendWinId, opts.pluginsAreStandalone, resizable, false);
|
||||
#else
|
||||
#error why is CLAP_WINDOW_API_NATIVE defined??
|
||||
pData->engine->callback(true, true,
|
||||
ENGINE_CALLBACK_UI_STATE_CHANGED,
|
||||
pData->id,
|
||||
-1,
|
||||
0, 0, 0.0f,
|
||||
"Unsupported UI type");
|
||||
return;
|
||||
#endif
|
||||
|
||||
#ifndef CARLA_OS_MAC
|
||||
|
|
|
@ -40,7 +40,7 @@
|
|||
#include "water/files/File.h"
|
||||
#include "water/misc/Time.h"
|
||||
|
||||
#ifdef _POSIX_VERSION
|
||||
#if defined(V3_VIEW_PLATFORM_TYPE_NATIVE) && defined(_POSIX_VERSION)
|
||||
# ifdef CARLA_OS_LINUX
|
||||
# define CARLA_VST3_POSIX_EPOLL
|
||||
# include <sys/epoll.h>
|
||||
|
@ -97,11 +97,15 @@ void strncpy_utf8(char* const dst, const int16_t* const src, const size_t length
|
|||
|
||||
struct v3HostCallback {
|
||||
virtual ~v3HostCallback() {}
|
||||
// v3_component_handler
|
||||
virtual v3_result v3BeginEdit(v3_param_id) = 0;
|
||||
virtual v3_result v3PerformEdit(v3_param_id, double) = 0;
|
||||
virtual v3_result v3EndEdit(v3_param_id) = 0;
|
||||
virtual v3_result v3RestartComponent(int32_t) = 0;
|
||||
#ifdef V3_VIEW_PLATFORM_TYPE_NATIVE
|
||||
// v3_plugin_frame
|
||||
virtual v3_result v3ResizeView(struct v3_plugin_view**, struct v3_view_rect*) = 0;
|
||||
#endif
|
||||
};
|
||||
|
||||
// --------------------------------------------------------------------------------------------------------------------
|
||||
|
@ -926,6 +930,7 @@ private:
|
|||
|
||||
// --------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
#ifdef V3_VIEW_PLATFORM_TYPE_NATIVE
|
||||
struct HostTimer {
|
||||
v3_timer_handler** handler;
|
||||
uint64_t periodInMs;
|
||||
|
@ -1050,6 +1055,7 @@ private:
|
|||
CARLA_DECLARE_NON_COPYABLE(carla_v3_run_loop)
|
||||
CARLA_PREVENT_HEAP_ALLOCATION
|
||||
};
|
||||
#endif // V3_VIEW_PLATFORM_TYPE_NATIVE
|
||||
|
||||
// --------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
|
@ -1116,6 +1122,7 @@ private:
|
|||
|
||||
// --------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
#ifdef V3_VIEW_PLATFORM_TYPE_NATIVE
|
||||
struct carla_v3_plugin_frame : v3_plugin_frame_cpp {
|
||||
v3HostCallback* const callback;
|
||||
carla_v3_run_loop loop;
|
||||
|
@ -1159,11 +1166,14 @@ private:
|
|||
CARLA_DECLARE_NON_COPYABLE(carla_v3_plugin_frame)
|
||||
CARLA_PREVENT_HEAP_ALLOCATION
|
||||
};
|
||||
#endif
|
||||
|
||||
// --------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
class CarlaPluginVST3 : public CarlaPlugin,
|
||||
#ifdef V3_VIEW_PLATFORM_TYPE_NATIVE
|
||||
private CarlaPluginUI::Callback,
|
||||
#endif
|
||||
private v3HostCallback
|
||||
{
|
||||
public:
|
||||
|
@ -1181,12 +1191,13 @@ public:
|
|||
fV3ApplicationPtr(&fV3Application),
|
||||
fComponentHandler(this),
|
||||
fComponentHandlerPtr(&fComponentHandler),
|
||||
#ifdef V3_VIEW_PLATFORM_TYPE_NATIVE
|
||||
fPluginFrame(this),
|
||||
fPluginFramePtr(&fPluginFrame),
|
||||
#endif
|
||||
fV3ClassInfo(),
|
||||
fV3(),
|
||||
fEvents(),
|
||||
fUI()
|
||||
fEvents()
|
||||
{
|
||||
carla_debug("CarlaPluginVST3::CarlaPluginVST3(%p, %i)", engine, id);
|
||||
|
||||
|
@ -1199,6 +1210,7 @@ public:
|
|||
|
||||
runIdleCallbacksAsNeeded(false);
|
||||
|
||||
#ifdef V3_VIEW_PLATFORM_TYPE_NATIVE
|
||||
fPluginFrame.loop.timers.clear();
|
||||
#ifdef _POSIX_VERSION
|
||||
fPluginFrame.loop.posixfds.clear();
|
||||
|
@ -1223,6 +1235,7 @@ public:
|
|||
v3_cpp_obj_unref(fV3.view);
|
||||
fV3.view = nullptr;
|
||||
}
|
||||
#endif
|
||||
|
||||
pData->singleMutex.lock();
|
||||
pData->masterMutex.lock();
|
||||
|
@ -1583,6 +1596,7 @@ public:
|
|||
// ----------------------------------------------------------------------------------------------------------------
|
||||
// Set ui stuff
|
||||
|
||||
#ifdef V3_VIEW_PLATFORM_TYPE_NATIVE
|
||||
void setCustomUITitle(const char* const title) noexcept override
|
||||
{
|
||||
if (fUI.window != nullptr)
|
||||
|
@ -1799,6 +1813,7 @@ public:
|
|||
|
||||
return nullptr;
|
||||
}
|
||||
#endif // V3_VIEW_PLATFORM_TYPE_NATIVE
|
||||
|
||||
void runIdleCallbacksAsNeeded(const bool isIdleCallback)
|
||||
{
|
||||
|
@ -1810,6 +1825,7 @@ public:
|
|||
|
||||
fRestartFlags = flags;
|
||||
|
||||
#ifdef V3_VIEW_PLATFORM_TYPE_NATIVE
|
||||
#ifdef _POSIX_VERSION
|
||||
LinkedList<HostPosixFileDescriptor>& posixfds(fPluginFrame.loop.posixfds);
|
||||
|
||||
|
@ -1852,7 +1868,7 @@ public:
|
|||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
#endif // _POSIX_VERSION
|
||||
|
||||
LinkedList<HostTimer>& timers(fPluginFrame.loop.timers);
|
||||
|
||||
|
@ -1870,6 +1886,7 @@ public:
|
|||
}
|
||||
}
|
||||
}
|
||||
#endif // V3_VIEW_PLATFORM_TYPE_NATIVE
|
||||
}
|
||||
|
||||
void idle() override
|
||||
|
@ -1885,6 +1902,7 @@ public:
|
|||
if (!kEngineHasIdleOnMainThread)
|
||||
runIdleCallbacksAsNeeded(true);
|
||||
|
||||
#ifdef V3_VIEW_PLATFORM_TYPE_NATIVE
|
||||
if (fUI.window != nullptr)
|
||||
fUI.window->idle();
|
||||
|
||||
|
@ -1905,6 +1923,7 @@ public:
|
|||
fUI.isResizingFromPlugin = false;
|
||||
carla_stdout("Plugin resize stopped");
|
||||
}
|
||||
#endif
|
||||
|
||||
CarlaPlugin::uiIdle();
|
||||
}
|
||||
|
@ -2285,6 +2304,7 @@ public:
|
|||
if (v3category == PLUGIN_CATEGORY_SYNTH)
|
||||
pData->hints |= PLUGIN_IS_SYNTH;
|
||||
|
||||
#ifdef V3_VIEW_PLATFORM_TYPE_NATIVE
|
||||
if (fV3.view != nullptr &&
|
||||
v3_cpp_obj(fV3.view)->is_platform_type_supported(fV3.view, V3_VIEW_PLATFORM_TYPE_NATIVE) == V3_TRUE)
|
||||
{
|
||||
|
@ -2292,6 +2312,7 @@ public:
|
|||
pData->hints |= PLUGIN_HAS_CUSTOM_EMBED_UI;
|
||||
pData->hints |= PLUGIN_NEEDS_UI_MAIN_THREAD;
|
||||
}
|
||||
#endif
|
||||
|
||||
if (aOuts > 0 && (aIns == aOuts || aIns == 1))
|
||||
pData->hints |= PLUGIN_CAN_DRYWET;
|
||||
|
@ -3450,6 +3471,7 @@ protected:
|
|||
return V3_OK;
|
||||
}
|
||||
|
||||
#ifdef V3_VIEW_PLATFORM_TYPE_NATIVE
|
||||
v3_result v3ResizeView(struct v3_plugin_view** const view, struct v3_view_rect* const rect) override
|
||||
{
|
||||
CARLA_SAFE_ASSERT_RETURN(fV3.view != nullptr, V3_INVALID_ARG);
|
||||
|
@ -3556,6 +3578,7 @@ protected:
|
|||
}
|
||||
}
|
||||
}
|
||||
#endif // V3_VIEW_PLATFORM_TYPE_NATIVE
|
||||
|
||||
private:
|
||||
#ifdef CARLA_OS_MAC
|
||||
|
@ -3576,8 +3599,10 @@ private:
|
|||
carla_v3_component_handler fComponentHandler;
|
||||
carla_v3_component_handler* const fComponentHandlerPtr;
|
||||
|
||||
#ifdef V3_VIEW_PLATFORM_TYPE_NATIVE
|
||||
carla_v3_plugin_frame fPluginFrame;
|
||||
carla_v3_plugin_frame* const fPluginFramePtr;
|
||||
#endif
|
||||
|
||||
// v3_class_info_2 is ABI compatible with v3_class_info
|
||||
union ClassInfo {
|
||||
|
@ -3595,7 +3620,9 @@ private:
|
|||
v3_audio_processor** processor;
|
||||
v3_connection_point** connComponent;
|
||||
v3_connection_point** connController;
|
||||
#ifdef V3_VIEW_PLATFORM_TYPE_NATIVE
|
||||
v3_plugin_view** view;
|
||||
#endif
|
||||
bool shouldTerminateComponent;
|
||||
bool shouldTerminateController;
|
||||
|
||||
|
@ -3609,7 +3636,9 @@ private:
|
|||
processor(nullptr),
|
||||
connComponent(nullptr),
|
||||
connController(nullptr),
|
||||
#ifdef V3_VIEW_PLATFORM_TYPE_NATIVE
|
||||
view(nullptr),
|
||||
#endif
|
||||
shouldTerminateComponent(false),
|
||||
shouldTerminateController(false) {}
|
||||
|
||||
|
@ -3746,17 +3775,21 @@ private:
|
|||
v3_cpp_obj(connController)->connect(connController, connComponent);
|
||||
}
|
||||
|
||||
#ifdef V3_VIEW_PLATFORM_TYPE_NATIVE
|
||||
// create view
|
||||
view = v3_cpp_obj(controller)->create_view(controller, "editor");
|
||||
carla_stdout("has view %p", view);
|
||||
#endif
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool exit()
|
||||
{
|
||||
#ifdef V3_VIEW_PLATFORM_TYPE_NATIVE
|
||||
// must be deleted by now
|
||||
CARLA_SAFE_ASSERT(view == nullptr);
|
||||
#endif
|
||||
|
||||
if (connComponent != nullptr && connController != nullptr)
|
||||
{
|
||||
|
@ -3938,6 +3971,7 @@ private:
|
|||
CARLA_DECLARE_NON_COPYABLE(Events)
|
||||
} fEvents;
|
||||
|
||||
#ifdef V3_VIEW_PLATFORM_TYPE_NATIVE
|
||||
struct UI {
|
||||
bool isAttached;
|
||||
bool isEmbed;
|
||||
|
@ -3972,6 +4006,7 @@ private:
|
|||
|
||||
CARLA_DECLARE_NON_COPYABLE(UI)
|
||||
} fUI;
|
||||
#endif
|
||||
|
||||
CARLA_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR(CarlaPluginVST3)
|
||||
};
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
* Carla Plugin Host
|
||||
* Copyright (C) 2011-2022 Filipe Coelho <falktx@falktx.com>
|
||||
* Copyright (C) 2011-2023 Filipe Coelho <falktx@falktx.com>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License as
|
||||
|
@ -19,26 +19,31 @@
|
|||
|
||||
#ifndef CARLA_OS_WASM
|
||||
# include "CarlaThread.hpp"
|
||||
#else
|
||||
# include "CarlaUtils.hpp"
|
||||
#endif
|
||||
|
||||
// -------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
void carla_fflush(bool err)
|
||||
void carla_fflush(const bool err)
|
||||
{
|
||||
std::fflush(err ? stderr : stdout);
|
||||
}
|
||||
|
||||
void carla_fputs(bool err, const char* string)
|
||||
void carla_fputs(const bool err, const char* const string)
|
||||
{
|
||||
std::fputs(string, err ? stderr : stdout);
|
||||
}
|
||||
|
||||
void carla_set_process_name(const char* name)
|
||||
void carla_set_process_name(const char* const name)
|
||||
{
|
||||
carla_debug("carla_set_process_name(\"%s\")", name);
|
||||
|
||||
#ifndef CARLA_OS_WASM
|
||||
CarlaThread::setCurrentThreadName(name);
|
||||
#else
|
||||
// unused
|
||||
(void)name;
|
||||
#endif
|
||||
}
|
||||
|
||||
|
|
|
@ -181,14 +181,9 @@ win64: $(BINDIR)/$(MODULENAME)-win64.exe
|
|||
|
||||
# ---------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
$(BINDIR)/$(MODULENAME)-native: $(OBJS_native) $(LIBS_native)
|
||||
$(BINDIR)/$(MODULENAME)-native$(APP_EXT): $(OBJS_native) $(LIBS_native)
|
||||
-@mkdir -p $(BINDIR)
|
||||
@echo "Linking $(MODULENAME)-native"
|
||||
$(SILENT)$(CXX) $(OBJS_native) $(LIBS_START) $(LIBS_native) $(LIBS_END) $(LINK_FLAGS) $(NATIVE_LINK_FLAGS) -o $@
|
||||
|
||||
$(BINDIR)/$(MODULENAME)-native.exe: $(OBJS_native) $(LIBS_native)
|
||||
-@mkdir -p $(BINDIR)
|
||||
@echo "Linking $(MODULENAME)-native.exe"
|
||||
@echo "Linking $(MODULENAME)-native$(APP_EXT)"
|
||||
$(SILENT)$(CXX) $(OBJS_native) $(LIBS_START) $(LIBS_native) $(LIBS_END) $(LINK_FLAGS) $(NATIVE_LINK_FLAGS) -o $@
|
||||
|
||||
$(BINDIR)/$(MODULENAME)-arm32: $(OBJS_arm32) $(LIBS_arm32)
|
||||
|
|
|
@ -1778,6 +1778,7 @@ static bool do_vst3_check(lib_t& libHandle, const char* const filename, const bo
|
|||
CARLA_SAFE_ASSERT_CONTINUE(cvIns <= MAX_DISCOVERY_CV_IO);
|
||||
CARLA_SAFE_ASSERT_CONTINUE(cvOuts <= MAX_DISCOVERY_CV_IO);
|
||||
|
||||
#ifdef V3_VIEW_PLATFORM_TYPE_NATIVE
|
||||
if (v3_plugin_view** const view = v3_cpp_obj(controller)->create_view(controller, "editor"))
|
||||
{
|
||||
if (v3_cpp_obj(view)->is_platform_type_supported(view, V3_VIEW_PLATFORM_TYPE_NATIVE) == V3_TRUE)
|
||||
|
@ -1785,6 +1786,7 @@ static bool do_vst3_check(lib_t& libHandle, const char* const filename, const bo
|
|||
|
||||
v3_cpp_obj_unref(view);
|
||||
}
|
||||
#endif
|
||||
|
||||
if (factory2 != nullptr && std::strstr(classInfo.v2.sub_categories, "Instrument") != nullptr)
|
||||
hints |= PLUGIN_IS_SYNTH;
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
* travesty, pure C VST3-compatible interface
|
||||
* Copyright (C) 2021-2022 Filipe Coelho <falktx@falktx.com>
|
||||
* Copyright (C) 2021-2023 Filipe Coelho <falktx@falktx.com>
|
||||
*
|
||||
* 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
|
||||
|
@ -37,7 +37,7 @@ struct v3_view_rect {
|
|||
# define V3_VIEW_PLATFORM_TYPE_NATIVE V3_VIEW_PLATFORM_TYPE_NSVIEW
|
||||
#elif defined(_WIN32)
|
||||
# define V3_VIEW_PLATFORM_TYPE_NATIVE V3_VIEW_PLATFORM_TYPE_HWND
|
||||
#else
|
||||
#elif !defined(__EMSCRIPTEN__)
|
||||
# define V3_VIEW_PLATFORM_TYPE_NATIVE V3_VIEW_PLATFORM_TYPE_X11
|
||||
#endif
|
||||
|
||||
|
|
Loading…
Reference in New Issue