mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-07-23 18:45:59 +02:00
codetools: added pas2js platforms electorn and module
This commit is contained in:
parent
9ced709010
commit
451ba64bde
@ -213,9 +213,11 @@ const
|
||||
'FPC', 'ObjFPC', 'Delphi', 'TP', 'MacPas', 'ISO'
|
||||
);
|
||||
|
||||
Pas2jsPlatformNames: array[1..2] of shortstring = (
|
||||
Pas2jsPlatformNames: array[1..4] of shortstring = (
|
||||
'Browser',
|
||||
'NodeJS'
|
||||
'NodeJS',
|
||||
'Electron',
|
||||
'Module'
|
||||
);
|
||||
Pas2jsProcessorNames: array[1..2] of shortstring = (
|
||||
'ECMAScript5',
|
||||
@ -3927,9 +3929,14 @@ begin
|
||||
end;
|
||||
|
||||
function IsPas2jsTargetOS(TargetOS: string): boolean;
|
||||
var
|
||||
i: Integer;
|
||||
begin
|
||||
Result:=(CompareText(TargetOS,'browser')=0)
|
||||
or (CompareText(TargetOS,'nodejs')=0);
|
||||
TargetOS:=lowercase(TargetOS);
|
||||
for i:=low(Pas2jsPlatformNames) to high(Pas2jsPlatformNames) do
|
||||
if Pas2jsPlatformNames[i]=TargetOS then
|
||||
exit(true);
|
||||
Result:=false;
|
||||
end;
|
||||
|
||||
function IsPas2jsTargetCPU(TargetCPU: string): boolean;
|
||||
|
@ -326,17 +326,17 @@ function GetExecutableExt(TargetOS: string): string;
|
||||
begin
|
||||
if TargetOS='' then
|
||||
TargetOS:=GetCompiledTargetOS;
|
||||
if (CompareText(copy(TargetOS,1,3), 'win') = 0)
|
||||
or (CompareText(copy(TargetOS,1,3), 'dos') = 0) then
|
||||
TargetOS:=LowerCase(TargetOS);
|
||||
if (copy(TargetOS,1,3)='win')
|
||||
or (copy(TargetOS,1,3)='dos') then
|
||||
Result:='.exe'
|
||||
else if SameText(TargetOS, 'browser') or SameText(TargetOS,'nodejs') then
|
||||
Result:='.js'
|
||||
else if SameText(TargetOS, 'wasi') then
|
||||
Result:='.wasm'
|
||||
else if SameText(TargetOS, 'embedded') then
|
||||
Result:='.elf'
|
||||
else
|
||||
Result:='';
|
||||
case TargetOS of
|
||||
'browser','nodejs','electron','module': Result:='.js';
|
||||
'wasi': Result:='.wasm';
|
||||
'embedded': Result:='.elf';
|
||||
else Result:='';
|
||||
end;
|
||||
end;
|
||||
|
||||
function MakeStandardExeFilename(TargetOS, Filename: string): string;
|
||||
@ -379,9 +379,11 @@ var
|
||||
begin
|
||||
if TargetOS='' then
|
||||
TargetOS:=GetCompiledTargetOS;
|
||||
TargetOS:=LowerCase(TargetOS);
|
||||
Result:='';
|
||||
if SameText(TargetOS, 'browser') or SameText(TargetOS,'nodejs') then
|
||||
exit('.js');
|
||||
case TargetOS of
|
||||
'browser','nodejs','electron','module': exit('.js');
|
||||
end;
|
||||
SrcOS:=GetDefaultSrcOSForTargetOS(TargetOS);
|
||||
if CompareText(SrcOS, 'unix') = 0 then
|
||||
Result:='lib';
|
||||
|
Loading…
Reference in New Issue
Block a user