commit aad2a31f76251d031638d6385a68efef25452715
parent 20477b35dd76527e85fc7ac476c07ed8d521f8a3
Author: falkTX <falktx@falktx.com>
Date: Mon, 7 Mar 2022 20:58:32 +0000
Add static plugin target
Signed-off-by: falkTX <falktx@falktx.com>
Diffstat:
3 files changed, 24 insertions(+), 2 deletions(-)
diff --git a/Makefile.plugins.mk b/Makefile.plugins.mk
@@ -129,6 +129,7 @@ ifneq ($(VST3_FILENAME),)
vst3 = $(TARGET_DIR)/$(VST3_FILENAME)
endif
shared = $(TARGET_DIR)/$(NAME)$(LIB_EXT)
+static = $(TARGET_DIR)/$(NAME).a
ifeq ($(MACOS),true)
vst2files += $(TARGET_DIR)/$(VST2_CONTENTS)/Info.plist
@@ -475,6 +476,21 @@ endif
$(SILENT)$(CXX) $^ $(BUILD_CXX_FLAGS) $(LINK_FLAGS) $(EXTRA_LIBS) $(DGL_LIBS) $(SHARED) $(SYMBOLS_SHARED) -o $@
# ---------------------------------------------------------------------------------------------------------------------
+# Static
+
+static: $(static)
+
+ifeq ($(HAVE_DGL),true)
+$(static): $(OBJS_DSP) $(OBJS_UI) $(BUILD_DIR)/DistrhoPluginMain_STATIC.cpp.o $(BUILD_DIR)/DistrhoUIMain_STATIC.cpp.o
+else
+$(static): $(OBJS_DSP) $(BUILD_DIR)/DistrhoPluginMain_STATIC.cpp.o
+endif
+ -@mkdir -p $(shell dirname $@)
+ @echo "Creating static library for $(NAME)"
+ $(SILENT)rm -f $@
+ $(SILENT)$(AR) crs $@ $^
+
+# ---------------------------------------------------------------------------------------------------------------------
# macOS files
$(TARGET_DIR)/%/Contents/Info.plist: $(DPF_PATH)/utils/plugin.vst/Contents/Info.plist
@@ -503,6 +519,7 @@ endif
-include $(BUILD_DIR)/DistrhoPluginMain_VST2.cpp.d
-include $(BUILD_DIR)/DistrhoPluginMain_VST3.cpp.d
-include $(BUILD_DIR)/DistrhoPluginMain_SHARED.cpp.d
+-include $(BUILD_DIR)/DistrhoPluginMain_STATIC.cpp.d
-include $(BUILD_DIR)/DistrhoUIMain_JACK.cpp.d
-include $(BUILD_DIR)/DistrhoUIMain_DSSI.cpp.d
@@ -510,5 +527,6 @@ endif
-include $(BUILD_DIR)/DistrhoUIMain_VST2.cpp.d
-include $(BUILD_DIR)/DistrhoUIMain_VST3.cpp.d
-include $(BUILD_DIR)/DistrhoUIMain_SHARED.cpp.d
+-include $(BUILD_DIR)/DistrhoUIMain_STATIC.cpp.d
# ---------------------------------------------------------------------------------------------------------------------
diff --git a/distrho/DistrhoPluginMain.cpp b/distrho/DistrhoPluginMain.cpp
@@ -32,6 +32,10 @@
#elif defined(DISTRHO_PLUGIN_TARGET_SHARED)
DISTRHO_PLUGIN_EXPORT DISTRHO_NAMESPACE::Plugin* createSharedPlugin();
DISTRHO_PLUGIN_EXPORT DISTRHO_NAMESPACE::Plugin* createSharedPlugin() { return DISTRHO_NAMESPACE::createPlugin(); }
+#elif defined(DISTRHO_PLUGIN_TARGET_STATIC)
+START_NAMESPACE_DISTRHO
+Plugin* createStaticPlugin() { return createPlugin(); }
+END_NAMESPACE_DISTRHO
#else
# error unsupported format
#endif
diff --git a/distrho/DistrhoUIMain.cpp b/distrho/DistrhoUIMain.cpp
@@ -1,6 +1,6 @@
/*
* DISTRHO Plugin Framework (DPF)
- * Copyright (C) 2012-2021 Filipe Coelho <falktx@falktx.com>
+ * Copyright (C) 2012-2022 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
@@ -28,7 +28,7 @@
// nothing
#elif defined(DISTRHO_PLUGIN_TARGET_VST3)
# include "src/DistrhoUIVST3.cpp"
-#elif defined(DISTRHO_PLUGIN_TARGET_SHARED)
+#elif defined(DISTRHO_PLUGIN_TARGET_SHARED) || defined(DISTRHO_PLUGIN_TARGET_STATIC)
// nothing
#else
# error unsupported format