Name

SPVM::Builder::Config - Config for Compiling and Linking Native Classes

Description

SPVM::Builder::Config class gets and sets config for compiling and linking native classes.

Fields

class_name

my $class_name = $config->class_name;
$config->class_name($class_name);

Gets and sets class_name field, the name of the class configured by this config.

This field is automatically set and users nomally do not change it.

file

my $file = $config->file;
$config->file($file);

Gets and sets file field, the file path of this config.

category

my $category = $config->category;
$config->category($category);

Gets and sets category field.

If this field is precompile, this config is for precompilation,

If this field is native, this config is for a native class.

This field is automatically set and users nomally do not change it.

is_resource

my $is_resource = $config->is_resource;
$config->is_resource($is_resource);

Gets and sets is_resource field.

If this field is true, this config is for a resource class.

quiet

my $quiet = $config->quiet;
$config->quiet($quiet);

Gets and sets quiet field.

If this field is a true value, the messages from the compiler and the linker are output to stderr.

If this field is a false value except for undef, the messages from the compiler and the linker are not output.

If this field is undef, this config does specify whether the messages from the compiler and the linker are output.

mode

my $mode = $config->mode;
$config->mode($mode);

Gets and sets mode field.

config_global

my $config_global = $config->config_global;
$config->config_global($config_global);

Gets and sets the config_global field, which provides global compilation rules.

This field is an SPVM::Builder::Config::Global object (like SPVM::Builder::Config::Exe) that stores shared settings used across multiple compilation units.

For example, when the spvmcc command generates an executable file, it sets this field to an SPVM::Builder::Config::Exe object. This allows individual resource configurations to inherit or refer to global flags, such as optimization levels or common library paths, defined in the executable's main configuration.

loaded_config_files

Returns the config files loaded by "load_config" in SPVM::Builder::Config::Util function.

resource_loader_config

Gets and sets the resource_loader_config field, which is the config that loaded this resource.

Class Methods

new

my $config = SPVM::Builder::Config::Base->new(%fields);

Creates a new SPVM::Builder::Config::Base object with fields, and returns it.

Field Default Values:

new_with_config

my $config = SPVM::Builder::Config::Base->new_with_config($config);

Creates a new SPVM::Builder::Config::Base object with the config $config copied shallowly.

Instance Methods

clone

my $clone = $self->clone;

Clones SPVM::Builder::Config object, and returns it.

Config Mode

A config can have its mode if the config is one for an executable file generated by spvmcc command.

The mode is written in the format .MODE_NAME just before .config extension of a config file.

MODE_NAME must consist of a-zA-Z0-9_.

Examples:

# production mode
MyClass.production.config

# devel mode
MyClass.devel.config

Use "mode" field to get the config mode.

my $mode = $config->mode;

The spvmcc command has --mode option for giving a config mode.

spvmcc -o myapp --mode production myapp.spvm

Copyright & License

Copyright (c) 2023 Yuki Kimoto

MIT License