add -fvisibility=hidden to libgtkmm2ext, and make things work

This commit is contained in:
Paul Davis 2013-10-17 14:36:41 -04:00
parent 2eabeebdc5
commit 2fab8182cc
10 changed files with 60 additions and 35 deletions

View file

@ -22,6 +22,7 @@
#include <list> #include <list>
#define ABSTRACT_UI_EXPORTS
#include "pbd/abstract_ui.h" #include "pbd/abstract_ui.h"
#include "pbd/signals.h" #include "pbd/signals.h"
#include "pbd/stacktrace.h" #include "pbd/stacktrace.h"

View file

@ -43,6 +43,7 @@
#include "gtkmm2ext/actions.h" #include "gtkmm2ext/actions.h"
#include "gtkmm2ext/activatable.h" #include "gtkmm2ext/activatable.h"
#include "gtkmm2ext/actions.h" #include "gtkmm2ext/actions.h"
#include "gtkmm2ext/gui_thread.h"
#include "i18n.h" #include "i18n.h"

View file

@ -28,67 +28,69 @@
#include <gtkmm/actiongroup.h> #include <gtkmm/actiongroup.h>
#include <gtkmm/accelkey.h> #include <gtkmm/accelkey.h>
#include "gtkmm2ext/visibility.h"
namespace Gtk { namespace Gtk {
class UIManager; class UIManager;
} }
namespace ActionManager { namespace ActionManager {
extern std::string unbound_string; /* the key string returned if an action is not bound */ LIBGTKMM2EXT_API extern std::string unbound_string; /* the key string returned if an action is not bound */
extern Glib::RefPtr<Gtk::UIManager> ui_manager; LIBGTKMM2EXT_API extern Glib::RefPtr<Gtk::UIManager> ui_manager;
extern void set_sensitive (std::vector<Glib::RefPtr<Gtk::Action> >& actions, bool); LIBGTKMM2EXT_API extern void set_sensitive (std::vector<Glib::RefPtr<Gtk::Action> >& actions, bool);
extern std::string get_key_representation (const std::string& accel_path, Gtk::AccelKey& key); LIBGTKMM2EXT_API extern std::string get_key_representation (const std::string& accel_path, Gtk::AccelKey& key);
extern Gtk::Widget* get_widget (const char * name); LIBGTKMM2EXT_API extern Gtk::Widget* get_widget (const char * name);
extern Glib::RefPtr<Gtk::Action> get_action (const char* group, const char* name); LIBGTKMM2EXT_API extern Glib::RefPtr<Gtk::Action> get_action (const char* group, const char* name);
extern Glib::RefPtr<Gtk::Action> get_action (const char* path); LIBGTKMM2EXT_API extern Glib::RefPtr<Gtk::Action> get_action (const char* path);
extern Glib::RefPtr<Gtk::Action> get_action_from_name (const char* name); LIBGTKMM2EXT_API extern Glib::RefPtr<Gtk::Action> get_action_from_name (const char* name);
extern void do_action (const char* group, const char* name); LIBGTKMM2EXT_API 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 void set_toggle_action (const char* group, const char* name, bool);
extern void add_action_group (Glib::RefPtr<Gtk::ActionGroup>); LIBGTKMM2EXT_API extern void add_action_group (Glib::RefPtr<Gtk::ActionGroup>);
extern Glib::RefPtr<Gtk::Action> register_action (Glib::RefPtr<Gtk::ActionGroup> group, LIBGTKMM2EXT_API extern Glib::RefPtr<Gtk::Action> register_action (Glib::RefPtr<Gtk::ActionGroup> group,
const char * name, const char * label); const char * name, const char * label);
extern Glib::RefPtr<Gtk::Action> register_action (Glib::RefPtr<Gtk::ActionGroup> group, LIBGTKMM2EXT_API extern Glib::RefPtr<Gtk::Action> register_action (Glib::RefPtr<Gtk::ActionGroup> group,
const char * name, const char * label, sigc::slot<void> sl, const char * name, const char * label, sigc::slot<void> sl,
guint key, Gdk::ModifierType mods); guint key, Gdk::ModifierType mods);
extern Glib::RefPtr<Gtk::Action> register_action (Glib::RefPtr<Gtk::ActionGroup> group, LIBGTKMM2EXT_API extern Glib::RefPtr<Gtk::Action> register_action (Glib::RefPtr<Gtk::ActionGroup> group,
const char * name, const char * label, sigc::slot<void> sl); const char * name, const char * label, sigc::slot<void> sl);
extern Glib::RefPtr<Gtk::Action> register_radio_action (Glib::RefPtr<Gtk::ActionGroup> group, Gtk::RadioAction::Group&, LIBGTKMM2EXT_API extern Glib::RefPtr<Gtk::Action> register_radio_action (Glib::RefPtr<Gtk::ActionGroup> group, Gtk::RadioAction::Group&,
const char * name, const char * label, sigc::slot<void> sl, const char * name, const char * label, sigc::slot<void> sl,
guint key, Gdk::ModifierType mods); guint key, Gdk::ModifierType mods);
extern Glib::RefPtr<Gtk::Action> register_radio_action (Glib::RefPtr<Gtk::ActionGroup> group, Gtk::RadioAction::Group&, LIBGTKMM2EXT_API extern Glib::RefPtr<Gtk::Action> register_radio_action (Glib::RefPtr<Gtk::ActionGroup> group, Gtk::RadioAction::Group&,
const char * name, const char * label, sigc::slot<void> sl); const char * name, const char * label, sigc::slot<void> sl);
extern Glib::RefPtr<Gtk::Action> register_radio_action (Glib::RefPtr<Gtk::ActionGroup> group, Gtk::RadioAction::Group&, LIBGTKMM2EXT_API extern Glib::RefPtr<Gtk::Action> register_radio_action (Glib::RefPtr<Gtk::ActionGroup> group, Gtk::RadioAction::Group&,
std::string const &, std::string const &, std::string const &, sigc::slot<void> sl); std::string const &, std::string const &, std::string const &, sigc::slot<void> sl);
extern Glib::RefPtr<Gtk::Action> register_toggle_action (Glib::RefPtr<Gtk::ActionGroup> group, LIBGTKMM2EXT_API extern Glib::RefPtr<Gtk::Action> register_toggle_action (Glib::RefPtr<Gtk::ActionGroup> group,
const char * name, const char * label, sigc::slot<void> sl, const char * name, const char * label, sigc::slot<void> sl,
guint key, Gdk::ModifierType mods); guint key, Gdk::ModifierType mods);
extern Glib::RefPtr<Gtk::Action> register_toggle_action (Glib::RefPtr<Gtk::ActionGroup> group, LIBGTKMM2EXT_API extern Glib::RefPtr<Gtk::Action> register_toggle_action (Glib::RefPtr<Gtk::ActionGroup> group,
std::string const &, std::string const &, std::string const &, sigc::slot<void> sl); std::string const &, std::string const &, std::string const &, sigc::slot<void> sl);
extern Glib::RefPtr<Gtk::Action> register_toggle_action (Glib::RefPtr<Gtk::ActionGroup> group, LIBGTKMM2EXT_API extern Glib::RefPtr<Gtk::Action> register_toggle_action (Glib::RefPtr<Gtk::ActionGroup> group,
const char * name, const char * label, sigc::slot<void> sl); const char * name, const char * label, sigc::slot<void> 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<std::string>& names, LIBGTKMM2EXT_API extern void get_all_actions (std::vector<std::string>& names,
std::vector<std::string>& paths, std::vector<std::string>& paths,
std::vector<std::string>& tooltips, std::vector<std::string>& tooltips,
std::vector<std::string>& keys, std::vector<std::string>& keys,
std::vector<Gtk::AccelKey>& bindings); std::vector<Gtk::AccelKey>& bindings);
extern void get_all_actions (std::vector<std::string>& groups, LIBGTKMM2EXT_API extern void get_all_actions (std::vector<std::string>& groups,
std::vector<std::string>& paths, std::vector<std::string>& paths,
std::vector<std::string>& tooltips, std::vector<std::string>& tooltips,
std::vector<Gtk::AccelKey>& bindings); std::vector<Gtk::AccelKey>& bindings);
extern void check_toggleaction (std::string); LIBGTKMM2EXT_API extern void check_toggleaction (std::string);
extern void uncheck_toggleaction (std::string); LIBGTKMM2EXT_API extern void uncheck_toggleaction (std::string);
extern void set_toggleaction_state (std::string, bool); LIBGTKMM2EXT_API extern void set_toggleaction_state (std::string, bool);
}; };
#endif /* __libgtkmm2ext_actions_h__ */ #endif /* __libgtkmm2ext_actions_h__ */

View file

@ -37,12 +37,13 @@
#include <gtkmm/textbuffer.h> #include <gtkmm/textbuffer.h>
#include <gtkmm/main.h> #include <gtkmm/main.h>
#include <gdkmm/color.h> #include <gdkmm/color.h>
#include <pbd/abstract_ui.h>
#include <pbd/ringbufferNPT.h> #define ABSTRACT_UI_EXPORTS
#include "pbd/abstract_ui.h"
#include <pbd/pool.h> #include "pbd/ringbufferNPT.h"
#include <pbd/error.h> #include "pbd/pool.h"
#include <pbd/receiver.h> #include "pbd/error.h"
#include "pbd/receiver.h"
#include "gtkmm2ext/visibility.h" #include "gtkmm2ext/visibility.h"

View file

@ -90,6 +90,8 @@ def build(bld):
obj.defines = [ 'LIBGTKMM2EXT_DLL=1', 'LIBGTKMM2EXT_DLL_EXPORTS=1' ] obj.defines = [ 'LIBGTKMM2EXT_DLL=1', 'LIBGTKMM2EXT_DLL_EXPORTS=1' ]
# internal shared libs that we use # internal shared libs that we use
obj.defines += [ 'LIBPBD_DLL=1' ] obj.defines += [ 'LIBPBD_DLL=1' ]
obj.cxxflags = [ '-fvisibility=hidden' ]
obj.cflags = [ '-fvisibility=hidden' ]
else: else:
obj = bld.stlib(features = 'c cxx cstlib cxxstlib', source=gtkmm2ext_sources) obj = bld.stlib(features = 'c cxx cstlib cxxstlib', source=gtkmm2ext_sources)
obj.cxxflags = [ '-fPIC' ] obj.cxxflags = [ '-fPIC' ]

View file

@ -32,10 +32,27 @@
#include "pbd/signals.h" #include "pbd/signals.h"
#include "pbd/base_ui.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<T> (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; class Touchable;
template<typename RequestObject> template<typename RequestObject>
class AbstractUI : public BaseUI class ABSTRACT_UI_API AbstractUI : public BaseUI /* see notes in visibility.h about why this is not LIBPBD_API */
{ {
public: public:
AbstractUI (const std::string& name); AbstractUI (const std::string& name);

View file

@ -38,8 +38,6 @@
#define LIBPBD_DLL_IMPORT #define LIBPBD_DLL_IMPORT
#define LIBPBD_DLL_EXPORT #define LIBPBD_DLL_EXPORT
#define LIBPBD_DLL_LOCAL #define LIBPBD_DLL_LOCAL
#define LIBPBD_DLL_IMPORT_CLASS
#define LIBPBD_DLL_EXPORT_CLASS
#endif #endif
#endif #endif

View file

@ -28,6 +28,7 @@
#include <pthread.h> #include <pthread.h>
#include <boost/smart_ptr.hpp> #include <boost/smart_ptr.hpp>
#define ABSTRACT_UI_EXPORTS
#include "pbd/abstract_ui.h" #include "pbd/abstract_ui.h"
#include "midi++/types.h" #include "midi++/types.h"
#include "ardour/types.h" #include "ardour/types.h"

View file

@ -31,6 +31,7 @@
#include <glibmm/main.h> #include <glibmm/main.h>
#define ABSTRACT_UI_EXPORTS
#include "pbd/abstract_ui.h" #include "pbd/abstract_ui.h"
#include "ardour/types.h" #include "ardour/types.h"

View file

@ -23,6 +23,7 @@
#include <cwiid.h> #include <cwiid.h>
#define ABSTRACT_UI_EXPORTS
#include "pbd/abstract_ui.h" #include "pbd/abstract_ui.h"
#include "ardour/types.h" #include "ardour/types.h"
#include "control_protocol/control_protocol.h" #include "control_protocol/control_protocol.h"