diff --git a/source/backend/CarlaEngine.hpp b/source/backend/CarlaEngine.hpp index 72cc7bb8f..7d1f1670f 100644 --- a/source/backend/CarlaEngine.hpp +++ b/source/backend/CarlaEngine.hpp @@ -696,12 +696,6 @@ public: */ virtual void idle(); - /*! - * Give the event loop to the engine.\n - * The function will complete when the last plugin UI is closed. - */ - virtual void exec(); - /*! * Check if engine is running. */ diff --git a/source/backend/engine/CarlaEngine.cpp b/source/backend/engine/CarlaEngine.cpp index 66026f05e..20148aefb 100644 --- a/source/backend/engine/CarlaEngine.cpp +++ b/source/backend/engine/CarlaEngine.cpp @@ -30,9 +30,9 @@ CARLA_BACKEND_START_NAMESPACE // ------------------------------------------------------------------------------------------------------------------- // Engine Helpers -DGL::App* getEngineApp(CarlaEngine* const engine) +::QMainWindow* getEngineHostWindow(CarlaEngine* const engine) { - return CarlaEngineProtectedData::getApp(engine); + return CarlaEngineProtectedData::getHostWindow(engine); } // ------------------------------------------------------------------------------------------------------------------- @@ -643,13 +643,6 @@ void CarlaEngine::idle() if (plugin != nullptr && plugin->enabled()) plugin->idleGui(); } - - kData->app.idle(); -} - -void CarlaEngine::exec() -{ - kData->app.exec(); } // ----------------------------------------------------------------------- diff --git a/source/backend/engine/CarlaEngine.pro b/source/backend/engine/CarlaEngine.pro index c184528cc..8cb373b1c 100644 --- a/source/backend/engine/CarlaEngine.pro +++ b/source/backend/engine/CarlaEngine.pro @@ -6,8 +6,10 @@ VERSION = 1.0 # ------------------------------------------------------- +QT = core xml + CONFIG = debug -CONFIG += link_pkgconfig shared warn_on +CONFIG += link_pkgconfig qt shared warn_on DEFINES = DEBUG DEFINES += QTCREATOR_TEST @@ -25,12 +27,13 @@ DEFINES += WANT_JACK_LATENCY DEFINES += WANT_JACK_PORT_RENAME DEFINES += WANT_FLUIDSYNTH DEFINES += WANT_LINUXSAMPLER +DEFINES += WANT_OPENGL DEFINES += WANT_AUDIOFILE DEFINES += WANT_ZYNADDSUBFX -PKGCONFIG = gl +DEFINES += WANT_ZYNADDSUBFX_UI # Engine -PKGCONFIG += liblo QtCore +PKGCONFIG += liblo # RtAudio DEFINES += HAVE_GETTIMEOFDAY @@ -89,7 +92,6 @@ HEADERS += \ INCLUDEPATH = . .. plugin \ ../../includes \ ../../libs \ - ../../libs/distrho \ ../../utils # RtAudio/RtMidi diff --git a/source/backend/engine/CarlaEngineInternal.hpp b/source/backend/engine/CarlaEngineInternal.hpp index 9fe00b387..d5ea75917 100644 --- a/source/backend/engine/CarlaEngineInternal.hpp +++ b/source/backend/engine/CarlaEngineInternal.hpp @@ -24,12 +24,12 @@ #include "CarlaPlugin.hpp" #include "RtList.hpp" -#include "dgl/App.hpp" - #ifndef BUILD_BRIDGE # include #endif +class QMainWindow; + CARLA_BACKEND_START_NAMESPACE // ------------------------------------------------------------------------------------------------------------------- @@ -120,8 +120,6 @@ struct EnginePluginData { // ------------------------------------------------------------------------------------------------------------------- struct CarlaEngineProtectedData { - DGL::App app; - CarlaEngineOsc osc; CarlaEngineThread thread; @@ -134,6 +132,7 @@ struct CarlaEngineProtectedData { #ifndef BUILD_BRIDGE QProcessEnvironment procEnv; + QMainWindow* hostWindow; #endif bool aboutToClose; // don't re-activate thread if true @@ -182,23 +181,28 @@ struct CarlaEngineProtectedData { oscData(nullptr), callback(nullptr), callbackPtr(nullptr), +#ifndef BUILD_BRIDGE + hostWindow(nullptr), +#endif aboutToClose(false), curPluginCount(0), maxPluginNumber(0), plugins(nullptr) {} - ~CarlaEngineProtectedData() - { - //plugins.clear(); - } - CarlaEngineProtectedData() = delete; CarlaEngineProtectedData(CarlaEngineProtectedData&) = delete; CarlaEngineProtectedData(const CarlaEngineProtectedData&) = delete; - static DGL::App* getApp(CarlaEngine* const engine) + static ::QMainWindow* getHostWindow(CarlaEngine* const engine) { - return &engine->kData->app; +#ifndef BUILD_BRIDGE + return engine->kData->hostWindow; +#else + return nullptr; + + // unused + (void)engine; +#endif } }; diff --git a/source/backend/engine/Makefile b/source/backend/engine/Makefile index ba7b866f4..24a19b3f0 100644 --- a/source/backend/engine/Makefile +++ b/source/backend/engine/Makefile @@ -8,8 +8,8 @@ include ../Makefile.mk # -------------------------------------------------------------- -BUILD_CXX_FLAGS += $(shell pkg-config --cflags liblo QtCore) -LINK_FLAGS += $(shell pkg-config --libs liblo QtCore) +BUILD_CXX_FLAGS += $(shell pkg-config --cflags liblo QtCore QtXml) +LINK_FLAGS += $(shell pkg-config --libs liblo QtCore QtXml) # -------------------------------------------------------------- diff --git a/source/backend/native/Makefile b/source/backend/native/Makefile index 55b8020d5..bf0ada354 100644 --- a/source/backend/native/Makefile +++ b/source/backend/native/Makefile @@ -8,7 +8,8 @@ include ../Makefile.mk # -------------------------------------------------------------- -BUILD_CXX_FLAGS += $(shell pkg-config --cflags QtCore QtGui) -I../../widgets +BUILD_CXX_FLAGS += -I. -I../../libs/distrho -I../../widgets +BUILD_CXX_FLAGS += $(shell pkg-config --cflags QtCore QtGui) LINK_FLAGS += $(shell pkg-config --libs QtCore QtGui) # -------------------------------------------------------------- @@ -165,13 +166,13 @@ distrho-pingpongpan.cpp.o: distrho-pingpongpan.cpp pingpongpan/DistrhoArtworkPin distrho-notes.cpp.o: distrho-notes.cpp notes/DistrhoPluginNotes.cpp notes/DistrhoUINotes.cpp distrho/DistrhoPluginCarla.cpp moc_DistrhoUINotes.cpp $(CXX) $< $(BUILD_CXX_FLAGS) -Inotes -DDISTRHO_NAMESPACE=DISTRHO_Notes -c -o $@ -zynaddsubfx.cpp.o: zynaddsubfx.cpp $(ZYN_UI_FILES) +zynaddsubfx.cpp.o: zynaddsubfx.cpp $(ZYN_UI_FILES_CPP) $(CXX) $< $(ZYN_CXX_FLAGS) -c -o $@ zynaddsubfx-src.cpp.o: zynaddsubfx-src.cpp $(CXX) $< $(ZYN_CXX_FLAGS) -c -o $@ -zynaddsubfx-ui.cpp.o: zynaddsubfx-ui.cpp $(ZYN_UI_FILES) +zynaddsubfx-ui.cpp.o: zynaddsubfx-ui.cpp $(ZYN_UI_FILES_CPP) $(CXX) $< $(ZYN_CXX_FLAGS) -c -o $@ # -------------------------------------------------------------- diff --git a/source/backend/plugin/CarlaPlugin.cpp b/source/backend/plugin/CarlaPlugin.cpp index 7eb1281d9..71e6c89fe 100644 --- a/source/backend/plugin/CarlaPlugin.cpp +++ b/source/backend/plugin/CarlaPlugin.cpp @@ -19,10 +19,13 @@ #include "CarlaLibUtils.hpp" #include "CarlaMIDI.h" -#include "dgl/App.hpp" - #include #include +#include + +#ifdef Q_WS_X11 +# include +#endif CARLA_BACKEND_START_NAMESPACE @@ -1972,38 +1975,89 @@ CarlaPlugin::ScopedProcessLocker::~ScopedProcessLocker() // ------------------------------------------------------------------- // CarlaPluginGUI -CarlaPluginGUI::CarlaPluginGUI(DGL::App* const app, Callback* const callback) - : DGL::Window(app), - kCallback(callback) +CarlaPluginGUI::CarlaPluginGUI(QWidget* const parent, Callback* const callback) + : QMainWindow(parent), + kCallback(callback), + fContainer(nullptr), + fNextWidth(0), + fNextHeight(0) { - carla_debug("CarlaPluginGUI::CarlaPluginGUI(%p, %p)", app, callback); - CARLA_ASSERT(app != nullptr); CARLA_ASSERT(callback != nullptr); - - hide(); + carla_debug("CarlaPluginGUI::CarlaPluginGUI(%p, %p)", parent, callback); } CarlaPluginGUI::~CarlaPluginGUI() { carla_debug("CarlaPluginGUI::~CarlaPluginGUI()"); + + closeContainer(); +} + +void CarlaPluginGUI::idle() +{ + if (fNextWidth > 0 && fNextHeight > 0) + { + setFixedSize(fNextWidth, fNextHeight); + fNextWidth = 0; + fNextHeight = 0; + } +} + +void CarlaPluginGUI::resizeLater(int width, int height) +{ + fNextWidth = width; + fNextHeight = height; +} + +void* CarlaPluginGUI::getContainerWinId() +{ + carla_debug("CarlaPluginGUI::getContainerWinId()"); + + if (fContainer == nullptr) + { +#ifdef Q_WS_X11 + QX11EmbedContainer* container(new QX11EmbedContainer(this)); +#else + QWidget* container(new QWidget(this)); +#endif + setCentralWidget(container); + fContainer = container; + } + + return (void*)winId(); } -// void CarlaPluginGUI::closeEvent(QCloseEvent* const event) -// { -// carla_debug("CarlaPluginGUI::closeEvent(%p)", event); -// CARLA_ASSERT(event != nullptr); -// -// if (! event->spontaneous()) -// { -// event->ignore(); -// return; -// } -// -// if (kCallback != nullptr) -// kCallback->guiClosedCallback(); -// -// QMainWindow::closeEvent(event); -// } +void CarlaPluginGUI::closeContainer() +{ + carla_debug("CarlaPluginGUI::closeContainer()"); + + if (fContainer != nullptr) + { +#ifdef Q_WS_X11 + delete (QX11EmbedContainer*)fContainer; +#else + delete (QWidget*)fContainer; +#endif + fContainer = nullptr; + } +} + +void CarlaPluginGUI::closeEvent(QCloseEvent* const event) +{ + carla_debug("CarlaPluginGUI::closeEvent(%p)", event); + CARLA_ASSERT(event != nullptr); + + if (! event->spontaneous()) + { + event->ignore(); + return; + } + + if (kCallback != nullptr) + kCallback->guiClosedCallback(); + + QMainWindow::closeEvent(event); +} // ------------------------------------------------------------------- diff --git a/source/backend/plugin/CarlaPlugin.pro b/source/backend/plugin/CarlaPlugin.pro index 6c8c700b7..ecd8e52ad 100644 --- a/source/backend/plugin/CarlaPlugin.pro +++ b/source/backend/plugin/CarlaPlugin.pro @@ -6,8 +6,10 @@ VERSION = 1.0 # ------------------------------------------------------- +QT = core gui xml + CONFIG = debug -CONFIG += link_pkgconfig shared warn_on +CONFIG += link_pkgconfig qt shared warn_on DEFINES = DEBUG DEFINES += QTCREATOR_TEST @@ -25,12 +27,13 @@ DEFINES += WANT_JACK_LATENCY DEFINES += WANT_JACK_PORT_RENAME DEFINES += WANT_FLUIDSYNTH DEFINES += WANT_LINUXSAMPLER +DEFINES += WANT_OPENGL DEFINES += WANT_AUDIOFILE DEFINES += WANT_ZYNADDSUBFX -PKGCONFIG = gl +DEFINES += WANT_ZYNADDSUBFX_UI # Plugin -PKGCONFIG += liblo QtCore +PKGCONFIG += liblo # FluidSynth PKGCONFIG += fluidsynth linuxsampler @@ -75,7 +78,6 @@ HEADERS += \ INCLUDEPATH = . .. \ ../../includes \ ../../libs \ - ../../libs/distrho \ ../../utils QMAKE_CXXFLAGS += -std=c++0x diff --git a/source/backend/plugin/CarlaPluginInternal.hpp b/source/backend/plugin/CarlaPluginInternal.hpp index d86f8b96a..8c212d918 100644 --- a/source/backend/plugin/CarlaPluginInternal.hpp +++ b/source/backend/plugin/CarlaPluginInternal.hpp @@ -26,9 +26,9 @@ #include "CarlaStateUtils.hpp" #include "CarlaMutex.hpp" #include "CarlaMIDI.h" - #include "RtList.hpp" -#include "dgl/Window.hpp" + +#include #define CARLA_DECLARE_NON_COPY_STRUCT(structName) \ structName(structName&) = delete; \ @@ -386,7 +386,13 @@ struct ExternalMidiNote { // ----------------------------------------------------------------------- -class CarlaPluginGUI : public DGL::Window +enum CarlaPluginGuiType { + PLUGIN_GUI_NULL, + PLUGIN_GUI_PARENT, + PLUGIN_GUI_QT +}; + +class CarlaPluginGUI : public QMainWindow { public: class Callback @@ -396,14 +402,27 @@ public: virtual void guiClosedCallback() = 0; }; - CarlaPluginGUI(DGL::App* const app, Callback* const callback); + CarlaPluginGUI(QWidget* const parent, Callback* const callback); ~CarlaPluginGUI(); -//protected: - //void closeEvent(QCloseEvent* const event); + void idle(); + void resizeLater(int width, int height); + + // Parent UIs + void* getContainerWinId(); + void closeContainer(); + + // Qt4 UIs, TODO + +protected: + void closeEvent(QCloseEvent* const event); private: Callback* const kCallback; + QWidget* fContainer; + + int fNextWidth; + int fNextHeight; CARLA_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR(CarlaPluginGUI) }; @@ -411,7 +430,7 @@ private: // ----------------------------------------------------------------------- // Engine Helpers, defined in CarlaEngine.cpp -extern DGL::App* getEngineApp(CarlaEngine* const engine); +extern ::QMainWindow* getEngineHostWindow(CarlaEngine* const engine); // ----------------------------------------------------------------------- @@ -571,7 +590,7 @@ struct CarlaPluginProtectedData { if (gui != nullptr) return; - gui = new CarlaPluginGUI(getEngineApp(engine), callback); + gui = new CarlaPluginGUI(getEngineHostWindow(engine), callback); } void destroyUiIfNeeded() @@ -579,11 +598,19 @@ struct CarlaPluginProtectedData { if (gui == nullptr) return; - gui->hide(); + gui->close(); delete gui; gui = nullptr; } + void resizeUiLater(int width, int height) + { + if (gui == nullptr) + return; + + gui->resizeLater(width, height); + } + static CarlaEngine* getEngine(CarlaPlugin* const plugin) { return plugin->kData->engine; diff --git a/source/backend/plugin/Makefile b/source/backend/plugin/Makefile index 4e09929d8..7c546eff6 100644 --- a/source/backend/plugin/Makefile +++ b/source/backend/plugin/Makefile @@ -8,8 +8,8 @@ include ../Makefile.mk # -------------------------------------------------------------- -BUILD_CXX_FLAGS += $(shell pkg-config --cflags liblo QtCore QtGui) -LINK_FLAGS += $(shell pkg-config --libs liblo QtCore QtGui) +BUILD_CXX_FLAGS += $(shell pkg-config --cflags liblo QtCore QtGui QtXml) +LINK_FLAGS += $(shell pkg-config --libs liblo QtCore QtGui QtXml) # -------------------------------------------------------------- diff --git a/source/backend/plugin/NativePlugin.cpp b/source/backend/plugin/NativePlugin.cpp index dc62bd170..8bf7f3efa 100644 --- a/source/backend/plugin/NativePlugin.cpp +++ b/source/backend/plugin/NativePlugin.cpp @@ -33,17 +33,21 @@ void carla_register_all_plugins() carla_register_native_plugin_midiTranspose(); carla_register_native_plugin_nekofilter(); - // DISTRHO plugins - carla_register_native_plugin_3BandEQ(); - carla_register_native_plugin_3BandSplitter(); - carla_register_native_plugin_PingPongPan(); - carla_register_native_plugin_Notes(); - #ifdef WANT_AUDIOFILE // AudioFile carla_register_native_plugin_audiofile(); #endif +#ifdef WANT_OPENGL + // DISTRHO plugins (OpenGL) + carla_register_native_plugin_3BandEQ(); + carla_register_native_plugin_3BandSplitter(); + carla_register_native_plugin_PingPongPan(); +#endif + + // DISTRHO plugins (Qt) + carla_register_native_plugin_Notes(); + #ifdef WANT_ZYNADDSUBFX // ZynAddSubFX carla_register_native_plugin_zynaddsubfx(); @@ -1881,30 +1885,22 @@ protected: const char* handleUiOpenFile(const bool isDir, const char* const title, const char* const filter) { -#ifdef BUILD_BRIDGE - return nullptr; -#else static CarlaString retStr; QFileDialog::Options options(isDir ? QFileDialog::ShowDirsOnly : 0x0); retStr = QFileDialog::getOpenFileName(nullptr, title, "", filter, nullptr, options).toUtf8().constData(); return retStr.isNotEmpty() ? (const char*)retStr : nullptr; -#endif } const char* handleUiSaveFile(const bool isDir, const char* const title, const char* const filter) { -#ifdef BUILD_BRIDGE - return nullptr; -#else static CarlaString retStr; QFileDialog::Options options(isDir ? QFileDialog::ShowDirsOnly : 0x0); retStr = QFileDialog::getSaveFileName(nullptr, title, "", filter, nullptr, options).toUtf8().constData(); - return (const char*)retStr; -#endif + return retStr.isNotEmpty() ? (const char*)retStr : nullptr; } public: diff --git a/source/backend/plugin/VstPlugin.cpp b/source/backend/plugin/VstPlugin.cpp index 26f3855ce..8ee84db9c 100644 --- a/source/backend/plugin/VstPlugin.cpp +++ b/source/backend/plugin/VstPlugin.cpp @@ -361,7 +361,7 @@ public: #ifdef Q_WS_X11 //value = (intptr_t)QX11Info::display(); #endif - void* const ptr = (void*)kData->gui->getWindowId(); + void* const ptr = kData->gui->getContainerWinId(); if (dispatcher(effEditOpen, 0, value, ptr, 0.0f) != 0) { @@ -376,7 +376,7 @@ public: if (width > 0 && height > 0) { - kData->gui->setSize(width, height); + kData->gui->setFixedSize(width, height); } } @@ -391,7 +391,7 @@ public: return; } } - else if (fGui.isVisible) + else { dispatcher(effEditClose, 0, 0, nullptr, 0.0f); kData->destroyUiIfNeeded(); @@ -412,7 +412,7 @@ public: if (fNeedIdle) dispatcher(effIdle, 0, 0, nullptr, 0.0f); - if (! fGui.isOsc && fGui.isVisible) + if (fGui.isVisible && ! fGui.isOsc) { dispatcher(effEditIdle, 0, 0, nullptr, 0.0f); kData->gui->idle(); @@ -1737,19 +1737,21 @@ protected: #endif break; -#if 0 case audioMasterProcessEvents: + CARLA_ASSERT(fEnabled); + CARLA_ASSERT(fIsProcessing); + CARLA_ASSERT(kData->event.portOut != nullptr); CARLA_ASSERT(ptr != nullptr); - CARLA_ASSERT(m_enabled); - CARLA_ASSERT(midi.portMout); - CARLA_ASSERT(isProcessing); - if (! m_enabled) + if (! fEnabled) return 0; - - if (! midi.portMout) + if (! fIsProcessing) return 0; - + if (kData->event.portOut == nullptr) + return 0; + if (ptr == nullptr) + return 0; +#if 0 if (! isProcessing) { carla_stderr2("VstPlugin::handleAudioMasterProcessEvents(%p) - received MIDI out events outside audio thread, ignoring", vstEvents); @@ -1766,10 +1768,9 @@ protected: if (vstMidiEvent->type == kVstMidiType) memcpy(&midiEvents[events.numEvents++], vstMidiEvent, sizeof(VstMidiEvent)); } - +#endif ret = 1; break; -#endif #if ! VST_FORCE_DEPRECATED case audioMasterSetTime: @@ -1842,12 +1843,7 @@ protected: break; case audioMasterSizeWindow: - CARLA_ASSERT(kData->gui != nullptr); - - // FIXME - ensure thread safe - //if (kData->gui != nullptr) - // kData->gui->setFixedSize(index, value); - + kData->resizeUiLater(index, value); ret = 1; break; diff --git a/source/bridges/CarlaBridgePlugin.cpp b/source/bridges/CarlaBridgePlugin.cpp index 58f76cd6e..6c0f92909 100644 --- a/source/bridges/CarlaBridgePlugin.cpp +++ b/source/bridges/CarlaBridgePlugin.cpp @@ -24,12 +24,16 @@ #include "CarlaEngine.hpp" #include "CarlaPlugin.hpp" -#include "dgl/App.hpp" - #include #include #include +#if (QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)) +# include +#else +# include +#endif + #ifdef CARLA_OS_UNIX # include #endif @@ -107,14 +111,18 @@ CARLA_BRIDGE_START_NAMESPACE // ------------------------------------------------------------------------- -class CarlaPluginClient : public CarlaBridgeClient +class CarlaPluginClient : public CarlaBridgeClient, + public QObject { public: CarlaPluginClient(const char* const name) : CarlaBridgeClient(nullptr), + QObject(nullptr), fEngine(nullptr), - fPlugin(nullptr) + fPlugin(nullptr), + fTimerId(0) { + CARLA_ASSERT(name != nullptr); carla_debug("CarlaPluginClient::CarlaPluginClient()"); carla_engine_init("JACK", name); @@ -123,15 +131,21 @@ public: ~CarlaPluginClient() { + CARLA_ASSERT(fTimerId == 0); carla_debug("CarlaPluginClient::~CarlaPluginClient()"); + carla_set_engine_about_to_close(); carla_engine_close(); } void ready() { + CARLA_ASSERT(fTimerId == 0); + fEngine = carla_get_standalone_engine(); fPlugin = fEngine->getPlugin(0); + + fTimerId = startTimer(50); } void idle() @@ -146,6 +160,21 @@ public: // TODO gSaveNow = false; } + + if (gCloseNow) + { + if (fTimerId != 0) + { + killTimer(fTimerId); + fTimerId = 0; + } + + if (QApplication* const app = qApp) + { + if (! app->closingDown()) + app->quit(); + } + } } void exec() @@ -324,7 +353,15 @@ private: CarlaBackend::CarlaEngine* fEngine; CarlaBackend::CarlaPlugin* fPlugin; - bool fClosed; + int fTimerId; + + void timerEvent(QTimerEvent* const event) + { + if (event->timerId() == fTimerId) + idle(); + + QObject::timerEvent(event); + } static void callback(void* ptr, CarlaBackend::CallbackType action, unsigned int pluginId, int value1, int value2, float value3, const char* valueStr) { @@ -471,6 +508,9 @@ int main(int argc, char* argv[]) return 1; } + QApplication app(argc, argv, true); + app.setQuitOnLastWindowClosed(false); + // Init Plugin client CarlaPluginClient client(name ? name : label); @@ -487,7 +527,7 @@ int main(int argc, char* argv[]) extraStuff = CarlaBackend::findDSSIGUI(filename, label); // Init plugin - int ret = 0; + int ret; if (carla_add_plugin(CarlaBackend::BINARY_NATIVE, itype, filename, name, label, extraStuff)) { @@ -503,7 +543,8 @@ int main(int argc, char* argv[]) } client.ready(); - client.exec(); + + ret = app.exec(); carla_remove_plugin(0); } diff --git a/source/bridges/Makefile b/source/bridges/Makefile index c6b497069..287c056d5 100644 --- a/source/bridges/Makefile +++ b/source/bridges/Makefile @@ -11,17 +11,6 @@ include ../Makefile.mk HAVE_GTK2 = $(shell pkg-config --exists gtk+-2.0 && echo true) HAVE_GTK3 = $(shell pkg-config --exists gtk+-3.0 && echo true) -# -------------------------------------------------------------- - -BUILD_CXX_FLAGS += -DBUILD_BRIDGE -pthread -BUILD_CXX_FLAGS += -I. -I../backend -I../includes -I../utils -BUILD_CXX_FLAGS += $(shell pkg-config --cflags liblo QtCore QtXml) -LINK_FLAGS += $(shell pkg-config --libs liblo QtCore QtXml) -lpthread - -ifeq ($(CARLA_PLUGIN_SUPPORT),true) -BUILD_CXX_FLAGS += -DWANT_LADSPA -DWANT_DSSI -DWANT_LV2 -DWANT_VST -endif - ifeq ($(HAVE_QT5),true) QT_UI_FLAGS = $(shell pkg-config --cflags QtWidgets) QT_UI_LIBS = $(shell pkg-config --libs QtWidgets) @@ -30,40 +19,77 @@ QT_UI_FLAGS = $(shell pkg-config --cflags QtGui) QT_UI_LIBS = $(shell pkg-config --libs QtGui) endif +# -------------------------------------------------------------- + +BUILD_CXX_FLAGS += -DBUILD_BRIDGE +BUILD_CXX_FLAGS += -I. -I../backend -I../includes -I../utils +BUILD_CXX_FLAGS += $(shell pkg-config --cflags liblo QtCore) +LINK_FLAGS += $(shell pkg-config --libs liblo QtCore) + # -------------------------------------------------------------- # Plugin bridges BUILD_PLUGIN_FLAGS = $(BUILD_CXX_FLAGS) BUILD_PLUGIN_FLAGS += -DBUILD_BRIDGE_PLUGIN -DBRIDGE_PLUGIN -DWANT_JACK -BUILD_PLUGIN_FLAGS += -I../backend/engine -I../backend/plugin -I../libs -I../libs/distrho -BUILD_PLUGIN_FLAGS += $(shell pkg-config --cflags gl) +BUILD_PLUGIN_FLAGS += -I../backend/engine -I../backend/plugin -I../libs +BUILD_PLUGIN_FLAGS += $(shell pkg-config --cflags QtGui QtXml) LINK_PLUGIN_FLAGS = $(LINK_FLAGS) -LINK_PLUGIN_FLAGS += $(shell pkg-config --libs gl) - -NATIVE_BUILD_FLAGS = $(BUILD_PLUGIN_FLAGS) $(shell pkg-config --cflags jack QtGui) -DWANT_NATIVE -NATIVE_LINK_FLAGS = $(LINK_PLUGIN_FLAGS) $(shell pkg-config --libs jack QtGui) -ldl +LINK_PLUGIN_FLAGS += $(shell pkg-config --libs QtGui QtXml) -lpthread -ifeq ($(HAVE_AF_DEPS),true) -NATIVE_BUILD_FLAGS += -DWANT_AUDIOFILE -NATIVE_LINK_FLAGS += $(shell pkg-config --libs libavcodec libavformat sndfile) +ifeq ($(CARLA_PLUGIN_SUPPORT),true) +BUILD_PLUGIN_FLAGS += -DWANT_LADSPA -DWANT_DSSI -DWANT_LV2 -DWANT_VST endif -ifeq ($(HAVE_ZYN_DEPS),true) -NATIVE_BUILD_FLAGS += -DWANT_ZYNADDSUBFX -NATIVE_LINK_FLAGS += $(shell pkg-config --libs fftw3 mxml zlib) -NATIVE_LINK_FLAGS += $(shell pkg-config --libs ntk ntk_images) -endif +# -------------------------------------------------------------- +# Plugin bridges (POSIX) POSIX_BUILD_FLAGS = $(BUILD_PLUGIN_FLAGS) POSIX_32BIT_FLAGS = $(32BIT_FLAGS) -L/usr/lib32 -L/usr/lib/i386-linux-gnu POSIX_64BIT_FLAGS = $(64BIT_FLAGS) -L/usr/lib64 -L/usr/lib/x86_64-linux-gnu POSIX_LINK_FLAGS = $(LINK_PLUGIN_FLAGS) $(shell pkg-config --libs jack) -ldl +# -------------------------------------------------------------- +# Plugin bridges (Windows) + WIN_BUILD_FLAGS = $(BUILD_PLUGIN_FLAGS) -DJACKBRIDGE_EXPORT -DPTW32_STATIC_LIB -I../libs/jackbridge WIN_32BIT_FLAGS = $(32BIT_FLAGS) WIN_64BIT_FLAGS = $(64BIT_FLAGS) -WIN_LINK_FLAGS = $(LINK_PLUGIN_FLAGS) -mwindows -L../libs -lpthread -lwinspool -lole32 -luuid -limm32 -lshell32 -lws2_32 +WIN_LINK_FLAGS = $(LINK_PLUGIN_FLAGS) -mwindows -lwinspool -lole32 -luuid -limm32 -lshell32 -lws2_32 -L../libs + +# -------------------------------------------------------------- +# Plugin bridges (Native) + +NATIVE_BUILD_FLAGS = $(POSIX_BUILD_FLAGS) +NATIVE_LINK_FLAGS = $(POSIX_LINK_FLAGS) + +ifeq ($(HAVE_FLUIDSYNTH),true) +NATIVE_BUILD_FLAGS += -DWANT_FLUIDSYNTH +NATIVE_LINK_FLAGS += $(shell pkg-config --libs fluidsynth) +endif + +ifeq ($(HAVE_LINUXSAMPLER),true) +NATIVE_BUILD_FLAGS += -DWANT_LINUXSAMPLER +NATIVE_LINK_FLAGS += $(shell pkg-config --libs linuxsampler) +endif + +ifeq ($(HAVE_OPENGL),true) +NATIVE_BUILD_FLAGS += -DWANT_OPENGL +NATIVE_LINK_FLAGS += $(shell pkg-config --libs gl) +endif + +ifeq ($(HAVE_AF_DEPS),true) +NATIVE_BUILD_FLAGS += -DWANT_AUDIOFILE +NATIVE_LINK_FLAGS += $(shell pkg-config --libs libavcodec libavformat sndfile) +endif + +ifeq ($(HAVE_ZYN_DEPS),true) +NATIVE_BUILD_FLAGS += -DWANT_ZYNADDSUBFX +NATIVE_LINK_FLAGS += $(shell pkg-config --libs fftw3 mxml zlib) +ifeq ($(HAVE_ZYN_UI_DEPS),true) +NATIVE_LINK_FLAGS += $(shell pkg-config --libs ntk ntk_images) +endif +endif # -------------------------------------------------------------- # UI bridges