Name
SPVM::Builder::API - Builder APIs
Description
SPVM::Builder::API class has the public methods to build SPVM native classes and SPVM precompilation classes.
Usage
my $builder = SPVM::Builder::API->new(
build_dir => '.spvm_build',
);
$builder->build_dynamic_lib_dist_precompile('MyClass');
$builder->build_dynamic_lib_dist_native('MyClass');
Class Methods
new
my $builder = SPVM::Builder::API->new(%options);
Creates a new SPVM::Builder::API object, and returns it.
Options:
build_dirA build directory.
optimizeThe optimization level for the compiler.
Instance Methods
build_dynamic_lib_dist_precompile
$builder->build_dynamic_lib_dist_precompile($class_name)
$builder->build_dynamic_lib_dist_precompile($class_name, $options)
Generates a dynamic library for a native class given by the class name $class_name, and copies it into the blib/lib directory.
A native class must have at least one method with native attribute.
Options:
$options is a hash reference. This is optional.
forceIf this option is a true value, the compilation and link are forced.
optimizeThe optimization level for the compiler (e.g.,
O2,O3,O0).
build_dynamic_lib_dist_native
$builder->build_dynamic_lib_dist_native($class_name)
$builder->build_dynamic_lib_dist_native($class_name, $options)
Generates a dynamic library for a precompilation class $class_name that has native methods, and copies it into the blib/lib directory.
A precompilation class must have at least one method with precompile attribute.
Options:
$options is a hash reference. This is optional.
forceIf this option is a true value, the compilation and link are forced.
optimizeThe optimization level for the compiler (e.g.,
O2,O3,O0).
build_parallel_dynamic_lib_dist
$builder->build_parallel_dynamic_lib_dist($options);
Generates dynamic libraries for multiple native classes and precompile classes in parallel, and copies them into the blib/lib directory.
Options:
$options is a hash reference.
native_classesAn array reference of native class names to be built.
native_classes_fileA path to a text file containing native class names to be built. The file must contain one class name per line. If both
native_classesand this option are specified, they are merged.precompile_classesAn array reference of precompile class names to be built.
precompile_classes_fileA path to a text file containing precompile class names to be built. The file must contain one class name per line. If both
precompile_classesand this option are specified, they are merged.forceIf this option is a true value, the compilation and link are forced.
optimizeThe optimization level for the compiler (e.g.,
O2,O3,O0).jobsThe number of parallel jobs. The default value is the number of CPU cores.