diff options
author | David Robillard <d@drobilla.net> | 2021-01-02 13:24:48 +0100 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2021-01-02 14:13:35 +0100 |
commit | 08b89f80784e2885b45cdae0cd5e0a672b0611fd (patch) | |
tree | eb6288bd785e7c0075bb7f2ca7688f05ceb241e4 | |
parent | 2e376791927e6e061c0c044056cff6c1f768b100 (diff) | |
download | sord-08b89f80784e2885b45cdae0cd5e0a672b0611fd.tar.gz sord-08b89f80784e2885b45cdae0cd5e0a672b0611fd.tar.bz2 sord-08b89f80784e2885b45cdae0cd5e0a672b0611fd.zip |
Use SORD_STATIC instead of SORD_SHARED to control visibility
For consistency, this seems to be the most common convention.
-rw-r--r-- | include/sord/sord.h | 19 | ||||
-rw-r--r-- | wscript | 12 |
2 files changed, 12 insertions, 19 deletions
diff --git a/include/sord/sord.h b/include/sord/sord.h index 134d493..3179dd0 100644 --- a/include/sord/sord.h +++ b/include/sord/sord.h @@ -27,19 +27,12 @@ #include <stddef.h> #include <stdint.h> -#ifdef SORD_SHARED -# ifdef _WIN32 -# define SORD_LIB_IMPORT __declspec(dllimport) -# define SORD_LIB_EXPORT __declspec(dllexport) -# else -# define SORD_LIB_IMPORT __attribute__((visibility("default"))) -# define SORD_LIB_EXPORT __attribute__((visibility("default"))) -# endif -# ifdef SORD_INTERNAL -# define SORD_API SORD_LIB_EXPORT -# else -# define SORD_API SORD_LIB_IMPORT -# endif +#if defined(_WIN32) && !defined(SORD_STATIC) && defined(SORD_INTERNAL) +# define SORD_API __declspec(dllexport) +#elif defined(_WIN32) && !defined(SORD_STATIC) +# define SORD_API __declspec(dllimport) +#elif defined(__GNUC__) +# define SORD_API __attribute__((visibility("default"))) #else # define SORD_API #endif @@ -197,7 +197,7 @@ def build(bld): install_path = '${LIBDIR}', libs = libs, uselib = 'SERD', - defines = defines + ['SORD_SHARED', 'SORD_INTERNAL'], + defines = defines + ['SORD_INTERNAL'], cflags = libflags) # Static Library @@ -212,7 +212,7 @@ def build(bld): install_path = '${LIBDIR}', libs = libs, uselib = 'SERD', - defines = ['SORD_INTERNAL']) + defines = ['SORD_STATIC', 'SORD_INTERNAL']) if bld.env.BUILD_TESTS: test_libs = libs @@ -229,7 +229,7 @@ def build(bld): name = 'libsord_profiled', target = 'sord_profiled', install_path = '', - defines = defines, + defines = defines + ['SORD_STATIC', 'SORD_INTERNAL'], cflags = test_cflags, linkflags = test_linkflags, lib = test_libs, @@ -243,7 +243,7 @@ def build(bld): lib = test_libs, target = 'sord_test', install_path = '', - defines = defines, + defines = defines + ['SORD_STATIC'], cflags = test_cflags, linkflags = test_linkflags, uselib = 'SERD') @@ -256,7 +256,7 @@ def build(bld): lib = test_libs, target = 'sordi_static', install_path = '', - defines = defines, + defines = defines + ['SORD_STATIC'], cflags = test_cflags, linkflags = test_linkflags, uselib = 'SERD') @@ -270,7 +270,7 @@ def build(bld): lib = test_libs, target = 'sordmm_test', install_path = '', - defines = defines, + defines = defines + ['SORD_STATIC'], cxxflags = test_cflags, linkflags = test_linkflags, uselib = 'SERD') |