ios_build package
Submodules
ios_build.build module
- ios_build.build.checkPath(path, **kwargs)
Determines whether the given path exists and is a valid CMake project, i.e. contains a CMakeLists.txt file. If the path is not found a NotADirectoryError is thown. Else if the path does not contain a CMakeLists.txt file, then a FileNotFoundError is raised. Whether the CMakeLists.txt file is valid is not checked here.
- Parameters:
path (str) – Local path for the CMake project.
- Raises:
IOSBuildError – Raised if path is not a valid CMake project directory.
- ios_build.build.setupDirectory(dir_prefix, clean=False, prefix=None, name='Directory', **kwargs)
Setup a directory at path prefix/dir_prefix and returns the full path. If the directory already exists, nothing is done unless the clean option is specified. If clean is specified, the existing directory is removed and a clean version created. If prefix is not specified, then dir_prefix may be specified relative to the current working directory. If prefix is specified, then dir_prefix is the desired path relative to prefix.
- ios_build.build.createFrameworks(install_dir, output_dir=None, **kwargs)
Searches for static libraries in the install_dir and uses them to create an xcframework for each. The framework contains versions of the library for each platform.
- ios_build.build.cleanUp(build_dir, install_dir, clean_up=False, **kwargs)
Function to clean up files after the program is run.
- ios_build.build.build(build_dir, platforms=None, **kwargs)
Loop through each platform and run CMake for each. This includes the configure step, building and installation.
- Parameters:
- Raises:
RuntimeError – _description_
- ios_build.build.iosBuild(build_prefix='build', install_prefix='install', **kwargs)
Run the full iOSBuild using CMake and XCodeBuild for the CMake project using the options obtained from the parser.
- ios_build.build.runBuild(print_level=0, **kwargs)
Run the full iOSBuild using CMake and XCodeBuild for the CMake project using the options obtained from the parser.
ios_build.cmake module
- ios_build.cmake.checkCMake(**kwargs)
Check the existence of cmake by calling the interface with the –version option.
- ios_build.cmake.checkInput(*args)
Checks args are not None
- Raises:
TypeError – Raised if arg is None
- ios_build.cmake.configure(path=None, platform=None, toolchain_path=None, install_dir=None, platform_dir=None, platform_options={}, cmake_options={}, generator='Xcode', **kwargs)
Run the CMake configure step. This passes the path to CMake along with all the options necessary for CMake to run the configuration. Some of the cmake options are fixed and may not be altered for compatibility with the ios toolchain. CMake cache options may be specified using the cmake_options dictionary and platform specific options using a similar embedded dictionary in platform_options keyed by platform name.
- Parameters:
path (str, optional) – Path to a valid CMake project. Defaults to None.
platform (str, optional) – The target platform to build. Defaults to None.
toolchain_path (str, optional) – Path to toolchain file. Defaults to None.
install_dir (str, optional) – Install directory prefix. Defaults to None.
platform_dir (str, optional) – Platform specific build directory. Defaults to None.
platform_options (dict, optional) – Platform specific cmake cache options. Defaults to {}.
cmake_options (dict, optional) – CMake cache options. Defaults to {}.
generator (str, optional) – CMake generator. Defaults to “Xcode”.
- ios_build.cmake.build(platform_dir=None, config='Release', **kwargs)
CMake build step. Assumes configuration is completed runs cmake –build {platform_dir} –config {config} where platform_dir is the CMake build directory.
- ios_build.cmake.install(platform_dir=None, config='Release', **kwargs)
Cmake install step. Assumes configuration and build are complete and runs cmake –install {platform_dir} –config {config} where platform_dir is the CMake build directory.
- ios_build.cmake.runCMake(**kwargs)
Run CMake configuration, build and install, with all options specified using kwargs.
ios_build.interface module
- ios_build.interface.callSubProcess(command, printer)
Call a subprocess specified using a list of commands.
- Parameters:
- Raises:
RuntimeError – Raised if the process returns a non-zero exit code.
- ios_build.interface.cmake(*args, cmake_command='cmake', **kwargs)
Runs cmake using subprocess.
ios_build.parser module
- ios_build.parser.checkValues(val, options)
Check CMake Cache string is of the form {OPTION}={VALUE} and return {OPTION} k and {VALUE} v if formatted correctly.
- ios_build.parser.sortCMakeOptions(options)
Sort CMake Cache variables into a dictionary.
- ios_build.parser.loadJson(filename)
Load file in JSON format as a dictionary.
- ios_build.parser.sortArgs(kwargs)
Sorts the arparse output into a dictionary for use with the rest of the program.
- Parameters:
kwargs (argparse.Namespace) – The input arguments returned from argparse
- Returns:
All options for the program in dictionary format.
- Return type:
- ios_build.parser.parseArgs(args=None)
Main parser, parses the command-line arguments using argparse. The full list of arguments is found using the help option -h. Note that any errors in argparse return a SystemExit signal which must be caught.
- Parameters:
args (optional) – Optional additional arguments (for testing purposes).
- ios_build.parser.parse(args=None)
Parse command-line arguments.
- Parameters:
args (_type_, optional) – Pass arguments directly to function (for testing). Defaults to None.
- Raises:
IOSBuildError – Raised if argparse throws an exit signal
- Returns:
Arguments sorted into a Python dictionary
- Return type:
ios_build.printer module
- class ios_build.printer.Printer(print_level=0)
Bases:
objectClass to handle all printing using a verbosity scale to determine what to print
- print(value, verbosity=0, **kwargs)
- printValue(text, value, verbosity=0, **kwargs)
Print a value inline with a fixed width for key. :param text: Key for printed value :type text: str :param value: value to be printed :type value: str :param verbosity: The level of verbosity at which the statement should be printed. Defaults to 0. :type verbosity: int
- tick(verbosity=0, **kwargs)
Print a ✅ character
- Parameters:
verbosity (int) – The level of verbosity at which the statement should be printed. Defaults to 0.
- cross(verbosity=0, **kwargs)
Print a ❌ character
- Parameters:
verbosity (int) – The level of verbosity at which the statement should be printed. Defaults to 0.
- printStat(text, tick='tick', **kwargs)
- printEmbeddedDict(input_dict, verbosity=0, header=None)
Print a dictionary using a recursive algorithm for embedded dictionaries.
- showOutput()
- showError()
- printError(value)
- printHeader(**kwargs)
- Return type:
ios_build.run module
ios_build.search module
- ios_build.search.findPlatformLibraries(directory)
Search for static libraries within the directory. This function uses os.walk() to search the directory for static libraries (files with suffix .a). Any results are added to the results dictionary.
- ios_build.search.invertDict(libraries)
Invert a dictionary of structure libraries[k1][k2] to a dictionary with structure result[k2][k1].
- ios_build.search.findlibraries(install_dir, platforms=[], **kwargs)
Find static libraries for each platform in a directory. Assuming files for each platform are contained in a subdirectory of the same name.
ios_build.xcodebuild module
- ios_build.xcodebuild.checkXCodeBuild(**kwargs)
Check availability of xcodebuild command using xcodebuild -version.
- ios_build.xcodebuild.createXCFramework(install_dir, lib, files, **kwargs)
Create an xcframework for library lib in install_dir containing all the libraries in files.