Add option to link mono statically on Windows

(cherry picked from commit b5e6e142ef)
This commit is contained in:
Ignacio Etcheverry 2018-04-25 21:15:35 +02:00 committed by Hein-Pieter van Braam
parent 7645c539c8
commit c358e4c728
1 changed files with 28 additions and 14 deletions

View File

@ -59,9 +59,6 @@ def configure(env):
mono_lib_names = ['mono-2.0-sgen', 'monosgen-2.0'] mono_lib_names = ['mono-2.0-sgen', 'monosgen-2.0']
if env['platform'] == 'windows': if env['platform'] == 'windows':
if mono_static:
raise RuntimeError('mono-static: Not supported on Windows')
if bits == '32': if bits == '32':
if os.getenv('MONO32_PREFIX'): if os.getenv('MONO32_PREFIX'):
mono_root = os.getenv('MONO32_PREFIX') mono_root = os.getenv('MONO32_PREFIX')
@ -81,6 +78,23 @@ def configure(env):
env.Append(LIBPATH=mono_lib_path) env.Append(LIBPATH=mono_lib_path)
env.Append(CPPPATH=os.path.join(mono_root, 'include', 'mono-2.0')) env.Append(CPPPATH=os.path.join(mono_root, 'include', 'mono-2.0'))
if mono_static:
lib_suffix = Environment()['LIBSUFFIX']
mono_static_lib_name = 'libmono-static-sgen'
if not os.path.isfile(os.path.join(mono_lib_path, mono_static_lib_name + lib_suffix)):
raise RuntimeError('Could not find static mono library in: ' + mono_lib_path)
if os.getenv('VCINSTALLDIR'):
env.Append(LINKFLAGS=mono_static_lib_name + lib_suffix)
env.Append(LINKFLAGS='Mincore' + lib_suffix)
env.Append(LINKFLAGS='msvcrt' + lib_suffix)
env.Append(LINKFLAGS='LIBCMT' + lib_suffix)
env.Append(LINKFLAGS='Psapi' + lib_suffix)
else:
env.Append(LIBS=mono_static_lib_name)
else:
mono_lib_name = find_file_in_dir(mono_lib_path, mono_lib_names, extension='.lib') mono_lib_name = find_file_in_dir(mono_lib_path, mono_lib_names, extension='.lib')
if not mono_lib_name: if not mono_lib_name: