The spvmcc command generates an executable file from SPVM classes.
=head1 Usage
Usage: spvmcc [OPTIONS] SCRIPT_NAME
spvmcc -o myapp myapp.spvm
spvmcc -I lib/SPVM -o myapp myapp.spvm
Options:
-h, --help Shows this message
-v, --version Shows the version
-o, --output FILE The output file name
-I, --include-dir DIRECTORY Adds a include directory
-B, --build-dir DIRECTORY Build diretory
-q, --quiet Stops the output of messages
-f,--force Forces the compile and link
--no-config No configration file is ok
-m, --mode MODE Config mode
--config-argv ARG A config argument
--config-argv-option ARG_PAIR Key-value config arguments such as KEY=VALUE
--optimize LEVEL Optimization level such as O3, "-O0 -g"
=head1 Details
spvmcc [OPTIONS] SCRIPT_NAME
The C<spvmcc> command generates an executable file from SPVM classes.
I<OPTIONS> are L<options|/"Options">.
I<SCRIPT_NAME> is a script name that contains a L<bootstrap method|SPVM::Document::Language::Class/"Bootstrap Method"> in an L<anon class|SPVM::Document::Language::Class/"Anon Class">.
class {
static method main : void () {
}
}
See L<Class Search Directories|SPVM::Document::Language::Class/"Class Search Directories"> about defaultclass search directories.
See L<SPVM::Document::EnvironmentVariables> about available environment variables.
=head2 Config File forExecutable File
A config file that corresponding to the script name must exist foran executable file except forthe case that L<"--no-config"> is specified.
The config foran executable file is a L<SPVM::Builder::Config::Exe> object.
Compiled object files and an executable file are not rebuilt unlessthey need to be rebuilt.
L</"--force"> option forces the rebuild.
=head2 Resources
There are important points to be aware of whengenerating executable files. That is, L<resources|SPVM::Document::Resource> are not automatically compiled.
When you run an SPVM program withthe L<spvm> command, the resources are contained within the shared library of eachclass. Therefore, there are noconflicts between resources.
However, in the case of executable files, there are resource conflicts. For this, the resources must be resolved manually in the configuration file.
$config->use_resource('Resource::Zlib');
This is hard work, but giventhat the executable file must be compiled from source files and run on a variety of platforms, I think that solving it manually is a better way.
I have published a command that allows you to view the list of classes using resources and the resource settings.
See also L<--resource-info|spvmdeps/"--resource-info"> option in L<spvmdeps> command to dumpresource information.
=head1 Options
=head2 --help
Outputs how to usethe C<spvmcc> command to standard output.
=head2 -h
-h
Same as L</"--help">.
=head2 --version
Outputs the version of the C<spvmcc> command to standard output. This version is the same as the version of L<SPVM>.
=head2 -v
-v
Same as L</"--version">.
=head2 --include-dir
--include-dir DIRECTORY
Prepends I<DIRECTORY> to L<class search directories|SPVM::Document::Language::Class/"Class Search Directories">
This option can be specified multiple times.
--include-dir dir1 --include-dir dir2
In this case, class search directories becomes the following.
[dir1, dir2, default_dirs]
=head2 -I
-I DIRECTORY
Same as L</"--include-dir">.
=head2 --build-dir
--build-dir DIRECTORY
Sets L<SPVM_BUILD_DIR|SPVM::Document::EnvironmentVariables/"SPVM_BUILD_DIR"> environment variable to I<DIRECTORY>.
=head2 -B
-B DIRECTORY
Same as L</"--build-dir">.
=head2 --output
--output FILE
Specifies the output file path I<FILE>. This output file is an executable file.
=head2 -o
-o FILE
Same as L</"--output">.
=head2 --quiet
--quiet
Suppresses messages from the C<spvmcc> command.
=head2 -q
-q
Same as L</"--quiet">.
=head2 --force
--force
Forces the rebuild of object files and an executable file.
=head2 -f
-f
Same as L</"--force">.
=head2 --no-config
If this option is specified and a config file does not exist, the C<spvmcc> command runs without finising the program.
=head2 --mode
--mode MODE
Specifies the config mode I<MODE>.
See L<Config Mode|SPVM::Builder::Config/"Config Mode"> about config modes.
=head2 -m
-m MODE
Same as L</"--mode">.
=head2 --config-argv
--config-argv ARG
Specifies a config argument I<ARG>.
This option can be specified multiple times.
See L<Config Arguments|SPVM::Builder::Config/"Config Arguments"> about config arguments.
Examples:
--config-argv FOO
=head2 --config-argv-option
--config-argv-option ARG_PAIR
Specifies two config arguments I<ARG_PAIR> as the formatC<KEY=VALUE>.
This is expaned to the following options.
--config-argv KEY --config-argv VALUE
If only I<KEY> existsor I<VALUE> dose not exist, I<VALUE> is set to an empty string C<"">.
This option can be specified multiple times.
See L<Config Arguments|SPVM::Builder::Config/"Config Arguments"> about config arguments.
Examples:
--config-argv-option FOO=1
=head2 --optimize
--optimize LEVEL
Sepcifies optimization level I<LEVEL>.
This affects all source files that are compiled.
Examples:
--optimize "-O0 -g"
=head2 -w
-w
Enables warning flag.
Implementation:
Sets L<CommandInfo#WARNING|SPVM::CommandInfo> class variable to 1.
=head1 lib Directive
If the source code specified by I<SCRIPT_NAME> contains lib directives, The directories specified by lib directive is prepeneded to L<class search directories|SPVM::Document::Language::Class/"Class Search Directories">.
#lib "$FindBin::Bin/lib"
class {
}
This directories specified by lib directive is placed afterthe directories specified by L</"--include-dir"> option.
=head1 Copyright & License
Copyright 2023 Yuki Kimoto. All Rights Reserved.
MIT License.
Keyboard Shortcuts
Global
s
Focus search bar
?
Bring up this help dialog
GitHub
gp
Go to pull requests
gi
go to github issues (only if github is preferred repository)