From 04d884d38999150d993f48c205e2f6c8dda81b3e Mon Sep 17 00:00:00 2001 From: John Ehresman Date: Tue, 18 Apr 2006 21:41:01 +0000 Subject: Add compiler / linker flags from pkgconfig-2.0.pc by default, with an 2006-04-18 John Ehresman * dsextras.py: Add compiler / linker flags from pkgconfig-2.0.pc by default, with an override mechanism. Filter out -lc & -lm if compiling with msvc. * setup.py: Change C extension name to _gobject and don't use the pkgconfig-2.0.pc when compiling --- dsextras.py | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'dsextras.py') diff --git a/dsextras.py b/dsextras.py index 9caac13..0f8fa62 100644 --- a/dsextras.py +++ b/dsextras.py @@ -137,8 +137,17 @@ class BuildExt(build_ext): # Generate eventual templates before building if hasattr(ext, 'generate'): ext.generate() + # Filter out 'c' and 'm' libs when compilic w/ msvc + if sys.platform == 'win32' and self.compiler.compiler_type == 'msvc': + save_libs = ext.libraries + ext.libraries = [lib for lib in ext.libraries + if lib not in ['c', 'm']] + else: + save_libs = ext.libraries # Invoke base build_extension() build_ext.build_extension(self, ext) + if save_libs != None and save_libs != ext.libraries: + ext.libraries = save_libs class InstallLib(install_lib): @@ -208,6 +217,8 @@ class InstallData(install_data): return install_lib.get_inputs(self) + self.local_inputs class PkgConfigExtension(Extension): + # Name of pygobject package extension depends on, can be None + pygobject_pkc = 'pygobject-2.0' can_build_ok = None def __init__(self, **kwargs): name = kwargs['pkc_name'] @@ -215,6 +226,12 @@ class PkgConfigExtension(Extension): kwargs['define_macros'] = GLOBAL_MACROS kwargs['libraries'] = self.get_libraries(name) kwargs['library_dirs'] = self.get_library_dirs(name) + if 'pygobject_pkc' in kwargs: + self.pygobject_pkc = kwargs.pop('pygobject_pkc') + if self.pygobject_pkc: + kwargs['include_dirs'] += self.get_include_dirs(self.pygobject_pkc) + kwargs['libraries'] += self.get_libraries(self.pygobject_pkc) + kwargs['library_dirs'] += self.get_library_dirs(self.pygobject_pkc) self.name = kwargs['name'] self.pkc_name = kwargs['pkc_name'] self.pkc_version = kwargs['pkc_version'] -- cgit