def run_main(raw_args, target_platform): import cmd_utils from collections import OrderedDict from typing import Callable actions = OrderedDict() actions['configure'] = configure actions['make'] = make actions['copy-bcl'] = copy_bcl actions['clean'] = clean parser = cmd_utils.build_arg_parser( description='Builds the Mono runtime for the Desktop') default_help = 'default: %(default)s' parser.add_argument('action', choices=['configure', 'make', 'copy-bcl', 'clean']) parser.add_argument('--target', choices=targets[target_platform], action='append', required=True) parser.add_argument('--with-llvm', action='store_true', default=False, help=default_help) cmd_utils.add_runtime_arguments(parser, default_help) args = parser.parse_args(raw_args) input_action = args.action input_targets = args.target opts = desktop_opts_from_args(args) if not os.path.isdir(opts.mono_source_root): print('Mono sources directory not found: ' + opts.mono_source_root) sys.exit(1) if target_platform == 'osx' and sys.platform != 'darwin' and not 'OSXCROSS_ROOT' in os.environ: raise RuntimeError( 'The \'OSXCROSS_ROOT\' environment variable is required for cross-compiling to macOS' ) if is_cross_compiling(target_platform) and sys.platform == 'darwin': raise RuntimeError('Cross-compiling from macOS is not supported') action = actions[input_action] try: for target in input_targets: action(opts, 'desktop-%s' % target_platform, target_platform, target) except BuildError as e: sys.exit(e.message)
def main(raw_args): import cmd_utils from collections import OrderedDict from typing import Callable target_shortcuts = {'all-runtime': runtime_targets} target_values = runtime_targets + cross_targets + cross_mxe_targets + list( target_shortcuts) actions = OrderedDict() actions['configure'] = configure actions['make'] = make actions['clean'] = clean parser = cmd_utils.build_arg_parser( description='Builds the Mono runtime for WebAssembly') emsdk_root_default = os.environ.get('EMSDK_ROOT', default='') default_help = 'default: %(default)s' parser.add_argument('action', choices=['configure', 'make', 'clean']) parser.add_argument('--target', choices=target_values, action='append', required=True) cmd_utils.add_runtime_arguments(parser, default_help) args = parser.parse_args(raw_args) input_action = args.action input_targets = args.target opts = runtime_opts_from_args(args) if not os.path.isdir(opts.mono_source_root): print('Mono sources directory not found: ' + opts.mono_source_root) sys.exit(1) targets = cmd_utils.expand_input_targets(input_targets, target_shortcuts) action = actions[input_action] try: for target in targets: action(opts, 'wasm', target) except BuildError as e: sys.exit(e.message)
def main(raw_args): import cmd_utils from cmd_utils import custom_bool from collections import OrderedDict from typing import Callable target_shortcuts = { 'all-device': device_targets, 'all-sim': sim_targets, 'all-cross': cross_targets } target_values = device_targets + sim_targets + cross_targets + list( target_shortcuts) actions = OrderedDict() actions['configure'] = configure actions['make'] = make actions['clean'] = clean parser = cmd_utils.build_arg_parser( description='Builds the Mono runtime for iOS') default_help = 'default: %(default)s' default_ios_toolchain = '/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain' default_osx_toolchain = '/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain' default_ios_version_min = '10.0' # Same as Godot parser.add_argument('action', choices=['configure', 'make', 'clean']) parser.add_argument('--target', choices=target_values, action='append', required=True) parser.add_argument('--ios-toolchain', default=default_ios_toolchain, help=default_help) parser.add_argument('--ios-sdk', default='', help=default_help) parser.add_argument('--ios-version-min', default=default_ios_version_min, help=default_help) parser.add_argument('--osx-toolchain', default=default_osx_toolchain, help=default_help) parser.add_argument('--osx-sdk', default='', help=default_help) parser.add_argument('--osx-triple-abi', default='darwin18', help=default_help) cmd_utils.add_runtime_arguments(parser, default_help) args = parser.parse_args(raw_args) input_action = args.action input_targets = args.target opts = ios_opts_from_args(args) targets = cmd_utils.expand_input_targets(input_targets, target_shortcuts) if not os.path.isdir(opts.mono_source_root): print('Mono sources directory not found: ' + opts.mono_source_root) sys.exit(1) action = actions[input_action] try: for target in targets: action(opts, 'ios', target) except BuildError as e: sys.exit(e.message)
def main(raw_args): import cmd_utils from cmd_utils import custom_bool from collections import OrderedDict from typing import Callable target_shortcuts = { 'all-runtime': runtime_targets, 'all-cross': cross_targets, 'all-cross-win': cross_mxe_targets } target_values = runtime_targets + cross_targets + cross_mxe_targets + list(target_shortcuts) actions = OrderedDict() actions['configure'] = configure actions['make'] = make actions['clean'] = clean parser = cmd_utils.build_arg_parser( description='Builds the Mono runtime for Android', env_vars={ 'ANDROID_SDK_ROOT': 'Overrides default value for --android-sdk', 'ANDROID_NDK_ROOT': 'Overrides default value for --android-ndk', 'ANDROID_HOME': 'Same as ANDROID_SDK_ROOT' } ) home = os.environ.get('HOME') android_sdk_default = os.environ.get('ANDROID_HOME', os.environ.get('ANDROID_SDK_ROOT', path_join(home, 'Android/Sdk'))) android_ndk_default = os.environ.get('ANDROID_NDK_ROOT', path_join(android_sdk_default, 'ndk-bundle')) default_help = 'default: %(default)s' parser.add_argument('action', choices=['configure', 'make', 'clean']) parser.add_argument('--target', choices=target_values, action='append', required=True) parser.add_argument('--toolchains-prefix', default=path_join(home, 'android-toolchains'), help=default_help) parser.add_argument('--android-sdk', default=android_sdk_default, help=default_help) parser.add_argument('--android-ndk', default=android_ndk_default, help=default_help) parser.add_argument('--android-api-version', default='18', help=default_help) parser.add_argument('--android-cmake-version', default='autodetect', help=default_help) parser.add_argument('--with-monodroid', type=custom_bool, default=True, help=default_help) cmd_utils.add_runtime_arguments(parser, default_help) args = parser.parse_args(raw_args) input_action = args.action input_targets = args.target opts = android_opts_from_args(args) if not os.path.isdir(opts.mono_source_root): print('Mono sources directory not found: ' + opts.mono_source_root) sys.exit(1) targets = cmd_utils.expand_input_targets(input_targets, target_shortcuts) action = actions[input_action] try: for target in targets: action(opts, 'android', target) except BuildError as e: sys.exit(e.message)