This is the central class for compiling modules and compositions.
Its main responsibilities are:
A VuoCompiler instance encapsulates a set of VuoCompilerEnvironment instances that hold the node classes, types, and library modules that are available to the VuoCompiler. Some VuoCompilerEnvironments are shared among all VuoCompilers, while others are unique to one or a few VuoCompilers.
Definition at line 49 of file VuoCompiler.hh.
Public Types | |
enum | Optimization { Optimization_ModuleCaches , Optimization_ExistingModuleCaches , Optimization_NoModuleCaches } |
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. | |
~VuoCompiler (void) | |
Destructor. | |
void | setDelegate (VuoCompilerDelegate *delegate) |
Sets the delegate that receives messages from the compiler when modules are loaded. | |
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. | |
void | compileComposition (VuoCompilerComposition *composition, string outputPath, bool isTopLevelComposition, VuoCompilerIssues *issues) |
Compiles a composition to LLVM bitcode. | |
void | compileComposition (string inputPath, string outputPath, bool isTopLevelComposition, VuoCompilerIssues *issues) |
Compiles a composition, read from file, to LLVM bitcode. | |
void | compileCompositionString (const string &compositionString, string outputPath, bool isTopLevelComposition, VuoCompilerIssues *issues) |
Compiles the composition, read from a string, to LLVM bitcode. | |
VuoModuleCompiler * | createModuleCompiler (const string &moduleKey, const string &inputPath, const map< string, string > &typeNameReplacements={}) |
Returns a VuoModuleCompiler suitable for compiling the given module, or null if no such VuoModuleCompiler exists. | |
VuoModuleCompilerResults | compileModuleInMemory (const string &inputPath, const string &overriddenSourceCode="", const map< string, string > &typeNameReplacements={}) |
Compiles a node class, port type, or library module to LLVM bitcode. | |
void | compileModule (const string &inputPath, const string &outputPath) |
Compiles a node class, port type, or library module to an LLVM bitcode file. | |
void | generateHeaderForModule (const string &inputPath, const string &outputPath) |
Generates a header file for a specialization of a generic module. | |
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. | |
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. | |
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. | |
set< string > | getDirectDependenciesForComposition (VuoCompilerComposition *composition) |
Returns the names of dependencies (node classes and types) directly referenced by the composition. | |
set< string > | getDependenciesForComposition (VuoCompilerComposition *composition) |
Returns the names of dependencies (node classes, types, libraries, and frameworks) needed for linking the composition. | |
set< string > | getDylibDependencyPathsForComposition (VuoCompilerComposition *composition) |
Returns the absolute paths of dylibs needed for linking the composition. | |
VuoCompilerCompatibility | getCompatibilityOfDependencies (const set< string > &dependencies) |
Returns a description of the set of systems that all of dependencies are able to run on. | |
void | prepareModuleCaches (void) |
Asynchronously makes the module caches available, rebuilding any non-built-in module caches that are out of date, to avoid a delay the first time a composition is linked with VuoCompiler::Optimization_ModuleCaches or VuoCompiler::Optimization_ExistingModuleCaches. | |
string | getTarget (void) |
Returns this compiler instance's LLVM target triple. | |
string | getArch (void) |
Returns this compiler instance's CPU architecture. | |
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. | |
VuoNode * | createNode (VuoCompilerNodeClass *nodeClass, string title="", double x=0, double y=0) |
Instantiates a node for the given node class. | |
VuoNode * | createNode (VuoCompilerNodeClass *nodeClass, VuoNode *nodeToCopyMetadataFrom) |
Instantiates a node for the given node class. | |
VuoNode * | createPublishedInputNode (vector< VuoPublishedPort * > publishedInputPorts) |
Instantiates a node used during code generation to represent published input ports. | |
VuoNode * | createPublishedOutputNode (vector< VuoPublishedPort * > publishedOutputPorts) |
Instantiates a node used during code generation to represent published output ports. | |
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. | |
void | uninstallNodeClassAtCompositionLocalScope (const string &sourcePath) |
Causes the node class that was previously loaded from sourcePath by VuoCompiler::installNodeClassAtCompositionLocalScope(), if any, to be unloaded. | |
void | overrideInstalledNodeClass (const string &sourcePath, const string &sourceCode) |
Temporarily replaces the subcomposition installed at sourcePath with a subcomposition compiled from sourceCode. | |
void | revertOverriddenNodeClass (const string &sourcePath) |
Removes an override added by VuoCompiler::overrideInstalledNodeClass() (if any), reverting to the installed version of the node class. | |
VuoCompilerNodeClass * | getNodeClass (const string &nodeClassName) |
Returns the node class specified by nodeClassName, or null if it can't be found or loaded. | |
map< string, VuoCompilerNodeClass * > | getNodeClasses (void) |
Returns all node classes found and loaded, indexed by node class name. | |
VuoCompilerType * | getType (const string &typeName) |
Returns the type specified by typeName, or null if it can't be found or loaded. | |
map< string, VuoCompilerType * > | getTypes (void) |
Returns all types found and loaded, indexed by type name. | |
VuoCompilerModule * | getLibraryModule (const string &libraryModuleName) |
Returns the library specified by libraryName , or null if it can't be found or loaded. | |
map< string, VuoCompilerModule * > | getLibraryModules () |
Returns all libraries found and loaded, indexed by key. | |
map< string, VuoNodeSet * > | getNodeSets () |
Returns all node sets found and loaded, indexed by node set name. | |
VuoNodeSet * | getNodeSetForName (const string &name) |
Returns the node set with the given name, or null if it can't be found. | |
void | listNodeClasses (const string &format="") |
Prints a list of all loaded node classes to standard output. | |
bool | isCompositionLocalModule (string moduleKey) |
Returns true if the module is installed in the composition-local Modules folder for this compiler's composition path. | |
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. | |
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. | |
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 | addFrameworkSearchPath (const string &path) |
Adds a macOS framework search path to use when linking a composition. | |
void | setVerbose (bool isVerbose) |
Sets the verbosity to use when compiling or linking. | |
void | setShouldPotentiallyShowSplashWindow (bool potentiallyShow) |
Sets whether the compiled composition should show the Vuo Community Edition splash window, if generated by Vuo Community Edition. | |
void | setDependencyOutput (const string &path) |
Specifies the path at which to create a GCC-style Makefile-depfile (used by CMake's DEPFILE) that lists the source/header files this module depends on. | |
bool | shouldShowSplashWindow () |
Returns whether the compiled composition should show the Vuo Community Edition splash window. | |
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 Module * | readModuleFromBitcode (string inputPath, string arch) |
Returns the LLVM module in the arch slice of inputFile . | |
static void | destroyModule (VuoCompilerModule *module) |
Deallocates module and associated data. | |
static void | destroyLlvmModule (Module *module) |
Calls the destructor for module, using the LLVM global context thread-safely. | |
static void | generateBuiltInModuleCache (string vuoFrameworkPath, string target, bool onlyGenerateModules) |
Generates the cache of built-in modules and places it inside of Vuo.framework. | |
static string | getTargetArch (string target) |
Returns the CPU architecture part of the target triple. | |
static string | getVuoFrameworkPath (void) |
Returns the absolute path of Vuo.framework. | |
static string | getModuleKeyForPath (string path) |
Returns the name of the node class or other module that would be located at path . | |
static VuoRunner * | newSeparateProcessRunnerFromCompositionFile (string compositionFilePath, VuoCompilerIssues *issues) |
Creates a runner object that can run the composition in file compositionFilePath in a new process. | |
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. | |
static VuoRunner * | newCurrentProcessRunnerFromCompositionFile (string compositionFilePath, VuoCompilerIssues *issues) |
Creates a runner object that can run the composition in file compositionFilePath in this process. | |
static VuoRunner * | newCurrentProcessRunnerFromCompositionString (string composition, string workingDirectory, VuoCompilerIssues *issues) |
Creates a runner object that can run the composition in string composition in this process. | |
Static Public Attributes | |
static llvm::LLVMContext * | globalLLVMContext = nullptr |
LLVM's global context. | |
Friends | |
class | VuoCompilerEnvironment |
class | VuoLinkerInputs |
class | VuoModuleCache |
class | TestCompilerDelegate |
class | TestCompilingAndLinking |
TestCompilingAndLinking calls reset() . | |
class | TestCompositionExecution |
TestCompositionExecution needs to add a search path for its own private nodes. | |
class | TestEventDropping |
TestEventDropping calls reset() . | |
class | TestModuleLoading |
TestModuleLoading calls reset() . | |
class | TestModuleCaches |
TestModuleCaches calls getProcessTarget() . | |
class | TestNodes |
TestNodes calls getProcessTarget() . | |
class | TestSubcompositions |
TestSubcompositions calls reset() . | |
class | TestVuoCompiler |
TestVuoCompiler needs to add a search path for its own private nodes/types. | |
class | TestVuoCompilerBitcodeGenerator |
class | TestVuoCompilerCompatibility |
TestVuoCompilerCompatibility calls getProcessTarget() . | |
class | TestVuoCompilerModule |
class | TestVuoIsfModuleCompiler |
TestVuoIsfModuleCompiler calls writeModuleToBitcode() . | |
Options for optimizations when building a composition.
Enumerator | |
---|---|
Optimization_ModuleCaches | The composition binary will link to module cache dylibs on the user's system. These dylibs are created in advance of linking the composition; see VuoCompiler::prepareModuleCaches(). |
Optimization_ExistingModuleCaches | Like Optimization_ModuleCaches, but skips ensuring that the module cache dylibs are up to date. |
Optimization_NoModuleCaches | The composition binary will not link to any module cache dylibs. |
Definition at line 55 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 VuoCompiler::setCompositionPath() or VuoCompiler::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 214 of file VuoCompiler.cc.
VuoCompiler::~VuoCompiler | ( | void | ) |
Destructor.
Definition at line 313 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 4447 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 4427 of file VuoCompiler.cc.
void VuoCompiler::addLibrarySearchPath | ( | const string & | path | ) |
Adds a library search path to use when linking a composition.
Definition at line 4437 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 VuoCompiler::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 2310 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 2267 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 2354 of file VuoCompiler.cc.
void VuoCompiler::compileModule | ( | const string & | inputPath, |
const string & | outputPath | ||
) |
Compiles a node class, port type, or library module to an LLVM bitcode file.
inputPath | The file to compile, containing a text-code implementation of the node class, port type, or library module. |
outputPath | The file in which to save the compiled LLVM bitcode. |
VuoCompilerException | The module source code is invalid. |
Definition at line 2135 of file VuoCompiler.cc.
VuoModuleCompilerResults VuoCompiler::compileModuleInMemory | ( | const string & | inputPath, |
const string & | overriddenSourceCode = "" , |
||
const map< string, string > & | typeNameReplacements = {} |
||
) |
Compiles a node class, port type, or library module to LLVM bitcode.
inputPath | The file to compile, containing a text-code implementation of the node class, port type, or library module. |
overriddenSourceCode | An implementation overriding the contents of inputPath. |
typeNameReplacements | For each generic type name, the specialized type name that should be substituted in its place. |
VuoCompilerException | The module source code is invalid. |
Definition at line 2095 of file VuoCompiler.cc.
VuoModuleCompiler * VuoCompiler::createModuleCompiler | ( | const string & | moduleKey, |
const string & | inputPath, | ||
const map< string, string > & | typeNameReplacements = {} |
||
) |
Returns a VuoModuleCompiler suitable for compiling the given module, or null if no such VuoModuleCompiler exists.
Definition at line 2042 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 3825 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 3840 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 3852 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 3861 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 3807 of file VuoCompiler.cc.
|
static |
Deallocates module and associated data.
This function may be called on any dispatch queue except llvmQueue
.
Definition at line 3764 of file VuoCompiler.cc.
|
static |
Generates the cache of built-in modules and places it 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. |
onlyGenerateModules | If true, this function only generates the modules for the module cache's compiled modules directory; it doesn't create the module cache dylib. |
Definition at line 3165 of file VuoCompiler.cc.
void VuoCompiler::generateHeaderForModule | ( | const string & | inputPath, |
const string & | outputPath | ||
) |
Generates a header file for a specialization of a generic module.
inputPath | The path of the generic module's implementation file with the specialized type(s) appended to the file name, e.g. vuo/type/compound/VuoList_VuoInteger.cc . |
outputPath | The path at which to save the header file. |
Definition at line 2197 of file VuoCompiler.cc.
string VuoCompiler::getArch | ( | void | ) |
Returns this compiler instance's CPU architecture.
E.g., x86_64
or arm64
.
Definition at line 3202 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 3006 of file VuoCompiler.cc.
string VuoCompiler::getCompositionLoaderPath | ( | void | ) |
Returns the path to the VuoCompositionLoader executable.
Definition at line 4507 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 4393 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 4408 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 2777 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 2731 of file VuoCompiler.cc.
set< string > VuoCompiler::getDylibDependencyPathsForComposition | ( | VuoCompilerComposition * | composition | ) |
Returns the absolute paths of dylibs needed for linking the composition.
Definition at line 2788 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 4117 of file VuoCompiler.cc.
map< string, VuoCompilerModule * > VuoCompiler::getLibraryModules | ( | ) |
Returns all libraries found and loaded, indexed by key.
The libraries are loaded if they haven't been already.
Definition at line 4127 of file VuoCompiler.cc.
|
static |
Returns the name of the node class or other module that would be located at path
.
Definition at line 4343 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.
If the node class has any ports with compound types, those types may still be loading in the background after this function returns. If you need to wait for them to load, either call getType() on each compound type, which will block until the type loads, or wait for a notification from the VuoCompilerDelegate that the node class has been added.
Definition at line 4039 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 4056 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 4165 of file VuoCompiler.cc.
map< string, VuoNodeSet * > VuoCompiler::getNodeSets | ( | ) |
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 4146 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 3193 of file VuoCompiler.cc.
|
static |
Returns the CPU architecture part of the target triple.
E.g., for x86_64-apple-macosx10.10.0
, returns x86_64
.
Definition at line 3723 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 4075 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 4098 of file VuoCompiler.cc.
|
static |
Returns the absolute path of Vuo.framework.
This returns the same thing as VuoFileUtilities::getVuoFrameworkPath() except during a call to VuoCompiler::generateBuiltInModuleCaches().
Definition at line 4324 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 3915 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 4375 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. This object should not be shared between different VuoRunner instances (or else the VuoModuleCacheRevision reference counts won't be incremented/decremented appropriately). |
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 2466 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 VuoCompiler::Optimization_ModuleCaches or VuoCompiler::Optimization_ExistingModuleCaches. 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 2403 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 ld . If empty, defaults to all run-path search paths available to this compiler's environments. |
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 2380 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 4207 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 4658 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 4697 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 4587 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 4626 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 VuoCompiler::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 3958 of file VuoCompiler.cc.
void VuoCompiler::prepareModuleCaches | ( | void | ) |
Asynchronously makes the module caches available, rebuilding any non-built-in module caches that are out of date, to avoid a delay the first time a composition is linked with VuoCompiler::Optimization_ModuleCaches or VuoCompiler::Optimization_ExistingModuleCaches.
Definition at line 3143 of file VuoCompiler.cc.
void VuoCompiler::print | ( | void | ) |
Prints info about this compiler, for debugging.
Definition at line 4529 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 3505 of file VuoCompiler.cc.
void VuoCompiler::revertOverriddenNodeClass | ( | const string & | sourcePath | ) |
Removes an override added by VuoCompiler::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 4017 of file VuoCompiler.cc.
void VuoCompiler::setCompositionPath | ( | const string & | compositionPathOrig | ) |
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 404 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 388 of file VuoCompiler.cc.
void VuoCompiler::setDependencyOutput | ( | const string & | path | ) |
Specifies the path at which to create a GCC-style Makefile-depfile (used by CMake's DEPFILE) that lists the source/header files this module depends on.
Definition at line 4483 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 3211 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 4466 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 4457 of file VuoCompiler.cc.
bool VuoCompiler::shouldShowSplashWindow | ( | ) |
Returns whether the compiled composition should show the Vuo Community Edition splash window.
Definition at line 4491 of file VuoCompiler.cc.
void VuoCompiler::uninstallNodeClassAtCompositionLocalScope | ( | const string & | sourcePath | ) |
Causes the node class that was previously loaded from sourcePath by VuoCompiler::installNodeClassAtCompositionLocalScope(), if any, to be unloaded.
Definition at line 3927 of file VuoCompiler.cc.
|
friend |
Definition at line 136 of file VuoCompiler.hh.
|
friend |
TestCompilingAndLinking calls reset()
.
Definition at line 137 of file VuoCompiler.hh.
|
friend |
TestCompositionExecution needs to add a search path for its own private nodes.
Definition at line 138 of file VuoCompiler.hh.
|
friend |
TestEventDropping calls reset()
.
Definition at line 139 of file VuoCompiler.hh.
|
friend |
TestModuleCaches calls getProcessTarget()
.
Definition at line 141 of file VuoCompiler.hh.
|
friend |
TestModuleLoading calls reset()
.
Definition at line 140 of file VuoCompiler.hh.
|
friend |
TestNodes calls getProcessTarget()
.
Definition at line 142 of file VuoCompiler.hh.
|
friend |
TestSubcompositions calls reset()
.
Definition at line 143 of file VuoCompiler.hh.
|
friend |
TestVuoCompiler needs to add a search path for its own private nodes/types.
Definition at line 144 of file VuoCompiler.hh.
|
friend |
Definition at line 145 of file VuoCompiler.hh.
|
friend |
TestVuoCompilerCompatibility calls getProcessTarget()
.
Definition at line 146 of file VuoCompiler.hh.
|
friend |
Definition at line 147 of file VuoCompiler.hh.
|
friend |
TestVuoIsfModuleCompiler calls writeModuleToBitcode()
.
Definition at line 148 of file VuoCompiler.hh.
|
friend |
Definition at line 133 of file VuoCompiler.hh.
|
friend |
Definition at line 134 of file VuoCompiler.hh.
|
friend |
Definition at line 135 of file VuoCompiler.hh.
|
static |
LLVM's global context.
Definition at line 215 of file VuoCompiler.hh.