This class compiles node classes, types, and library modules.
It compiles and links compositions.
Node classes, types, library modules, and compositions are all compiled to LLVM bitcode. LLVM bitcode is one of the file formats used by the Clang compiler.
When a composition is linked, the compiled composition and all of its node classes, types, library modules, and other dependencies are combined to create one of the following: an executable, a dynamic library, or or separate dynamic libraries for the composition and its resources.
All VuoCompiler instances share a basic set of node classes, types, library modules, and other dependencies. Each VuoCompiler instance can add its own dependencies on top of that basic set.
The easiest way to compile, link, and run a composition is to use the VuoCompiler factory methods to create a VuoRunner that's ready to run the composition:
When building a composition, this class optimizes the build in different ways depending on the functions, and in some cases the arguments, that you use. Some functions for linking a composition accept an Optimization argument. The rest default to the "faster build" optimization (Optimization_FastBuild). The "faster build" optimization works by caching a library on the user's filesystem and reusing it each time a composition is linked. The caching takes a while, and may delay the building of the first composition. However, if you call prepareForFastBuild(), the caching can be done in advance.
If you plan to distribute an executable or dynamic library built from a composition, use either linkCompositionToCreateExecutable() or linkCompositionToCreateDynamicLibrary(), and choose the "smaller binary" optimization. If building an executable, pass an rpath (such as "@loader_path/../Frameworks") to enable the executable to find Vuo.framework. Since the executable or dynamic library links to Vuo.framework, you need to distribute it along with the build composition.
Definition at line 68 of file VuoCompiler.hh.
Public Types | |
enum | Optimization { Optimization_FastBuild , Optimization_FastBuildExistingCache , Optimization_SmallBinary } |
Options for optimizations when building a composition. More... | |
Public Member Functions | |
VuoCompiler (const string &compositionPath="", string target="") | |
Creates a compiler instance that can be used for compiling and linking. More... | |
~VuoCompiler (void) | |
Destructor. More... | |
void | setDelegate (VuoCompilerDelegate *delegate) |
Sets the delegate that receives messages from the compiler when modules are loaded. More... | |
void | setCompositionPath (const string &compositionPath) |
If this compiler will be compiling a composition, pass its path here (if not already passed to VuoCompiler::VuoCompiler) so the compiler can locate composition-local modules. More... | |
void | compileComposition (VuoCompilerComposition *composition, string outputPath, bool isTopLevelComposition, VuoCompilerIssues *issues) |
Compiles a composition to LLVM bitcode. More... | |
void | compileComposition (string inputPath, string outputPath, bool isTopLevelComposition, VuoCompilerIssues *issues) |
Compiles a composition, read from file, to LLVM bitcode. More... | |
void | compileCompositionString (const string &compositionString, string outputPath, bool isTopLevelComposition, VuoCompilerIssues *issues) |
Compiles the composition, read from a string, to LLVM bitcode. More... | |
void | compileModule (string inputPath, string outputPath) |
Compiles a node class, port type, or library module to LLVM bitcode. More... | |
void | compileModule (string inputPath, string outputPath, const vector< string > &includeDirs) |
Compiles a node class, port type, or library module to LLVM bitcode. More... | |
void | linkCompositionToCreateExecutable (string inputPath, string outputPath, Optimization optimization, string rPath="", bool shouldAdHocCodeSign=true) |
Turns a compiled composition into an executable by linking in all of its dependencies and adding a main function. More... | |
void | linkCompositionToCreateDynamicLibrary (string inputPath, string outputPath, Optimization optimization, bool shouldAdHocCodeSign=true) |
Turns a compiled composition into a dynamic library by linking in all of its dependencies. More... | |
void | linkCompositionToCreateDynamicLibraries (string compiledCompositionPath, string linkedCompositionPath, VuoRunningCompositionLibraries *runningCompositionLibraries) |
Creates one dynamic library for the composition by itself and, if needed, additional dynamic libraries for the node classes and other resources that are dependencies of the composition. More... | |
set< string > | getDirectDependenciesForComposition (VuoCompilerComposition *composition) |
Returns the names of dependencies (node classes and types) directly referenced by the composition. More... | |
set< string > | getDependenciesForComposition (VuoCompilerComposition *composition) |
Returns the names of dependencies (node classes, types, libraries, and frameworks) needed for linking the composition. More... | |
set< string > | getDylibDependencyPathsForComposition (VuoCompilerComposition *composition) |
Returns the absolute paths of dylibs needed for linking the composition. More... | |
VuoCompilerCompatibility | getCompatibilityOfDependencies (const set< string > &dependencies) |
Returns a description of the set of systems that all of dependencies are able to run on. More... | |
void | prepareForFastBuild (void) |
Asynchronously prepares the cache that enables compositions to build faster. More... | |
string | getTarget (void) |
Returns this compiler instance's LLVM target triple. More... | |
string | getArch (void) |
Returns this compiler instance's CPU architecture. More... | |
void | setLoadAllModules (bool shouldLoadAllModules) |
Controls whether the VuoCompiler should load all node classes, types, and library modules from the module search paths the first time a module is needed. More... | |
VuoNode * | createNode (VuoCompilerNodeClass *nodeClass, string title="", double x=0, double y=0) |
Instantiates a node for the given node class. More... | |
VuoNode * | createNode (VuoCompilerNodeClass *nodeClass, VuoNode *nodeToCopyMetadataFrom) |
Instantiates a node for the given node class. More... | |
VuoNode * | createPublishedInputNode (vector< VuoPublishedPort * > publishedInputPorts) |
Instantiates a node used during code generation to represent published input ports. More... | |
VuoNode * | createPublishedOutputNode (vector< VuoPublishedPort * > publishedOutputPorts) |
Instantiates a node used during code generation to represent published output ports. More... | |
void | installNodeClassAtCompositionLocalScope (const string &sourcePath) |
Causes the node class source code located at sourcePath to be loaded at composition-family scope — unless this compiler's composition path is within the user, system, or built-in scope, in which case does nothing. More... | |
void | uninstallNodeClassAtCompositionLocalScope (const string &sourcePath) |
Causes the node class that was previously loaded from sourcePath by installNodeClassAtCompositionLocalScope, if any, to be unloaded. More... | |
void | overrideInstalledNodeClass (const string &sourcePath, const string &sourceCode) |
Temporarily replaces the subcomposition installed at sourcePath with a subcomposition compiled from sourceCode. More... | |
void | revertOverriddenNodeClass (const string &sourcePath) |
Removes an override added by overrideInstalledNodeClass (if any), reverting to the installed version of the node class. More... | |
VuoCompilerNodeClass * | getNodeClass (const string &nodeClassName) |
Returns the node class specified by nodeClassName, or null if it can't be found or loaded. More... | |
map< string, VuoCompilerNodeClass * > | getNodeClasses (void) |
Returns all node classes found and loaded, indexed by node class name. More... | |
VuoCompilerType * | getType (const string &typeName) |
Returns the type specified by typeName, or null if it can't be found or loaded. More... | |
map< string, VuoCompilerType * > | getTypes (void) |
Returns all types found and loaded, indexed by type name. More... | |
VuoCompilerModule * | getLibraryModule (const string &libraryModuleName) |
Returns the library specified by libraryName , or null if it can't be found or loaded. More... | |
map< string, VuoCompilerModule * > | getLibraryModules () |
Returns all libraries found and loaded, indexed by key. More... | |
map< string, VuoNodeSet * > | getNodeSets () |
Returns all node sets found and loaded, indexed by node set name. More... | |
VuoNodeSet * | getNodeSetForName (const string &name) |
Returns the node set with the given name, or null if it can't be found. More... | |
void | listNodeClasses (const string &format="") |
Prints a list of all loaded node classes to standard output. More... | |
bool | isCompositionLocalModule (string moduleKey) |
Returns true if the module is installed in the composition-local Modules folder for this compiler's composition path. More... | |
string | getCompositionLocalModulesPath (void) |
Returns the path of the composition-local Modules folder for this compiler's composition path, or an empty string if the composition path hasn't been set. More... | |
string | getCompositionLocalPath (void) |
Returns the path of the top-level composition folder for this compiler's composition path, or an empty string if the composition path hasn't been set. More... | |
void | addHeaderSearchPath (const string &path) |
Adds a header search path to use when compiling a node class. More... | |
void | addLibrarySearchPath (const string &path) |
Adds a library search path to use when linking a composition. More... | |
void | addFrameworkSearchPath (const string &path) |
Adds a macOS framework search path to use when linking a composition. More... | |
void | setTelemetry (const string &telemetry) |
Sets the telemetry option to use when compiling a composition. More... | |
void | setVerbose (bool isVerbose) |
Sets the verbosity to use when compiling or linking. More... | |
void | setShouldPotentiallyShowSplashWindow (bool potentiallyShow) |
Sets whether the compiled composition should show the Vuo Community Edition splash window, if generated by Vuo Community Edition. More... | |
bool | shouldShowSplashWindow () |
Returns whether the compiled composition should show the Vuo Community Edition splash window. More... | |
string | getCompositionLoaderPath (void) |
Returns the path to the VuoCompositionLoader executable. More... | |
void | print (void) |
Prints info about this compiler, for debugging. More... | |
Static Public Member Functions | |
static Module * | readModuleFromBitcode (string inputPath, string arch) |
Returns the LLVM module in the arch slice of inputFile . More... | |
static void | destroyModule (VuoCompilerModule *module) |
Deallocates module and associated data. More... | |
static void | destroyLlvmModule (Module *module) |
Calls the destructor for module, using the LLVM global context thread-safely. More... | |
static void | generateBuiltInModuleCaches (string vuoFrameworkPath, string target) |
Generates the caches of built-in modules and places them inside of Vuo.framework. More... | |
static void | deleteOldModuleCaches (void) |
Deletes: More... | |
static string | getVuoFrameworkPath (void) |
Returns the absolute path of Vuo.framework. More... | |
static string | getModuleKeyForPath (string path) |
Returns the name of the node class or other module that would be located at path . More... | |
static VuoRunner * | newSeparateProcessRunnerFromCompositionFile (string compositionFilePath, VuoCompilerIssues *issues) |
Creates a runner object that can run the composition in file compositionFilePath in a new process. More... | |
static VuoRunner * | newSeparateProcessRunnerFromCompositionString (string composition, string processName, string workingDirectory, VuoCompilerIssues *issues) |
Creates a runner object that can run the composition in string composition in a new process. More... | |
static VuoRunner * | newCurrentProcessRunnerFromCompositionFile (string compositionFilePath, VuoCompilerIssues *issues) |
Creates a runner object that can run the composition in file compositionFilePath in this process. More... | |
static VuoRunner * | newCurrentProcessRunnerFromCompositionString (string composition, string workingDirectory, VuoCompilerIssues *issues) |
Creates a runner object that can run the composition in string composition in this process. More... | |
Static Public Attributes | |
static llvm::LLVMContext * | globalLLVMContext = nullptr |
LLVM's global context. More... | |
Friends | |
class | TestVuoCompiler |
TestVuoCompiler needs to add a search path for its own private nodes/types. More... | |
class | TestCompositionExecution |
TestCompositionExecution needs to add a search path for its own private nodes. More... | |
class | TestCompilerDelegate |
class | TestVuoCompilerModule |
class | TestVuoCompilerBitcodeGenerator |
class | TestCompilingAndLinking |
TestCompilingAndLinking calls reset() . More... | |
class | TestSubcompositions |
TestSubcompositions calls reset() . More... | |
class | TestModuleLoading |
TestModuleLoading calls reset() . More... | |
class | TestEventDropping |
TestEventDropping calls reset() . More... | |
class | TestVuoIsfModuleCompiler |
TestVuoIsfModuleCompiler calls writeModuleToBitcode() . More... | |
class | TestVuoCompilerCompatibility |
TestVuoCompilerCompatibility calls getProcessTarget() . More... | |
class | TestNodes |
TestNodes calls getProcessTarget() . More... | |
Options for optimizations when building a composition.
Enumerator | |
---|---|
Optimization_FastBuild | Speed up the build by having the composition binary link to cache libraries on the user's system. See prepareForFastBuild. |
Optimization_FastBuildExistingCache | Like Optimization_FastBuild, but skips ensuring that the cache libraries are up to date. |
Optimization_SmallBinary | Don't link to any cache libraries. |
Definition at line 74 of file VuoCompiler.hh.
VuoCompiler::VuoCompiler | ( | const string & | compositionPath = "" , |
string | target = "" |
||
) |
Creates a compiler instance that can be used for compiling and linking.
compositionPath | If this compiler will be compiling a composition and its path is already known, pass the path so the compiler can locate composition-local modules. If the path is not yet known, it can be set later with setCompositionPath or compileComposition. If not compiling a composition, pass an empty string. |
target | The LLVM Target Triple to use for this compiler instance. Affects which slice of multi-archtecture binaries is loaded, and affects the bitcode that's generated. If no target is specified, the current process's architecture is used. |
compositionPath
argument. Definition at line 2718 of file VuoCompiler.cc.
VuoCompiler::~VuoCompiler | ( | void | ) |
Destructor.
Definition at line 2815 of file VuoCompiler.cc.
void VuoCompiler::addFrameworkSearchPath | ( | const string & | path | ) |
Adds a macOS framework search path to use when linking a composition.
Definition at line 6566 of file VuoCompiler.cc.
void VuoCompiler::addHeaderSearchPath | ( | const string & | path | ) |
Adds a header search path to use when compiling a node class.
Definition at line 6546 of file VuoCompiler.cc.
void VuoCompiler::addLibrarySearchPath | ( | const string & | path | ) |
Adds a library search path to use when linking a composition.
Definition at line 6556 of file VuoCompiler.cc.
void VuoCompiler::compileComposition | ( | string | inputPath, |
string | outputPath, | ||
bool | isTopLevelComposition, | ||
VuoCompilerIssues * | issues | ||
) |
Compiles a composition, read from file, to LLVM bitcode.
inputPath | The .vuo file containing the composition. If you haven't already specified the composition path in the constructor or setCompositionPath, then inputPath will be used to locate composition-local modules. |
outputPath | The file in which to save the compiled LLVM bitcode. |
isTopLevelComposition | True if the composition is top-level, false if it's a subcomposition. |
issues | Issues encountered while compiling the composition are appended to this. |
VuoCompilerException | The composition is invalid. |
Definition at line 4257 of file VuoCompiler.cc.
void VuoCompiler::compileComposition | ( | VuoCompilerComposition * | composition, |
string | outputPath, | ||
bool | isTopLevelComposition, | ||
VuoCompilerIssues * | issues | ||
) |
Compiles a composition to LLVM bitcode.
composition | The composition to compile. |
outputPath | The file in which to save the compiled LLVM bitcode. |
isTopLevelComposition | True if the composition is top-level, false if it's a subcomposition. |
issues | Issues encountered while compiling the composition are appended to this. |
VuoCompilerException | The composition is invalid. |
Definition at line 4232 of file VuoCompiler.cc.
void VuoCompiler::compileCompositionString | ( | const string & | compositionString, |
string | outputPath, | ||
bool | isTopLevelComposition, | ||
VuoCompilerIssues * | issues | ||
) |
Compiles the composition, read from a string, to LLVM bitcode.
compositionString | A string containing the composition. |
outputPath | The file in which to save the compiled LLVM bitcode. |
isTopLevelComposition | True if the composition is top-level, false if it's a subcomposition. |
issues | Issues encountered while compiling the composition are appended to this. |
VuoCompilerException | The composition is invalid. |
Definition at line 4301 of file VuoCompiler.cc.
void VuoCompiler::compileModule | ( | string | inputPath, |
string | outputPath | ||
) |
Compiles a node class, port type, or library module to LLVM bitcode.
inputPath | The file to compile, containing a C implementation of the node class, port type, or library module. |
outputPath | The file in which to save the compiled LLVM bitcode. |
Definition at line 4070 of file VuoCompiler.cc.
void VuoCompiler::compileModule | ( | string | inputPath, |
string | outputPath, | ||
const vector< string > & | includePaths | ||
) |
Compiles a node class, port type, or library module to LLVM bitcode.
inputPath | The file to compile, containing a C implementation of the node class, port type, or library module. |
outputPath | The file in which to save the compiled LLVM bitcode. |
includePaths | Directories with header files to be included when compiling. |
Definition at line 4082 of file VuoCompiler.cc.
VuoNode * VuoCompiler::createNode | ( | VuoCompilerNodeClass * | nodeClass, |
string | title = "" , |
||
double | x = 0 , |
||
double | y = 0 |
||
) |
Instantiates a node for the given node class.
If the node class is a generic template (e.g. vuo.data.hold), then the node is instantiated with the specialized version of the node class (e.g. vuo.data.hold.VuoGenericType1).
nodeClass | The node class from which to create the node. |
title | The node's title. |
x | The node's x-coordinate within the composition. |
y | The node's y-coordinate within the composition. |
Definition at line 5960 of file VuoCompiler.cc.
VuoNode * VuoCompiler::createNode | ( | VuoCompilerNodeClass * | nodeClass, |
VuoNode * | nodeToCopyMetadataFrom | ||
) |
Instantiates a node for the given node class.
If the node class is a generic template (e.g. vuo.data.hold), then the node is instantiated with the specialized version of the node class (e.g. vuo.data.hold.VuoGenericType1).
Definition at line 5975 of file VuoCompiler.cc.
VuoNode * VuoCompiler::createPublishedInputNode | ( | vector< VuoPublishedPort * > | publishedInputPorts | ) |
Instantiates a node used during code generation to represent published input ports.
Definition at line 5987 of file VuoCompiler.cc.
VuoNode * VuoCompiler::createPublishedOutputNode | ( | vector< VuoPublishedPort * > | publishedOutputPorts | ) |
Instantiates a node used during code generation to represent published output ports.
Definition at line 5996 of file VuoCompiler.cc.
|
static |
Deletes:
Definition at line 5261 of file VuoCompiler.cc.
|
static |
Calls the destructor for module, using the LLVM global context thread-safely.
This function may be called on any dispatch queue except llvmQueue
.
Definition at line 5942 of file VuoCompiler.cc.
|
static |
Deallocates module and associated data.
This function may be called on any dispatch queue except llvmQueue
.
Definition at line 5899 of file VuoCompiler.cc.
|
static |
Generates the caches of built-in modules and places them inside of Vuo.framework.
This function is intended for running Vuo in a special mode just to generate the caches and then exit. It's called while building Vuo itself, toward the end of the process of creating Vuo.framework.
Assumes that no VuoCompiler instances have been constructed before this call.
vuoFrameworkPath | The absolute path of Vuo.framework, as would be returned by VuoFileUtilities::getVuoFrameworkPath if the Vuo.framework dynamic library were loaded. |
target | The LLVM target-triple to build. |
Definition at line 5246 of file VuoCompiler.cc.
string VuoCompiler::getArch | ( | void | ) |
Returns this compiler instance's CPU architecture.
E.g., x86_64
or arm64
.
Definition at line 5228 of file VuoCompiler.cc.
VuoCompilerCompatibility VuoCompiler::getCompatibilityOfDependencies | ( | const set< string > & | dependencies | ) |
Returns a description of the set of systems that all of dependencies are able to run on.
Definition at line 4906 of file VuoCompiler.cc.
string VuoCompiler::getCompositionLoaderPath | ( | void | ) |
Returns the path to the VuoCompositionLoader executable.
Definition at line 6625 of file VuoCompiler.cc.
string VuoCompiler::getCompositionLocalModulesPath | ( | void | ) |
Returns the path of the composition-local Modules folder for this compiler's composition path, or an empty string if the composition path hasn't been set.
Definition at line 6512 of file VuoCompiler.cc.
string VuoCompiler::getCompositionLocalPath | ( | void | ) |
Returns the path of the top-level composition folder for this compiler's composition path, or an empty string if the composition path hasn't been set.
If the composition is a composition-local subcomposition (it's located in a folder called Modules other than the Built-in, User, and System Modules folders), returns the folder containing the Modules folder. Otherwise, returns the folder containing the composition.
Definition at line 6527 of file VuoCompiler.cc.
set< string > VuoCompiler::getDependenciesForComposition | ( | VuoCompilerComposition * | composition | ) |
Returns the names of dependencies (node classes, types, libraries, and frameworks) needed for linking the composition.
Definition at line 4725 of file VuoCompiler.cc.
set< string > VuoCompiler::getDirectDependenciesForComposition | ( | VuoCompilerComposition * | composition | ) |
Returns the names of dependencies (node classes and types) directly referenced by the composition.
Does not include dependencies of dependencies.
Definition at line 4679 of file VuoCompiler.cc.
set< string > VuoCompiler::getDylibDependencyPathsForComposition | ( | VuoCompilerComposition * | composition | ) |
Returns the absolute paths of dylibs needed for linking the composition.
Definition at line 4736 of file VuoCompiler.cc.
VuoCompilerModule * VuoCompiler::getLibraryModule | ( | const string & | libraryModuleName | ) |
Returns the library specified by libraryName
, or null if it can't be found or loaded.
The library is loaded if it haven't been already.
Definition at line 6268 of file VuoCompiler.cc.
map< string, VuoCompilerModule * > VuoCompiler::getLibraryModules | ( | void | ) |
Returns all libraries found and loaded, indexed by key.
The libraries are loaded if they haven't been already.
Definition at line 6290 of file VuoCompiler.cc.
|
static |
Returns the name of the node class or other module that would be located at path
.
Definition at line 6462 of file VuoCompiler.cc.
VuoCompilerNodeClass * VuoCompiler::getNodeClass | ( | const string & | nodeClassName | ) |
Returns the node class specified by nodeClassName, or null if it can't be found or loaded.
The node class module is loaded or generated if it hasn't been already.
Definition at line 6170 of file VuoCompiler.cc.
map< string, VuoCompilerNodeClass * > VuoCompiler::getNodeClasses | ( | void | ) |
Returns all node classes found and loaded, indexed by node class name.
The node class modules are loaded if they haven't been already.
Definition at line 6200 of file VuoCompiler.cc.
VuoNodeSet * VuoCompiler::getNodeSetForName | ( | const string & | name | ) |
Returns the node set with the given name, or null if it can't be found.
The node class modules are loaded if they haven't been already.
Definition at line 6326 of file VuoCompiler.cc.
map< string, VuoNodeSet * > VuoCompiler::getNodeSets | ( | void | ) |
Returns all node sets found and loaded, indexed by node set name.
The node class modules are loaded if they haven't been already.
Definition at line 6308 of file VuoCompiler.cc.
string VuoCompiler::getTarget | ( | void | ) |
Returns this compiler instance's LLVM target triple.
E.g., x86_64-apple-macosx10.10.0
.
Definition at line 5219 of file VuoCompiler.cc.
VuoCompilerType * VuoCompiler::getType | ( | const string & | typeName | ) |
Returns the type specified by typeName, or null if it can't be found or loaded.
The type module is loaded or generated if it haven't been already.
Definition at line 6218 of file VuoCompiler.cc.
map< string, VuoCompilerType * > VuoCompiler::getTypes | ( | void | ) |
Returns all types found and loaded, indexed by type name.
The type modules are loaded if they haven't been already.
Definition at line 6250 of file VuoCompiler.cc.
|
static |
Returns the absolute path of Vuo.framework.
This returns the same thing VuoFileUtilities::getVuoFrameworkPath except during a call to VuoCompiler::generateBuiltInModuleCaches.
Definition at line 6443 of file VuoCompiler.cc.
void VuoCompiler::installNodeClassAtCompositionLocalScope | ( | const string & | sourcePath | ) |
Causes the node class source code located at sourcePath to be loaded at composition-family scope — unless this compiler's composition path is within the user, system, or built-in scope, in which case does nothing.
Definition at line 6050 of file VuoCompiler.cc.
bool VuoCompiler::isCompositionLocalModule | ( | string | moduleKey | ) |
Returns true if the module is installed in the composition-local Modules folder for this compiler's composition path.
Definition at line 6494 of file VuoCompiler.cc.
void VuoCompiler::linkCompositionToCreateDynamicLibraries | ( | string | compiledCompositionPath, |
string | linkedCompositionPath, | ||
VuoRunningCompositionLibraries * | runningCompositionLibraries | ||
) |
Creates one dynamic library for the composition by itself and, if needed, additional dynamic libraries for the node classes and other resources that are dependencies of the composition.
compiledCompositionPath | Path to the compiled composition (an LLVM bitcode file). |
linkedCompositionPath | Path where the resulting dynamic library for the composition should be placed. Pass a different path each time this function is called (to ensure that the OS will agree to swap out the library during live coding). |
runningCompositionLibraries | Information about libraries referenced by the composition. On the first call to this function, pass in a newly constructed object. On subsequent calls, pass in the same object. It gets updated with each call. |
VuoCompilerException | At least one of the dependencies is incompatible with the targets for building the composition, or the linker encountered errors and failed. runningCompositionLibraries is unchanged. |
newLinkedResourcePath
, alreadyLinkedResourcePaths
, alreadyLinkedResources
arguments with runningCompositionLibraries
. Definition at line 4405 of file VuoCompiler.cc.
void VuoCompiler::linkCompositionToCreateDynamicLibrary | ( | string | inputPath, |
string | outputPath, | ||
Optimization | optimization, | ||
bool | shouldAdHocCodeSign = true |
||
) |
Turns a compiled composition into a dynamic library by linking in all of its dependencies.
If you plan to run multiple compositions, or multiple instances of the same composition, in the same process (VuoRunner::newCurrentProcessRunnerFromDynamicLibrary), optimization should be Optimization_FastBuild
or Optimization_FastBuildExistingCache
. This prevents conflicts between Objective-C classes (from nodes) being defined in multiple loaded dynamic libraries.
inputPath | Path to the compiled composition (an LLVM bitcode file). |
outputPath | Path where the resulting dynamic library should be placed. |
optimization | Controls the time it takes to link the composition and the size and dependencies of the resulting dynamic library. |
shouldAdHocCodeSign | Whether to ad-hoc code-sign the generated dylib. Disable to improve performance (e.g., for systems that don't require code-signing, or if you will later be code-signing the whole bundle). |
VuoCompilerException | At least one of the dependencies is incompatible with the targets for building the composition, or the linker encountered errors and failed. |
Definition at line 4348 of file VuoCompiler.cc.
void VuoCompiler::linkCompositionToCreateExecutable | ( | string | inputPath, |
string | outputPath, | ||
Optimization | optimization, | ||
string | rPath = "" , |
||
bool | shouldAdHocCodeSign = true |
||
) |
Turns a compiled composition into an executable by linking in all of its dependencies and adding a main function.
inputPath | Path to the compiled composition (an LLVM bitcode file). |
outputPath | Path where the resulting executable should be placed. |
optimization | Controls the time it takes to link the composition and the size and dependencies of the resulting executable. |
rPath | An optional -rpath argument to be passed to clang. |
shouldAdHocCodeSign | Whether to ad-hoc code-sign the generated executable. Disable to improve performance (e.g., for systems that don't require code-signing, or if you will later be code-signing the whole bundle). |
VuoCompilerException | At least one of the dependencies is incompatible with the targets for building the composition, or the linker encountered errors and failed. |
isApp
argument. Definition at line 4326 of file VuoCompiler.cc.
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.
format | The format for printing the node classes.
|
Definition at line 6366 of file VuoCompiler.cc.
|
static |
Creates a runner object that can run the composition in file compositionFilePath in this process.
If there's an error compiling or linking the composition, the error is added to issues and this function returns null. Any warnings are also added to issues.
issues
argument. Definition at line 6781 of file VuoCompiler.cc.
|
static |
Creates a runner object that can run the composition in string composition in this process.
If there's an error compiling or linking the composition, the error is added to issues and this function returns null. Any warnings are also added to issues.
composition | A serialized composition. |
workingDirectory | The compiling and linking steps and the running composition behave as if the composition is in this directory. The directory is used by when compiling and linking to search for composition-local nodes, and it's used by nodes in the running composition to resolve relative paths. |
issues | Problems encountered while compiling and linking. |
issues
argument. Definition at line 6817 of file VuoCompiler.cc.
|
static |
Creates a runner object that can run the composition in file compositionFilePath in a new process.
If there's an error compiling or linking the composition, the error is added to issues and this function returns null. Any warnings are also added to issues.
issues
argument. Definition at line 6716 of file VuoCompiler.cc.
|
static |
Creates a runner object that can run the composition in string composition in a new process.
If there's an error compiling or linking the composition, the error is added to issues and this function returns null. Any warnings are also added to issues.
composition | A serialized composition. |
processName | The executable filename that the running composition should use. |
workingDirectory | The compiling and linking steps and the running composition behave as if the composition is in this directory. The directory is used by when compiling and linking to search for composition-local nodes, and it's used by nodes in the running composition to resolve relative paths. |
issues | Problems encountered while compiling and linking. |
processName
, issues
arguments. Definition at line 6752 of file VuoCompiler.cc.
void VuoCompiler::overrideInstalledNodeClass | ( | const string & | sourcePath, |
const string & | sourceCode | ||
) |
Temporarily replaces the subcomposition installed at sourcePath with a subcomposition compiled from sourceCode.
The newly compiled subcomposition becomes the active version, overriding the installed subcomposition.
This function can be called multiple times in succession, replacing one override with another.
The most recent override remains active until the installed subcomposition is saved or revertOverriddenNodeClass is called.
A call to this function may or may not result in a call to VuoCompilerDelegate::loadedModules. The node class won't be reloaded if sourceCode is the same as source code from which the module was most recently loaded.
Definition at line 6093 of file VuoCompiler.cc.
void VuoCompiler::prepareForFastBuild | ( | void | ) |
Asynchronously prepares the cache that enables compositions to build faster.
The first time a composition is built with the "faster build" optimization, it waits until the cache is prepared. Preparing the cache may take several seconds. By calling this function, the cache can be prepared in advance, so that there's no delay when building the first composition.
Definition at line 5208 of file VuoCompiler.cc.
void VuoCompiler::print | ( | void | ) |
Prints info about this compiler, for debugging.
Definition at line 6658 of file VuoCompiler.cc.
|
static |
Returns the LLVM module in the arch
slice of inputFile
.
This function may be called on any dispatch queue except llvmQueue
.
Definition at line 5653 of file VuoCompiler.cc.
void VuoCompiler::revertOverriddenNodeClass | ( | const string & | sourcePath | ) |
Removes an override added by overrideInstalledNodeClass (if any), reverting to the installed version of the node class.
A call to this function always results in a call to VuoCompilerDelegate::loadedModules, even if the node class's source code was not overridden.
Definition at line 6153 of file VuoCompiler.cc.
void VuoCompiler::setCompositionPath | ( | const string & | compositionPath | ) |
If this compiler will be compiling a composition, pass its path here (if not already passed to VuoCompiler::VuoCompiler) so the compiler can locate composition-local modules.
If you compile a composition and haven't told the compiler its path, the composition will be able to use modules at the shared scopes (built-in, system, user) but not at the composition-local scope.
Definition at line 2901 of file VuoCompiler.cc.
void VuoCompiler::setDelegate | ( | VuoCompilerDelegate * | delegate | ) |
Sets the delegate that receives messages from the compiler when modules are loaded.
May be null.
Definition at line 2885 of file VuoCompiler.cc.
void VuoCompiler::setLoadAllModules | ( | bool | shouldLoadAllModules | ) |
Controls whether the VuoCompiler should load all node classes, types, and library modules from the module search paths the first time a module is needed.
Definition at line 5294 of file VuoCompiler.cc.
void VuoCompiler::setShouldPotentiallyShowSplashWindow | ( | bool | potentiallyShow | ) |
Sets whether the compiled composition should show the Vuo Community Edition splash window, if generated by Vuo Community Edition.
Definition at line 6593 of file VuoCompiler.cc.
void VuoCompiler::setTelemetry | ( | const string & | telemetry | ) |
Sets the telemetry option to use when compiling a composition.
Valid values are "on" and "console".
Definition at line 6576 of file VuoCompiler.cc.
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.
Definition at line 6584 of file VuoCompiler.cc.
bool VuoCompiler::shouldShowSplashWindow | ( | ) |
Returns whether the compiled composition should show the Vuo Community Edition splash window.
Definition at line 6609 of file VuoCompiler.cc.
void VuoCompiler::uninstallNodeClassAtCompositionLocalScope | ( | const string & | sourcePath | ) |
Causes the node class that was previously loaded from sourcePath by installNodeClassAtCompositionLocalScope, if any, to be unloaded.
Definition at line 6062 of file VuoCompiler.cc.
|
friend |
TestCompilingAndLinking calls reset()
.
Definition at line 397 of file VuoCompiler.hh.
|
friend |
TestCompositionExecution needs to add a search path for its own private nodes.
Definition at line 393 of file VuoCompiler.hh.
|
friend |
TestEventDropping calls reset()
.
Definition at line 400 of file VuoCompiler.hh.
|
friend |
TestModuleLoading calls reset()
.
Definition at line 399 of file VuoCompiler.hh.
|
friend |
TestNodes calls getProcessTarget()
.
Definition at line 403 of file VuoCompiler.hh.
|
friend |
TestSubcompositions calls reset()
.
Definition at line 398 of file VuoCompiler.hh.
|
friend |
TestVuoCompiler needs to add a search path for its own private nodes/types.
Definition at line 392 of file VuoCompiler.hh.
|
friend |
TestVuoCompilerCompatibility calls getProcessTarget()
.
Definition at line 402 of file VuoCompiler.hh.
|
friend |
TestVuoIsfModuleCompiler calls writeModuleToBitcode()
.
Definition at line 401 of file VuoCompiler.hh.
|
static |
LLVM's global context.
Definition at line 468 of file VuoCompiler.hh.