API Documentation¶
DataConverter¶
Manage conversion of data into CMake
-
class
cmake_converter.data_converter.DataConverter¶ Bases:
objectBase class for converters
-
static
collect_data(context)¶ Collect data for converter.
-
convert_project(context, xml_project_path, cmake_lists_destination_path)¶ Method template for data collecting and writing
-
static
copy_cmake_utils(cmake_lists_path)¶ Copy necessary util files into CMake folder
-
do_conversion(project_context, input_data_for_converter)¶ Executes conversion with given projects input data
-
merge_data_settings(context)¶ Merge common settings found among configuration settings (reduce copy-paste)
Parameters: context – Returns:
-
run_conversion(subdirectory_targets_data)¶ Routine that converts projects located at the same directory
-
verify_data(context)¶ Verify procedure after gathering information from source project
-
static
Context object descriptor¶
-
class
cmake_converter.context.Context¶ Bases:
objectConverter context
-
clone()¶ Deep clone of Context
Returns:
-
static
get_project_initialization_dict()¶ Get initializer functors mapped to path keys
-
init(source_project_path, cmake_lists_destination_dir)¶ Initialize instance of Context with Initializer
Parameters: - source_project_path –
- cmake_lists_destination_dir –
Returns:
-
Data Files¶
Manage the VS Project data and creation of CMakeLists.txt file
-
cmake_converter.data_files.get_cmake_lists(context, cmake_path=None, open_type='w')¶ Create CMakeLists.txt file in wanted “cmake_path”
Parameters: Returns: cmake file wrapper opened
Return type: _io.TextIOWrapper
-
cmake_converter.data_files.get_definitiongroup(target_platform)¶ Return ItemDefinitionGroup namespace depends on platform and target
Parameters: target_platform (tuple[str,str]) – wanted target: debug | release Returns: wanted ItemDefinitionGroup namespace Return type: str
-
cmake_converter.data_files.get_propertygroup(target_platform, attributes='')¶ Return “property_groups” value for wanted platform and target
Parameters: Returns: “property_groups” value
Return type:
-
cmake_converter.data_files.get_vcxproj_data(context, vs_project)¶ Return xml data from “vcxproj” file
Parameters: Returns: dict with VS Project data
Return type:
-
cmake_converter.data_files.get_xml_data(context, xml_file)¶ Return xml data from “xml” file
Parameters: Returns: dict with VS Project data
Return type:
-
cmake_converter.data_files.search_file_path(context, xml_file)¶ Util function for checking file in path.
Dependencies¶
Manage directories and libraries of project dependencies
-
class
cmake_converter.dependencies.Dependencies¶ Bases:
objectClass who find and write dependencies of project, additional directories…
-
static
get_dependency_target_name(context, vs_project)¶ Return dependency target name
Parameters: Returns: target name
Return type:
-
static
set_additional_include_directories(aid_text, setting, context)¶ Return additional include directories of given context
Parameters: Returns: include directories of context, separated by semicolons
Return type:
-
static
set_target_additional_dependencies_impl(context, dependencies_text, splitter)¶ Implementation of Handler for additional link dependencies
-
static
Flags¶
Manage compilation flags of project
ProjectFiles¶
Manages the recovery of project files
-
class
cmake_converter.project_files.ProjectFiles¶ Bases:
objectClass that collects and store project files
-
add_file_from_node(context, **kwargs)¶ Adds file into source group and creates file context using into from xml node
-
apply_files_to_context(context)¶ Analyzes collected set of files and initializes necessary variables
-
find_cmake_target_languages(context)¶ Add CMake Project
-
include_directive_case_check(context, file_path_name, file_lists_for_include_paths)¶ Dummy to fix crash
-
init_file_lists_for_include_paths(context)¶ For include directive case ad path checking. Works only with vfproj. :param context: :return:
-
ProjectVariables¶
Manage creation of CMake variables that will be used during compilation
-
class
cmake_converter.project_variables.ProjectVariables¶ Bases:
objectClass that manages project variables
-
static
set_output_dir_impl(context, output_node_text)¶ Parameters: - context –
- output_node_text –
Returns:
-
static
set_output_file_impl(context, output_file_node_text)¶ Common routine for evaluating path and name of output file
-
static
set_path_and_name_from_node(context, node_name, file_path, path_property, name_property)¶ Common routine for evaluating path and name from node text
-
static
set_target_name(context, target_name_value)¶ Evaluates target name and sets it into project context
-
static
Utils¶
Utils manage function needed by converter
-
class
cmake_converter.utils.Utils¶ Bases:
objectBasic Class for holding util functions needed by converter
-
init_context_current_setting(context)¶ Define settings of converter.
Parameters: context (Context) – converter context
-
static
lists_of_settings_to_merge()¶ Lists of keys of settings at context that will be merged
-
-
cmake_converter.utils.check_for_relative_in_path(context, path, remove_relative=True)¶ Return path by adding CMake variable or current path prefix, to remove relative
Parameters: Returns: formatted path without relative
Return type:
-
cmake_converter.utils.cleaning_output(context, output)¶ Clean Output string by remove VS Project Variables
Parameters: Returns: clean output
Return type:
-
cmake_converter.utils.escape_string(context, wrong_chars_regex, input_str)¶ Removes wrong chars from input string
-
cmake_converter.utils.get_actual_filename(context, name)¶ Return actual filename from given name if file iis found, else return None
Parameters: Returns: None | str
Return type: None | str
-
cmake_converter.utils.get_dir_name_with_vars(context, path)¶ Tries to split directory and filename from given path
-
cmake_converter.utils.get_global_project_name_from_vcxproj_file(vcxproj)¶ Return global project name from “.vcxproj” file
Parameters: vcxproj (dict) – vcxproj data Returns: project name Return type: str
-
cmake_converter.utils.get_mapped_architectures(sln_setting_2_project_setting, arch)¶ Get all projects architectures that mapped onto given solution one
-
cmake_converter.utils.get_mount_point(path)¶ Returns mount point of given path
-
cmake_converter.utils.init_colorama()¶ Initialization of colorful console output
-
cmake_converter.utils.insensitive_glob(path)¶ Searches given path case insensitive
-
cmake_converter.utils.is_settings_has_data(sln_configurations_map, settings, settings_key, sln_arch=None, conf=None)¶ Checker of available settings in context
-
cmake_converter.utils.make_cmake_configuration(context, sln_configuration)¶ Tries to make cmake configuration name from sln_configuration
-
cmake_converter.utils.make_cmake_literal(context, input_str)¶ Tries to make cmake literal from input string
-
cmake_converter.utils.make_os_specific_shell_path(output)¶ Tries to make path readable with CMake
-
cmake_converter.utils.message(context, text, status)¶ Displays a message while the script is running
Parameters:
-
cmake_converter.utils.normalize_path(context, working_path, path_to_normalize, remove_relative=True, unix_slash=True)¶ Normalize path from working path
Parameters: Returns: normalized path
Return type:
-
cmake_converter.utils.prepare_build_event_cmd_line_for_cmake(context, build_event)¶ Tries to fit build event command to be compliant CMake language
-
cmake_converter.utils.replace_vs_var_with_cmake_var(context, var)¶ Translate Visual studio variable into CMake variable
-
cmake_converter.utils.replace_vs_vars_with_cmake_vars(context, output)¶ Translates variables at given string to corresponding CMake ones
-
cmake_converter.utils.resolve_path_variables_of_vs(context, path_with_vars)¶ Evaluates paths with visual studio variables
-
cmake_converter.utils.set_native_slash(raw_path)¶ Set native slash
Parameters: raw_path (str) – any style path Returns: unix style path Return type: str
-
cmake_converter.utils.set_unix_slash(win_path)¶ Set windows path to unix style path
Parameters: win_path (str) – windows style path Returns: unix style path Return type: str
-
cmake_converter.utils.take_name_from_list_case_ignore(context, search_list, name_to_search)¶ Return real name of name to search
Parameters: Returns: real name
Return type: