diff --git a/compiler/ngenutil.pas b/compiler/ngenutil.pas index 62a82a96da..5eee2fd0db 100644 --- a/compiler/ngenutil.pas +++ b/compiler/ngenutil.pas @@ -1503,7 +1503,7 @@ implementation var tcb: ttai_typedconstbuilder; begin - if (target_res.id in [res_elf,res_macho,res_xcoff]) or + if (target_res.id in [res_elf,res_macho,res_xcoff,res_wasm]) or { generate the FPC_RESLOCATION symbol even when using external resources, because in SysInit we can only reference it unconditionally } ((target_res.id=res_ext) and (target_info.system in systems_darwin)) then diff --git a/compiler/rescmn.pas b/compiler/rescmn.pas index 64aa1d690d..301b0866b1 100644 --- a/compiler/rescmn.pas +++ b/compiler/rescmn.pas @@ -54,6 +54,18 @@ uses resflags : []; ); + res_wasm_info : tresinfo = + ( + id : res_wasm; + resbin : 'fpcres'; + rescmd : '-o $OBJ -a $ARCH -of wasm $DBG'; + { cross compiled windres can be used to compile .rc files on other platforms } + rcbin : 'windres'; + rccmd : '--include $INC -O res -D FPC -o $RES $RC'; + resourcefileclass : nil; + resflags : []; + ); + res_ext_info : tresinfo = ( id : res_ext; diff --git a/compiler/systems.inc b/compiler/systems.inc index 54fb124899..3df71fc1e2 100644 --- a/compiler/systems.inc +++ b/compiler/systems.inc @@ -353,7 +353,7 @@ ,res_m68k_palmos,res_m68k_mpw ,res_powerpc_mpw,res_elf,res_xcoff ,res_win64_gorc, res_macho, res_ext - ,res_jvm_raw + ,res_jvm_raw,res_wasm ); tresinfoflags = (res_external_file,res_arch_in_file_name diff --git a/compiler/systems/i_wasi.pas b/compiler/systems/i_wasi.pas index 1738769c4a..1c7b905d0a 100644 --- a/compiler/systems/i_wasi.pas +++ b/compiler/systems/i_wasi.pas @@ -29,17 +29,6 @@ unit i_wasi; systems,rescmn; const - res_wasmraw_info : tresinfo = - ( - id : res_none; // todo: not implemented. but could be as memory - resbin : 'fpcwasmres'; - rescmd : '-o $OBJ $DBG'; - rcbin : ''; - rccmd : ''; - resourcefileclass : nil; - resflags : [res_no_compile]; - ); - system_wasm32_wasi_info : tsysteminfo = ( system : system_wasm32_wasi; @@ -82,7 +71,7 @@ unit i_wasi; link : ld_int_wasi; linkextern : ld_wasi; ar : ar_none; - res : res_none; + res : res_wasm; dbg : dbg_dwarf2; script : script_unix; endian : endian_little; diff --git a/compiler/systems/t_wasi.pas b/compiler/systems/t_wasi.pas index 32442f2f78..dae65c5bfb 100644 --- a/compiler/systems/t_wasi.pas +++ b/compiler/systems/t_wasi.pas @@ -90,7 +90,8 @@ implementation uses SysUtils, - verbose; + verbose, + comprsrc,rescmn; { timportlibwasi } @@ -332,5 +333,5 @@ initialization RegisterExport(system_wasm32_wasi, texportlibwasi); RegisterLinker(ld_int_wasi,TInternalLinkerWasi); RegisterLinker(ld_wasi, tlinkerwasi); - + RegisterRes(res_wasm_info,TWinLikeResourceFile); end.