def track_file_list_changes(ctx, kw): """ Util function to ensure file lists are correctly tracked regardless of current target platform * Fork of TrackFileListChanges """ def _to_list(value): """ Helper function to ensure a value is always a list """ if isinstance(value, list): return value return [value] files_to_track = [] kw['waf_file_entries'] = [] # Collect all file list entries for (key,value) in kw.items(): if 'file_list' in key: files_to_track += _to_list(value) # Collect potential file lists from additional options if 'additional_settings' in key: for settings_container in kw['additional_settings']: for (key2,value2) in settings_container.items(): if 'file_list' in key2: files_to_track += _to_list(value2) # Remove duplicates files_to_track = list(set(files_to_track)) # Add results to global lists for file in files_to_track: file_node = ctx.path.make_node(file) append_kw_entry(kw, 'waf_file_entries', [file_node])
def LumberyardFileContainer(ctx, *k, **kw): """ Function to create a header-only library that others can still 'use' in order to recieve exported defines and exported includes. """ target = get_target(ctx, kw) platform, configuration = get_current_platform_configuration(ctx) additional_aliases = initialize_task_generator(ctx, target, platform, configuration, kw) configure_task_generator(ctx, target, kw) append_kw_entry(kw, 'features', ['copy_3rd_party_binaries']) if not BuildTaskGenerator(ctx, kw): return None if ctx.env['PLATFORM'] != 'project_generator': # clear out the 'source' and features so that as little as possible executes kw['source'] = [] kw['features'] = ['use'] return ctx( *k, **kw ) # calling ctx() directly declares an empty target gen that doesn't do builds.
def set_pipeline_flags(self, kw, ctx): append_kw_entry(kw,'defines',['RESOURCE_COMPILER', 'FORCE_STANDARD_ASSERT', '_CRT_SECURE_NO_DEPRECATE=1', '_CRT_NONSTDC_NO_DEPRECATE=1']) if ctx.is_windows_platform(ctx.env['PLATFORM']): append_kw_entry(kw,'defines',['WIN32'])
def set_pipeline_flags(self, kw): prepend_kw_entry(kw,'includes',['.', self.CreateRootRelativePath('Code/CryEngine/CryCommon')]) append_kw_entry(kw,'defines',['WIN32', 'RESOURCE_COMPILER', 'FORCE_STANDARD_ASSERT', 'NOT_USE_CRY_MEMORY_MANAGER', '_CRT_SECURE_NO_DEPRECATE=1', '_CRT_NONSTDC_NO_DEPRECATE=1'])
def set_pipeline_flags(self, kw, ctx): prepend_kw_entry(kw,'includes',['.', self.CreateRootRelativePath('Code/CryEngine/CryCommon')]) append_kw_entry(kw,'defines',['RESOURCE_COMPILER', 'FORCE_STANDARD_ASSERT', '_CRT_SECURE_NO_DEPRECATE=1', '_CRT_NONSTDC_NO_DEPRECATE=1']) if ctx.is_windows_platform(ctx.env['PLATFORM']): append_kw_entry(kw,'defines',['WIN32'])
def set_rc_flags(self, kw, ctx): compileDefines = ['RESOURCE_COMPILER', 'FORCE_STANDARD_ASSERT', '_CRT_SECURE_NO_DEPRECATE=1', '_CRT_NONSTDC_NO_DEPRECATE=1'] if ctx.is_windows_platform(ctx.env['PLATFORM']): compileDefines.append('WIN32') append_kw_entry(kw,'defines', compileDefines)
def set_editor_flags(self, kw): if 'platforms' not in kw: append_kw_entry(kw, 'platforms', ['win', 'darwin']) if 'configurations' not in kw: append_kw_entry(kw, 'configurations', ['all']) if 'exclude_monolithic' not in kw: kw['exclude_monolithic'] = True kw['client_only'] = True prepend_kw_entry(kw,'includes',['.', self.CreateRootRelativePath('Code/Sandbox/Editor'), self.CreateRootRelativePath('Code/Sandbox/Editor/Include'), self.CreateRootRelativePath('Code/Sandbox/Plugins/EditorCommon'), self.CreateRootRelativePath('Code/CryEngine/CryCommon') , self.ThirdPartyPath('boost')]) if 'priority_includes' in kw: prepend_kw_entry(kw,'includes',kw['priority_includes']) append_kw_entry(kw,'defines',['CRY_ENABLE_RC_HELPER', '_CRT_SECURE_NO_DEPRECATE=1', '_CRT_NONSTDC_NO_DEPRECATE=1', 'LUMBERYARD_COPYRIGHT_YEAR="{}"'.format(LUMBERYARD_COPYRIGHT_YEAR), ]) append_kw_entry(kw,'win_defines',['WIN32'])
def set_rc_flags(self, kw, ctx): prepend_kw_entry(kw,'includes',['.', self.CreateRootRelativePath('Code/CryEngine/CryCommon'), self.ThirdPartyPath('boost'), self.CreateRootRelativePath('Code/Sandbox/Plugins/EditorCommon')]) compileDefines = ['RESOURCE_COMPILER', 'FORCE_STANDARD_ASSERT', '_CRT_SECURE_NO_DEPRECATE=1', '_CRT_NONSTDC_NO_DEPRECATE=1'] if ctx.is_windows_platform(ctx.env['PLATFORM']): compileDefines.append('WIN32') append_kw_entry(kw,'defines', compileDefines)
def LumberyardApplication(ctx, *k, **kw): """ WAF Task Generator for c++ applications """ target = get_target(ctx, kw) platform, configuration = get_current_platform_configuration(ctx) additional_aliases = initialize_task_generator(ctx, target, platform, configuration, kw) configure_task_generator(ctx, target, kw) append_kw_entry(kw, 'features', ['copy_3rd_party_binaries']) if not BuildTaskGenerator(ctx, kw): return None return RunTaskGenerator(ctx, *k, **kw)
def set_editor_flags(self, kw): prepend_kw_entry(kw,'includes',['.', self.CreateRootRelativePath('Code/Sandbox/Editor'), self.CreateRootRelativePath('Code/Sandbox/Editor/Include'), self.CreateRootRelativePath('Code/Sandbox/Plugins/EditorCommon'), self.CreateRootRelativePath('Code/CryEngine/CryCommon') , self.ThirdPartyPath('boost')]) if 'priority_includes' in kw: prepend_kw_entry(kw,'includes',kw['priority_includes']) append_kw_entry(kw,'defines',['CRY_ENABLE_RC_HELPER', '_CRT_SECURE_NO_DEPRECATE=1', '_CRT_NONSTDC_NO_DEPRECATE=1', 'LUMBERYARD_COPYRIGHT_YEAR="{}"'.format(LUMBERYARD_COPYRIGHT_YEAR), ]) append_kw_entry(kw,'win_defines',['WIN32'])
def set_editor_flags(self, kw): prepend_kw_entry(kw,'includes',['.', self.CreateRootRelativePath('Code/Sandbox/Editor'), self.CreateRootRelativePath('Code/Sandbox/Editor/Include'), self.CreateRootRelativePath('Code/Sandbox/Plugins/EditorCommon'), self.CreateRootRelativePath('Code/CryEngine/CryCommon') , self.CreateRootRelativePath('Code/SDKs/boost'), self.CreateRootRelativePath('Code/SDKs/XT_13_4/Include')]) if 'priority_includes' in kw: prepend_kw_entry(kw,'includes',kw['priority_includes']) append_kw_entry(kw,'defines',['WIN32', 'CRY_ENABLE_RC_HELPER', '_AFXDLL', '_CRT_SECURE_NO_DEPRECATE=1', '_CRT_NONSTDC_NO_DEPRECATE=1', ]) append_kw_entry(kw,'libpath',[self.CreateRootRelativePath('Code/SDKs/XT_13_4/lib')])
def set_editor_flags(self, kw): if 'platforms' not in kw: append_kw_entry(kw, 'platforms', ['win', 'darwin']) if 'configurations' not in kw: append_kw_entry(kw, 'configurations', ['all']) if 'exclude_monolithic' not in kw: kw['exclude_monolithic'] = True kw['client_only'] = True if 'priority_includes' in kw: prepend_kw_entry(kw,'includes',kw['priority_includes']) append_kw_entry(kw,'defines',['CRY_ENABLE_RC_HELPER', '_CRT_SECURE_NO_DEPRECATE=1', '_CRT_NONSTDC_NO_DEPRECATE=1', 'LUMBERYARD_COPYRIGHT_YEAR="{}"'.format(LUMBERYARD_COPYRIGHT_YEAR), ]) append_kw_entry(kw,'win_defines',['WIN32'])
def process_optional_copy_keywords(ctx, target, kw): """ Process any optional copy* keywords """ is_build_platform_cmd = getattr(ctx, 'is_build_cmd', False) if is_build_platform_cmd: # Check if we are applying external file copies if 'copy_external' in kw and len(kw['copy_external']) > 0: for copy_external_key in kw['copy_external']: copy_external_env_key = 'COPY_EXTERNAL_FILES_{}'.format( copy_external_key) if 'COPY_EXTERNAL_FILES' not in ctx.env: ctx.env['COPY_EXTERNAL_FILES'] = [] append_kw_entry(kw, 'features', 'copy_external_files') if copy_external_env_key in ctx.env: for copy_external_value in ctx.env[copy_external_env_key]: ctx.env['COPY_EXTERNAL_FILES'].append( copy_external_value) # Check if we are applying external file copies to specific files copy_dependent_files = kw.get('copy_dependent_files', []) if len(copy_dependent_files) > 0: append_kw_entry(kw, 'features', 'copy_module_dependent_files') copy_dependent_env_key = 'COPY_DEPENDENT_FILES_{}'.format( target.upper()) if copy_dependent_env_key not in ctx.env: ctx.env[copy_dependent_env_key] = [] for copy_dependent_file in copy_dependent_files: ctx.env[copy_dependent_env_key].append(copy_dependent_file) # Check if we are applying external file copies to specific files copy_dependent_files = kw.get('copy_dependent_files_keep_folder_tree', []) if len(copy_dependent_files) > 0: append_kw_entry(kw, 'features', 'copy_module_dependent_files_keep_folder_tree') copy_dependent_env_key = 'COPY_DEPENDENT_FILES_KEEP_FOLDER_TREE_{}'.format( target.upper()) if copy_dependent_env_key not in ctx.env: ctx.env[copy_dependent_env_key] = [] for copy_dependent_file in copy_dependent_files: ctx.env[copy_dependent_env_key].append(copy_dependent_file)
def split_keywords_from_static_lib_definition_for_test(ctx, original_kw_dict): """ This helper function will take the keyword definitions for a static library that may also include test_ keywords, and in the even of having test_ keywords, split them out into two keyword dictionaries: one for the original static library and the other for a shell DLL that will link against the static library but will use its own file list which will represent the source unit tests that will test the code in the static library. :param ctx: The current context :param original_kw_dict: The keyword input dictionary for the static library :return: Tuple of the preprocessed kw dict for the static library, preprocessed kw dict for the shared test dll (if the proper test_ keywords are provided) """ base_target_name = original_kw_dict['target'] # The following are the only common keywords that will be shared between the static and the test shared libraries. All other keywords will be not be copies of each other common_keywords = ('platforms', 'vs_filter') # The following are the test_ equivalent common keywords that we we search for to determine if we need to copy over the original common value or accept the 'test_' over-ridden on test_common_keywords = ['test_{}'.format(keyword) for keyword in common_keywords] kw_for_test_static = dict() kw_for_test_shared = dict() # Track if a test file list was specified, otherwise do not create a shared dll for test has_test_filelist = False # Split the values appropriately for original_key, original_value in original_kw_dict.items(): check_test_keyword = 'test_{}'.format(original_key) if original_key.endswith('test_file_list') or original_key.endswith('test_all_file_list'): # We found the test file list (potentially platform restricted and/or with the 'all' aliase for test), set the flag and add it only to the test_shared kw dict has_test_filelist = True kw_for_test_shared[original_key] = copy.copy(original_value) elif original_key.startswith('test_') and original_key.endswith('file_list'): check_key = original_key[len('test_'):] kw_for_test_shared[check_key] = copy.copy(original_value) elif original_key == 'test_platform_roots': # Special case: set the specific 'test_platform_roots' keyword as 'platform_roots' only in the shared (test) configuration. This is needed because 'platform_roots' # does not support platform or configuration keyword filtering, so we will manually do it at this point kw_for_test_shared['platform_roots'] = copy.copy(original_value) elif original_key.endswith('file_list'): # We found a file list that is non-test, only add it to the test_static kw dict kw_for_test_static[original_key] = copy.copy(original_value) elif 'test_' in original_key and original_key != 'test_only' and original_key not in test_common_keywords: # we found a test-specific keyword (With the exception of 'test_only', which is used to # restrict the module to test-only configurations kw_for_test_shared[original_key] = copy.copy(original_value) elif original_key in common_keywords: # The key is a common keyword that may be shared between the static and test shared library. if check_test_keyword not in original_kw_dict: # There is no 'test_' equivalent of the common keyword, then share the one from the static library directly in the test shared library kw_for_test_shared[original_key] = copy.copy(original_value) else: # There is a specific 'test_' equivalent of the common one. Set the test shared shared library's value to the 'test_' one kw_for_test_shared[original_key] = copy.copy(original_kw_dict[check_test_keyword]) kw_for_test_static[original_key] = copy.copy(original_value) else: kw_for_test_static[original_key] = copy.copy(original_value) if has_test_filelist: kw_for_test_shared['target'] = '{}Tests'.format(base_target_name) kw_for_test_shared['file_list'] = kw_for_test_shared['test_file_list'] del kw_for_test_shared['test_file_list'] kw_for_test_shared['test_only'] = True kw_for_test_shared['unit_test_target'] = base_target_name append_kw_entry(kw_for_test_shared, 'use', [base_target_name, 'AzTest']) return kw_for_test_static, kw_for_test_shared else: return kw_for_test_static, None