mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-04-13 04:09:33 +02:00
* Allow setting compiler options in the fppkg config file
git-svn-id: trunk@44281 -
This commit is contained in:
parent
c49dbb9d9c
commit
a9d508f117
@ -213,7 +213,7 @@ Var
|
||||
P : TFPPackage;
|
||||
DepPackage: TFPPackage;
|
||||
DepDirList: TStringList;
|
||||
Reason: string;
|
||||
S,Reason: string;
|
||||
begin
|
||||
Result := True;
|
||||
P:=DeterminePackage;
|
||||
@ -309,6 +309,10 @@ begin
|
||||
AddOption('-vi');
|
||||
AddOption('-O2');
|
||||
AddOption('-XXs');
|
||||
if PackageManager.FPMakeCompilerOptions.HasOptions then
|
||||
for S in PackageManager.FPMakeCompilerOptions.Options do
|
||||
AddOption(S);
|
||||
// AddOption(PackageManager.FPMakeCompilerOptions.Options.DelimitedText) ;
|
||||
// Create fpmkunit.pp if needed
|
||||
if NeedFPMKUnitSource then
|
||||
begin
|
||||
@ -356,6 +360,7 @@ Var
|
||||
if OOptions<>'' then
|
||||
OOptions:=OOptions+' ';
|
||||
OOptions:=OOptions+maybequoted(s);
|
||||
Writeln('Options: >>>>',OOptions,'<<<<');
|
||||
end;
|
||||
|
||||
procedure CondAddOption(const Name,Value:string);
|
||||
|
@ -17,7 +17,7 @@ unit pkgoptions;
|
||||
interface
|
||||
|
||||
// pkgglobals must be AFTER fpmkunit
|
||||
uses Classes, Sysutils, Inifiles, fpTemplate, fpmkunit, pkgglobals, fgl;
|
||||
uses Classes, Sysutils, Inifiles, StrUtils, fpTemplate, fpmkunit, pkgglobals, fgl;
|
||||
|
||||
Const
|
||||
UnitConfigFileName = 'fpunits.cfg';
|
||||
@ -323,6 +323,7 @@ Const
|
||||
KeyCompilerOS = 'OS';
|
||||
KeyCompilerCPU = 'CPU';
|
||||
KeyCompilerVersion = 'Version';
|
||||
KeyCompilerOptions = 'CompilerOptions';
|
||||
|
||||
{ TFppkgIncludeFilesOptionSection }
|
||||
|
||||
@ -1167,6 +1168,8 @@ end;
|
||||
procedure TCompilerOptions.LoadCompilerFromFile(const AFileName: String);
|
||||
Var
|
||||
Ini : TMemIniFile;
|
||||
S,sOptions : UTF8String;
|
||||
|
||||
begin
|
||||
Ini:=TMemIniFile.Create(AFileName);
|
||||
try
|
||||
@ -1192,6 +1195,10 @@ begin
|
||||
FCompiler:=ReadString(SDefaults,KeyCompiler,FCompiler);
|
||||
FCompilerOS:=StringToOS(ReadString(SDefaults,KeyCompilerOS,OSToString(CompilerOS)));
|
||||
FCompilerCPU:=StringToCPU(ReadString(SDefaults,KeyCompilerCPU,CPUtoString(CompilerCPU)));
|
||||
sOptions:=ReadString(SDefaults,KeyCompilerOptions,'');
|
||||
if (sOptions<>'') then
|
||||
for S in SplitCommandline(sOptions) do
|
||||
self.Options.Add(S);
|
||||
CompilerVersion:=ReadString(SDefaults,KeyCompilerVersion,FCompilerVersion);
|
||||
end;
|
||||
finally
|
||||
@ -1221,6 +1228,8 @@ begin
|
||||
WriteString(SDefaults,KeyCompilerOS,OSToString(CompilerOS));
|
||||
WriteString(SDefaults,KeyCompilerCPU,CPUtoString(CompilerCPU));
|
||||
WriteString(SDefaults,KeyCompilerVersion,FCompilerVersion);
|
||||
if HasOptions then
|
||||
WriteString(SDefaults,KeyCompilerOptions,Self.Options.Text);
|
||||
FSaveInifileChanges:=False;
|
||||
end;
|
||||
Ini.UpdateFile;
|
||||
|
Loading…
Reference in New Issue
Block a user