aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--include/pugl/pugl.h19
-rw-r--r--wscript10
2 files changed, 13 insertions, 16 deletions
diff --git a/include/pugl/pugl.h b/include/pugl/pugl.h
index bb21a29..7cb7bc2 100644
--- a/include/pugl/pugl.h
+++ b/include/pugl/pugl.h
@@ -21,19 +21,12 @@
#include <stddef.h>
#include <stdint.h>
-#ifdef PUGL_SHARED
-# ifdef _WIN32
-# define PUGL_LIB_IMPORT __declspec(dllimport)
-# define PUGL_LIB_EXPORT __declspec(dllexport)
-# else
-# define PUGL_LIB_IMPORT __attribute__((visibility("default")))
-# define PUGL_LIB_EXPORT __attribute__((visibility("default")))
-# endif
-# ifdef PUGL_INTERNAL
-# define PUGL_API PUGL_LIB_EXPORT
-# else
-# define PUGL_API PUGL_LIB_IMPORT
-# endif
+#if defined(_WIN32) && !defined(PUGL_STATIC) && defined(PUGL_INTERNAL)
+# define PUGL_API __declspec(dllexport)
+#elif defined(_WIN32) && !defined(PUGL_STATIC)
+# define PUGL_API __declspec(dllimport)
+#elif defined(__GNUC__)
+# define PUGL_API __attribute__((visibility("default")))
#else
# define PUGL_API
#endif
diff --git a/wscript b/wscript
index 39b86b1..1dc95c1 100644
--- a/wscript
+++ b/wscript
@@ -421,7 +421,7 @@ def build(bld):
bld(features = 'c cshlib',
name = name,
target = 'pugl_%s-%s' % (name, PUGL_MAJOR_VERSION),
- defines = ['PUGL_INTERNAL', 'PUGL_SHARED'],
+ defines = ['PUGL_INTERNAL'],
cflags = flags,
linkflags = flags,
**args)
@@ -430,7 +430,7 @@ def build(bld):
bld(features = 'c cstlib',
name = 'pugl_%s_static' % name,
target = 'pugl_%s-%s' % (name, PUGL_MAJOR_VERSION),
- defines = ['PUGL_INTERNAL', 'PUGL_DISABLE_DEPRECATED'],
+ defines = ['PUGL_STATIC', 'PUGL_INTERNAL', 'PUGL_DISABLE_DEPRECATED'],
cflags = flags,
linkflags = flags,
**args)
@@ -566,6 +566,8 @@ def build(bld):
deps.get(platform, {}).get(k, []) +
deps.get(backend_lib, {}).get(k, []))})
+ kwargs['defines'] = kwargs.get('defines', []) + ['PUGL_STATIC']
+
bld(features = '%s %sprogram' % (lang, lang),
source = source,
target = target,
@@ -612,6 +614,7 @@ def build(bld):
source = 'test/test_%s.c' % test,
target = 'test/test_%s' % test,
install_path = '',
+ defines = ['PUGL_STATIC'],
use = ['pugl_%s_static' % platform,
'pugl_%s_gl_static' % platform],
uselib = deps[platform]['uselib'] + ['GL'])
@@ -641,7 +644,7 @@ def build(bld):
['examples/pugl_vulkan_cxx_demo.cpp',
'examples/file_utils.c'],
platform, 'vulkan',
- defines=['PUGL_DISABLE_DEPRECATED'],
+ defines=['PUGL_STATIC', 'PUGL_DISABLE_DEPRECATED'],
uselib=['DL', 'M', 'PTHREAD', 'VULKAN'])
if bld.env.HAVE_CAIRO:
@@ -654,6 +657,7 @@ def build(bld):
source = 'test/test_%s.c' % test,
target = 'test/test_%s' % test,
install_path = '',
+ defines = ['PUGL_STATIC'],
use = ['pugl_%s_static' % platform,
'pugl_%s_stub_static' % platform,
'pugl_%s_gl_static' % platform],