1
0
mirror of https://github.com/godotengine/godot.git synced 2025-11-04 12:00:25 +00:00

Merge pull request #30292 from neikeq/android_fixes

Mono: Android build and shared libraries fixes
This commit is contained in:
Rémi Verschelde
2019-07-03 21:26:12 +02:00
committed by GitHub
12 changed files with 285 additions and 49 deletions

View File

@@ -41,7 +41,7 @@ def copy_file(src_dir, dst_dir, name):
dst_dir = Dir(dst_dir).abspath
if not os.path.isdir(dst_dir):
os.mkdir(dst_dir)
os.makedirs(dst_dir)
copy(src_path, dst_dir)
@@ -65,6 +65,10 @@ def configure(env, env_mono):
# TODO: Implement this. We have to add the data directory to the apk, concretely the Api and Tools folders.
raise RuntimeError('This module does not currently support building for android with tools enabled')
if is_android and mono_static:
# When static linking and doing something that requires libmono-native, we get a dlopen error as libmono-native seems to depend on libmonosgen-2.0
raise RuntimeError('Linking Mono statically is not currently supported on Android')
if (os.getenv('MONO32_PREFIX') or os.getenv('MONO64_PREFIX')) and not mono_prefix:
print("WARNING: The environment variables 'MONO32_PREFIX' and 'MONO64_PREFIX' are deprecated; use the 'mono_prefix' SCons parameter instead")
@@ -188,7 +192,7 @@ def configure(env, env_mono):
if is_apple:
env.Append(LIBS=['iconv', 'pthread'])
elif is_android:
env.Append(LIBS=['m', 'dl'])
pass # Nothing
else:
env.Append(LIBS=['m', 'rt', 'dl', 'pthread'])
@@ -236,6 +240,14 @@ def configure(env, env_mono):
mono_root = subprocess.check_output(['pkg-config', 'mono-2', '--variable=prefix']).decode('utf8').strip()
make_template_dir(env, mono_root)
elif not tools_enabled and is_android:
# Compress Android Mono Config
from . import make_android_mono_config
config_file_path = os.path.join(mono_root, 'etc', 'mono', 'config')
make_android_mono_config.generate_compressed_config(config_file_path, 'mono_gd/')
# Copy the required shared libraries
copy_mono_shared_libs(env, mono_root, None)
if copy_mono_root:
if not mono_root:
@@ -270,9 +282,8 @@ def make_template_dir(env, mono_root):
# Copy etc/mono/
if platform != 'android':
template_mono_config_dir = os.path.join(template_mono_root_dir, 'etc', 'mono')
copy_mono_etc_dir(mono_root, template_mono_config_dir, env['platform'])
template_mono_config_dir = os.path.join(template_mono_root_dir, 'etc', 'mono')
copy_mono_etc_dir(mono_root, template_mono_config_dir, env['platform'])
# Copy the required shared libraries