mirror of https://gitlab.com/basile.b/dexed.git
CE projects, add list for specific DMD/LDC/GDC options
This commit is contained in:
parent
4be099408e
commit
d502757268
|
@ -239,16 +239,26 @@ type
|
||||||
private
|
private
|
||||||
fCov: boolean;
|
fCov: boolean;
|
||||||
fCustom: TStringList;
|
fCustom: TStringList;
|
||||||
|
fDmdOthers: TstringList;
|
||||||
|
fLdcOthers: TStringList;
|
||||||
|
fGdcOthers: TStringList;
|
||||||
procedure setCov(const value: boolean);
|
procedure setCov(const value: boolean);
|
||||||
procedure setCustom(value: TStringList);
|
procedure setCustom(value: TStringList);
|
||||||
|
procedure setDmdOtherOptions(value: TStringList);
|
||||||
|
procedure setLdcOtherOptions(value: TStringList);
|
||||||
|
procedure setGdcOtherOptions(value: TStringList);
|
||||||
published
|
published
|
||||||
property coverage: boolean read fCov write setCov default false;
|
property coverage: boolean read fCov write setCov default false;
|
||||||
property customOptions: TStringList read fCustom write setCustom;
|
property customOptions: TStringList read fCustom write setCustom;
|
||||||
|
property dmdOtherOptions: TStringList read fDmdOthers write setDmdOtherOptions;
|
||||||
|
property ldcOtherOptions: TStringList read fLdcOthers write setLdcOtherOptions;
|
||||||
|
property gdcOtherOptions: TStringList read fGdcOthers write setGdcOtherOptions;
|
||||||
public
|
public
|
||||||
constructor create; override;
|
constructor create; override;
|
||||||
destructor destroy; override;
|
destructor destroy; override;
|
||||||
procedure assign(source: TPersistent); override;
|
procedure assign(source: TPersistent); override;
|
||||||
procedure getOpts(list: TStrings; base: TOptsGroup = nil); override;
|
procedure getOpts(list: TStrings; base: TOptsGroup = nil); override;
|
||||||
|
procedure getCompilerSpecificOpts(list: TStrings; base: TOptsGroup = nil; compiler: TCECompiler = dmd);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
(*****************************************************************************
|
(*****************************************************************************
|
||||||
|
@ -1122,6 +1132,9 @@ constructor TOtherOpts.create;
|
||||||
begin
|
begin
|
||||||
inherited;
|
inherited;
|
||||||
fCustom := TStringList.Create;
|
fCustom := TStringList.Create;
|
||||||
|
fDmdOthers := TStringList.Create;
|
||||||
|
fLdcOthers := TStringList.Create;
|
||||||
|
fGdcOthers := TStringList.Create;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TOtherOpts.assign(source: TPersistent);
|
procedure TOtherOpts.assign(source: TPersistent);
|
||||||
|
@ -1131,8 +1144,11 @@ begin
|
||||||
if (source is TOtherOpts) then
|
if (source is TOtherOpts) then
|
||||||
begin
|
begin
|
||||||
src := TOtherOpts(source);
|
src := TOtherOpts(source);
|
||||||
fCustom.Assign(src.fCustom);
|
|
||||||
fCov := src.fCov;
|
fCov := src.fCov;
|
||||||
|
fCustom.Assign(src.fCustom);
|
||||||
|
fDmdOthers.Assign(src.fDmdOthers);
|
||||||
|
fLdcOthers.Assign(src.fLdcOthers);
|
||||||
|
fGdcOthers.Assign(src.fGdcOthers);
|
||||||
end
|
end
|
||||||
else inherited;
|
else inherited;
|
||||||
end;
|
end;
|
||||||
|
@ -1140,6 +1156,9 @@ end;
|
||||||
destructor TOtherOpts.destroy;
|
destructor TOtherOpts.destroy;
|
||||||
begin
|
begin
|
||||||
fCustom.Free;
|
fCustom.Free;
|
||||||
|
fDmdOthers.Free;
|
||||||
|
fLdcOthers.Free;
|
||||||
|
fGdcOthers.Free;
|
||||||
inherited;
|
inherited;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
@ -1152,47 +1171,122 @@ end;
|
||||||
|
|
||||||
procedure TOtherOpts.getOpts(list: TStrings; base: TOptsGroup = nil);
|
procedure TOtherOpts.getOpts(list: TStrings; base: TOptsGroup = nil);
|
||||||
var
|
var
|
||||||
str1, str2: string;
|
i: integer;
|
||||||
|
str: string;
|
||||||
baseopt: TOtherOpts;
|
baseopt: TOtherOpts;
|
||||||
rightList: TStringList;
|
rightList: TStringList;
|
||||||
begin
|
begin
|
||||||
if base.isNil then
|
if base.isNil then
|
||||||
|
begin
|
||||||
|
for i := 0 to fCustom.Count-1 do
|
||||||
begin
|
begin
|
||||||
for str1 in fCustom do if str1 <> '' then
|
str := fCustom[i];
|
||||||
begin
|
if str.isEmpty or isStringDisabled(str) then
|
||||||
if isStringDisabled(str1) then
|
|
||||||
continue;
|
continue;
|
||||||
if str1[1] <> '-' then
|
if str[1] <> '-' then
|
||||||
str2 := '-' + str1
|
str := '-' + str;
|
||||||
else
|
list.AddText(fSymStringExpander.expand(str));
|
||||||
str2 := str1;
|
|
||||||
list.AddText(fSymStringExpander.expand(str2));
|
|
||||||
end;
|
end;
|
||||||
if fCov then list.Add('-cov');
|
if fCov then list.Add('-cov');
|
||||||
end else
|
end else
|
||||||
begin
|
begin
|
||||||
baseopt := TOtherOpts(base);
|
baseopt := TOtherOpts(base);
|
||||||
if fCustom.Count = 0 then rightList := baseopt.fCustom
|
if fCustom.Count = 0 then
|
||||||
else rightList := fCustom;
|
rightList := baseopt.fCustom
|
||||||
for str1 in rightList do if str1 <> '' then
|
else
|
||||||
|
rightList := fCustom;
|
||||||
|
for i := 0 to rightList.Count-1 do
|
||||||
begin
|
begin
|
||||||
if isStringDisabled(str1) then
|
str := rightList[i];
|
||||||
|
if str.isEmpty or isStringDisabled(str) then
|
||||||
continue;
|
continue;
|
||||||
if str1[1] <> '-' then
|
if str[1] <> '-' then
|
||||||
str2 := '-' + str1
|
str := '-' + str;
|
||||||
else
|
list.AddText(fSymStringExpander.expand(str));
|
||||||
str2 := str1;
|
|
||||||
list.AddText(fSymStringExpander.expand(str2));
|
|
||||||
end;
|
end;
|
||||||
if baseopt.fCov or fCov then list.Add('-cov');
|
if baseopt.fCov or fCov then list.Add('-cov');
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
procedure TOtherOpts.getCompilerSpecificOpts(list: TStrings; base:
|
||||||
|
TOptsGroup = nil; compiler: TCECompiler = dmd);
|
||||||
|
var
|
||||||
|
i: integer;
|
||||||
|
str: string;
|
||||||
|
baseopt: TOtherOpts;
|
||||||
|
lst: TStringList;
|
||||||
|
begin
|
||||||
|
if base.isNil then
|
||||||
|
begin
|
||||||
|
case compiler of
|
||||||
|
TCECompiler.dmd: lst := fDmdOthers;
|
||||||
|
TCECompiler.ldc: lst := fLdcOthers;
|
||||||
|
TCECompiler.gdc: lst := fGdcOthers;
|
||||||
|
end;
|
||||||
|
for i := 0 to lst.Count-1 do
|
||||||
|
begin
|
||||||
|
str := lst[i];
|
||||||
|
if str.isEmpty or isStringDisabled(str) then
|
||||||
|
continue;
|
||||||
|
if str[1] <> '-' then
|
||||||
|
str := '-' + str;
|
||||||
|
list.AddText(fSymStringExpander.expand(str));
|
||||||
|
end;
|
||||||
|
end else
|
||||||
|
begin
|
||||||
|
baseopt := TOtherOpts(base);
|
||||||
|
case compiler of
|
||||||
|
TCECompiler.dmd:
|
||||||
|
if fDmdOthers.Count = 0 then
|
||||||
|
lst := baseopt.fDmdOthers
|
||||||
|
else
|
||||||
|
lst := fDmdOthers;
|
||||||
|
TCECompiler.ldc:
|
||||||
|
if fLdcOthers.Count = 0 then
|
||||||
|
lst := baseopt.fLdcOthers
|
||||||
|
else
|
||||||
|
lst := fLdcOthers;
|
||||||
|
TCECompiler.gdc:
|
||||||
|
if fGdcOthers.Count = 0 then
|
||||||
|
lst := baseopt.fGdcOthers
|
||||||
|
else
|
||||||
|
lst := fGdcOthers;
|
||||||
|
end;
|
||||||
|
for i := 0 to lst.Count-1 do
|
||||||
|
begin
|
||||||
|
str := lst[i];
|
||||||
|
if str.isEmpty or isStringDisabled(str) then
|
||||||
|
continue;
|
||||||
|
if str[1] <> '-' then
|
||||||
|
str := '-' + str;
|
||||||
|
list.AddText(fSymStringExpander.expand(str));
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
procedure TOtherOpts.setCustom(value: TStringList);
|
procedure TOtherOpts.setCustom(value: TStringList);
|
||||||
begin
|
begin
|
||||||
fCustom.Assign(value);
|
fCustom.Assign(value);
|
||||||
doChanged;
|
doChanged;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
procedure TOtherOpts.setDmdOtherOptions(value: TStringList);
|
||||||
|
begin
|
||||||
|
fDmdOthers.Assign(value);
|
||||||
|
doChanged;
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TOtherOpts.setLdcOtherOptions(value: TStringList);
|
||||||
|
begin
|
||||||
|
fLdcOthers.Assign(value);
|
||||||
|
doChanged;
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TOtherOpts.setGdcOtherOptions(value: TStringList);
|
||||||
|
begin
|
||||||
|
fGdcOthers.Assign(value);
|
||||||
|
doChanged;
|
||||||
|
end;
|
||||||
{$ENDREGION}
|
{$ENDREGION}
|
||||||
|
|
||||||
{$REGION TCustomProcOptions ----------------------------------------------------}
|
{$REGION TCustomProcOptions ----------------------------------------------------}
|
||||||
|
@ -1368,7 +1462,7 @@ begin
|
||||||
fPostProcOpt.assign(src.fPostProcOpt);
|
fPostProcOpt.assign(src.fPostProcOpt);
|
||||||
fRunProjOpt.assign(src.fRunProjOpt);
|
fRunProjOpt.assign(src.fRunProjOpt);
|
||||||
//
|
//
|
||||||
// isBase / isOverriden not copied by purpose.
|
// isBase / isOverriden not copied on purpose.
|
||||||
end
|
end
|
||||||
else inherited;
|
else inherited;
|
||||||
end;
|
end;
|
||||||
|
|
|
@ -65,6 +65,8 @@ type
|
||||||
// passes compilation message as "to be guessed"
|
// passes compilation message as "to be guessed"
|
||||||
procedure compProcOutput(proc: TObject);
|
procedure compProcOutput(proc: TObject);
|
||||||
procedure compProcTerminated(proc: TObject);
|
procedure compProcTerminated(proc: TObject);
|
||||||
|
function getObjectsDirectory: string; inline;
|
||||||
|
procedure getUpToDateObjects(str: TStrings);
|
||||||
protected
|
protected
|
||||||
procedure beforeLoad; override;
|
procedure beforeLoad; override;
|
||||||
procedure afterSave; override;
|
procedure afterSave; override;
|
||||||
|
@ -407,15 +409,17 @@ var
|
||||||
i: Integer;
|
i: Integer;
|
||||||
exc: TStringList;
|
exc: TStringList;
|
||||||
libAliasesPtr: TStringList;
|
libAliasesPtr: TStringList;
|
||||||
|
conf: TCompilerConfiguration;
|
||||||
str: string;
|
str: string;
|
||||||
begin
|
begin
|
||||||
if fConfIx = -1 then exit;
|
if fConfIx = -1 then exit;
|
||||||
exc := TStringList.Create;
|
exc := TStringList.Create;
|
||||||
try
|
try
|
||||||
|
conf := currentConfiguration;
|
||||||
// prepares the exclusions
|
// prepares the exclusions
|
||||||
for i := 0 to currentConfiguration.pathsOptions.exclusions.Count-1 do
|
for i := 0 to conf.pathsOptions.exclusions.Count-1 do
|
||||||
begin
|
begin
|
||||||
str := fSymStringExpander.expand(currentConfiguration.pathsOptions.exclusions[i]);
|
str := fSymStringExpander.expand(conf.pathsOptions.exclusions[i]);
|
||||||
exc.Add(str)
|
exc.Add(str)
|
||||||
end;
|
end;
|
||||||
// sources
|
// sources
|
||||||
|
@ -448,18 +452,25 @@ begin
|
||||||
{$IFDEF WINDOWS}
|
{$IFDEF WINDOWS}
|
||||||
// only link lib file if executable/shared lib
|
// only link lib file if executable/shared lib
|
||||||
// OS switch: read more @ http://forum.dlang.org/post/ooekdkwrefposmchekrp@forum.dlang.org
|
// OS switch: read more @ http://forum.dlang.org/post/ooekdkwrefposmchekrp@forum.dlang.org
|
||||||
if (currentConfiguration.outputOptions.binaryKind in [executable, sharedlib]) or
|
if (conf.outputOptions.binaryKind in [executable, sharedlib]) or
|
||||||
currentConfiguration.outputOptions.alwaysLinkStaticLibs then
|
conf.outputOptions.alwaysLinkStaticLibs then
|
||||||
{$ENDIF}
|
{$ENDIF}
|
||||||
LibMan.getLibFiles(libAliasesPtr, list);
|
LibMan.getLibFiles(libAliasesPtr, list);
|
||||||
|
|
||||||
// but always adds -I<path>
|
// but always adds -I<path>
|
||||||
LibMan.getLibSourcePath(libAliasesPtr, list);
|
LibMan.getLibSourcePath(libAliasesPtr, list);
|
||||||
// config
|
// config
|
||||||
if currentConfiguration.isOverriddenConfiguration then
|
if conf.isOverriddenConfiguration then
|
||||||
currentConfiguration.getOpts(list, fBaseConfig)
|
begin
|
||||||
|
conf.getOpts(list, fBaseConfig);
|
||||||
|
conf.otherOptions.getCompilerSpecificOpts(list, fBaseConfig.otherOptions,
|
||||||
|
NativeProjectCompiler);
|
||||||
|
end
|
||||||
else
|
else
|
||||||
currentConfiguration.getOpts(list);
|
begin
|
||||||
|
conf.getOpts(list);
|
||||||
|
conf.otherOptions.getCompilerSpecificOpts(list, nil, NativeProjectCompiler);
|
||||||
|
end;
|
||||||
finally
|
finally
|
||||||
exc.Free;
|
exc.Free;
|
||||||
end;
|
end;
|
||||||
|
@ -771,6 +782,7 @@ begin
|
||||||
fCompilProc.OnReadData:= @compProcOutput;
|
fCompilProc.OnReadData:= @compProcOutput;
|
||||||
fCompilProc.OnTerminate:= @compProcTerminated;
|
fCompilProc.OnTerminate:= @compProcTerminated;
|
||||||
getOpts(fCompilProc.Parameters);
|
getOpts(fCompilProc.Parameters);
|
||||||
|
//getUpToDateObjects(fCompilProc.Parameters);
|
||||||
if NativeProjectCompiler = gdc then
|
if NativeProjectCompiler = gdc then
|
||||||
fCompilProc.Parameters.Add('-gdc=gdc');
|
fCompilProc.Parameters.Add('-gdc=gdc');
|
||||||
fCompilProc.Execute;
|
fCompilProc.Execute;
|
||||||
|
@ -904,6 +916,46 @@ begin
|
||||||
result := true;
|
result := true;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
function TCENativeProject.getObjectsDirectory: string; inline;
|
||||||
|
var
|
||||||
|
cfg: TCompilerConfiguration;
|
||||||
|
begin
|
||||||
|
result := '';
|
||||||
|
cfg := currentConfiguration;
|
||||||
|
if (cfg.pathsOptions.objectDirectory <> '') and
|
||||||
|
DirectoryExistsUTF8(cfg.pathsOptions.objectDirectory) then
|
||||||
|
result := cfg.pathsOptions.objectDirectory;
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TCENativeProject.getUpToDateObjects(str: TStrings);
|
||||||
|
var
|
||||||
|
odr: string;
|
||||||
|
src: string;
|
||||||
|
obj: string;
|
||||||
|
i: integer;
|
||||||
|
begin
|
||||||
|
odr := getObjectsDirectory;
|
||||||
|
if odr.isEmpty then
|
||||||
|
begin
|
||||||
|
for i := 0 to fSrcs.Count-1 do
|
||||||
|
begin
|
||||||
|
src := sourceAbsolute(i);
|
||||||
|
obj := stripFileExt(src) + objExt;
|
||||||
|
if obj.fileExists and src.fileExists then
|
||||||
|
begin
|
||||||
|
if FileAgeUTF8(src) > FileAgeUTF8(obj) then
|
||||||
|
DeleteFile(obj)
|
||||||
|
else
|
||||||
|
str.Add(obj);
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
end
|
||||||
|
else
|
||||||
|
begin
|
||||||
|
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
function TCENativeProject.outputFilename: string;
|
function TCENativeProject.outputFilename: string;
|
||||||
begin
|
begin
|
||||||
exit(fOutputFilename);
|
exit(fOutputFilename);
|
||||||
|
|
Loading…
Reference in New Issue