From 14e959b06b5f167b0406772fc0ee8e2111eb4613 Mon Sep 17 00:00:00 2001 From: David Robillard Date: Sun, 19 Apr 2020 19:46:20 +0200 Subject: Set library flags on targets only instead of globally --- wscript | 24 ++++++++++++++---------- 1 file changed, 14 insertions(+), 10 deletions(-) (limited to 'wscript') diff --git a/wscript b/wscript index 8385e40..bf4596d 100644 --- a/wscript +++ b/wscript @@ -63,8 +63,6 @@ def configure(conf): if conf.env.MSVC_COMPILER: append_cflags(['/wd4191', '/wd4355']) else: - conf.env.append_unique('LINKFLAGS', ['-fvisibility=hidden']) - append_cflags(['-fvisibility=hidden']) if Options.options.ultra_strict: append_cflags(['-Wunused-parameter', '-Wno-pedantic']) @@ -221,18 +219,24 @@ def build(bld): 'install_path': '${LIBDIR}', 'vnum': PUGL_VERSION}) + flags = [] if bld.env.MSVC_COMPILER else ['-fPIC', '-fvisibility=hidden'] + if bld.env.BUILD_SHARED: - bld(features = 'c cshlib', - name = name, - target = 'pugl_%s-%s' % (name, PUGL_MAJOR_VERSION), - defines = ['PUGL_INTERNAL', 'PUGL_SHARED'], + bld(features = 'c cshlib', + name = name, + target = 'pugl_%s-%s' % (name, PUGL_MAJOR_VERSION), + defines = ['PUGL_INTERNAL', 'PUGL_SHARED'], + cflags = flags, + linkflags = flags, **args) if bld.env.BUILD_STATIC: - bld(features = 'c cstlib', - name = 'pugl_%s_static' % name, - target = 'pugl_%s-%s' % (name, PUGL_MAJOR_VERSION), - defines = ['PUGL_INTERNAL', 'PUGL_DISABLE_DEPRECATED'], + bld(features = 'c cstlib', + name = 'pugl_%s_static' % name, + target = 'pugl_%s-%s' % (name, PUGL_MAJOR_VERSION), + defines = ['PUGL_INTERNAL', 'PUGL_DISABLE_DEPRECATED'], + cflags = flags, + linkflags = flags, **args) def build_platform(platform, **kwargs): -- cgit v1.2.1