diff --git a/Makefile b/Makefile index 8e43c477e..e24993e84 100644 --- a/Makefile +++ b/Makefile @@ -113,6 +113,9 @@ else $(error Trying to build Windows binaries with a regular toolchain, this cannot work) endif +$(MODULEDIR)/dgl.wine.a: .FORCE + @$(MAKE) -C source/modules/dgl wine + $(MODULEDIR)/%.a: .FORCE @$(MAKE) -C source/modules/$* @@ -146,6 +149,9 @@ libjack: libs plugin: backend bridges-plugin bridges-ui discovery @$(MAKE) -C source/plugin +plugin-wine: $(MODULEDIR)/dgl.wine.a + @$(MAKE) -C source/plugin wine + rest: libs @$(MAKE) -C source/rest diff --git a/source/plugin/Makefile b/source/plugin/Makefile index ddd185664..be60e3986 100644 --- a/source/plugin/Makefile +++ b/source/plugin/Makefile @@ -87,10 +87,19 @@ SYMBOLS_VST = # TODO endif # --------------------------------------------------------------------------------------------------------------------- -# ... +# Other libs LIBS_ui = $(MODULEDIR)/water.a +LIBS_wine = $(MODULEDIR)/dgl.wine.a +LIBS_wine += $(MODULEDIR)/water.files.a + +WINE_LINK_FLAGS = $(LINK_FLAGS) +WINE_LINK_FLAGS += -L$(BINDIR) -lcarla_native-plugin +WINE_LINK_FLAGS += -lstdc++ -lopengl32 -lgdi32 +WINE_LINK_FLAGS += -Wl,-rpath,/usr/local/lib/carla +WINE_LINK_FLAGS += -Wl,-rpath,/usr/lib/carla + # --------------------------------------------------------------------------------------------------------------------- TARGETS = \ @@ -127,6 +136,10 @@ endif all: $(TARGETS) +ifneq ($(WIN32),true) +wine: $(BINDIR)/CarlaVstShell.dll +endif + # --------------------------------------------------------------------------------------------------------------------- clean: @@ -193,9 +206,16 @@ $(BINDIR)/CarlaPatchbayFX$(LIB_EXT): $(OBJDIR)/carla-vst.cpp.patchbay-fx.o $(OBJ @echo "Linking CarlaPatchbayFX$(LIB_EXT)" @$(CXX) $^ $(LIBS_START) $(LIBS) $(LIBS_END) $(SHARED) $(LINK_FLAGS) -o $@ -$(BINDIR)/CarlaVstShell$(LIB_EXT): $(OBJDIR)/carla-vst.cpp.shell.o $(OBJDIR)/carla-vst-export.cpp.o +ifneq ($(WIN32),true) +$(BINDIR)/CarlaVstShell.dll: $(OBJDIR)/carla-vst.cpp.shell.o $(OBJDIR)/carla-vst-export.cpp.dll.o carla-vst-export.def -@mkdir -p $(BINDIR) @echo "Linking CarlaRackVstShell$(LIB_EXT)" + @$(WINECC) $^ $(LIBS_START) $(LIBS_wine) $(LIBS_END) $(SHARED) $(WINE_LINK_FLAGS) -o $@ +endif + +$(BINDIR)/CarlaVstShell$(LIB_EXT): $(OBJDIR)/carla-vst.cpp.shell.o $(OBJDIR)/carla-vst-export.cpp.o + -@mkdir -p $(BINDIR) + @echo "Linking CarlaVstShell$(LIB_EXT)" @$(CXX) $^ $(LIBS_START) $(LIBS) $(LIBS_END) $(SHARED) $(LINK_FLAGS) -o $@ # --------------------------------------------------------------------------------------------------------------------- @@ -259,6 +279,11 @@ $(OBJDIR)/carla-vst-export.cpp.o: carla-vst-export.cpp @echo "Compiling $<" @$(CXX) $< $(BUILD_CXX_FLAGS) -c -o $@ +$(OBJDIR)/carla-vst-export.cpp.dll.o: carla-vst-export.cpp + -@mkdir -p $(OBJDIR) + @echo "Compiling $< (Wine)" + @$(WINECC) $< $(BUILD_CXX_FLAGS) -c -o $@ + # --------------------------------------------------------------------------------------------------------------------- $(BINDIR)/carla.lv2/manifest.ttl: $(OBJDIR)/carla-lv2-export.cpp.o @@ -286,6 +311,7 @@ $(OBJDIR)/carla-lv2-export.cpp.o: carla-lv2-export.cpp # --------------------------------------------------------------------------------------------------------------------- +-include $(OBJDIR)/carla-native-plugin.cpp.d -include $(OBJDIR)/carla-lv2.cpp.d -include $(OBJDIR)/carla-lv2-export.cpp.d -include $(OBJDIR)/carla-vst.cpp.patchbay-fx.d @@ -295,5 +321,6 @@ $(OBJDIR)/carla-lv2-export.cpp.o: carla-lv2-export.cpp -include $(OBJDIR)/carla-vst.cpp.rack-syn.d -include $(OBJDIR)/carla-vst.cpp.shell.d -include $(OBJDIR)/carla-vst-export.cpp.d +-include $(OBJDIR)/carla-vst-export.cpp.dll.d # --------------------------------------------------------------------------------------------------------------------- diff --git a/source/plugin/carla-vst-export.def b/source/plugin/carla-vst-export.def new file mode 100644 index 000000000..70e286c9c --- /dev/null +++ b/source/plugin/carla-vst-export.def @@ -0,0 +1,3 @@ +LIBRARY CarlaVST +DESCRIPTION 'Carla VST Plugin' +EXPORTS VSTPluginMain diff --git a/source/plugin/carla-vst.cpp b/source/plugin/carla-vst.cpp index 0594c350c..42a541478 100644 --- a/source/plugin/carla-vst.cpp +++ b/source/plugin/carla-vst.cpp @@ -15,6 +15,10 @@ * For a full copy of the GNU General Public License see the doc/GPL.txt file. */ +#ifdef __WINE__ + #error This file is not supposed to be built with wine! +#endif + #ifndef CARLA_VST_SHELL #ifndef CARLA_PLUGIN_PATCHBAY #error CARLA_PLUGIN_PATCHBAY undefined @@ -79,8 +83,12 @@ public: File curExe = File::getSpecialLocation(File::currentExecutableFile).getLinkedTarget(); File resDir = curExe.getSiblingFile("resources"); + + // FIXME: proper fallback path for other OSes if (! resDir.exists()) - resDir = File("/usr/share/carla/resources/"); + resDir = File("/usr/local/share/carla/resources"); + if (! resDir.exists()) + resDir = File("/usr/share/carla/resources"); // find host type const String hostFilename(File::getSpecialLocation(File::hostApplicationPath).getFileName()); @@ -755,12 +763,10 @@ intptr_t vst_dispatcherCallback(AEffect* effect, int32_t opcode, int32_t index, effect->numInputs = pluginDesc->audioIns; effect->numOutputs = pluginDesc->audioOuts; - /* if (pluginDesc->hints & NATIVE_PLUGIN_HAS_UI) effect->flags |= effFlagsHasEditor; else effect->flags &= ~effFlagsHasEditor; - */ if (pluginDesc->hints & NATIVE_PLUGIN_IS_SYNTH) effect->flags |= effFlagsIsSynth; @@ -928,10 +934,6 @@ intptr_t vst_dispatcherCallback(AEffect* effect, int32_t opcode, int32_t index, if (desc->midiIns > 1 || desc->midiOuts > 1) continue; - if (std::strncmp(desc->label, "carlarack", 9) == 0) - continue; - if (std::strncmp(desc->label, "carlapatchbay", 13) == 0) - continue; std::strncpy(cptr, desc->label, 32); return effect->uniqueID;