Functions

Dispatchers

makeprojects.build

makeprojects.build(working_directory=None, args=None)

Invoke the buildme command line from within Python.

See also

makeprojects.buildme

Parameters:
  • working_directory – None for current working directory.

  • args – Argument list to pass to the command, None uses sys.argv.

Returns:

Zero on success, system error code on failure

makeprojects.clean

makeprojects.clean(working_directory=None, args=None)

Invoke the cleanme command line from within Python.

See also

makeprojects.cleanme

Parameters:
  • working_directory – None for current working directory.

  • args – Argument list to pass to the command, None uses sys.argv

Returns:

Zero on success, system error code on failure

makeprojects.rebuild

makeprojects.rebuild(working_directory=None, args=None)

Invoke the rebuildme command line from within Python.

See also

makeprojects.rebuildme

Parameters:
  • working_directory – Directory to rebuild

  • args – Command line to use instead of sys.argv

Returns:

Zero on no error, non-zero on error

Generators

makeprojects.new_solution

makeprojects.new_solution(name=None, platform=None, project_type=None)

Create a new instance of a full solution.

Convenience routine to create a Solution with a Project and three configurations β€œDebug”, β€œRelease”, β€œInternal”

See also

core.Solution

Parameters:
  • name – Name of the project

  • platform – Platform for the project

  • project_type – Type of project

Returns:

None, a fully stocked Solution

makeprojects.new_configuration

makeprojects.new_configuration(configuration_list)

Create a new instance of a core.Configuration.

Convenience routine to create a core.Configuration instance.

See also

core.Configuration

Parameters:

configuration_list – Array of dict() records to describe configurations

Returns:

None, a single Configuration or a list of valid Configuration records.

Configuration

config.save_default

makeprojects.config.save_default(working_directory=None, destinationfile=BUILD_RULES_PY)

Calls the internal function to save a default .projectsrc file.

Given a pathname, create and write out a default .projectsrc file that can be used as input to makeprojects to generate project files.

Parameters:
  • working_directory – Directory to save the destination file

  • destinationfile – Pathname of where to save the default configuation file

Returns:

0 if no error, an error code if the file couldn’t be saved.

config.find_default_build_rules

makeprojects.config.find_default_build_rules()

Search for the build_rules.py file.

Scan for the build_rules.py file starting from the current working directory and search downwards until the root directoy is it. If not found, search in the user’s home directory or for linux/macOS, in /etc

Returns:

Pathname of the configuration file, or None if no file was found.

Clean

cleanme.create_parser

makeprojects.cleanme.create_parser()

Create the parser to process the command line for buildme.

The returned object has these member variables

  • version boolean if version is requested

  • recursive boolean for directory recursion

  • verbose boolean for verbose output

  • preview boolean for previewing the clean process

  • generate_build_rules boolean create build rules and exit

  • rules_file string override build_rules.py

  • fatal boolean abort if error occurs in processing

  • directories string array of directories to process

  • files string array of project files to process

  • configurations string array of configurations to process

  • args string array of unknown parameters

Returns:

argparse.ArgumentParser() object

cleanme.add_clean_rules

makeprojects.cleanme.add_clean_rules(projects, working_directory, file_name, args, build_rules=None)

Add a build_rules.py to the clean list.

Given a build_rules.py to parse, check for the function β€œclean” and use that for scanning for functions to call.

All valid entries will be appended to the projects list.

See also

add_project

Parameters:
  • projects – List of projects to clean.

  • working_directory – Directory to perform actions on

  • file_name – Pathname to the build_rules.py file.

  • args – Args for determining verbosity for output.

  • build_rules – Preloaded build_rules.py object.

cleanme.add_project

makeprojects.cleanme.add_project(projects, processed, file_name, args)

Detect the project type and add it to the list.

Parameters:
  • projects – List of projects to build.

  • processed – List of directories already processed.

  • file_name – Pathname to the build_rules.py file.

  • args – Args for determining verbosity for output.

Returns:

True if the file was buildable, False if not.

cleanme.process_projects

makeprojects.cleanme.process_projects(results, projects, args)

Process a list of projects.

Sort the projects by priority and build all of them.

cleanme.process_files

makeprojects.cleanme.process_files(results, processed, files, args)

Process a list of files.

cleanme.process_directories

makeprojects.cleanme.process_directories(results, processed, directories, args)

Process a list of directories.

Parameters:
  • results – list object to append BuildError objects

  • processed – List of directories already processed.

  • directories – iterable list of directories to process

  • args – parsed argument list for verbosity

Returns:

True if processing should abort, False if not.

cleanme.process_dependencies

makeprojects.cleanme.process_dependencies(results, processed, dependencies, args)

Process a mixed string list of both directories and files.

Iterate over the dependencies list and test each object if it’s a directory, and if so, dispatch to the directory handler, otherwise, process as a file.

Parameters:
  • results – list object to append BuildError objects

  • processed – List of directories already processed.

  • dependencies – iterable list of files/directories to process

  • args – parsed argument list for verbosity

Returns:

True if processing should abort, False if not.

cleanme.main

makeprojects.cleanme.main(working_directory=None, args=None)

Command line shell for cleanme.

Entry point for the program cleanme, this function will either get the parameters from sys.argv or the paramater args.

  • --version, show version.

  • -r, Perform a recursive clean.

  • -v, Verbose output.

  • -n, Preview clean commands

  • --generate-rules, Create build_rules.py and exit.

  • --rules-file, Override the configruration file.

  • -q, Quit after the first error

  • -f, List of files to build.

  • -d, List of directories to clean.

  • -c, List of configurations to build

  • Additional terms are considered specific files or configurations to clean.

Parameters:
  • working_directory – Directory to operate on, or None for os.getcwd()

  • args – Command line to use instead of sys.argv

Returns:

Zero on no error, non-zero on error

Build

buildme.create_parser

makeprojects.buildme.create_parser()

Create the parser to process the command line for buildme.

The returned object has these member variables

  • version boolean if version is requested

  • recursive boolean for directory recursion

  • verbose boolean for verbose output

  • preview boolean for previewing the build process

  • generate_build_rules boolean create build rules and exit

  • rules_file string override build_rules.py

  • fatal boolean abort if error occurs in processing

  • directories string array of directories to process

  • files string array of project files to process

  • configurations string array of configurations to process

  • documentation boolean if Doxygen is be executed

  • args string array of unknown parameters

Returns:

argparse.ArgumentParser() object

buildme.add_build_rules

makeprojects.buildme.add_build_rules(projects, file_name, args, build_rules=None)

Add a build_rules.py to the build list.

Given a build_rules.py to parse, check it for a BUILD_LIST and use that for scanning for functions to call. If BUILD_LIST doesn’t exist, use makeprojects.python.BUILD_LIST instead.

All valid entries will be appended to the projects list.

See also

add_project

Parameters:
  • projects – List of projects to build.

  • file_name – Pathname to the build_rules.py file.

  • args – Args for determining verbosity for output.

  • build_rules – Preloaded build_rules.py object.

buildme.add_project

makeprojects.buildme.add_project(projects, processed, file_name, args)

Detect the project type and add it to the list.

Parameters:
  • projects – List of projects to build.

  • processed – List of directories already processed.

  • file_name – Pathname to the build_rules.py file.

  • args – Args for determining verbosity for output.

Returns:

True if the file was buildable, False if not.

buildme.process_projects

makeprojects.buildme.process_projects(results, projects, args)

Process a list of projects.

Sort the projects by priority and build all of them.

buildme.process_files

makeprojects.buildme.process_files(results, processed, files, args)

Process a list of files.

buildme.process_directories

makeprojects.buildme.process_directories(results, processed, directories, args)

Process a list of directories.

Parameters:
  • results – list object to append BuildError objects

  • processed – List of directories already processed.

  • directories – iterable list of directories to process

  • args – parsed argument list for verbosity

Returns:

True if processing should abort, False if not.

buildme.process_dependencies

makeprojects.buildme.process_dependencies(results, processed, dependencies, args)

Process a mixed string list of both directories and files.

Iterate over the dependencies list and test each object if it’s a directory, and if so, dispatch to the directory handler, otherwise, process as a file.

Parameters:
  • results – list object to append BuildError objects

  • processed – List of directories already processed.

  • dependencies – iterable list of files/directories to process

  • args – parsed argument list for verbosity

Returns:

True if processing should abort, False if not.

buildme.main

makeprojects.buildme.main(working_directory=None, args=None)

Command line shell for buildme.

Entry point for the program buildme, this function will either get the parameters from sys.argv or the paramater args.

  • --version, show version.

  • -r, Perform a recursive rebuild.

  • -v, Verbose output.

  • -n, Preview build commands

  • --generate-rules, Create build_rules.py and exit.

  • --rules-file, Override the configruration file.

  • -q, Quit after the first error

  • -f, List of files to build.

  • -d, List of directories to build.

  • -c, List of configurations to build

  • -docs, Compile Doxyfile files.

  • Additional terms are considered specific files or configurations to build.

Parameters:
  • working_directory – Directory to operate on, or None.

  • args – Command line to use instead of sys.argv.

Returns:

Zero on no error, non-zero on error

Rebuild

rebuild.main

makeprojects.rebuildme.main(working_directory=None, args=None)

Invoke the command line rebuildme.

Entry point for the program rebuildme, this function will either get the parameters from sys.argv or the paramater args.

  • --version, show version.

  • -r, Perform a recursive rebuild.

  • -v, Verbose output.

  • --generate-rules, Create build_rules.py and exit.

  • --rules-file, Override the configruration file.

  • -f, Stop building on the first build failure.

  • -d, List of directories to rebuild.

  • -docs, Compile Doxyfile files.

  • Additional terms are considered specific files to build.

Parameters:
  • working_directory – Directory to rebuild, or None for os.getcwd()

  • args – Command line to use instead of sys.argv

Returns:

Zero on no error, non-zero on error

Enums

enums.source_file_filter

makeprojects.enums.source_file_filter(file_list, file_type_list)

Prune the file list for a specific type.

Note

file_type_list can either be a single enums.FileTypes enum or an iterable list of enums.FileTypes

Parameters:
  • file_list – list of core.SourceFile entries.

  • file_type_list – enums.FileTypes to match.

Returns:

list of matching core.SourceFile entries.

enums.get_installed_visual_studio

makeprojects.enums.get_installed_visual_studio()

Find installed Visual Studio version.

Scan the host computer and return the IDETypes for the most recent version of Visual Studio that’s installed.

Returns:

IDETypes value or None

enums.get_installed_xcode

makeprojects.enums.get_installed_xcode()

Find installed Xcode version.

Scan the host computer and return the IDETypes for the most recent version of XCode that’s installed.

Returns:

IDETypes value or None

enums.platformtype_short_code

makeprojects.enums.platformtype_short_code(configurations)

Iterate over a list of Configurations to determine the short code.

For files that create multiple platforms, determine if it matches a known expandable PlatformType

Parameters:

configurations – List of configurations to scan

Returns:

Either β€˜β€™ or the generic short code of the group or the first code in the configuration list.

enums.get_output_template

makeprojects.enums.get_output_template(project_type, platform)

Determine the file prefix and suffix for the binary.

Using the project type and platform, determine if the final binary name template so that if the output was used with format(), it will create the binary filename appropriate for the platform.

Parameters:
Returns:

String to be used with format() to create the final name.

Util

util.validate_enum_type

makeprojects.util.validate_enum_type(value, data_type)

Verify a value is a specific data type.

Check if the value is either None or an instance of a specfic data type. If so, return immediately. If the value is a string, call the lookup() function of the data type for conversion.

Parameters:
  • value – Value to check.

  • data_type – Type instance of the class type to match.

Throws TypeError:

Returns:

Value converted to data_type or None.

util.regex_dict

makeprojects.util.regex_dict(value)

Convert *.cpp keys to regex keys.

Given a dict where the keys are all filenames with wildcards, convert only the keys into equivalent regexes and leave the values intact.

Examples

rules = {
    "*.cpp":
        {"a": "arf", "b": "bark", "c": "coo"},
    "*.h":
        {"h": "help"}
}
regex_keys = regex_dict(rules)

Parameters:

value – dict to convert

Returns:

dict with keys converted to regexes

util.validate_boolean

makeprojects.util.validate_boolean(value)

Verify a value is a boolean.

Check if the value can be converted to a bool, if so, return the value as bool. None is converted to False.

Parameters:

value – Value to check.

Throws ValueError:

Returns:

Value converted to data_type or None.

util.validate_string

makeprojects.util.validate_string(value)

Verify a value is a string.

Check if the value is a string, if so, return the value as is or None.

Parameters:

value – Value to check.

Throws ValueError:

Returns:

Value is string or None.

util.clear_build_rules_cache

makeprojects.util.clear_build_rules_cache()

Clear the build rules cache.

util.load_build_rules uses a cache. Call this function to clear the cache without calling util.load_build_rules to do it.

See also

load_build_rules

util.load_build_rules

makeprojects.util.load_build_rules(path_name, clear_cache=False)

Load build_rules using a cache.

Check if the path was already loaded. If so, use the cached version, otherwise load and cache the build_rules.py script

Parameters:
  • path_name – Full pathname to the build_rules.py script

  • clear_cache – Boolean, if true, clear the cache first

util.getattr_build_rules

makeprojects.util.getattr_build_rules(build_rules, attributes, fallback=None)

Find an attribute in a build rules module.

Scan the build rules until an attribute value is found. It will return the first one found. If none are found, this function returns fallback.

This function returns two values, the first is the attribute value, the second is a boolean of True meaning the attribute was found, or False if the default value was returned.

Parameters:
  • build_rules – build_rules.py module instance.

  • attributes – String or list of strings, attribute name(s).

  • fallback – Value to return if the attribute was not found.

Returns:

Tuple of attribute value found in build_rules, or fallback and the second value is True if found, False if default was

Returns:

used.

util.getattr_build_rules_list

makeprojects.util.getattr_build_rules_list(build_rules_list, attributes, fallback)

Find an attribute in a list of build rules.

Iterate over the build rules list until an entry has an attribute value. It will return the first one found. If none are found, or there were no entries in build_rules_list, this function returns fallback.

Parameters:
  • build_rules_list – List of build_rules.py instances.

  • attributes – String or list of strings, attribute name(s).

  • fallback – Value to return if the attribute was not found.

Returns:

Attribute value found in build_rules_list entry, or fallback.

util.add_build_rules

makeprojects.util.add_build_rules(build_rules_list, file_name, verbose, is_root, basename)

Load in the file build_rules.py

Load the build_rules.py file. If the variable *_GENERIC is True or if is_root is True, append the module to build_rules_list. If the variable *_CONTINUE was found in the file, check if it is set to True. If so, return True to allow processing to continue. If the file is not found, return True to allow processing the parent folder.

Since this is called from buildme, cleanme, and makeprojects, the prefix needed for the tool is passed in basename. An example is β€œCLEANME”.

Parameters:
  • build_rules_list – List to add build_rules.py instances.

  • file_name – Full path name of the build_rules.py to load.

  • verbose – True for verbose output.

  • is_root – True if *_GENERIC is ignored.

  • basename – Variable prefix to substitute * in *_GENERIC

Returns:

True if the parent folder should be checked, False if not.

util.get_build_rules

makeprojects.util.get_build_rules(working_directory, verbose, build_rules_name, basename)

Find all build_rules.py files that apply to this directory.

If no files are found, return an empty list.

Parameters:
  • working_directory – Directory to scan for build_rules.py

  • verbose – True if verbose output is desired

  • build_rules_name – build_rules.py or an override

  • basename – β€œCLEANME”, β€œBUILDME”, etc.

Returns:

List of loaded build_rules.py file modules

util.remove_ending_os_sep

makeprojects.util.remove_ending_os_sep(input_list)

Iterate over a string list and remove trailing os separator characters.

Each string is tested if its length is greater than one and if the last character is the pathname separator. If so, the pathname separator character is removed.

Parameters:

input_list – list of strings

Throws TypeError:

Returns:

Processed list of strings

util.was_processed

makeprojects.util.was_processed(processed, path_name, verbose)

Check if a file or directory has already been processed.

To prevent recursion, expand the path name to an absolution path call this function with a set that will store all the entries and the entry to test. If the entry is already in the set, report the issue and return True. Otherwise, add the entry to the set and return False to allow the path to be processed.

Parameters:
  • processed – Set to store processed pathnames

  • path_name – Path to a directory or file

  • verbose – True if verbose output is requested

Returns:

True if it’s already in the set. False if not.

util.fixup_args

makeprojects.util.fixup_args(args)

Check unused args if they are directories, files or configurations.

The args object has the attributes args, directories, configurations, and files. The attribute args has all the unparsed arguments that will be tested to see if they are a file, directory or a string. The entries will be added to their appropriate attribute, with strings appended to configurations. Attribute args is set to None.

Parameters:

args – args class from argparser

util.convert_file_name

makeprojects.util.convert_file_name(item, source_file)

Convert macros to literal filename strings.

Parameters:
  • item – Filename string

  • source_file – SourceFile object

Returns:

String with converted macros

util.do_generate_build_rules

makeprojects.util.do_generate_build_rules(parsed, working_directory)

Test if the parsed parameters have —generate-rules.

If —generate-rules was not invoked, return None. Otherwise return a numeric error code.

Parameters:
  • parsed – An ArgumentParser object with attribute generate_build_rules

  • working_directory – Directory to store the build_rules.py

Returns:

None or an integer error code

util.iterate_configurations

makeprojects.util.iterate_configurations(solution)

Iterate all configurations in a solution.

Given a solution, iterate over all of the configurations within the solution and return each object.

Parameters:

solution – Solution object.

Returns:

Iterator that returns configuration objects.

validators.lookup_enum_value

makeprojects.validators.lookup_enum_value(enum_lookup, key, fallback)

Find a value in a list of enums.

Iterate over a list of two entry tuples, the first entry is the key and the second is the value. Essentually, it’s a dict implemented as a list/tuple.

Parameters:
  • enum_lookup – iterable of enumeration entries (key, integer)

  • key – Key value to match in enumeration keys

  • fallback – Value to return if there is no match

Returns:

Second value in the enumeration entry where the key matches, or fallback

validators.lookup_enum_append_key

makeprojects.validators.lookup_enum_append_key(cmd, enum_lookup, value)

Look up a command line option from an enumeration.

Iterate over a list of tuples, with the first entry is a command line entry and the second entry is the integer enumeration value. If the value is a match to the enumeration value, append the command line entry to cmd.

Parameters:
  • cmd – list of command line options to append the new entry

  • enum_lookup – iterable of enumeration entries (key, integer)

  • value – integer enumeration value to match in enum_lookup

Throws ValueError:

Returns:

cmd, which may have been modified.

validators.lookup_enum_append_keys

makeprojects.validators.lookup_enum_append_keys(cmd, enum_dicts, command_dict)

Look up a set of enum command line options.

A command_dict has keys in the form of Visual Studio XML entries with the data being the expected setting, or None for default. If the value starts with _NOT_USED, it’s considered None and will use the default.

Note

Enumeration entries are a list of tuples where the first entry is the command line switch and the second entry is an integer as the enumeration value. If multiple entries have the same integer, the first entry is the default.

Parameters:
  • cmd – list of command line options to append the new entry

  • enum_dicts – Iterable of enumeration entries

  • command_dict – dict of command entries

Throws ValueError:

Returns:

Argument cmd is returned.

validators.lookup_strings

makeprojects.validators.lookup_strings(cmd, string_entries, command_dict)

Lookup string items and add them to the command line.

The command dictionary has a key of the Visual Studio XML name and the data is a valid string, usually a filename. If the data is None, the default string is used.

String entries are a list of tuples where the first entry is the key and the second entry is a four entry tuple with the actions.

The function will return a list of strings of output files so the caller can properly create the make entries for output files for the dependency tree.

The four entry tuple is as follows:

  1. String/None, Output filename if any, or None for no output.

  2. String, command line switch, may have a space at the end.

  3. Boolean, if True, encapsulate the output filename with quotes.

  4. Boolean, if True, add the string to the return list.

Parameters:
  • cmd – list of command line options to append the new entry

  • string_entries – dict of string entries

  • command_dict – dict of command entries

Returns:

String list of string items the generate output

validators.lookup_string_list

makeprojects.validators.lookup_string_list(cmd, switches, entry_list, quotes=True)

Create a command line with an entry list.

Given a list of strings in entry_list, add to a command line a compiler switch followed by each string with or without quotes. If the switch has an ending space, the space is removed and entries are stored in separate lines.

Parameters:
  • cmd – list of command line options to append the new entry.

  • switches – String, Command line switch string.

  • entry_list – List of parameter strings.

  • quotes – Boolean, True caused the entries to be quoted.

Returns:

Returns:

None

validators.lookup_string_lists

makeprojects.validators.lookup_string_lists(cmd, string_list, command_dict)

Lookup string items and add them to the command line.

The command_dict has the overrides where the value is either a single string or an array of strings or None.

The string_list is an iterable of tuples where the first entry is a string of the Visual Studio XML name and the second entry is a 2 entry tuple, where the first entry is the command line switch and the second entry is a boolean where if True will have the string in quotes.

Note

If a command line switch ends with a space, it will be used as a flag to append the parameter string as a separate line in the cmd list.

Parameters:
  • cmd – list of command line options to append the new entry.

  • string_list – dict of string list entries.

  • command_dict – dict of command entries.

Returns:

Returns:

None

validators.lookup_booleans

makeprojects.validators.lookup_booleans(cmd, boolean_list, command_dict)

Look up a command line option from a list of booleans.

The command dict is a dict of Visual Studio XML entries where the value is None, or a value that will be converted into a boolean.

The boolean list is an iterable of tuples where the first entry is the Visual Studio XML entry and the second is a variable length tuple where the first entry is the default value followed by pairs of values of a string for the command line switch and then the boolean to match.

Parameters:
  • cmd – list of command line options to append the new entry.

  • boolean_list – list of boolean entries.

  • command_dict – dict of command entries.

Returns:

Returns:

None

Defaults

defaults.settings_from_name

makeprojects.defaults.settings_from_name(configuration)

Given a configuration name, set default settings.

Default names are Debug, Internal, Release, Release_LTCG, Profile, Profile_FastCap and CodeAnalysis. If the setting name is one of these, or a variant, settings like debug, optimization, short_code, or profile are preset.

Parameters:

configuration – Configuration to update

Returns:

Returns:

configuration

defaults.configuration_presets

makeprojects.defaults.configuration_presets(configuration)

Set the default settings for a configuration.

Scan a configuration for a platform and an ide and set up compiler macros and other settings that are default for the specific platform.

Parameters:

configuration – Configuration record to update.

defaults.get_project_name

makeprojects.defaults.get_project_name(build_rules_list, working_directory, verbose=False, project_name=None)

Determine the project name.

Scan the build_rules.py file for the variable PROJECT_NAME, and if found use that string for the project name. Otherwise, use the name of the working folder.

Parameters:
  • build_rules_list – List of build_rules to iterate over.

  • working_directory – Full path name of the build_rules.py to load.

  • verbose – Boolean, True if name is to be printed

  • project_name – String, project name override

Returns:

Name of the project.

defaults.get_project_type

makeprojects.defaults.get_project_type(build_rules_list, verbose=False, project_type=None)

Determine the project type.

Scan the build_rules.py file for the variable PROJECT_TYPE, and if found use that string for the project type. Otherwise, assume it’s a command line tool.

Parameters:
  • build_rules_list – List of build_rules to iterate over.

  • verbose – Boolean, True for verbose output

  • project_type – Proposed project type.

Returns:

ProjectTypes enumeration.

defaults.get_platform

makeprojects.defaults.get_platform(build_rules_list, verbose=False, platform=None)

Determine the platforms to generate projects for.

Scan the build_rules.py file for the variable PROJECT_PLATFORM, and if found use that list of PlatformTypes or strings to lookup with PlatformTypes.lookup().

Parameters:
  • build_rules_list – List to append a valid build_rules file instance.

  • verbose – Boolean, True for verbose output

  • platform – Proposed platform type.

Returns:

Platform to generate project for.

defaults.guess_ide

makeprojects.defaults.guess_ide(platform)

Guess the IDE for a specific platform.

In cases where the platform is known, but the IDE is not, return the most likely IDE to use for building the platform.

Parameters:

platform – Platform to build for.

Returns:

IDETypes of the recommended IDE, or None if not known.

defaults.get_ide

makeprojects.defaults.get_ide(build_rules_list, verbose=False, ide=None, platform=None)

Determine the IDEs to generate projects for.

Scan the build_rules.py file for the variable PROJECT_IDE, and if found use that IDETypes or string to lookup with IDETypes.lookup().

Parameters:
  • build_rules_list – List to append a valid build_rules file instance.

  • verbose – Boolean, True for verbose output

  • ide – Proposed ide type.

  • platform – Platform to build for, used for guess_ide

Returns:

IDE to generate project for.

defaults.default_configuration_list

makeprojects.defaults.default_configuration_list(platform, ide)

Create the default configurations.

Parameters:
  • platform – platform being built.

  • ide – IDE being generated for.

Returns:

List strings with names of configurations.

defaults.get_configuration_list

makeprojects.defaults.get_configuration_list(build_rules_list, configurations, platform, ide)

Determine the configurations to generate projects for.

Scan the build_rules.py file for the command β€œconfiguration_list” and if found, use that list of strings to create configurations.

Parameters:
  • build_rules_list – List to append a valid build_rules file instance.

  • configurations – List of configuration names

  • platform – Platform building.

  • ide – IDETypes for the ide generating for.

Returns:

List of configuration strings to generate projects for.

Visual Studio

visual_studio.SUPPORTED_IDES

makeprojects.visual_studio.SUPPORTED_IDES = (     IDETypes.vs2003,     IDETypes.vs2005,     IDETypes.vs2008,     IDETypes.vs2010,     IDETypes.vs2012,     IDETypes.vs2013,     IDETypes.vs2015,     IDETypes.vs2017,     IDETypes.vs2019,     IDETypes.vs2022)

List of IDETypes the visual_studio module supports.

visual_studio.parse_sln_file

makeprojects.visual_studio.parse_sln_file(full_pathname)

Find build targets in .sln file.

Given a .sln file for Visual Studio 2003 through 2022, locate and extract all of the build targets available and return the list.

It will also determine which version of Visual Studio this solution file requires.

Parameters:

full_pathname – Pathname to the .sln file

Returns:

tuple(list of configuration strings, integer Visual Studio version year)

visual_studio.match

makeprojects.visual_studio.match(filename)

Check if the filename is a type that this module supports.

Match if the filename ends with .sln.

Parameters:

filename – Filename to match

Returns:

False if not a match, True if supported

visual_studio.create_build_object

makeprojects.visual_studio.create_build_object(file_name, priority=50, configurations=None, verbose=False)

Create BuildVisualStudioFile build records for every desired configuration.

Parameters:
  • file_name – Pathname to the *.sln to build

  • priority – Priority to build this object

  • configurations – Configuration list to build

  • verbose – True if verbose output

Returns:

list of BuildVisualStudioFile classes

visual_studio.create_clean_object

makeprojects.visual_studio.create_clean_object(file_name, priority=50, configurations=None, verbose=False)

Create BuildVisualStudioFile clean records for every desired configuration.

Parameters:
  • file_name – Pathname to the *.sln to build

  • priority – Priority to clean this object

  • configurations – Configuration list to clean

  • verbose – True if verbose output

Returns:

list of BuildVisualStudioFile classes

visual_studio.test

makeprojects.visual_studio.test(ide, platform_type)

Filter for supported platforms.

Test for classic xbox that can be built with Visual Studio 2003. Windows on all versions.

Game consoles, are a long list…

Parameters:
Returns:

True if supported, False if not

visual_studio.do_filter_tree

makeprojects.visual_studio.do_filter_tree(xml_entry, filter_name, tree, groups)

Recursively create a Filter/File tree.

Dump out a recursive tree of files to reconstruct a directory hiearchy for a file list with XML Filter records.

Parameters:
  • xml_entry – Root entry to attach records to.

  • filter_name – Name of the current filter

  • tree – dict() containing the file list

  • groups – List of filter entries to match to the tree

visual_studio.generate

makeprojects.visual_studio.generate(solution)

Create a solution and project(s) file for Visual Studio.

Given a Solution object, create an appropriate Visual Studio solution and project files to allow this project to build.

Parameters:

solution – Solution instance.

Returns:

Zero if no error, non-zero on error.

visual_studio_utils.get_path_property

makeprojects.visual_studio_utils.get_path_property(ide, pathname)

If a path is relative, return the proper object.

Check if a pathname starts with a β€œ.”, which means it’s relative to the project. If so, return a RelativePath string, otherwise return a FileName string. Special case for Visual Studio 2003, it only accepts RelativePath as a parameter

Parameters:
  • ide – enums.IDETypes of the IDE being generated for.

  • pathname – Pathname to test.

Returns:

validators.VSStringProperty of type RelativePath or FileName

visual_studio_utils.get_toolset_version

makeprojects.visual_studio_utils.get_toolset_version(ide)

Get the toolset version for the Visual Studio version.

Each version of Visual Studio uses a toolset version specific to that version. Return the version number for the vcxproj file.

Strings returned are β€œ4.0”, β€œ12.0”, β€œ14.0” and β€œ15.0”.

Parameters:

ide – enums.IDETypes of the IDE being generated

Returns:

String of the toolset version for the ide

visual_studio_utils.convert_file_name_vs2010

makeprojects.visual_studio_utils.convert_file_name_vs2010(item)

Convert macros from to Visual Studio 2003-2008.

This table shows the conversions

Visual Studio 2010+

2003-2008

%(RootDir)%(Directory)

$(InputDir)

%(FileName)

$(InputName)

%(Extension)

$(InputExt)

%(FullPath)

$(InputPath)

%(Identity)

$(InputPath)

Parameters:

item – Filename string

Returns:

String with converted macros

visual_studio_utils.wiiu_props

makeprojects.visual_studio_utils.wiiu_props(project)

If the project is for WiiU, check if there are assembly files.

If there are assembly files, add the Nintendo supplied props file for assembly language support.

Note

This assumes that the official WiiU SDK from Nintendo is installed on the machine that will build this project file.

Parameters:

project – Project to check

visual_studio_utils.add_masm_support

makeprojects.visual_studio_utils.add_masm_support(project)

If the project is has assembly files, add the props files.

This function works for Visual Studio 2003-2022.

Note

  • Visual Studio 2003 only supports x86 files

  • Visual Studio 2005-2015 only support x86 and x64 files

  • Visual Studio 2017+ support arm, arm64, x86, and x64 files

Parameters:

project – Project to check

visual_studio_utils.get_cpu_folder

makeprojects.visual_studio_utils.get_cpu_folder(platform)

If the platform is a Windows type, return the CPU name.

Returns None, β€œx86”, β€œx64”, β€œarm”, β€œarm64”, or β€œia64”

Parameters:

platform – enums.PlatformTypes to check

Returns:

None or platform CPU name.

visual_studio_utils.generate_solution_file

makeprojects.visual_studio_utils.generate_solution_file(solution_lines, solution)

Serialize the solution file into a string array.

This function generates SLN files for all versions of Visual Studio. It assumes the text file will be encoded using UTF-8 character encoding so the resulting file will be pre-pended with a UTF-8 Byte Order Mark (BOM) for Visual Studio 2005 or higher.

Note

Byte Order Marks are not supplied by this function.

Parameters:
  • solution_lines – List to insert string lines.

  • solution – Reference to the raw solution record

Returns:

Zero on success, non-zero on error.

visual_studio_utils.create_copy_file_script

makeprojects.visual_studio_utils.create_copy_file_script(source_file, dest_file, perforce)

Create a batch file to copy a single file.

Create a list of command lines to copy a file from source_file to dest_file with perforce support.

This is an example of the Windows batch file. The lines for the tool p4 are added if perforce=True.

p4 edit dest_file
copy /Y source_file dest_file
p4 revert -a dest_file

Parameters:
  • source_file – Pathname to the source file

  • dest_file – Pathname to where to copy source file

  • perforce – True if perforce commands should be generated.

Returns:

List of command strings for Windows Command shell.

visual_studio_utils.create_deploy_script

makeprojects.visual_studio_utils.create_deploy_script(configuration)

Create a deployment batch file if needed.

If an attribute of deploy_folder exists, a batch file will be returned that has the commands to copy the output file to the folder named in deploy_folder.

Two values are returned, the first is the command description suitable for Visual Studio Post Build and the second is the batch file string to perform the file copy. Both values are set to None if deploy_folder is empty.

mkdir final_folder
p4 edit dest_file
copy /Y source_file dest_file
p4 revert -a dest_file

Note

If the output is project_type of Tool, the folder will have cpu name appended to it and any suffix stripped.

Parameters:

configuration – Configuration record.

Returns:

None, None or description and batch file string.

Watcom

watcom.SUPPORTED_IDES

makeprojects.watcom.SUPPORTED_IDES = (IDETypes.watcom,)

List of IDETypes the watcom module supports.

watcom.match

makeprojects.watcom.match(filename)

Check if the filename is a project type that this module supports.

Check if the project file ends with β€œ.wmk”, return True if so.

Parameters:

filename – Filename to match

Returns:

False if not a match, True if supported

watcom.create_build_object

makeprojects.watcom.create_build_object(file_name, priority=50, configurations=None, verbose=False)

Create BuildWatcomFile build records for every desired configuration.

Parameters:
  • file_name – Pathname to the *.wmk to build

  • priority – Priority to build this object

  • configurations – Configuration list to build

  • verbose – True if verbose output

Returns:

list of BuildWatcomFile classes

watcom.create_clean_object

makeprojects.watcom.create_clean_object(file_name, priority=50, configurations=None, verbose=False)

Create BuildWatcomFile clean records for every desired configuration.

Parameters:
  • file_name – Pathname to the *.wmk to build

  • priority – Priority to build this object

  • configurations – Configuration list to build

  • verbose – True if verbose output

Returns:

list of BuildWatcomFile classes

watcom.test

makeprojects.watcom.test(ide, platform_type)

Filter for supported platforms.

Watcom supports MSDOS 4GW, MSDOS X32 and Windows 32 only.

Parameters:
Returns:

True if supported, False if not

watcom.generate

makeprojects.watcom.generate(solution)

Create a project file for Watcom.

Given a Solution object, create an appropriate Watcom WMAKE file to allow this project to build.

Parameters:

solution – Solution instance.

Returns:

Zero if no error, non-zero on error.

watcom_util.fixup_env

makeprojects.watcom_util.fixup_env(item)

Check if a path has an environment variable.

If an pathname starts with $(XXX), then it needs to be invoking an environment variable. Watcom uses the form $(%XXX) so insert a percent sign to convert to Watcom format if needed. If it already has a percent sign, don’t change the string.

Parameters:

item – String to check

Returns:

Updated pathname using $(%XXX) format

watcom_util.convert_file_name_watcom

makeprojects.watcom_util.convert_file_name_watcom(item)

Convert macros from Visual Studio to Open Watcom.

This table shows the conversions

Visual Studio

Watcom

%(RootDir)%(Directory)

$[:

%(FileName)

$[&

%(FullPath)

$[@

%(Identity)

$[@

$(TargetPath)

$^@

Parameters:

item – Filename string

Returns:

String with converted macros

watcom_util.get_element_dict

makeprojects.watcom_util.get_element_dict(rule_list, base_name, tool_enums)

Create Visual Studio style element list.

Given a list of rules, the base name of the source file, and the enumeration table for the command generator, return a dict with all the keys and values for the Visual Studio overrides for this file.

This is usually parsed by the HLSL and GLSL command generators.

Note

The returned value is a dict using Visual Studio elements as keys with the parameter template string as the value. Example keys are ObjectFileName, VariableName, and HeaderFileName.

Parameters:
  • rule_list – Iterable of a list of rules

  • base_name – Name of the source file to check

  • tool_enums – Enumeration lookup for the command generator

Returns:

dict of values for file overrides, can be empty

watcom_util.get_custom_list

makeprojects.watcom_util.get_custom_list(custom_list, rule_list, codefiles)

Scan the custom rules and create a list of bespoke builders.

First, convert the rule list into the Visual Studio dictionaries, and then use the GLSL or HLSL command line generators to create

Next, iterate over the codefiles for any GLSL or HLSL files and apply the rules (If found) and create the command lines needed to build the files.

If any custom build commands are generated, they are appended to custom_list as a 4 entry tuple, with the first entry being the command line, the second is a text description of the command, the third is the name of the output file(s) and lastly the input filename.

Return

custom_list

Parameters:
  • custom_list – list object to receive new entries

  • rule_list – Tuple of rules

  • codefiles – List of SourceFile objects to check

watcom_util.get_output_list

makeprojects.watcom_util.get_output_list(custom_list)

Scan the custom_list and return the output files.

Create a list of output filenames and sort them before returning the list. The third entry of the custom_list is the output filename.

See also

get_custom_list

Return

List of output file names

Parameters:

custom_list – List of custom commands

watcom_util.get_obj_list

makeprojects.watcom_util.get_obj_list(codefiles, type_list)

Extract a list of file names without extensions.

Given a codefiles list and a list of acceptable types, return a list of filenames stripped of their extensions and directories.

See also

enums.FileTypes

Parameters:
  • codefiles – Codefiles list from the project

  • type_list – List of enums.FileTypes objects

Returns:

List of processed matching filenames, or empty list

watcom_util.add_obj_list

makeprojects.watcom_util.add_obj_list(line_list, obj_list, prefix, suffix)

Create a list of object files with prefix.

Give a list of filenames without extensions, create a Watcom compatible list with an $(A) prefix for runtime pathname substitution. Add the supplied prefix to all filenames.

The filename list is sorted before processing.

Parameters:
  • line_list – Output file

  • obj_list – List of filenames without extensions

  • prefix – Variable name for the list

  • suffix – Object file suffix

watcom_util.add_post_build

makeprojects.watcom_util.add_post_build(line_list, configuration)

If there are custom build rules, add them.

Scan the configuration attribute post_build and if it exists, append the commands to line_list.

See also

fixup_env

Parameters:
  • line_list – Output stream

  • configuration – Project configuration

watcom_util.watcom_linker_system

makeprojects.watcom_util.watcom_linker_system(configuration)

Determine the watcom system for linkage.

Scan the configuration and return the string β€œsystem ???” where ??? is replaced with dos4g, nt, etc.

Can be overriden with the attribute wat_system. If this exists, use it to declare β€œsystem ???” or β€œβ€ to disable.

Return

String β€œsystem β€œ + actual type

Parameters:

configuration – Project configuration

watcom_util.warn_if_invalid

makeprojects.watcom_util.warn_if_invalid(solution)

Iterate over the solution and determine if there are errors.

Test for use of use_mfc or use_atl

Parameters:

solution – Reference to a solution record

Returns:

Zero if no error, non-zero if error