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;
});
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.
dynamic_lib
my $dynamic_lib = $config->dynamic_lib;
$config->dynamic_lib($dynamic_lib);
If dynamic_lib
is a true value, a dynamic library is created instead of a executable file.
A dynamic library means a shared library foo.so
on Linux/UNIX
, a Mach-O Dynamic Library foo.dylib
on Mac
, a dynamic link library foo.dll
on Windows
.
static_lib
my $static_lib = $config->static_lib;
$config->static_lib($static_lib);
If static_lib
is a true value, a static library foo.a
on Linux/UNIX
is created instead of a executable file.
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.