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