Skip to content

Commit

Permalink
Fix linker errors in plugin builds
Browse files Browse the repository at this point in the history
  • Loading branch information
nickdowell committed Jul 9, 2017
1 parent 8da37b4 commit 4dd9c29
Show file tree
Hide file tree
Showing 7 changed files with 22 additions and 33 deletions.
6 changes: 6 additions & 0 deletions CMakeLists.txt
Expand Up @@ -189,6 +189,8 @@ add_executable(amsynth_dssi_gtk
src/GUI/editor_menus.h
src/GUI/editor_pane.c
src/GUI/editor_pane.h
src/GUI/gui_main.cc
src/GUI/gui_main.h
)

target_link_libraries(amsynth_dssi_gtk
Expand Down Expand Up @@ -218,6 +220,8 @@ add_library(amsynth_lv2_gtk MODULE
src/GUI/editor_menus.h
src/GUI/editor_pane.c
src/GUI/editor_pane.h
src/GUI/gui_main.cc
src/GUI/gui_main.h
src/amsynth_lv2_ui_gtk.cpp
)
set_target_properties(amsynth_lv2_gtk PROPERTIES PREFIX "")
Expand All @@ -238,6 +242,8 @@ add_library(amsynth_vst MODULE
src/GUI/editor_menus.h
src/GUI/editor_pane.c
src/GUI/editor_pane.h
src/GUI/gui_main.cc
src/GUI/gui_main.h
)
target_compile_options(amsynth_vst PUBLIC -DWITH_GUI)
set_target_properties(amsynth_vst PROPERTIES PREFIX "")
Expand Down
6 changes: 3 additions & 3 deletions Makefile.am
Expand Up @@ -80,7 +80,9 @@ libgui_sources = \
src/GUI/editor_menus.cpp \
src/GUI/editor_menus.h \
src/GUI/editor_pane.c \
src/GUI/editor_pane.h
src/GUI/editor_pane.h \
src/GUI/gui_main.cc \
src/GUI/gui_main.h


#
Expand Down Expand Up @@ -122,8 +124,6 @@ if BUILD_GUI
amsynth_SOURCES += $(libgui_sources) \
src/GUI/ConfigDialog.cpp \
src/GUI/ConfigDialog.h \
src/GUI/gui_main.cc \
src/GUI/gui_main.h \
src/GUI/MainMenu.cpp \
src/GUI/MainMenu.h \
src/GUI/MainWindow.cpp \
Expand Down
7 changes: 7 additions & 0 deletions src/GUI/MainWindow.cpp
Expand Up @@ -38,6 +38,7 @@
#include "PresetControllerView.h"

#include <glib/gi18n.h>
#include <gtk/gtk.h>


static MIDILearnDialog *midiLearnDialog;
Expand Down Expand Up @@ -297,6 +298,12 @@ main_window_new(Synthesizer *synthesizer, GenericOutput *audio)
return mainWindow->window;
}

void
main_window_show(Synthesizer *synthesizer, GenericOutput *audio)
{
gtk_widget_show_all(main_window_new(synthesizer, audio));
}

void
modal_midi_learn(Param param_index) // called by editor_pane upon right-clicking a control
{
Expand Down
6 changes: 2 additions & 4 deletions src/GUI/MainWindow.h
Expand Up @@ -22,9 +22,7 @@
#ifndef _MAINWINDOW_H
#define _MAINWINDOW_H

#include <gtk/gtk.h>

GtkWidget *
main_window_new(class Synthesizer *, class GenericOutput *);
void
main_window_show(class Synthesizer *, class GenericOutput *);

#endif
19 changes: 2 additions & 17 deletions src/GUI/gui_main.cc
Expand Up @@ -25,7 +25,7 @@

#include "gui_main.h"

#include "MainWindow.h"
#include <gtk/gtk.h>


static char **_argv = NULL;
Expand All @@ -34,6 +34,7 @@ void gui_kit_init(int *argc, char ***argv)
{
_argv = g_strdupv(*argv);
gtk_init(argc, argv);
gtk_window_set_default_icon_name("amsynth");
}

void gui_kit_run(unsigned (*timer_callback)())
Expand All @@ -42,22 +43,6 @@ void gui_kit_run(unsigned (*timer_callback)())
gtk_main();
}

void gui_init(Synthesizer *synth, GenericOutput *out)
{
gtk_window_set_default_icon_name("amsynth");

GtkWidget *window = main_window_new(synth, out);
gtk_widget_show_all(window);
}

void gui_dealloc()
{
// if (gui) {
// delete gui;
// gui = NULL;
// }
}

void ShowModalErrorMessage(const std::string & msg, const std::string & secondaryText)
{
GtkWidget *dialog = gtk_message_dialog_new(
Expand Down
7 changes: 0 additions & 7 deletions src/GUI/gui_main.h
Expand Up @@ -21,17 +21,10 @@

#include <string>

class GenericOutput;
class Synthesizer;

void gui_kit_init(int *argc, char ***argv);

void gui_kit_run(unsigned (*timer_callback)());

void gui_init(Synthesizer *, GenericOutput *);

void gui_dealloc();

void ShowModalErrorMessage(const std::string & msg, const std::string & secondaryText = "");

#if defined(__linux)
Expand Down
4 changes: 2 additions & 2 deletions src/main.cc
Expand Up @@ -31,6 +31,7 @@
#include "drivers/OSSMidiDriver.h"
#ifdef WITH_GUI
#include "GUI/gui_main.h"
#include "GUI/MainWindow.h"
#endif
#include "JackOutput.h"
#include "lash.h"
Expand Down Expand Up @@ -450,9 +451,8 @@ int main( int argc, char *argv[] )

#ifdef WITH_GUI
if (!no_gui) {
gui_init(s_synthesizer, out);
main_window_show(s_synthesizer, out);
gui_kit_run(&amsynth_timer_callback);
gui_dealloc();
} else {
#endif
printf(_("amsynth running in headless mode, press ctrl-c to exit\n"));
Expand Down

0 comments on commit 4dd9c29

Please sign in to comment.