Deal with clang-cl generating empty implibs
Deal with clang-cl doing the sane (but different to MSVC) thing, of generating an empty import library, rather than silently ignoring /IMPLIB when there are no exports.
This commit is contained in:
parent
e116b94833
commit
94cdb68a3a
|
@ -118,8 +118,14 @@ def get_relative_files_list_from_dir(fromdir):
|
||||||
return paths
|
return paths
|
||||||
|
|
||||||
def platform_fix_name(fname, compiler, env):
|
def platform_fix_name(fname, compiler, env):
|
||||||
|
# canonicalize compiler
|
||||||
|
if compiler == 'clang-cl':
|
||||||
|
canonical_compiler = 'msvc'
|
||||||
|
else:
|
||||||
|
canonical_compiler = compiler
|
||||||
|
|
||||||
if '?lib' in fname:
|
if '?lib' in fname:
|
||||||
if mesonlib.for_windows(env.is_cross_build(), env) and compiler == 'msvc':
|
if mesonlib.for_windows(env.is_cross_build(), env) and canonical_compiler == 'msvc':
|
||||||
fname = re.sub(r'lib/\?lib(.*)\.', r'bin/\1.', fname)
|
fname = re.sub(r'lib/\?lib(.*)\.', r'bin/\1.', fname)
|
||||||
fname = re.sub(r'/\?lib/', r'/bin/', fname)
|
fname = re.sub(r'/\?lib/', r'/bin/', fname)
|
||||||
elif mesonlib.for_windows(env.is_cross_build(), env):
|
elif mesonlib.for_windows(env.is_cross_build(), env):
|
||||||
|
@ -141,17 +147,17 @@ def platform_fix_name(fname, compiler, env):
|
||||||
|
|
||||||
if fname.startswith('?msvc:'):
|
if fname.startswith('?msvc:'):
|
||||||
fname = fname[6:]
|
fname = fname[6:]
|
||||||
if compiler != 'msvc':
|
if canonical_compiler != 'msvc':
|
||||||
return None
|
return None
|
||||||
|
|
||||||
if fname.startswith('?gcc:'):
|
if fname.startswith('?gcc:'):
|
||||||
fname = fname[5:]
|
fname = fname[5:]
|
||||||
if compiler == 'msvc':
|
if canonical_compiler == 'msvc':
|
||||||
return None
|
return None
|
||||||
|
|
||||||
if fname.startswith('?cygwin:'):
|
if fname.startswith('?cygwin:'):
|
||||||
fname = fname[8:]
|
fname = fname[8:]
|
||||||
if compiler == 'msvc' or not mesonlib.for_cygwin(env.is_cross_build(), env):
|
if not mesonlib.for_cygwin(env.is_cross_build(), env):
|
||||||
return None
|
return None
|
||||||
|
|
||||||
if fname.endswith('?so'):
|
if fname.endswith('?so'):
|
||||||
|
@ -173,11 +179,14 @@ def platform_fix_name(fname, compiler, env):
|
||||||
else:
|
else:
|
||||||
return fname[:-3] + '.so'
|
return fname[:-3] + '.so'
|
||||||
|
|
||||||
if fname.endswith('?implib'):
|
if fname.endswith('?implib') or fname.endswith('?implibempty'):
|
||||||
if mesonlib.for_windows(env.is_cross_build(), env) and compiler == 'msvc':
|
if mesonlib.for_windows(env.is_cross_build(), env) and canonical_compiler == 'msvc':
|
||||||
return re.sub(r'/(?:lib|)([^/]*?)\?implib$', r'/\1.lib', fname)
|
# only MSVC doesn't generate empty implibs
|
||||||
|
if fname.endswith('?implibempty') and compiler == 'msvc':
|
||||||
|
return None
|
||||||
|
return re.sub(r'/(?:lib|)([^/]*?)\?implib(?:empty|)$', r'/\1.lib', fname)
|
||||||
elif mesonlib.for_windows(env.is_cross_build(), env) or mesonlib.for_cygwin(env.is_cross_build(), env):
|
elif mesonlib.for_windows(env.is_cross_build(), env) or mesonlib.for_cygwin(env.is_cross_build(), env):
|
||||||
return fname[:-7] + '.dll.a'
|
return re.sub(r'\?implib(?:empty|)$', r'.dll.a', fname)
|
||||||
else:
|
else:
|
||||||
return None
|
return None
|
||||||
|
|
||||||
|
@ -732,10 +741,6 @@ def detect_system_compiler():
|
||||||
raise RuntimeError("Could not find C compiler.")
|
raise RuntimeError("Could not find C compiler.")
|
||||||
system_compiler = comp.get_id()
|
system_compiler = comp.get_id()
|
||||||
|
|
||||||
# canonicalize for platform_fix_name()
|
|
||||||
if system_compiler == 'clang-cl':
|
|
||||||
system_compiler = 'msvc'
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
parser = argparse.ArgumentParser(description="Run the test suite of Meson.")
|
parser = argparse.ArgumentParser(description="Run the test suite of Meson.")
|
||||||
parser.add_argument('extra_args', nargs='*',
|
parser.add_argument('extra_args', nargs='*',
|
||||||
|
|
|
@ -1,3 +1,3 @@
|
||||||
usr/lib/modules/libnosyms?so
|
usr/lib/modules/libnosyms?so
|
||||||
?gcc:usr/lib/modules/libnosyms?implib
|
usr/lib/modules/libnosyms?implibempty
|
||||||
?msvc:usr/lib/modules/nosyms.pdb
|
?msvc:usr/lib/modules/nosyms.pdb
|
||||||
|
|
Loading…
Reference in New Issue