Fix build variant environment variable handling
This commit is contained in:
@ -51,7 +51,7 @@ sub date_now {
|
|||||||
|
|
||||||
sub run {
|
sub run {
|
||||||
my @cmd = @_;
|
my @cmd = @_;
|
||||||
say " + @cmd";
|
say "Running: @cmd";
|
||||||
system(@cmd) == 0
|
system(@cmd) == 0
|
||||||
or die "Command failed (exit " . ( $? >> 8 ) . "): @cmd\n";
|
or die "Command failed (exit " . ( $? >> 8 ) . "): @cmd\n";
|
||||||
}
|
}
|
||||||
|
|||||||
@ -24,9 +24,12 @@ sub compile {
|
|||||||
" WAMR_USE_MMAP_IN_TEXT=$ENV{WAMR_USE_MMAP_IN_TEXT}",
|
" WAMR_USE_MMAP_IN_TEXT=$ENV{WAMR_USE_MMAP_IN_TEXT}",
|
||||||
" WAMR_USE_XIP=$ENV{WAMR_USE_XIP}",
|
" WAMR_USE_XIP=$ENV{WAMR_USE_XIP}",
|
||||||
" WAMR_USE_ALLOCATOR=$ENV{WAMR_USE_ALLOCATOR}",
|
" WAMR_USE_ALLOCATOR=$ENV{WAMR_USE_ALLOCATOR}",
|
||||||
|
" WAMR_USE_GLOBAL_HEAP_IN_TEXT=$ENV{WAMR_USE_GLOBAL_HEAP_IN_TEXT}",
|
||||||
|
" WAMR_USE_RUNTIME_POOL_IN_TEXT=$ENV{WAMR_USE_RUNTIME_POOL_IN_TEXT}",
|
||||||
|
" WAMR_USE_LINEAR_POOL_IN_TEXT=$ENV{WAMR_USE_LINEAR_POOL_IN_TEXT}",
|
||||||
" compile.pl $module $target $mode";
|
" compile.pl $module $target $mode";
|
||||||
|
|
||||||
system( 'perl', $compile_pl, $module, $target, $mode ) == 0
|
system( "perl $compile_pl $module $target $mode > $local_root/build.log 2>&1" ) == 0
|
||||||
or die "Build failed\n";
|
or die "Build failed\n";
|
||||||
sleep(1);
|
sleep(1);
|
||||||
}
|
}
|
||||||
@ -57,33 +60,33 @@ my @allocator_variants = (
|
|||||||
"Pool allocator (Alloc_With_Pool)",
|
"Pool allocator (Alloc_With_Pool)",
|
||||||
"Allocator with usage (Alloc_With_Allocator)",
|
"Allocator with usage (Alloc_With_Allocator)",
|
||||||
);
|
);
|
||||||
my $selected_allocator_variant;
|
my $selected_allocator_variant = $allocator_variants[1];
|
||||||
if ( grep { $_ eq "aot" or $_ eq "interp" } @selected_modes ) {
|
if ( grep { $_ eq "aot" or $_ eq "interp" } @selected_modes ) {
|
||||||
($selected_allocator_variant) =
|
($selected_allocator_variant) =
|
||||||
TUI::select_from_list( "Select WAMR Allocator Variant",
|
TUI::select_from_list( "Select WAMR Allocator Variant",
|
||||||
0, @allocator_variants );
|
0, @allocator_variants );
|
||||||
die "No allocator variant selected" unless $selected_allocator_variant;
|
die "No allocator variant selected" unless $selected_allocator_variant;
|
||||||
local $ENV{WAMR_USE_ALLOCATOR} =
|
|
||||||
( $selected_allocator_variant eq $allocator_variants[0] )
|
|
||||||
? "false"
|
|
||||||
: "true";
|
|
||||||
}
|
}
|
||||||
|
local $ENV{WAMR_USE_ALLOCATOR} =
|
||||||
|
( $selected_allocator_variant eq $allocator_variants[1] )
|
||||||
|
? "true"
|
||||||
|
: "false";
|
||||||
|
|
||||||
# ========================================================================================= #
|
# ========================================================================================= #
|
||||||
# Select XIP variant
|
# Select XIP variant
|
||||||
# ========================================================================================= #
|
# ========================================================================================= #
|
||||||
|
|
||||||
my @xip_variants = ( "Compile AOT with --xip", "Compile AOT without --xip" );
|
my @xip_variants = ( "Compile AOT with --xip", "Compile AOT without --xip" );
|
||||||
my $selected_xip_variant;
|
my $selected_xip_variant = $xip_variants[0];
|
||||||
if ( grep { $_ eq "aot" } @selected_modes ) {
|
if ( grep { $_ eq "aot" } @selected_modes ) {
|
||||||
($selected_xip_variant) =
|
($selected_xip_variant) =
|
||||||
TUI::select_from_list( "Select WAMRC XIP Variant", 0, @xip_variants );
|
TUI::select_from_list( "Select WAMRC XIP Variant", 0, @xip_variants );
|
||||||
die "No XIP variant selected" unless $selected_xip_variant;
|
die "No XIP variant selected" unless $selected_xip_variant;
|
||||||
|
}
|
||||||
local $ENV{WAMR_USE_XIP} =
|
local $ENV{WAMR_USE_XIP} =
|
||||||
( $selected_xip_variant eq $xip_variants[0] )
|
( $selected_xip_variant eq $xip_variants[0] )
|
||||||
? "true"
|
? "true"
|
||||||
: "false";
|
: "false";
|
||||||
}
|
|
||||||
|
|
||||||
# ========================================================================================= #
|
# ========================================================================================= #
|
||||||
# Select .text.wamr_mmap variant
|
# Select .text.wamr_mmap variant
|
||||||
@ -93,17 +96,17 @@ my @mmap_variants = (
|
|||||||
"Place mmap_space in .text.wamr_mmap",
|
"Place mmap_space in .text.wamr_mmap",
|
||||||
"Let the linker decide where mmap_space is located"
|
"Let the linker decide where mmap_space is located"
|
||||||
);
|
);
|
||||||
my $selected_mmap_variant;
|
my $selected_mmap_variant = $mmap_variants[1];
|
||||||
if ( grep { $_ eq "aot" or $_ eq "interp" } @selected_modes ) {
|
if ( grep { $_ eq "aot" or $_ eq "interp" } @selected_modes ) {
|
||||||
($selected_mmap_variant) =
|
($selected_mmap_variant) =
|
||||||
TUI::select_from_list( "Select WAMR Mmap.Text Variant",
|
TUI::select_from_list( "Select WAMR Mmap.Text Variant",
|
||||||
0, @mmap_variants );
|
0, @mmap_variants );
|
||||||
die "No variant selected" unless $selected_mmap_variant;
|
die "No variant selected" unless $selected_mmap_variant;
|
||||||
|
}
|
||||||
local $ENV{WAMR_USE_MMAP_IN_TEXT} =
|
local $ENV{WAMR_USE_MMAP_IN_TEXT} =
|
||||||
( $selected_mmap_variant eq $mmap_variants[0] )
|
( $selected_mmap_variant eq $mmap_variants[0] )
|
||||||
? "true"
|
? "true"
|
||||||
: "false";
|
: "false";
|
||||||
}
|
|
||||||
|
|
||||||
# ========================================================================================= #
|
# ========================================================================================= #
|
||||||
# Select .text.wamr_aot variant
|
# Select .text.wamr_aot variant
|
||||||
@ -113,17 +116,17 @@ my @aot_section_variants = (
|
|||||||
"Place AOT array in .text.wamr_aot",
|
"Place AOT array in .text.wamr_aot",
|
||||||
"Let the linker decide where the AOT array is located",
|
"Let the linker decide where the AOT array is located",
|
||||||
);
|
);
|
||||||
my $selected_aot_variant;
|
my $selected_aot_variant = $aot_section_variants[1];
|
||||||
if ( grep { $_ eq "aot" } @selected_modes ) {
|
if ( grep { $_ eq "aot" } @selected_modes ) {
|
||||||
($selected_aot_variant) =
|
($selected_aot_variant) =
|
||||||
TUI::select_from_list( "Select WAMR Array.Text Variant",
|
TUI::select_from_list( "Select WAMR Array.Text Variant",
|
||||||
0, @aot_section_variants );
|
0, @aot_section_variants );
|
||||||
die "No AOT section variant selected" unless $selected_aot_variant;
|
die "No AOT section variant selected" unless $selected_aot_variant;
|
||||||
|
}
|
||||||
local $ENV{WAMR_USE_AOT_IN_TEXT} =
|
local $ENV{WAMR_USE_AOT_IN_TEXT} =
|
||||||
( $selected_aot_variant eq $aot_section_variants[0] )
|
( $selected_aot_variant eq $aot_section_variants[0] )
|
||||||
? "true"
|
? "true"
|
||||||
: "false";
|
: "false";
|
||||||
}
|
|
||||||
|
|
||||||
# ========================================================================================= #
|
# ========================================================================================= #
|
||||||
# Select .text.wamr_global_heap variant
|
# Select .text.wamr_global_heap variant
|
||||||
@ -133,17 +136,17 @@ my @global_heap_variants = (
|
|||||||
"Place pool allocator's global_heap in .text.wamr_global_heap",
|
"Place pool allocator's global_heap in .text.wamr_global_heap",
|
||||||
"Let the linker decide where global_heap is located"
|
"Let the linker decide where global_heap is located"
|
||||||
);
|
);
|
||||||
my $selected_global_heap_variant;
|
my $selected_global_heap_variant = $global_heap_variants[1];
|
||||||
if ( $selected_allocator_variant eq $allocator_variants[0] ) {
|
if ( $selected_allocator_variant eq $allocator_variants[0] ) {
|
||||||
($selected_global_heap_variant) =
|
($selected_global_heap_variant) =
|
||||||
TUI::select_from_list( "Select WAMR Global Heap Variant",
|
TUI::select_from_list( "Select WAMR Global Heap Variant",
|
||||||
0, @global_heap_variants );
|
0, @global_heap_variants );
|
||||||
die "No global heap variant selected" unless $selected_global_heap_variant;
|
die "No global heap variant selected" unless $selected_global_heap_variant;
|
||||||
|
}
|
||||||
local $ENV{WAMR_USE_GLOBAL_HEAP_IN_TEXT} =
|
local $ENV{WAMR_USE_GLOBAL_HEAP_IN_TEXT} =
|
||||||
( $selected_global_heap_variant eq $global_heap_variants[0] )
|
( $selected_global_heap_variant eq $global_heap_variants[0] )
|
||||||
? "true"
|
? "true"
|
||||||
: "false";
|
: "false";
|
||||||
}
|
|
||||||
|
|
||||||
# ========================================================================================= #
|
# ========================================================================================= #
|
||||||
# Select .text.wamr_runtime_pool variant
|
# Select .text.wamr_runtime_pool variant
|
||||||
@ -153,18 +156,18 @@ my @runtime_pool_variants = (
|
|||||||
"Place usage allocator's runtime_pool in .text.wamr_runtime_pool",
|
"Place usage allocator's runtime_pool in .text.wamr_runtime_pool",
|
||||||
"Let the linker decide where runtime_pool is located"
|
"Let the linker decide where runtime_pool is located"
|
||||||
);
|
);
|
||||||
my $selected_runtime_pool_variant;
|
my $selected_runtime_pool_variant = $runtime_pool_variants[1];
|
||||||
if ( $selected_allocator_variant eq $allocator_variants[1] ) {
|
if ( $selected_allocator_variant eq $allocator_variants[1] ) {
|
||||||
($selected_runtime_pool_variant) =
|
($selected_runtime_pool_variant) =
|
||||||
TUI::select_from_list( "Select WAMR Runtime Pool Variant",
|
TUI::select_from_list( "Select WAMR Runtime Pool Variant",
|
||||||
0, @runtime_pool_variants );
|
0, @runtime_pool_variants );
|
||||||
die "No runtime pool variant selected"
|
die "No runtime pool variant selected"
|
||||||
unless $selected_runtime_pool_variant;
|
unless $selected_runtime_pool_variant;
|
||||||
|
}
|
||||||
local $ENV{WAMR_USE_RUNTIME_POOL_IN_TEXT} =
|
local $ENV{WAMR_USE_RUNTIME_POOL_IN_TEXT} =
|
||||||
( $selected_runtime_pool_variant eq $runtime_pool_variants[0] )
|
( $selected_runtime_pool_variant eq $runtime_pool_variants[0] )
|
||||||
? "true"
|
? "true"
|
||||||
: "false";
|
: "false";
|
||||||
}
|
|
||||||
|
|
||||||
# ========================================================================================= #
|
# ========================================================================================= #
|
||||||
# Select .text.wamr_linear_pool variant
|
# Select .text.wamr_linear_pool variant
|
||||||
@ -174,17 +177,17 @@ my @linear_pool_variants = (
|
|||||||
"Place usage allocator's linear_pool in .text.wamr_linear_pool",
|
"Place usage allocator's linear_pool in .text.wamr_linear_pool",
|
||||||
"Let the linker decide where linear_pool is located"
|
"Let the linker decide where linear_pool is located"
|
||||||
);
|
);
|
||||||
my $selected_linear_pool_variant;
|
my $selected_linear_pool_variant = $linear_pool_variants[1];
|
||||||
if ( $selected_allocator_variant eq $allocator_variants[1] ) {
|
if ( $selected_allocator_variant eq $allocator_variants[1] ) {
|
||||||
($selected_linear_pool_variant) =
|
($selected_linear_pool_variant) =
|
||||||
TUI::select_from_list( "Select WAMR Linear Pool Variant",
|
TUI::select_from_list( "Select WAMR Linear Pool Variant",
|
||||||
0, @linear_pool_variants );
|
0, @linear_pool_variants );
|
||||||
die "No linear pool variant selected" unless $selected_linear_pool_variant;
|
die "No linear pool variant selected" unless $selected_linear_pool_variant;
|
||||||
|
}
|
||||||
local $ENV{WAMR_USE_LINEAR_POOL_IN_TEXT} =
|
local $ENV{WAMR_USE_LINEAR_POOL_IN_TEXT} =
|
||||||
( $selected_linear_pool_variant eq $linear_pool_variants[0] )
|
( $selected_linear_pool_variant eq $linear_pool_variants[0] )
|
||||||
? "true"
|
? "true"
|
||||||
: "false";
|
: "false";
|
||||||
}
|
|
||||||
|
|
||||||
# ========================================================================================= #
|
# ========================================================================================= #
|
||||||
# Select FAIL catch flags (written to runner_flags in each build dir)
|
# Select FAIL catch flags (written to runner_flags in each build dir)
|
||||||
@ -279,6 +282,9 @@ foreach my $experiment (@selected_experiments) {
|
|||||||
print $fhandle "$catch_flag_map{$_}\n" for @selected_catch_flags;
|
print $fhandle "$catch_flag_map{$_}\n" for @selected_catch_flags;
|
||||||
close($fhandle);
|
close($fhandle);
|
||||||
|
|
||||||
|
system( "mv", "$local_root/build.log",
|
||||||
|
"$local_root/build-$experiment/build.log" );
|
||||||
|
|
||||||
system(
|
system(
|
||||||
join " ",
|
join " ",
|
||||||
(
|
(
|
||||||
|
|||||||
@ -36,6 +36,9 @@ my $use_aot_in_text = ( $ENV{WAMR_USE_AOT_IN_TEXT} // 'false' ) eq 'true';
|
|||||||
my $use_mmap_in_text = ( $ENV{WAMR_USE_MMAP_IN_TEXT} // 'false' ) eq 'true';
|
my $use_mmap_in_text = ( $ENV{WAMR_USE_MMAP_IN_TEXT} // 'false' ) eq 'true';
|
||||||
my $use_xip = ( $ENV{WAMR_USE_XIP} // 'false' ) eq 'true';
|
my $use_xip = ( $ENV{WAMR_USE_XIP} // 'false' ) eq 'true';
|
||||||
my $use_allocator = ( $ENV{WAMR_USE_ALLOCATOR} // 'false' ) eq 'true';
|
my $use_allocator = ( $ENV{WAMR_USE_ALLOCATOR} // 'false' ) eq 'true';
|
||||||
|
my $use_global_heap_in_text = ( $ENV{WAMR_USE_GLOBAL_HEAP_IN_TEXT} // 'false' ) eq 'true';
|
||||||
|
my $use_runtime_pool_in_text = ( $ENV{WAMR_USE_RUNTIME_POOL_IN_TEXT} // 'false' ) eq 'true';
|
||||||
|
my $use_linear_pool_in_text = ( $ENV{WAMR_USE_LINEAR_POOL_IN_TEXT} // 'false' ) eq 'true';
|
||||||
|
|
||||||
# ========================================================================================= #
|
# ========================================================================================= #
|
||||||
# WAMR cmake configuration
|
# WAMR cmake configuration
|
||||||
@ -63,7 +66,7 @@ my @wamr_cmake_linux = ( '-DWAMR_BUILD_PLATFORM=linux', );
|
|||||||
# Variant defines passed as CMAKE_C_FLAGS
|
# Variant defines passed as CMAKE_C_FLAGS
|
||||||
my @variant_cflags =
|
my @variant_cflags =
|
||||||
( '-Wno-error=implicit-function-declaration', '-O0', '-ggdb3' );
|
( '-Wno-error=implicit-function-declaration', '-O0', '-ggdb3' );
|
||||||
push @variant_cflags, '-DWAMR_MMAP_IN_TEXT=0' unless $use_mmap_in_text;
|
push @variant_cflags, $use_mmap_in_text ? '-DWAMR_MMAP_IN_TEXT=1' : '-DWAMR_MMAP_IN_TEXT=0';
|
||||||
push @variant_cflags, '-DWASM_MEM_ALLOC_WITH_USAGE=1' if $use_allocator;
|
push @variant_cflags, '-DWASM_MEM_ALLOC_WITH_USAGE=1' if $use_allocator;
|
||||||
my $cmake_c_flags = join( ' ', @variant_cflags );
|
my $cmake_c_flags = join( ' ', @variant_cflags );
|
||||||
|
|
||||||
@ -75,6 +78,9 @@ push @variant_cmake_flags, '-DWAMR_BUILD_ALLOC_WITH_USAGE=1' if $use_allocator;
|
|||||||
# WASM_MEM_ALLOC_WITH_USAGE value as libiwasm.a was built with.
|
# WASM_MEM_ALLOC_WITH_USAGE value as libiwasm.a was built with.
|
||||||
my @host_variant_cflags;
|
my @host_variant_cflags;
|
||||||
push @host_variant_cflags, '-DWASM_MEM_ALLOC_WITH_USAGE=1' if $use_allocator;
|
push @host_variant_cflags, '-DWASM_MEM_ALLOC_WITH_USAGE=1' if $use_allocator;
|
||||||
|
push @host_variant_cflags, $use_global_heap_in_text ? '-DWAMR_GLOBAL_HEAP_IN_TEXT=1' : '-DWAMR_GLOBAL_HEAP_IN_TEXT=0';
|
||||||
|
push @host_variant_cflags, $use_runtime_pool_in_text ? '-DWAMR_RUNTIME_POOL_IN_TEXT=1' : '-DWAMR_RUNTIME_POOL_IN_TEXT=0';
|
||||||
|
push @host_variant_cflags, $use_linear_pool_in_text ? '-DWAMR_LINEAR_POOL_IN_TEXT=1' : '-DWAMR_LINEAR_POOL_IN_TEXT=0';
|
||||||
|
|
||||||
# ========================================================================================= #
|
# ========================================================================================= #
|
||||||
# Compiler / linker flags
|
# Compiler / linker flags
|
||||||
|
|||||||
Reference in New Issue
Block a user