The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

Name

SPVM::Builder::CompileInfo - Compilation Information

Description

The SPVM::Builder::CompileInfo class has methods to manipulate compilation information.

Fields

config

  my $config = $compile_info->config;
  $compile_info->config($config);

Gets and sets the config field.

This is a SPVM::Builder::Config object used to compile the source file.

source_file

  my $source_file = $compile_info->source_file;
  $compile_info->source_file($source_file);

Gets and sets the source_file field.

This field is a source file.

output_file

  my $output_file = $compile_info->output_file;
  $compile_info->output_file($output_file);

Gets and sets the output_file field.

This field is an output file.

Class Methods

new

  my $compile_info = SPVM::Builder::CompileInfo->new(%fields);

Creates a new SPVM::Builder::CompileInfo object with "Fields".

Default Field Values:

If a field is not defined, the field is set to the following default value.

Instance Methods

create_compile_command

  my $compile_command = $compile_info->create_compile_command;

Creates the compilation command, and returns it.

The return value is an array reference.

The following one is an example of the return value.

  [qw(cc -o foo.o -c -O2 -Ipath/include foo.c)]

create_compile_command_args

  my $config_args = $compile_info->create_compile_command_args;

Creates the parts of the arguments of the compilation command from the information of the "config" field, and returns it. The return value is an array reference.

The -c option, the -o option and the source file name are not contained.

The following one is an example of the return value.

  [qw(-O2 -Ipath/include)]

to_cmd

  my $compile_command_string = $compile_info->to_cmd;

Calls the create_compile_command method and joins all elements of the returned array reference with a space, and returns it.

The following one is an example of the return value.

  "cc -c -o foo.o -O2 -Ipath/include foo.c"

Copyright & License

Copyright (c) 2023 Yuki Kimoto

MIT License