Merge pull request #24545 from akien-mga/osxcross-mono
SCons: Allow building Mono module with OSXCross
This commit is contained in:
commit
dcc7f2b54b
@ -142,7 +142,9 @@ def configure(env):
|
|||||||
|
|
||||||
copy_file(mono_bin_path, 'bin', mono_dll_name + '.dll')
|
copy_file(mono_bin_path, 'bin', mono_dll_name + '.dll')
|
||||||
else:
|
else:
|
||||||
sharedlib_ext = '.dylib' if sys.platform == 'darwin' else '.so'
|
is_apple = (sys.platform == 'darwin' or "osxcross" in env)
|
||||||
|
|
||||||
|
sharedlib_ext = '.dylib' if is_apple else '.so'
|
||||||
|
|
||||||
mono_root = ''
|
mono_root = ''
|
||||||
mono_lib_path = ''
|
mono_lib_path = ''
|
||||||
@ -154,7 +156,7 @@ def configure(env):
|
|||||||
if os.getenv('MONO64_PREFIX'):
|
if os.getenv('MONO64_PREFIX'):
|
||||||
mono_root = os.getenv('MONO64_PREFIX')
|
mono_root = os.getenv('MONO64_PREFIX')
|
||||||
|
|
||||||
if not mono_root and sys.platform == 'darwin':
|
if not mono_root and is_apple:
|
||||||
# Try with some known directories under OSX
|
# Try with some known directories under OSX
|
||||||
hint_dirs = ['/Library/Frameworks/Mono.framework/Versions/Current', '/usr/local/var/homebrew/linked/mono']
|
hint_dirs = ['/Library/Frameworks/Mono.framework/Versions/Current', '/usr/local/var/homebrew/linked/mono']
|
||||||
for hint_dir in hint_dirs:
|
for hint_dir in hint_dirs:
|
||||||
@ -190,14 +192,14 @@ def configure(env):
|
|||||||
if mono_static:
|
if mono_static:
|
||||||
mono_lib_file = os.path.join(mono_lib_path, 'lib' + mono_lib + '.a')
|
mono_lib_file = os.path.join(mono_lib_path, 'lib' + mono_lib + '.a')
|
||||||
|
|
||||||
if sys.platform == 'darwin':
|
if is_apple:
|
||||||
env.Append(LINKFLAGS=['-Wl,-force_load,' + mono_lib_file])
|
env.Append(LINKFLAGS=['-Wl,-force_load,' + mono_lib_file])
|
||||||
else:
|
else:
|
||||||
env.Append(LINKFLAGS=['-Wl,-whole-archive', mono_lib_file, '-Wl,-no-whole-archive'])
|
env.Append(LINKFLAGS=['-Wl,-whole-archive', mono_lib_file, '-Wl,-no-whole-archive'])
|
||||||
else:
|
else:
|
||||||
env.Append(LIBS=[mono_lib])
|
env.Append(LIBS=[mono_lib])
|
||||||
|
|
||||||
if sys.platform == 'darwin':
|
if is_apple:
|
||||||
env.Append(LIBS=['iconv', 'pthread'])
|
env.Append(LIBS=['iconv', 'pthread'])
|
||||||
else:
|
else:
|
||||||
env.Append(LIBS=['m', 'rt', 'dl', 'pthread'])
|
env.Append(LIBS=['m', 'rt', 'dl', 'pthread'])
|
||||||
|
@ -350,7 +350,7 @@ if webm_multithread:
|
|||||||
env_libvpx.add_source_files(env.modules_sources, libvpx_sources_mt)
|
env_libvpx.add_source_files(env.modules_sources, libvpx_sources_mt)
|
||||||
|
|
||||||
if webm_cpu_x86:
|
if webm_cpu_x86:
|
||||||
is_clang_or_gcc = ('gcc' in os.path.basename(env["CC"])) or ('clang' in os.path.basename(env["CC"])) or ("OSXCROSS_ROOT" in os.environ)
|
is_clang_or_gcc = ('gcc' in os.path.basename(env["CC"])) or ('clang' in os.path.basename(env["CC"])) or ("osxcross" in env)
|
||||||
|
|
||||||
env_libvpx_mmx = env_libvpx.Clone()
|
env_libvpx_mmx = env_libvpx.Clone()
|
||||||
if cpu_bits == '32' and is_clang_or_gcc:
|
if cpu_bits == '32' and is_clang_or_gcc:
|
||||||
|
@ -23,7 +23,7 @@ ios_lib = env_ios.add_library('iphone', iphone_lib)
|
|||||||
|
|
||||||
def combine_libs(target=None, source=None, env=None):
|
def combine_libs(target=None, source=None, env=None):
|
||||||
lib_path = target[0].srcnode().abspath
|
lib_path = target[0].srcnode().abspath
|
||||||
if ("OSXCROSS_IOS" in os.environ):
|
if "osxcross" in env:
|
||||||
libtool = '$IPHONEPATH/usr/bin/${ios_triple}libtool'
|
libtool = '$IPHONEPATH/usr/bin/${ios_triple}libtool'
|
||||||
else:
|
else:
|
||||||
libtool = "$IPHONEPATH/usr/bin/libtool"
|
libtool = "$IPHONEPATH/usr/bin/libtool"
|
||||||
|
@ -76,6 +76,10 @@ def configure(env):
|
|||||||
|
|
||||||
## Compiler configuration
|
## Compiler configuration
|
||||||
|
|
||||||
|
# Save this in environment for use by other modules
|
||||||
|
if "OSXCROSS_IOS" in os.environ:
|
||||||
|
env["osxcross"] = True
|
||||||
|
|
||||||
env['ENV']['PATH'] = env['IPHONEPATH'] + "/Developer/usr/bin/:" + env['ENV']['PATH']
|
env['ENV']['PATH'] = env['IPHONEPATH'] + "/Developer/usr/bin/:" + env['ENV']['PATH']
|
||||||
|
|
||||||
compiler_path = '$IPHONEPATH/usr/bin/${ios_triple}'
|
compiler_path = '$IPHONEPATH/usr/bin/${ios_triple}'
|
||||||
|
@ -72,7 +72,11 @@ def configure(env):
|
|||||||
|
|
||||||
## Compiler configuration
|
## Compiler configuration
|
||||||
|
|
||||||
if "OSXCROSS_ROOT" not in os.environ: # regular native build
|
# Save this in environment for use by other modules
|
||||||
|
if "OSXCROSS_ROOT" in os.environ:
|
||||||
|
env["osxcross"] = True
|
||||||
|
|
||||||
|
if not "osxcross" in env: # regular native build
|
||||||
env.Append(CCFLAGS=['-arch', 'x86_64'])
|
env.Append(CCFLAGS=['-arch', 'x86_64'])
|
||||||
env.Append(LINKFLAGS=['-arch', 'x86_64'])
|
env.Append(LINKFLAGS=['-arch', 'x86_64'])
|
||||||
if (env["macports_clang"] != 'no'):
|
if (env["macports_clang"] != 'no'):
|
||||||
|
Loading…
Reference in New Issue
Block a user