summaryrefslogtreecommitdiff
path: root/libs/surfaces/control_protocol
diff options
context:
space:
mode:
authorPaul Davis <paul@linuxaudiosystems.com>2013-10-17 13:15:24 -0400
committerPaul Davis <paul@linuxaudiosystems.com>2013-10-17 13:15:24 -0400
commit5896d773e437dafd76bc643b0437391571b41e89 (patch)
tree973de2861a85d2390a3c6916fdc4b1dc3bbfc20a /libs/surfaces/control_protocol
parentf3d2ca0d9ac823d57af39d8d6a34c40e87fefa35 (diff)
add export control to control protocol library
Diffstat (limited to 'libs/surfaces/control_protocol')
-rw-r--r--libs/surfaces/control_protocol/control_protocol/basic_ui.h4
-rw-r--r--libs/surfaces/control_protocol/control_protocol/control_protocol.h3
-rw-r--r--libs/surfaces/control_protocol/control_protocol/visibility.h56
-rw-r--r--libs/surfaces/control_protocol/wscript23
4 files changed, 78 insertions, 8 deletions
diff --git a/libs/surfaces/control_protocol/control_protocol/basic_ui.h b/libs/surfaces/control_protocol/control_protocol/basic_ui.h
index 96a1227463..180688e616 100644
--- a/libs/surfaces/control_protocol/control_protocol/basic_ui.h
+++ b/libs/surfaces/control_protocol/control_protocol/basic_ui.h
@@ -32,12 +32,14 @@
#include "timecode/time.h"
+#include "control_protocol/visibility.h"
+
namespace ARDOUR {
class Session;
class SessionEvent;
}
-class BasicUI {
+class LIBCONTROLCP_API BasicUI {
public:
BasicUI (ARDOUR::Session&);
virtual ~BasicUI ();
diff --git a/libs/surfaces/control_protocol/control_protocol/control_protocol.h b/libs/surfaces/control_protocol/control_protocol/control_protocol.h
index 0c849064bb..55ea459cae 100644
--- a/libs/surfaces/control_protocol/control_protocol/control_protocol.h
+++ b/libs/surfaces/control_protocol/control_protocol/control_protocol.h
@@ -30,6 +30,7 @@
#include "pbd/stateful.h"
#include "pbd/signals.h"
+#include "control_protocol/visibility.h"
#include "control_protocol/basic_ui.h"
#include "control_protocol/types.h"
@@ -39,7 +40,7 @@ class Route;
class Session;
class Bundle;
-class ControlProtocol : public PBD::Stateful, public PBD::ScopedConnectionList, public BasicUI
+class LIBCONTROLCP_API ControlProtocol : public PBD::Stateful, public PBD::ScopedConnectionList, public BasicUI
{
public:
ControlProtocol (Session&, std::string name);
diff --git a/libs/surfaces/control_protocol/control_protocol/visibility.h b/libs/surfaces/control_protocol/control_protocol/visibility.h
new file mode 100644
index 0000000000..40c83b8580
--- /dev/null
+++ b/libs/surfaces/control_protocol/control_protocol/visibility.h
@@ -0,0 +1,56 @@
+/*
+ Copyright (C) 2013 Paul Davis
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+
+*/
+
+#ifndef __libcontrolcp_visibility_h__
+#define __libcontrolcp_visibility_h__
+
+/* _WIN32 is defined by most compilers targetting Windows, but within the
+ * controlcp source tree, we also define COMPILER_MSVC or COMPILER_MINGW depending
+ * on how a Windows build is built.
+ */
+
+#if defined _WIN32 || defined __CYGWIN__ || defined(COMPILER_MSVC) || defined(COMPILER_MINGW)
+ #define LIBCONTROLCP_DLL_IMPORT __declspec(dllimport)
+ #define LIBCONTROLCP_DLL_EXPORT __declspec(dllexport)
+ #define LIBCONTROLCP_DLL_LOCAL
+#else
+ #if __GNUC__ >= 4
+ #define LIBCONTROLCP_DLL_IMPORT __attribute__ ((visibility ("default")))
+ #define LIBCONTROLCP_DLL_EXPORT __attribute__ ((visibility ("default")))
+ #define LIBCONTROLCP_DLL_LOCAL __attribute__ ((visibility ("hidden")))
+ #else
+ #define LIBCONTROLCP_DLL_IMPORT
+ #define LIBCONTROLCP_DLL_EXPORT
+ #define LIBCONTROLCP_DLL_LOCAL
+ #endif
+#endif
+
+#ifdef LIBCONTROLCP_DLL // libcontrolcp is a DLL
+#ifdef LIBCONTROLCP_DLL_EXPORTS // defined if we are building the libcontrolcp DLL (instead of using it)
+ #define LIBCONTROLCP_API LIBCONTROLCP_DLL_EXPORT
+#else
+ #define LIBCONTROLCP_API LIBCONTROLCP_DLL_IMPORT
+#endif
+#define LIBCONTROLCP_LOCAL LIBCONTROLCP_DLL_LOCAL
+#else /* static lib, not DLL */
+#define LIBCONTROLCP_API
+#define LIBCONTROLCP_LOCAL
+#endif
+
+#endif /* __libcontrolcp_visibility_h__ */
diff --git a/libs/surfaces/control_protocol/wscript b/libs/surfaces/control_protocol/wscript
index 2ba48d5138..eb2db5d269 100644
--- a/libs/surfaces/control_protocol/wscript
+++ b/libs/surfaces/control_protocol/wscript
@@ -13,6 +13,11 @@ LIBARDOUR_CP_LIB_VERSION = '4.1.0'
top = '.'
out = 'build'
+controlcp_sources = [
+ 'basic_ui.cc',
+ 'control_protocol.cc',
+ ]
+
def options(opt):
autowaf.set_options(opt)
@@ -20,13 +25,19 @@ def configure(conf):
autowaf.configure(conf)
def build(bld):
- obj = bld(features = 'cxx cxxshlib')
- obj.source = '''
- basic_ui.cc
- control_protocol.cc
- '''
+ if bld.is_defined ('INTERNAL_SHARED_LIBS'):
+ obj = bld.shlib(features = 'c cxx cshlib cxxshlib', source=controlcp_sources)
+ # defines for this library
+ obj.defines = [ 'LIBCONTROLCP_DLL=1', 'LIBCONTROLCP_DLL_EXPORTS=1' ]
+ # internal shared libs that we use
+ obj.defines += [ 'LIBPBD_DLL=1', 'LIBARDOUR_DLL=1' ]
+ else:
+ obj = bld.stlib(features = 'c cxx cstlib cxxstlib', source=controlcp_sources)
+ obj.cxxflags = [ '-fPIC' ]
+ obj.defines = [ ]
+
obj.export_includes = ['.', './control_protocol' ]
- obj.cxxflags = '-DPACKAGE="ardour_cp" -fPIC'
+ obj.defines += [ 'PACKAGE="ardour_cp"' ]
obj.includes = ['.', './control_protocol']
obj.name = 'libardour_cp'
obj.target = 'ardourcp'