Name
SPVM::Builder::CompileInfo - Compilation Unit Information
Description
SPVM::Builder::CompileInfo class manages information for a single compilation unit.
Super Class
Fields
source_rel_file
my $source_rel_file = $compile_info->source_rel_file;
$compile_info->source_rel_file($source_rel_file);
Gets and sets the source_rel_file field. It is a relative path of a source file.
The base directory of this path is the SPVM::Builder::Config#cc_input_dir field.
dependent_files
my $dependent_files = $compile_info->dependent_files;
$compile_info->dependent_files($dependent_files);
Gets and sets the dependent_files field. It is an array reference of the files that the source file depends on.
If this field is defined, these files are added to the dependency list of a build rule in SPVM::Builder::Ninja.
If one of the dependent files is changed, the source file is recompiled.
category
my $category = $config->category;
$config->category($category);
Gets and sets the category field.
The category must be one of the following values:
bootstrapA bootstrap file.
spvm_coreAn SPVM core source file.
native_sourceA native source file in
src/directory.native_classA native class file.
precompile_classA precompile class file.
Class Methods
new
my $compile_info = SPVM::Builder::CompileInfo->new(%fields);
Creates a new SPVM::Builder::CompileInfo object given "Fields", and returns it.
Exceptions:
"config" field must be defined.
Instance Methods
create_command
my $compile_command = $compile_info->create_command;
my $compile_command_no_output = $compile_info->create_command({no_output_option => 1});
Creates an array reference of the compilation command, and returns it.
If the no_output_option option is a true value, the output option (e.g. -o foo.o) is not added to the command.
Return Value Examples:
[qw(cc -o foo.o -c -O2 -Ipath/include foo.c)]
# With no_output_option => 1
[qw(cc -c -O2 -Ipath/include foo.c)]
create_ccflags
my $config_args = $compile_info->create_ccflags;
Creates an array reference of the compilation options, and returns it.
The source file "source_file" and the output file "output_file" are not contained.
Return Value Examples:
[qw(-O2 -Ipath/include)]
source_file
my $source_file = $compile_info->source_file;
$compile_info->source_file($source_file);
Gets the source file path from the SPVM::Builder::Config#cc_input_dir field and the "source_rel_file" field.
Copyright & License
Copyright (c) 2023 Yuki Kimoto
MIT License