Fix build variant environment variable handling

This commit is contained in:
2026-06-09 21:21:17 +02:00
parent 6042b2a145
commit 8fc755372f
3 changed files with 56 additions and 44 deletions

View File

@ -32,10 +32,13 @@ my $wamr_root = require_env('WAMR_ROOT');
my $cross_cc = require_env('CROSS_CC');
my $linux_cc = require_env('LINUX_CC');
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_xip = ( $ENV{WAMR_USE_XIP} // 'false' ) eq 'true';
my $use_allocator = ( $ENV{WAMR_USE_ALLOCATOR} // 'false' ) eq 'true';
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_xip = ( $ENV{WAMR_USE_XIP} // '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
@ -63,7 +66,7 @@ my @wamr_cmake_linux = ( '-DWAMR_BUILD_PLATFORM=linux', );
# Variant defines passed as CMAKE_C_FLAGS
my @variant_cflags =
( '-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;
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.
my @host_variant_cflags;
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