vtkModuleWrapJavaScript#
APIs for wrapping modules for JavaScript
- _vtk_module_wrap_javascript_sources#
Generate sources for using a module’s classes from JavaScript. module-impl
This function generates the wrapped sources for a module. It places the list of generated source files and classes in variables named in the second and third arguments, respectively.
_vtk_module_wrap_javascript_sources(<module> <sources> <classes>)
- _vtk_module_wrap_javascript_library#
Generate a JavaScript library for a set of modules. module-impl
A JavaScript module library may consist of the JavaScript wrappings of multiple modules. This is useful for kit-based builds where the modules part of the same kit belong to the same JavaScript module as well.
_vtk_module_wrap_javascript_library(<module> ...)
The first argument is the name of the JavaScript module. The remaining arguments are modules to include in the JavaScript module.
The remaining information it uses is assumed to be provided by the
vtk_module_wrap_javascript function()
.
- vtk_module_wrap_javascript#
Wrap a set of modules for use in JavaScript.|module-wrapping-javascript|
vtk_module_wrap_javascript( MODULES <module>... TARGET_NAME <name> [WRAPPED_MODULES <varname>] [UTILITY_TARGET <target>] [EXTRA_BINDING_SOURCES <sources_list>] [MODULE_EXPORT_NAME <name>] [INSTALL_EXPORT <export>] [COMPONENT <component>] [BINDING_OBJECTS_DESTINATION <destination>] [DEBUG_INFO <debug>] [OPTIMIZATION <optimization>] [MEMORY64 <ON|OFF>] )
MODULES
: (Required) The list of modules to wrap.TARGET_NAME
: (Required) The name of the generated js/wasm files.WRAPPED_MODULES
: (Recommended) Not all modules are wrappable. This variable will be set to contain the list of modules which were wrapped.UTILITY_TARGET
: If specified, all libraries made by the JavaScript wrapping will link privately to this target. This may be used to add compile flags to the JavaScript libraries.EXTRA_BINDING_SOURCES
: Optional list of emscripten bindings sources to append to the list of automatically wrapped sources.MODULE_EXPORT_NAME
: Optional name for the async function called to instantiate the wasm module. Sets the value of the emscripten EXPORT_NAME variable which will default to ‘Module’ if not specified.INSTALL_EXPORT
: If provided, installed targets are added to the provided export set.COMPONENT
: Installation component of the install rules created by this function. Defaults todevelopment
.BINDING_OBJECTS_DESTINATION
: Optional install destination for the objects libraries that contain the generated binding sources. Default value: CMAKE_INSTALL_LIBDIR.DEBUG_INFO
: (Recommended) Extent of debug information in webassembly binaries: - NONE: -g0 - READABLE_JS: -g1 - PROFILE: -g2 - DEBUG_NATIVE: -g3 with emscripten compiler setting ASSERTIONS set to 1. Default value: “NONE”.OPTIMIZATION
: (Recommended) Optimization knobs for the webassembly binaries: - NO_OPTIMIZATION: -O0 - LITTLE: -O1 - MORE: -O2 - BEST: -O3 - SMALL: -Os - SMALLEST: -Oz - SMALLEST_WITH_CLOSURE: -Oz with –closure 1. Default value: “SMALL”.MEMORY64
: (Recommended) The architecture to compile for. Sets the value of the emscripten MEMORY64 compiler setting.OFF
is wasm32 andON
is wasm64. Defaults toOFF
The set of modules is compiled to a single
<TARGET_NAME>.wasm/.js
file.For each wrapped module, a
vtk<module>WebObjects
object library will be created. If the object library already exists for a given module, $<TARGET_OBJECTS:…> is used to automatically retrieve the list of pregenerated wrapped sources. Pregenerated sources can be filtered by specifying a list of class names in the following target properties prior to calling this macro:vtk_module_wrap_javascript_exclude: Exclude the specified list of class names
vtk_module_wrap_javascript_include: Only include the specified list of class names