NAME
SPVM::Builder::Config::Exe - Configurations of creating excutable files.
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;
});
METHODS
Methods of SPVM::Builder::Config::Exe.
Methods are inherited from SPVM::Builder::Config and you can use the following methods.
is_exe
my $is_exe = $config->is_exe;
Check this config is used for creating executalbe file. Always 1.