def filter_target_platforms(conf): """ Filter out any target platforms based on settings or options from the configuration/options :param conf: Configuration context """ # handle disabling android here to avoid having the same block of code in each of the compile_rules # for all the current and future android targets android_enabled = conf.get_env_file_var('ENABLE_ANDROID', required=False, silent=True) if android_enabled == 'True': # We need to validate the JDK path from SetupAssistant before loading the javaw tool. # This way we don't introduce a dependency on lmbrwaflib in the core waflib. jdk_home = conf.get_env_file_var('LY_JDK', required=True) if not jdk_home: conf.fatal( '[ERROR] Missing JDK path from Setup Assistant detected. Please re-run Setup Assistant with "Compile For Android" enabled and run the configure command again.' ) conf.env['JAVA_HOME'] = jdk_home conf.load('javaw') conf.load('android', tooldir=LMBR_WAF_TOOL_DIR) else: android_targets = [ target for target in conf.get_available_platforms() if 'android' in target ] Logs.warn( '[WARN] Removing the following Android target platforms due to "Compile For Android" not checked in Setup Assistant.\n' '\t-> {}'.format(', '.join(android_targets))) for android in android_targets: conf.remove_platform_from_available_platforms(android)
def configure_general_compile_settings(conf): """ Perform all the necessary configurations :param conf: Configuration context """ # Load general compile settings load_setting_count = 0 absolute_lmbr_waf_tool_path = LMBR_WAF_TOOL_DIR if os.path.isabs(LMBR_WAF_TOOL_DIR) else conf.path.make_node(LMBR_WAF_TOOL_DIR).abspath() for compile_settings in PLATFORM_COMPILE_SETTINGS: t_path = os.path.join(absolute_lmbr_waf_tool_path, "{}.py".format(compile_settings)) if os.path.exists(os.path.join(absolute_lmbr_waf_tool_path, "{}.py".format(compile_settings))): conf.load(compile_settings, tooldir=[LMBR_WAF_TOOL_DIR]) load_setting_count += 1 if load_setting_count == 0: conf.fatal('[ERROR] Unable to load any general compile settings modules') # load the android specific tools, if enabled if any(platform for platform in conf.get_available_platforms() if platform.startswith('android')): # We need to validate the JDK path from SetupAssistant before loading the javaw tool. # This way we don't introduce a dependency on lmbrwaflib in the core waflib. jdk_home = conf.get_env_file_var('LY_JDK', required = True) if not jdk_home: conf.fatal('[ERROR] Missing JDK path from Setup Assistant detected. Please re-run Setup Assistant with "Compile For Android" enabled and run the configure command again.') conf.env['JAVA_HOME'] = jdk_home conf.load('javaw') conf.load('android', tooldir=[LMBR_WAF_TOOL_DIR])
def get_available_platforms(conf): is_configure_context = isinstance(conf, ConfigurationContext) validated_platforms_node = conf.get_validated_platforms_node() validated_platforms_json = conf.parse_json_file( validated_platforms_node) if os.path.exists( validated_platforms_node.abspath()) else None global AVAILABLE_PLATFORMS if AVAILABLE_PLATFORMS is None: # Get all of the available target platforms for the current host platform host_platform = Utils.unversioned_sys_platform() # fallback option for android if the bootstrap params is empty android_enabled_var = conf.get_env_file_var('ENABLE_ANDROID', required=False, silent=True) android_enabled = (android_enabled_var == 'True') # Check the enabled capabilities from the bootstrap parameter. This value is set by the setup assistant enabled_capabilities = conf.get_enabled_capabilities() validated_platforms = [] for platform in PLATFORMS[host_platform]: platform_capability = PLATFORM_TO_CAPABILITY_MAP.get( platform, None) if platform_capability is not None: if len(enabled_capabilities) > 0 and platform_capability[ 0] not in enabled_capabilities: # Only log the target platform removal during the configure process if isinstance(conf, ConfigurationContext): Logs.info( '[INFO] Removing target platform {} due to "{}" not checked in Setup Assistant.' .format(platform, platform_capability[1])) continue # Perform extra validation of platforms that can be disabled through options if platform.startswith('android') and not android_enabled: continue if platform.endswith('clang') and platform.startswith('win'): if not conf.is_option_true('win_enable_clang_for_windows'): continue elif not conf.find_program( 'clang', mandatory=False, silent_output=True): Logs.warn( '[INFO] Removing target platform {}. Could not find Clang for Windows executable.' .format(platform)) continue if not is_configure_context and validated_platforms_json: if platform not in validated_platforms_json: continue validated_platforms.append(platform) AVAILABLE_PLATFORMS = validated_platforms return AVAILABLE_PLATFORMS