mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-09-01 23:40:26 +02:00
codetools: search cross compiler
git-svn-id: trunk@35093 -
This commit is contained in:
parent
e3ab9e771b
commit
5c9cd1a9ed
@ -2586,25 +2586,34 @@ function GetDefaultCompilerFilename(const TargetCPU: string;
|
|||||||
Cross: boolean): string;
|
Cross: boolean): string;
|
||||||
begin
|
begin
|
||||||
if Cross then
|
if Cross then
|
||||||
|
{$ifdef darwin}
|
||||||
|
Result:='ppc' // the mach-o format supports "fat" binaries whereby
|
||||||
|
// a single executable contains machine code for several architectures
|
||||||
|
{$else}
|
||||||
Result:='ppccross'
|
Result:='ppccross'
|
||||||
|
{$endif}
|
||||||
else
|
else
|
||||||
Result:='ppc';
|
Result:='ppc';
|
||||||
if TargetCPU='' then
|
if TargetCPU='' then
|
||||||
Result:='fpc'
|
Result:='fpc'
|
||||||
else if SysUtils.CompareText(TargetCPU,'i386')=0 then
|
else if SysUtils.CompareText(TargetCPU,'i386')=0 then
|
||||||
Result:=Result+'386'
|
Result:=Result+'386'
|
||||||
else if SysUtils.CompareText(TargetCPU,'powerpc')=0 then
|
|
||||||
Result:=Result+'ppc'
|
|
||||||
else if SysUtils.CompareText(TargetCPU,'sparc')=0 then
|
|
||||||
Result:=Result+'sparc'
|
|
||||||
else if SysUtils.CompareText(TargetCPU,'m68k')=0 then
|
else if SysUtils.CompareText(TargetCPU,'m68k')=0 then
|
||||||
Result:=Result+'86k'
|
Result:=Result+'86k'
|
||||||
else if SysUtils.CompareText(TargetCPU,'alpha')=0 then
|
else if SysUtils.CompareText(TargetCPU,'alpha')=0 then
|
||||||
Result:=Result+'alpha'
|
Result:=Result+'apx'
|
||||||
else if SysUtils.CompareText(TargetCPU,'x86_64')=0 then
|
else if SysUtils.CompareText(TargetCPU,'powerpc')=0 then
|
||||||
Result:=Result+'x64'
|
Result:=Result+'ppc'
|
||||||
|
else if SysUtils.CompareText(TargetCPU,'powerpc64')=0 then
|
||||||
|
Result:=Result+'ppc64'
|
||||||
else if SysUtils.CompareText(TargetCPU,'arm')=0 then
|
else if SysUtils.CompareText(TargetCPU,'arm')=0 then
|
||||||
Result:=Result+'arm'
|
Result:=Result+'arm'
|
||||||
|
else if SysUtils.CompareText(TargetCPU,'sparc')=0 then
|
||||||
|
Result:=Result+'sparc'
|
||||||
|
else if SysUtils.CompareText(TargetCPU,'x86_64')=0 then
|
||||||
|
Result:=Result+'x64'
|
||||||
|
else if SysUtils.CompareText(TargetCPU,'ia64')=0 then
|
||||||
|
Result:=Result+'ia64'
|
||||||
else
|
else
|
||||||
Result:='fpc';
|
Result:='fpc';
|
||||||
Result:=Result+ExeExt;
|
Result:=Result+ExeExt;
|
||||||
@ -7212,25 +7221,34 @@ end;
|
|||||||
|
|
||||||
function TFPCTargetConfigCache.FindRealCompilerInPath(aTargetCPU: string;
|
function TFPCTargetConfigCache.FindRealCompilerInPath(aTargetCPU: string;
|
||||||
ResolveLinks: boolean): string;
|
ResolveLinks: boolean): string;
|
||||||
var
|
|
||||||
ShortFileName: String;
|
function Search(const ShortFileName: string): string;
|
||||||
begin
|
|
||||||
Result:='';
|
|
||||||
if aTargetCPU='' then
|
|
||||||
aTargetCPU:=GetCompiledTargetCPU;
|
|
||||||
ShortFileName:=GetDefaultCompilerFilename(aTargetCPU);
|
|
||||||
if ShortFileName='' then exit;
|
|
||||||
// try in PATH
|
|
||||||
Result:=SearchFileInPath(ShortFileName,GetCurrentDirUTF8,
|
|
||||||
GetEnvironmentVariableUTF8('PATH'),PathSeparator,ctsfcDefault);
|
|
||||||
if (Result='') and (Compiler<>'') then
|
|
||||||
begin
|
begin
|
||||||
|
if ShortFileName='' then Result:='';
|
||||||
|
// try in PATH
|
||||||
|
Result:=SearchFileInPath(ShortFileName,GetCurrentDirUTF8,
|
||||||
|
GetEnvironmentVariableUTF8('PATH'),PathSeparator,ctsfcDefault);
|
||||||
|
if (Result<>'') or (Compiler='') then exit;
|
||||||
// try in directory of compiler
|
// try in directory of compiler
|
||||||
Result:=ExtractFilePath(Compiler)+ShortFileName;
|
Result:=ExtractFilePath(Compiler)+ShortFileName;
|
||||||
if not FileExistsCached(Result) then
|
if not FileExistsCached(Result) then
|
||||||
Result:='';
|
Result:='';
|
||||||
end;
|
end;
|
||||||
if Result='' then exit;
|
|
||||||
|
var
|
||||||
|
CompiledTargetCPU: String;
|
||||||
|
Cross: Boolean;
|
||||||
|
begin
|
||||||
|
Result:='';
|
||||||
|
CompiledTargetCPU:=GetCompiledTargetCPU;
|
||||||
|
if aTargetCPU='' then
|
||||||
|
aTargetCPU:=CompiledTargetCPU;
|
||||||
|
Cross:=aTargetCPU<>CompiledTargetCPU;
|
||||||
|
Result:=Search(GetDefaultCompilerFilename(aTargetCPU,Cross));
|
||||||
|
if (Result='') and Cross then begin
|
||||||
|
Result:=Search(GetDefaultCompilerFilename(aTargetCPU,false));
|
||||||
|
if Result='' then exit;
|
||||||
|
end;
|
||||||
if ResolveLinks then
|
if ResolveLinks then
|
||||||
Result:=TryReadAllLinks(Result);
|
Result:=TryReadAllLinks(Result);
|
||||||
end;
|
end;
|
||||||
|
Loading…
Reference in New Issue
Block a user