NAME
SPVM::Builder::Config::Exe - Configurations of creating excutable files.
SYNOPSYS
use SPVM::Builder::Config::Exe;
my $config = SPVM::Builder::Config::Exe->new_gnu99;
DESCRIPTION
SPVM::Builder::Config::Exe is configuration of creating excutable files of spvmcc.
FIELDS
Fields of SPVM::Builder::Config::Exe.
Fields are inherited from SPVM::Builder::Config and you can use the following fields.
global_cc_each
my $global_cc_each = $config->global_cc_each;
$config->global_cc_each($global_cc_each);
Get and set a global callback that returns the compiler name for each source file. The call back receives SPVM::Bulder::Config object and optional arguments as a hash reference.
Optional Arguments:
source_file
Each source file.
class_name
The class name
cc
The compiler name that is the value after the process of the process of cc or cc_each of SPVM::Builder::Config.
Examples:
$config->global_cc_each(sub {
my ($config, $args) = @_;
# Source file
my $source_file = $args->{source_file};
# Class name
my $class_name = $args->{class_name}
# The compiler name
my $cc = $args->{cc};
my $global_cc;
# C source file
if ($source_file =~ /\.c$/) {
$global_cc = 'clang';
}
# C++ source file
elsif ($source_file =~ /\.cpp$/) {
$global_cc = 'clang++';
}
return $global_cc;
});
global_ccflags_each
my $global_ccflags_each = $config->global_ccflags_each;
$config->global_ccflags_each($global_ccflags_each);
Get and set a callback that returns the compiler flags for each source file. The call back receives SPVM::Bulder::Config object and optional arguments as a hash reference.
Optional Arguments:
source_file
Each source file.
class_name
The class name
cc
The compiler name that is the value after the process of the process of cc or cc_each of SPVM::Builder::Config.
ccflags
The compiler flags that is the value after the process of the process of ccflags or ccflags_each of SPVM::Builder::Config.
Examples:
$config->global_ccflags_each(sub {
my ($config, $args) = @_;
# Source file
my $source_file = $args->{source_file};
# Class name
my $class_name = $args->{class_name}
# The compiler name
my $cc = $args->{cc};
# The compiler name
my $ccflags = $args->{ccflags};
my $global_ccflags = [];
# C source file
if ($source_file =~ /\.c$/) {
$global_ccflags = ['-DFoo', @$ccflags];
}
# C++ source file
elsif ($source_file =~ /\.cpp$/) {
$global_ccflags = ['-DBar', @$ccflags];
}
return $global_ccflags;
});
global_optimize_each
my $global_optimize_each = $config->global_optimize_each;
$config->global_optimize_each($global_optimize_each);
Get and set a callback that returns the compiler flags for each source file. The call back receives SPVM::Bulder::Config object and optional arguments as a hash reference.
Optional Arguments:
source_file
Each source file.
class_name
The class name
cc
The compiler name that is the value after the process of the process of cc or cc_each of SPVM::Builder::Config.
optimize
The value of optimize that is the value after the process of the process of optimize or optimize_each of SPVM::Builder::Config.
Examples:
$config->global_optimize_each(sub {
my ($config, $args) = @_;
# Source file
my $source_file = $args->{source_file};
# Class name
my $class_name = $args->{class_name}
# The compiler name
my $cc = $args->{cc};
# The compiler name
my $optimize = $args->{optimize};
my $global_optimize;
# C source file
if ($source_file =~ /\.c$/) {
$global_optimize = '-O3';
}
# C++ source file
elsif ($source_file =~ /\.cpp$/) {
$global_optimize = '-O3';
}
return $global_optimize;
});
no_precompile
my $no_precompile = $config->no_precompile;
$config->no_precompile($no_precompile);
If no_precompile
is a true value, precompiling is not performed.
no_compiler_api
my $no_compiler_api = $config->no_compiler_api;
$config->no_compiler_api($no_compiler_api);
If no_compiler_api
is a true value, the source codes of the compiler native APIs and the precompile native APIs is not linked.
METHODS
Methods of SPVM::Builder::Config::Exe.
Methods are inherited from SPVM::Builder::Config and you can use the following methods.
new
my $config = SPVM::Builder::Config::Exe->new;
Create a new SPVM::Builder::Config::Exe
object.
This is same as "new" in SPVM::Builder::Config, but set output_type
field to exe
.