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

Description

A compiler/linker for node classes and graphs.

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

Public Member Functions

void addModuleSearchPath (string path)
 Loads all node classes and types in the directory at path, which is recursively searched.
 
void realizePortTypes (void)
 Updates the data-and-event ports of each known node class to match them up with known types.
 
void compileGraph (VuoCompilerGraph *graph, string outputPath)
 Compiles a graph to LLVM bitcode.
 
void compileGraph (string inputPath, string outputPath)
 Compiles a graph, read from file, to LLVM bitcode.
 
void compileGraphString (const string &graphString, string outputPath)
 Compiles the graph in graphString to LLVM bitcode.
 
void compileNodeClass (string inputPath, string outputPath)
 Compiles inputPath (a .c file) and saves the resulting LLVM bitcode in outputPath.
 
void linkGraphIntoExecutable (string inputPath, string outputPath)
 Turns a compiled (but not linked) graph into a standalone executable by linking in all of its dependencies and adding a main function.
 
void linkGraphIntoDynamicLibrary (string inputPath, string outputPath)
 Turns a compiled (but not linked) graph into a dynamic library by linking in all of its dependencies.
 
VuoCompilerNodeClassgetNodeClass (const string &id) const
 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) const
 Looks up the VuoCompilerType for the type specified by id.
 
void listNodeClasses (const string &format="") const
 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 graph.
 
void addPreferredLibrarySearchPath (const string &path)
 Adds a preferred library search path to use when linking a graph.
 
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 graph.
 
void addPreferredFrameworkSearchPath (const string &path)
 Adds a preferred Mac OS X framework search path to use when linking a graph.
 
void setTelemetry (const string &telemetry)
 Sets the telemetry option to use when compiling a graph.
 
void setTarget (const string &target)
 Sets the target triple to use when compiling or linking.
 
void setClangVerbose (bool isClangVerbose)
 Sets the verbosity to use when compiling or linking with Clang.
 
void setClangPath (const string &clangPath)
 Sets the path to the clang binary.
 

Static Public Member Functions

static map< string, string > getPortDeclarationInfo (VuoCompilerInputEventPortClass *portClass)
 Helper function for listNodeClasses.
 
static map< string, string > getPortDeclarationInfo (VuoCompilerOutputEventPortClass *portClass)
 Helper function for listNodeClasses.
 
static map< string, string > getPortDeclarationInfo (VuoCompilerGeneratorPortClass *portClass)
 Helper function for listNodeClasses.
 
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.
 

Friends

class TestVuoCompiler
 
class TestVuoCompilerModule
 
class TestVuoCompilerGraph
 

Member Function Documentation

void VuoCompiler::addModuleSearchPath ( string  path)

Loads all node classes and types in the directory at path, which is recursively searched.

Adds path to the list of library search paths used in linking.

If multiple definitions of a node class or type are encountered (either in different folders inside of path or in different calls to this function), the most recently encountered definition is used.

If path does not exist, does nothing.

void VuoCompiler::addPreferredFrameworkSearchPath ( const string &  path)

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

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 graph.

Preferred paths will be searched before any other library paths.

void VuoCompiler::compileGraph ( VuoCompilerGraph graph,
string  outputPath 
)

Compiles a graph to LLVM bitcode.

Parameters
graphThe graph.
outputPathThe file in which to save the compiled LLVM bitcode.
void VuoCompiler::compileGraph ( string  inputPath,
string  outputPath 
)

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

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

Compiles the graph in graphString to LLVM bitcode.

Parameters
graphStringA string containing the graph.
outputPathThe file in which to save the compiled LLVM bitcode.
VuoCompilerNodeClass * VuoCompiler::getNodeClass ( const string &  id) const

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

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

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

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

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

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

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

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.
VuoRunner * VuoCompiler::newCurrentProcessRunnerFromCompositionFile ( string  compositionFilePath)
static

Creates a runner object that can run the composition in file compositionFilePath in this process.

VuoRunner * VuoCompiler::newCurrentProcessRunnerFromCompositionString ( string  composition)
static

Creates a runner object that can run the composition in string composition in this process.

VuoRunner * VuoCompiler::newSeparateProcessRunnerFromCompositionFile ( string  compositionFilePath)
static

Creates a runner object that can run the composition in file compositionFilePath in a new process.

VuoRunner * VuoCompiler::newSeparateProcessRunnerFromCompositionString ( string  composition)
static

Creates a runner object that can run the composition in string composition in a new process.

void VuoCompiler::realizePortTypes ( void  )

Updates the data-and-event ports of each known node class to match them up with known types.

This method needs to be called between when the last node class or type is loaded and when a graph is compiled. It can be called multiple times.

void VuoCompiler::setClangVerbose ( bool  isClangVerbose)

Sets the verbosity to use when compiling or linking with Clang.

If true, passes the -v option to Clang.

void VuoCompiler::setTelemetry ( const string &  telemetry)

Sets the telemetry option to use when compiling a graph.

Valid values are "off", "on", and "console".


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