Name

SPVM::Builder::Config::Exe - Excutable File Config

Description

The SPVM::Builder::Config::Exe class has methods to manipulate the config for the excutable file generated by spvmcc command.

Usage

use SPVM::Builder::Config::Exe;

my $config_exe = SPVM::Builder::Config::Exe->new_gnu99;

Super Class

Fields

global_after_create_compile_info_cbs

my $global_after_create_compile_info_cbs = $config_exe->global_after_create_compile_info_cbs;
$config_exe->global_after_create_compile_info_cbs($global_after_create_compile_info_cbs);

Gets and sets the global_after_create_compile_info_cbs field, an array reference of callbacks that work globally called just after creating a compilation information.

This affects all compilations of native classes and precompilation classes.

global_before_compile_cbs

my $global_before_compile_cbs = $config_exe->global_before_compile_cbs;
$config_exe->global_before_compile_cbs($global_before_compile_cbs);

Gets and sets the global_before_compile_cbs field, an array reference of callbacks that work globally called just before the compile command "cc" is executed.

This affects all compilations of native classes and precompilation classes.

config_spvm_core

my $config_exe_spvm_core = $config_exe->config_spvm_core;
$config_exe->config_spvm_core($config_exe_spvm_core);

Gets and sets the config_spvm_core field, an SPVM::Builder::Config object for SPVM core source files.

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

config_bootstrap

my $config_exe_bootstrap = $config_exe->config_bootstrap;
$config_exe->config_bootstrap($config_exe_bootstrap);

Gets and sets the config_bootstrap field, an SPVM::Builder::Config object for the bootstrap source file for the executable file.

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

Methods

new

my $config_exe = SPVM::Builder::Config::Exe->new(%fields);

Create a new SPVM::Builder::Config::Exe object with "Fields" and fields of its super classes.

This method calls the new method of its super class given %fields with field default values applied.

Field Default Values:

add_global_after_create_compile_info_cb

$config_exe->add_global_after_create_compile_info_cb(@global_after_create_compile_info_cbs);

Adds @global_after_create_compile_info_cbs to the end of "global_after_create_compile_info_cbs" field.

Examples:

$config_exe->add_global_after_create_compile_info_cb(sub {
  my ($config, $compile_info) = @_;
  
  my $cc = $config->cc;
  
  # Do something
});

add_global_before_compile_cb

$config_exe->add_global_before_compile_cb(@global_before_compile_cbs);

Adds @global_before_compile_cbs to the end of "global_before_compile_cbs" field.

Examples:

$config_exe->add_global_before_compile_cb(sub {
  my ($config, $compile_info) = @_;
  
  my $cc_command = $compile_info->to_command;
  
  # Do something
});

set_global_optimize

$config_exe->set_global_optimize("-O0 -g");

Sets optimize that works globally. This is the same as the following code.

$config_exe->add_global_after_create_compile_info_cb(sub {
  my ($config, $comile_info) = @_;
  
  $config->optimize($optimize);
});

Copyright & License

Copyright (c) 2023 Yuki Kimoto

MIT License