| 1 | package SPVM::Builder::API; | ||||||||||
| 2 | |||||||||||
| 3 | use strict; | ||||||||||
| 4 | use warnings; | ||||||||||
| 5 | |||||||||||
| 6 | use SPVM::Builder; | ||||||||||
| 7 | use SPVM::Builder::CC; | ||||||||||
| 8 | |||||||||||
| 9 | sub build_parallel_dynamic_lib_dist { | ||||||||||
| 10 | 0 | ▶ | my ($options) = @_; | ||||||||
|
Subroutine
build_parallel_dynamic_lib_dist: not called CC=4 SCAR=30.0
Pod
documented
| |||||||||||
| 11 | |||||||||||
| 12 | 0 | my @new_option_names = ( | |||||||||
| 13 | 'build_dir', | ||||||||||
| 14 | 'output_dir', | ||||||||||
| 15 | 'jobs', | ||||||||||
| 16 | ); | ||||||||||
| 17 | |||||||||||
| 18 | 0 | my @build_parallel_option_names = ( | |||||||||
| 19 | 'native_classes', | ||||||||||
| 20 | 'native_classes_file', | ||||||||||
| 21 | 'precompile_classes', | ||||||||||
| 22 | 'precompile_classes_file', | ||||||||||
| 23 | 'config_global_file', | ||||||||||
| 24 | ); | ||||||||||
| 25 | |||||||||||
| 26 | 0 | my @all_option_names = (@new_option_names, @build_parallel_option_names); | |||||||||
| 27 | 0 | SPVM::Builder::Util::check_option_names($options, \@all_option_names); | |||||||||
| 28 | |||||||||||
| 29 | 0 | my %is_new_option = map { $_ => 1 } @new_option_names; | |||||||||
| 30 | |||||||||||
| 31 | 0 | my $new_options = {}; | |||||||||
| 32 | 0 | my $build_parallel_options = {}; | |||||||||
| 33 | |||||||||||
| 34 | 0 | ▶ | if ($options) { | ||||||||
|
Branch: 1 branch
| |||||||||||
| 35 | 0 | for my $key (keys %$options) { | |||||||||
| 36 | 0 | ▶ | if ($is_new_option{$key}) { | ||||||||
|
Branch: 1 branch
| |||||||||||
| 37 | 0 | $new_options->{$key} = $options->{$key}; | |||||||||
| 38 | } | ||||||||||
| 39 | else { | ||||||||||
| 40 | 0 | $build_parallel_options->{$key} = $options->{$key}; | |||||||||
| 41 | } | ||||||||||
| 42 | } | ||||||||||
| 43 | } | ||||||||||
| 44 | |||||||||||
| 45 | 0 | my $builder = SPVM::Builder->new(%$new_options); | |||||||||
| 46 | 0 | my $builder_cc = SPVM::Builder::CC->new(builder => $builder); | |||||||||
| 47 | 0 | $builder_cc->build_parallel_dynamic_lib_dist($build_parallel_options); | |||||||||
| 48 | } | ||||||||||
| 49 | |||||||||||
| 50 | 1; | ||||||||||
| 51 | |||||||||||
| 52 | =head1 Name | ||||||||||
| 53 | |||||||||||
| 54 | SPVM::Builder::API - Builder APIs | ||||||||||
| 55 | |||||||||||
| 56 | =head1 Description | ||||||||||
| 57 | |||||||||||
| 58 | SPVM::Builder::API class has the public methods to build SPVM native classes and SPVM precompilation classes. | ||||||||||
| 59 | |||||||||||
| 60 | =head1 Usage | ||||||||||
| 61 | |||||||||||
| 62 | SPVM::Builder::API::build_parallel({ | ||||||||||
| 63 | build_dir => '.spvm_build', | ||||||||||
| 64 | native_classes => ['MyClass'], | ||||||||||
| 65 | precompile_classes => ['MyClass'], | ||||||||||
| 66 | }); | ||||||||||
| 67 | |||||||||||
| 68 | =head1 Functions | ||||||||||
| 69 | |||||||||||
| 70 | =head2 build_parallel_dynamic_lib_dist | ||||||||||
| 71 | |||||||||||
| 72 | SPVM::Builder::API::build_parallel_dynamic_lib_dist($options); | ||||||||||
| 73 | |||||||||||
| 74 | Generates dynamic libraries for multiple native classes and precompile classes in parallel, and copies them into the C<blib/lib> directory. | ||||||||||
| 75 | |||||||||||
| 76 | C<$options> is a hash reference. | ||||||||||
| 77 | |||||||||||
| 78 | =head2 Options | ||||||||||
| 79 | |||||||||||
| 80 | =over 2 | ||||||||||
| 81 | |||||||||||
| 82 | =item * C<build_dir> | ||||||||||
| 83 | |||||||||||
| 84 | A build directory. | ||||||||||
| 85 | |||||||||||
| 86 | =item * C<output_dir> | ||||||||||
| 87 | |||||||||||
| 88 | A output directory. | ||||||||||
| 89 | |||||||||||
| 90 | =item * C<jobs> | ||||||||||
| 91 | |||||||||||
| 92 | The number of parallel jobs. The default value is the number of CPU cores. | ||||||||||
| 93 | |||||||||||
| 94 | =item * C<config_global_file> | ||||||||||
| 95 | |||||||||||
| 96 | A global configuration file path. If it is defined, the file is loaded as an L<SPVM::Builder::Config::Global> object and applied globally during the build process. | ||||||||||
| 97 | |||||||||||
| 98 | =item * C<native_classes> | ||||||||||
| 99 | |||||||||||
| 100 | An array reference of native class names to be built. | ||||||||||
| 101 | |||||||||||
| 102 | =item * C<native_classes_file> | ||||||||||
| 103 | |||||||||||
| 104 | A path to a text file containing native class names to be built. The file must contain one class name per line. If both C<native_classes> and this option are specified, they are merged. | ||||||||||
| 105 | |||||||||||
| 106 | =item * C<precompile_classes> | ||||||||||
| 107 | |||||||||||
| 108 | An array reference of precompile class names to be built. | ||||||||||
| 109 | |||||||||||
| 110 | =item * C<precompile_classes_file> | ||||||||||
| 111 | |||||||||||
| 112 | A path to a text file containing precompile class names to be built. The file must contain one class name per line. If both C<precompile_classes> and this option are specified, they are merged. | ||||||||||
| 113 | |||||||||||
| 114 | =back | ||||||||||
| 115 | |||||||||||
| 116 | If this option is specified, it overrides the C<optimize> option and sets appropriate flags for both the compiler and the linker to match CMake's behavior. | ||||||||||
| 117 | |||||||||||
| 118 | =back | ||||||||||