From 2fab8182cc1e40844652922acf56cc0d71bc2051 Mon Sep 17 00:00:00 2001 From: Paul Davis Date: Thu, 17 Oct 2013 14:36:41 -0400 Subject: add -fvisibility=hidden to libgtkmm2ext, and make things work --- libs/ardour/ardour/midi_ui.h | 1 + libs/gtkmm2ext/gtk_ui.cc | 1 + libs/gtkmm2ext/gtkmm2ext/actions.h | 54 +++++++++++++------------- libs/gtkmm2ext/gtkmm2ext/gtk_ui.h | 13 ++++--- libs/gtkmm2ext/wscript | 2 + libs/pbd/pbd/abstract_ui.h | 19 ++++++++- libs/pbd/pbd/libpbd_visibility.h | 2 - libs/surfaces/mackie/mackie_control_protocol.h | 1 + libs/surfaces/osc/osc.h | 1 + libs/surfaces/wiimote/wiimote.h | 1 + 10 files changed, 60 insertions(+), 35 deletions(-) diff --git a/libs/ardour/ardour/midi_ui.h b/libs/ardour/ardour/midi_ui.h index 469f293770..e99d6bf499 100644 --- a/libs/ardour/ardour/midi_ui.h +++ b/libs/ardour/ardour/midi_ui.h @@ -22,6 +22,7 @@ #include +#define ABSTRACT_UI_EXPORTS #include "pbd/abstract_ui.h" #include "pbd/signals.h" #include "pbd/stacktrace.h" diff --git a/libs/gtkmm2ext/gtk_ui.cc b/libs/gtkmm2ext/gtk_ui.cc index d9e4c871a6..fc94657f6d 100644 --- a/libs/gtkmm2ext/gtk_ui.cc +++ b/libs/gtkmm2ext/gtk_ui.cc @@ -43,6 +43,7 @@ #include "gtkmm2ext/actions.h" #include "gtkmm2ext/activatable.h" #include "gtkmm2ext/actions.h" +#include "gtkmm2ext/gui_thread.h" #include "i18n.h" diff --git a/libs/gtkmm2ext/gtkmm2ext/actions.h b/libs/gtkmm2ext/gtkmm2ext/actions.h index 9101f8ea92..d92f85bb6e 100644 --- a/libs/gtkmm2ext/gtkmm2ext/actions.h +++ b/libs/gtkmm2ext/gtkmm2ext/actions.h @@ -28,67 +28,69 @@ #include #include +#include "gtkmm2ext/visibility.h" + namespace Gtk { class UIManager; } namespace ActionManager { - extern std::string unbound_string; /* the key string returned if an action is not bound */ - extern Glib::RefPtr ui_manager; + LIBGTKMM2EXT_API extern std::string unbound_string; /* the key string returned if an action is not bound */ + LIBGTKMM2EXT_API extern Glib::RefPtr ui_manager; - extern void set_sensitive (std::vector >& actions, bool); - extern std::string get_key_representation (const std::string& accel_path, Gtk::AccelKey& key); + LIBGTKMM2EXT_API extern void set_sensitive (std::vector >& actions, bool); + LIBGTKMM2EXT_API extern std::string get_key_representation (const std::string& accel_path, Gtk::AccelKey& key); - extern Gtk::Widget* get_widget (const char * name); - extern Glib::RefPtr get_action (const char* group, const char* name); - extern Glib::RefPtr get_action (const char* path); - extern Glib::RefPtr get_action_from_name (const char* name); - extern void do_action (const char* group, const char* name); - extern void set_toggle_action (const char* group, const char* name, bool); + LIBGTKMM2EXT_API extern Gtk::Widget* get_widget (const char * name); + LIBGTKMM2EXT_API extern Glib::RefPtr get_action (const char* group, const char* name); + LIBGTKMM2EXT_API extern Glib::RefPtr get_action (const char* path); + LIBGTKMM2EXT_API extern Glib::RefPtr get_action_from_name (const char* name); + LIBGTKMM2EXT_API extern void do_action (const char* group, const char* name); + LIBGTKMM2EXT_API extern void set_toggle_action (const char* group, const char* name, bool); - extern void add_action_group (Glib::RefPtr); + LIBGTKMM2EXT_API extern void add_action_group (Glib::RefPtr); - extern Glib::RefPtr register_action (Glib::RefPtr group, + LIBGTKMM2EXT_API extern Glib::RefPtr register_action (Glib::RefPtr group, const char * name, const char * label); - extern Glib::RefPtr register_action (Glib::RefPtr group, + LIBGTKMM2EXT_API extern Glib::RefPtr register_action (Glib::RefPtr group, const char * name, const char * label, sigc::slot sl, guint key, Gdk::ModifierType mods); - extern Glib::RefPtr register_action (Glib::RefPtr group, + LIBGTKMM2EXT_API extern Glib::RefPtr register_action (Glib::RefPtr group, const char * name, const char * label, sigc::slot sl); - extern Glib::RefPtr register_radio_action (Glib::RefPtr group, Gtk::RadioAction::Group&, + LIBGTKMM2EXT_API extern Glib::RefPtr register_radio_action (Glib::RefPtr group, Gtk::RadioAction::Group&, const char * name, const char * label, sigc::slot sl, guint key, Gdk::ModifierType mods); - extern Glib::RefPtr register_radio_action (Glib::RefPtr group, Gtk::RadioAction::Group&, + LIBGTKMM2EXT_API extern Glib::RefPtr register_radio_action (Glib::RefPtr group, Gtk::RadioAction::Group&, const char * name, const char * label, sigc::slot sl); - extern Glib::RefPtr register_radio_action (Glib::RefPtr group, Gtk::RadioAction::Group&, + LIBGTKMM2EXT_API extern Glib::RefPtr register_radio_action (Glib::RefPtr group, Gtk::RadioAction::Group&, std::string const &, std::string const &, std::string const &, sigc::slot sl); - extern Glib::RefPtr register_toggle_action (Glib::RefPtr group, + LIBGTKMM2EXT_API extern Glib::RefPtr register_toggle_action (Glib::RefPtr group, const char * name, const char * label, sigc::slot sl, guint key, Gdk::ModifierType mods); - extern Glib::RefPtr register_toggle_action (Glib::RefPtr group, + LIBGTKMM2EXT_API extern Glib::RefPtr register_toggle_action (Glib::RefPtr group, std::string const &, std::string const &, std::string const &, sigc::slot sl); - extern Glib::RefPtr register_toggle_action (Glib::RefPtr group, + LIBGTKMM2EXT_API extern Glib::RefPtr register_toggle_action (Glib::RefPtr group, const char * name, const char * label, sigc::slot sl); - extern bool lookup_entry (const Glib::ustring accel_path, Gtk::AccelKey& key); + LIBGTKMM2EXT_API extern bool lookup_entry (const Glib::ustring accel_path, Gtk::AccelKey& key); - extern void get_all_actions (std::vector& names, + LIBGTKMM2EXT_API extern void get_all_actions (std::vector& names, std::vector& paths, std::vector& tooltips, std::vector& keys, std::vector& bindings); - extern void get_all_actions (std::vector& groups, + LIBGTKMM2EXT_API extern void get_all_actions (std::vector& groups, std::vector& paths, std::vector& tooltips, std::vector& bindings); - extern void check_toggleaction (std::string); - extern void uncheck_toggleaction (std::string); - extern void set_toggleaction_state (std::string, bool); + LIBGTKMM2EXT_API extern void check_toggleaction (std::string); + LIBGTKMM2EXT_API extern void uncheck_toggleaction (std::string); + LIBGTKMM2EXT_API extern void set_toggleaction_state (std::string, bool); }; #endif /* __libgtkmm2ext_actions_h__ */ diff --git a/libs/gtkmm2ext/gtkmm2ext/gtk_ui.h b/libs/gtkmm2ext/gtkmm2ext/gtk_ui.h index 2e5cc11d23..b726eb89ac 100644 --- a/libs/gtkmm2ext/gtkmm2ext/gtk_ui.h +++ b/libs/gtkmm2ext/gtkmm2ext/gtk_ui.h @@ -37,12 +37,13 @@ #include #include #include -#include -#include - -#include -#include -#include + +#define ABSTRACT_UI_EXPORTS +#include "pbd/abstract_ui.h" +#include "pbd/ringbufferNPT.h" +#include "pbd/pool.h" +#include "pbd/error.h" +#include "pbd/receiver.h" #include "gtkmm2ext/visibility.h" diff --git a/libs/gtkmm2ext/wscript b/libs/gtkmm2ext/wscript index 7600c8a089..955b133d33 100644 --- a/libs/gtkmm2ext/wscript +++ b/libs/gtkmm2ext/wscript @@ -90,6 +90,8 @@ def build(bld): obj.defines = [ 'LIBGTKMM2EXT_DLL=1', 'LIBGTKMM2EXT_DLL_EXPORTS=1' ] # internal shared libs that we use obj.defines += [ 'LIBPBD_DLL=1' ] + obj.cxxflags = [ '-fvisibility=hidden' ] + obj.cflags = [ '-fvisibility=hidden' ] else: obj = bld.stlib(features = 'c cxx cstlib cxxstlib', source=gtkmm2ext_sources) obj.cxxflags = [ '-fPIC' ] diff --git a/libs/pbd/pbd/abstract_ui.h b/libs/pbd/pbd/abstract_ui.h index e78cf1ce28..f78ba26090 100644 --- a/libs/pbd/pbd/abstract_ui.h +++ b/libs/pbd/pbd/abstract_ui.h @@ -32,10 +32,27 @@ #include "pbd/signals.h" #include "pbd/base_ui.h" +/* We have a special case in libpbd of a template class that gets instantiated + * as the base class of several classes in other libraries. It is not possible + * to use LIBFOO_API to mark this visible, because the FOO in each case is + * different. So we define this generic visible/export/hidden/import pair + * of macros to try to deal with this special case. These should NEVER be + * used anywhere except AbstractUI (or similar cases if they arise. + * + * Note the assumption here that other libs are being built as DLLs if this one is. + */ + +#ifdef ABSTRACT_UI_EXPORTS +#define ABSTRACT_UI_API LIBPBD_DLL_EXPORT +#else +#define ABSTRACT_UI_API LIBPBD_DLL_IMPORT +#endif + + class Touchable; template -class AbstractUI : public BaseUI +class ABSTRACT_UI_API AbstractUI : public BaseUI /* see notes in visibility.h about why this is not LIBPBD_API */ { public: AbstractUI (const std::string& name); diff --git a/libs/pbd/pbd/libpbd_visibility.h b/libs/pbd/pbd/libpbd_visibility.h index 0aa309a4a4..e2c6235f0b 100644 --- a/libs/pbd/pbd/libpbd_visibility.h +++ b/libs/pbd/pbd/libpbd_visibility.h @@ -38,8 +38,6 @@ #define LIBPBD_DLL_IMPORT #define LIBPBD_DLL_EXPORT #define LIBPBD_DLL_LOCAL - #define LIBPBD_DLL_IMPORT_CLASS - #define LIBPBD_DLL_EXPORT_CLASS #endif #endif diff --git a/libs/surfaces/mackie/mackie_control_protocol.h b/libs/surfaces/mackie/mackie_control_protocol.h index 4669247726..81e1436938 100644 --- a/libs/surfaces/mackie/mackie_control_protocol.h +++ b/libs/surfaces/mackie/mackie_control_protocol.h @@ -28,6 +28,7 @@ #include #include +#define ABSTRACT_UI_EXPORTS #include "pbd/abstract_ui.h" #include "midi++/types.h" #include "ardour/types.h" diff --git a/libs/surfaces/osc/osc.h b/libs/surfaces/osc/osc.h index 84dd0d9c86..2479eceaff 100644 --- a/libs/surfaces/osc/osc.h +++ b/libs/surfaces/osc/osc.h @@ -31,6 +31,7 @@ #include +#define ABSTRACT_UI_EXPORTS #include "pbd/abstract_ui.h" #include "ardour/types.h" diff --git a/libs/surfaces/wiimote/wiimote.h b/libs/surfaces/wiimote/wiimote.h index f6ac8edc41..6edadf6c64 100644 --- a/libs/surfaces/wiimote/wiimote.h +++ b/libs/surfaces/wiimote/wiimote.h @@ -23,6 +23,7 @@ #include +#define ABSTRACT_UI_EXPORTS #include "pbd/abstract_ui.h" #include "ardour/types.h" #include "control_protocol/control_protocol.h" -- cgit v1.2.3