mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-04-17 13:39:36 +02:00
* Implemented BuildCPU, BuildOS en BuildString properties
git-svn-id: trunk@23007 -
This commit is contained in:
parent
b3d86072b8
commit
b61960a0fb
@ -863,6 +863,9 @@ Type
|
||||
FUnixPaths: Boolean;
|
||||
FNoFPCCfg: Boolean;
|
||||
FUseEnvironment: Boolean;
|
||||
function GetBuildCPU: TCpu;
|
||||
function GetBuildOS: TOS;
|
||||
function GetBuildString: String;
|
||||
function GetFPDocOutputDir: String;
|
||||
function GetLocalUnitDir: String;
|
||||
function GetGlobalUnitDir: String;
|
||||
@ -889,6 +892,7 @@ Type
|
||||
Constructor Create;
|
||||
Procedure InitDefaults;
|
||||
Function HaveOptions: Boolean;
|
||||
function IsBuildDifferentFromTarget: boolean;
|
||||
procedure CompilerDefaults; virtual;
|
||||
Procedure LocalInit(Const AFileName : String);
|
||||
Procedure LoadFromFile(Const AFileName : String);
|
||||
@ -899,6 +903,9 @@ Type
|
||||
Property Target : String Read FTarget Write SetTarget;
|
||||
Property OS : TOS Read FOS Write SetOS;
|
||||
Property CPU : TCPU Read FCPU Write SetCPU;
|
||||
Property BuildString : String read GetBuildString;
|
||||
Property BuildOS : TOS read GetBuildOS;
|
||||
Property BuildCPU : TCpu read GetBuildCPU;
|
||||
Property Mode : TCompilerMode Read FMode Write FMode;
|
||||
Property UnixPaths : Boolean Read FUnixPaths Write FUnixPaths;
|
||||
Property Options : TStrings Read GetOptions Write SetOptions; // Default compiler options.
|
||||
@ -3476,6 +3483,20 @@ begin
|
||||
Result:=IncludeTrailingPathDelimiter(FixPath('.'+PathDelim+'docs'));
|
||||
end;
|
||||
|
||||
function TCustomDefaults.GetBuildCPU: TCpu;
|
||||
begin
|
||||
result := StringToCPU({$I %FPCTARGETCPU%});
|
||||
end;
|
||||
|
||||
function TCustomDefaults.GetBuildOS: TOS;
|
||||
begin
|
||||
result := StringToOS({$I %FPCTARGETOS%});
|
||||
end;
|
||||
|
||||
function TCustomDefaults.GetBuildString: String;
|
||||
begin
|
||||
result := MakeTargetString(BuildCPU, BuildOS);
|
||||
end;
|
||||
|
||||
function TCustomDefaults.GetGlobalUnitDir: String;
|
||||
begin
|
||||
@ -3611,6 +3632,11 @@ begin
|
||||
Result:=Assigned(FOptions);
|
||||
end;
|
||||
|
||||
function TCustomDefaults.IsBuildDifferentFromTarget: boolean;
|
||||
begin
|
||||
result := (OS<>BuildOS) or (CPU<>BuildCPU);
|
||||
end;
|
||||
|
||||
|
||||
procedure TCustomDefaults.LocalInit(Const AFileName : String);
|
||||
Var
|
||||
@ -3865,6 +3891,7 @@ begin
|
||||
GlobalDictionary.AddVariable('BaseInstallDir',Defaults.BaseInstallDir);
|
||||
GlobalDictionary.AddVariable('bininstalldir',Defaults.BinInstallDir);
|
||||
GlobalDictionary.AddVariable('Target',Defaults.Target);
|
||||
GlobalDictionary.AddVariable('BuildString',Defaults.BuildString);
|
||||
GlobalDictionary.AddVariable('Prefix',Defaults.Prefix);
|
||||
CreatePackages;
|
||||
end;
|
||||
|
@ -15,7 +15,6 @@ Var
|
||||
T : TTarget;
|
||||
P : TPackage;
|
||||
Data2Inc : string;
|
||||
HostOS: TOS;
|
||||
begin
|
||||
AddCustomFpmakeCommandlineOption('data2inc', 'Use indicated data2inc executable.');
|
||||
AddCustomFpmakeCommandlineOption('genfpmkunit', 'Regenerate the fpmkunitsrc.inc file (fppkg).');
|
||||
@ -82,8 +81,7 @@ begin
|
||||
Data2Inc:= ExpandFileName(Data2Inc);
|
||||
if Data2Inc='' then
|
||||
begin
|
||||
HostOS:=StringToOS({$I %FPCTARGETOS%});
|
||||
data2inc := ExeSearch(AddProgramExtension('data2inc', HostOS));
|
||||
data2inc := ExeSearch(AddProgramExtension('data2inc', Defaults.BuildOS));
|
||||
end;
|
||||
if Data2Inc <> '' then
|
||||
P.Commands.AddCommand(Data2Inc,'-b -s $(SOURCE) $(DEST) fpmkunitsrc','src/fpmkunitsrc.inc','../fpmkunit/src/fpmkunit.pp');
|
||||
|
@ -17,12 +17,8 @@ var
|
||||
GdbLibDir, GdbLibFile: string;
|
||||
GdbLibFound: boolean;
|
||||
GdbVerTarget: TTarget;
|
||||
HostOS: TOS;
|
||||
HostCPU: TCpu;
|
||||
begin
|
||||
P := Sender as TPackage;
|
||||
HostOS:=StringToOS({$I %FPCTARGETOS%});
|
||||
HostCPU:=StringToCPU({$I %FPCTARGETCPU%});
|
||||
// Search for a libgdb file.
|
||||
GdbLibFound:=false;
|
||||
|
||||
@ -62,8 +58,8 @@ begin
|
||||
// gdb-version is not possible, unless a i386-win32 to i386-go32v2 compilation
|
||||
// is performed.
|
||||
if GdbLibFound and
|
||||
(((Defaults.CPU=HostCPU) and (Defaults.OS=HostOS))
|
||||
or ((Defaults.CPU=i386) and (Defaults.OS=go32v2) and (HostOS=win32) and (HostCPU=i386))) then
|
||||
(Defaults.IsBuildDifferentFromTarget
|
||||
or ((Defaults.CPU=i386) and (Defaults.OS=go32v2) and (Defaults.BuildOS=win32) and (Defaults.BuildCPU=i386))) then
|
||||
begin
|
||||
P.Options.Add('-Fl'+GdbLibDir);
|
||||
Installer.BuildEngine.CreateOutputDir(p);
|
||||
@ -71,7 +67,7 @@ begin
|
||||
Installer.BuildEngine.Compile(P,GdbVerTarget);
|
||||
Installer.BuildEngine.ExecuteCommand(Installer.BuildEngine.AddPathPrefix(p,p.
|
||||
GetBinOutputDir(Defaults.CPU, Defaults.OS))+PathDelim+
|
||||
AddProgramExtension('gdbver',HostOS),'-o ' +
|
||||
AddProgramExtension('gdbver',Defaults.BuildOS),'-o ' +
|
||||
Installer.BuildEngine.AddPathPrefix(p,'src'+PathDelim+'gdbver.inc'));
|
||||
|
||||
// Pass -dUSE_MINGW_GDB to the compiler when a MinGW gdb is used
|
||||
|
Loading…
Reference in New Issue
Block a user