Can build Python extension on OSX.
This commit is contained in:
parent
98d3fb5372
commit
a04c33e125
|
@ -46,6 +46,7 @@ known_shlib_kwargs = known_basic_kwargs.copy()
|
|||
known_shlib_kwargs.update({'version' : True,
|
||||
'soversion' : True,
|
||||
'name_prefix' : True,
|
||||
'name_suffix' : True,
|
||||
})
|
||||
|
||||
backslash_explanation = \
|
||||
|
@ -415,9 +416,20 @@ class BuildTarget():
|
|||
self.resources = resources
|
||||
if 'name_prefix' in kwargs:
|
||||
name_prefix = kwargs['name_prefix']
|
||||
if not isinstance(name_prefix, str):
|
||||
if isinstance(name_prefix, list):
|
||||
if len(name_prefix) != 0:
|
||||
raise InvalidArguments('Array must be empty to signify null.')
|
||||
elif not isinstance(name_prefix, str):
|
||||
raise InvalidArguments('Name prefix must be a string.')
|
||||
self.prefix = name_prefix
|
||||
if 'name_suffix' in kwargs:
|
||||
name_suffix = kwargs['name_suffix']
|
||||
if isinstance(name_suffix, list):
|
||||
if len(name_suffix) != 0:
|
||||
raise InvalidArguments('Array must be empty to signify null.')
|
||||
elif not isinstance(name_suffix, str):
|
||||
raise InvalidArguments('Name suffix must be a string.')
|
||||
self.suffix = name_suffix
|
||||
|
||||
def get_subdir(self):
|
||||
return self.subdir
|
||||
|
@ -684,14 +696,17 @@ class SharedLibrary(BuildTarget):
|
|||
super().__init__(name, subdir, subproject, is_cross, sources, objects, environment, kwargs);
|
||||
if len(self.sources) > 0 and self.sources[0].endswith('.cs'):
|
||||
prefix = 'lib'
|
||||
self.suffix = 'dll'
|
||||
suffix = 'dll'
|
||||
else:
|
||||
prefix = environment.get_shared_lib_prefix()
|
||||
self.suffix = environment.get_shared_lib_suffix()
|
||||
suffix = environment.get_shared_lib_suffix()
|
||||
if not hasattr(self, 'prefix'):
|
||||
self.prefix = prefix
|
||||
if not hasattr(self, 'suffix'):
|
||||
if len(self.sources) > 0 and self.sources[0].endswith('.rs'):
|
||||
self.suffix = 'rlib'
|
||||
else:
|
||||
self.suffix = suffix
|
||||
self.importsuffix = environment.get_import_lib_suffix()
|
||||
self.filename = self.prefix + self.name + '.' + self.suffix
|
||||
|
||||
|
|
|
@ -1077,6 +1077,7 @@ class ThreadDependency(Dependency):
|
|||
class Python3Dependency(Dependency):
|
||||
def __init__(self, environment, kwargs):
|
||||
super().__init__()
|
||||
self.name = 'python3'
|
||||
self.is_found = False
|
||||
try:
|
||||
pkgdep = PkgConfigDependency('python3', environment, kwargs)
|
||||
|
@ -1100,6 +1101,14 @@ class Python3Dependency(Dependency):
|
|||
self.libs = ['-L{}/libs'.format(basedir),
|
||||
'-lpython{}'.format(vernum)]
|
||||
self.is_found = True
|
||||
elif mesonlib.is_osx():
|
||||
# In OSX the Python 3 framework does not have a version
|
||||
# number in its name.
|
||||
fw = ExtraFrameworkDependency('python', False)
|
||||
if fw.found():
|
||||
self.cargs = fw.get_compile_args()
|
||||
self.libs = fw.get_link_args()
|
||||
self.is_found = True
|
||||
if self.is_found:
|
||||
mlog.log('Dependency', mlog.bold(self.name), 'found:', mlog.green('YES'))
|
||||
else:
|
||||
|
|
|
@ -1,6 +1,14 @@
|
|||
if host_machine.system() == 'darwin'
|
||||
# Default suffix is 'dylib' but Python does not use for extensions.
|
||||
suffix = 'so'
|
||||
else
|
||||
suffix = []
|
||||
endif
|
||||
|
||||
pylib = shared_library('tachyon',
|
||||
'tachyon_module.c',
|
||||
dependencies : py3_dep,
|
||||
name_prefix : '')
|
||||
name_prefix : '',
|
||||
name_suffix : suffix)
|
||||
|
||||
pypathdir = meson.current_build_dir()
|
||||
|
|
Loading…
Reference in New Issue