Vuo  0.4.8
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Public Member Functions | Static Public Member Functions | Protected Member Functions | Friends | List of all members
VuoCompiler Class Reference

Description

A compiler/linker for node classes and compositions.

Once you've compiled and linked a composition, you can use VuoRunner to execute and communicate with it.

Public Member Functions

void addNodeClass (VuoCompilerNodeClass *nodeClass)
 Adds a node class to use when linking a composition.
 
void compileComposition (VuoCompilerBitcodeGenerator *generator, string outputPath)
 Compiles a composition to LLVM bitcode.
 
void compileComposition (string inputPath, string outputPath)
 Compiles a composition, read from file, to LLVM bitcode.
 
void compileCompositionString (const string &compositionString, string outputPath)
 Compiles the composition in compositionString to LLVM bitcode.
 
void compileModule (string inputPath, string outputPath)
 Compiles a node class, type, or library to LLVM bitcode.
 
void linkCompositionToCreateExecutable (string inputPath, string outputPath)
 Turns a compiled (but not linked) composition into a standalone executable by linking in all of its dependencies and adding a main function.
 
void linkCompositionToCreateDynamicLibrary (string inputPath, string outputPath)
 Turns a compiled (but not linked) composition into a dynamic library by linking in all of its dependencies.
 
void linkCompositionToCreateDynamicLibraries (string compiledCompositionPath, string linkedCompositionPath, string &newLinkedResourcePath, vector< string > &alreadyLinkedResourcePaths, set< string > &alreadyLinkedResources)
 Creates one dynamic library for the composition by itself and, if needed, another dynamic library for the node classes and other resources that are dependencies of the composition.
 
VuoCompilerNodeClassgetNodeClass (const string &id)
 Looks up the VuoCompilerNodeClass for the node class specified by id.
 
map< string,
VuoCompilerNodeClass * > 
getNodeClasses (void)
 Returns a map linking a string representation of a node class's name to its VuoCompilerNodeClass instance.
 
VuoCompilerTypegetType (const string &id)
 Looks up the VuoCompilerType for the type specified by id.
 
void listNodeClasses (const string &format="")
 Prints a list of all loaded node classes to standard output.
 
void addHeaderSearchPath (const string &path)
 Adds a header search path to use when compiling a node class.
 
void addLibrarySearchPath (const string &path)
 Adds a library search path to use when linking a composition.
 
void addPreferredLibrarySearchPath (const string &path)
 Adds a preferred library search path to use when linking a composition.
 
void clearPreferredLibrarySearchPaths ()
 Clears the list of preferred library paths.
 
void addFrameworkSearchPath (const string &path)
 Adds a Mac OS X framework search path to use when linking a composition.
 
void addPreferredFrameworkSearchPath (const string &path)
 Adds a preferred Mac OS X framework search path to use when linking a composition.
 
void setTelemetry (const string &telemetry)
 Sets the telemetry option to use when compiling a composition.
 
void setTarget (const string &target)
 Sets the target triple to use when compiling or linking.
 
void setVerbose (bool isVerbose)
 Sets the verbosity to use when compiling or linking.
 
void setClangPath (const string &clangPath)
 Sets the path to the clang binary.
 
string getCompositionLoaderPath (void)
 Returns the path to the VuoCompositionLoader executable.
 
void print (void)
 Prints info about this compiler, for debugging.
 

Static Public Member Functions

static llvm::sys::Path getVuoFrameworkPath ()
 Returns the path to Vuo.framework, or an empty path if the framework cannot be located.
 
static string getUserModulesPath ()
 Returns the filesystem path to the user-specific Vuo Modules folder.
 
static string getSystemModulesPath ()
 Returns the filesystem path to the system-wide Vuo Modules folder.
 
static VuoRunnernewSeparateProcessRunnerFromCompositionFile (string compositionFilePath)
 Creates a runner object that can run the composition in file compositionFilePath in a new process.
 
static VuoRunnernewSeparateProcessRunnerFromCompositionString (string composition)
 Creates a runner object that can run the composition in string composition in a new process.
 
static VuoRunnernewCurrentProcessRunnerFromCompositionFile (string compositionFilePath)
 Creates a runner object that can run the composition in file compositionFilePath in this process.
 
static VuoRunnernewCurrentProcessRunnerFromCompositionString (string composition)
 Creates a runner object that can run the composition in string composition in this process.
 

Protected Member Functions

void addModuleSearchPath (string path)
 Adds a module search path (for node classes, types, and libraries) to use when linking a composition.
 

Friends

class TestVuoCompilerBitcodeGenerator
 
class TestVuoCompiler
 TestVuoCompiler needs to add a search path for its own private nodes/types.
 
class TestCompositionExecution
 TestCompositionExecution needs to add a search path for its own private nodes.
 

Member Function Documentation

void VuoCompiler::addNodeClass ( VuoCompilerNodeClass nodeClass)

Adds a node class to use when linking a composition.

Typically, node classes are loaded from file with addModuleSearchPath(). This function is useful if adding a node class that is generated at compile time.

void VuoCompiler::addPreferredFrameworkSearchPath ( const string &  path)

Adds a preferred Mac OS X framework search path to use when linking a composition.

Preferred paths will be searched before any other framework paths.

void VuoCompiler::addPreferredLibrarySearchPath ( const string &  path)

Adds a preferred library search path to use when linking a composition.

Preferred paths will be searched before any other library paths.

void VuoCompiler::compileComposition ( VuoCompilerBitcodeGenerator generator,
string  outputPath 
)

Compiles a composition to LLVM bitcode.

Parameters
generatorA bitcode generator for the composition.
outputPathThe file in which to save the compiled LLVM bitcode.
void VuoCompiler::compileComposition ( string  inputPath,
string  outputPath 
)

Compiles a composition, read from file, to LLVM bitcode.

Parameters
inputPathThe .vuo file containing the composition.
outputPathThe file in which to save the compiled LLVM bitcode.
void VuoCompiler::compileCompositionString ( const string &  compositionString,
string  outputPath 
)

Compiles the composition in compositionString to LLVM bitcode.

Parameters
compositionStringA string containing the composition.
outputPathThe file in which to save the compiled LLVM bitcode.
void VuoCompiler::compileModule ( string  inputPath,
string  outputPath 
)

Compiles a node class, type, or library to LLVM bitcode.

Parameters
inputPathThe file to compile, containing a C implementation of the node class, type, or library.
outputPathThe file in which to save the compiled LLVM bitcode.
VuoCompilerNodeClass * VuoCompiler::getNodeClass ( const string &  id)

Looks up the VuoCompilerNodeClass for the node class specified by id.

The node class module is loaded if it hasn't been already.

Example:
VuoCompiler *compiler = new VuoCompiler("nodes");
VuoCompilerNodeClass *nc = compiler->getNodeClass("vuo.math.add.integer");
[...]
delete compiler;
map< string, VuoCompilerNodeClass * > VuoCompiler::getNodeClasses ( void  )

Returns a map linking a string representation of a node class's name to its VuoCompilerNodeClass instance.

The node class modules are loaded if they haven't been already.

VuoCompilerType * VuoCompiler::getType ( const string &  id)

Looks up the VuoCompilerType for the type specified by id.

The type module is loaded if it haven't been already.

void VuoCompiler::linkCompositionToCreateDynamicLibraries ( string  compiledCompositionPath,
string  linkedCompositionPath,
string &  newLinkedResourcePath,
vector< string > &  alreadyLinkedResourcePaths,
set< string > &  alreadyLinkedResources 
)

Creates one dynamic library for the composition by itself and, if needed, another dynamic library for the node classes and other resources that are dependencies of the composition.

Parameters
compiledCompositionPathPath to the compiled composition (a .bc file generated by compileComposition).
linkedCompositionPathPath where the resulting dynamic library for the composition should be placed.
newLinkedResourcePathPath where the resulting dynamic library for the composition's resources should be placed. The dynamic library is only created if this version of the composition requires resources that are not in alreadyLinkedResources. When this function returns, if the dynamic library was created, then this argument is the same as when it was passed in; otherwise, this argument is the empty string.
alreadyLinkedResourcePathsPaths where the resulting dynamic libraries for the composition's resources have been placed in previous calls to this function. When this function returns, if a dynamic library was created at newLinkedResourcePath, it will be the last element in this list.
alreadyLinkedResourcesNames of resources that have been linked into the composition in previous calls to this function. When this function returns, any new resources will have been added to this list.
void VuoCompiler::linkCompositionToCreateDynamicLibrary ( string  inputPath,
string  outputPath 
)

Turns a compiled (but not linked) composition into a dynamic library by linking in all of its dependencies.

Parameters
inputPathPath to the compiled composition (a .bc file generated by compileComposition).
outputPathPath where the resulting dynamic library should be placed.
void VuoCompiler::linkCompositionToCreateExecutable ( string  inputPath,
string  outputPath 
)

Turns a compiled (but not linked) composition into a standalone executable by linking in all of its dependencies and adding a main function.

Parameters
inputPathPath to the compiled composition (a .bc file generated by compileComposition).
outputPathPath where the resulting executable should be placed.
void VuoCompiler::listNodeClasses ( const string &  format = "")

Prints a list of all loaded node classes to standard output.

The node class modules are loaded if they haven't been already.

Parameters
formatThe format for printing the node classes.
  • If "", prints each class name (e.g. vuo.math.count.integer), one per line.
  • If "path", prints the absolute path of each node class, one per line.
  • If "dot", prints the declaration of a node as it would appear in a .vuo (DOT format) file, with a constant value set for each data+event input port and a comment listing metadata and port types for the node class.
void VuoCompiler::setTelemetry ( const string &  telemetry)

Sets the telemetry option to use when compiling a composition.

Valid values are "on" and "console".

void VuoCompiler::setVerbose ( bool  isVerbose)

Sets the verbosity to use when compiling or linking.

If true, prints some debug info and passes the -v option to Clang.


The documentation for this class was generated from the following files: