ide: project options, show options star directories

This commit is contained in:
mattias 2023-08-03 21:47:09 +02:00
parent f904aa53b5
commit a8b8ec1b70

View File

@ -661,7 +661,7 @@ function InheritedOptionsToCompilerParameters(
Flags: TCompilerCmdLineOptions): string; Flags: TCompilerCmdLineOptions): string;
function MergeLinkerOptions(const OldOptions, AddOptions: string): string; function MergeLinkerOptions(const OldOptions, AddOptions: string): string;
function MergeCustomOptions(const OldOptions, AddOptions: string): string; function MergeCustomOptions(const OldOptions, AddOptions: string): string;
procedure ConvertSearchPathToCmdParams(const Switch, Paths: String; Params: TStrings); procedure ConvertSearchPathToCmdParams(const Switch, Paths, BasePath: String; Params: TStrings);
procedure ConvertOptionsToCmdParams(const Switch, OptionStr: string; Params: TStrings); procedure ConvertOptionsToCmdParams(const Switch, OptionStr: string; Params: TStrings);
type type
@ -865,13 +865,13 @@ begin
// include path // include path
CurIncludePath:=InheritedOptionStrings[icoIncludePath]; CurIncludePath:=InheritedOptionStrings[icoIncludePath];
if (CurIncludePath <> '') then if (CurIncludePath <> '') then
ConvertSearchPathToCmdParams('-Fi', CurIncludePath, Params); ConvertSearchPathToCmdParams('-Fi', CurIncludePath, '', Params);
// library path // library path
if (not (ccloNoLinkerOpts in Flags)) then begin if (not (ccloNoLinkerOpts in Flags)) then begin
CurLibraryPath:=InheritedOptionStrings[icoLibraryPath]; CurLibraryPath:=InheritedOptionStrings[icoLibraryPath];
if (CurLibraryPath <> '') then if (CurLibraryPath <> '') then
ConvertSearchPathToCmdParams('-Fl', CurLibraryPath, Params); ConvertSearchPathToCmdParams('-Fl', CurLibraryPath, '', Params);
end; end;
// namespaces // namespaces
@ -882,14 +882,14 @@ begin
// object path // object path
CurObjectPath:=InheritedOptionStrings[icoObjectPath]; CurObjectPath:=InheritedOptionStrings[icoObjectPath];
if (CurObjectPath <> '') then if (CurObjectPath <> '') then
ConvertSearchPathToCmdParams('-Fo', CurObjectPath, Params); ConvertSearchPathToCmdParams('-Fo', CurObjectPath, '', Params);
// unit path // unit path
CurUnitPath:=InheritedOptionStrings[icoUnitPath]; CurUnitPath:=InheritedOptionStrings[icoUnitPath];
// always add the current directory to the unit path, so that the compiler // always add the current directory to the unit path, so that the compiler
// checks for changed files in the directory // checks for changed files in the directory
CurUnitPath:=CurUnitPath+';.'; CurUnitPath:=CurUnitPath+';.';
ConvertSearchPathToCmdParams('-Fu', CurUnitPath, Params); ConvertSearchPathToCmdParams('-Fu', CurUnitPath, '', Params);
// custom options // custom options
CurCustomOptions:=InheritedOptionStrings[icoCustomOptions]; CurCustomOptions:=InheritedOptionStrings[icoCustomOptions];
@ -917,16 +917,17 @@ begin
Result+=AddOptions; Result+=AddOptions;
end; end;
procedure ConvertSearchPathToCmdParams(const Switch, Paths: String; procedure ConvertSearchPathToCmdParams(const Switch, Paths, BasePath: String;
Params: TStrings); Params: TStrings);
var var
StartPos: Integer; StartPos: Integer;
l, p, i: Integer; l, p, i: Integer;
EndPos: LongInt; EndPos: LongInt;
CurPath: String; CurPath, Dir: String;
Kind: TCTStarDirectoryKind; Kind: TCTStarDirectoryKind;
Cache: TCTStarDirectoryCache; Cache: TCTStarDirectoryCache;
SubDirs: TStringListUTF8Fast; SubDirs: TStringListUTF8Fast;
IsRelative: Boolean;
begin begin
if Switch='' then if Switch='' then
RaiseGDBException('ConvertSearchPathToCmdLine no Switch'); RaiseGDBException('ConvertSearchPathToCmdLine no Switch');
@ -941,21 +942,33 @@ begin
if StartPos<EndPos then if StartPos<EndPos then
begin begin
CurPath:=copy(Paths,StartPos,EndPos-StartPos); CurPath:=copy(Paths,StartPos,EndPos-StartPos);
StartPos:=EndPos+1;
Kind:=IsCTStarDirectory(CurPath,p); Kind:=IsCTStarDirectory(CurPath,p);
if Kind=ctsdStarStar then if Kind=ctsdStarStar then
begin begin
Delete(CurPath,p+1,length(CurPath)); Delete(CurPath,p+1,length(CurPath));
IsRelative:=not FilenameIsAbsolute(CurPath);
if IsRelative then
begin
if not FilenameIsAbsolute(BasePath) then continue;
CurPath:=BasePath+CurPath;
end;
Cache:=CodeToolBoss.DirectoryCachePool.GetStarCache(CurPath,Kind); Cache:=CodeToolBoss.DirectoryCachePool.GetStarCache(CurPath,Kind);
if Cache<>nil then if Cache<>nil then
begin begin
Cache.UpdateListing;
SubDirs:=Cache.Listing.SubDirs; SubDirs:=Cache.Listing.SubDirs;
for i:=0 to SubDirs.Count-1 do for i:=0 to SubDirs.Count-1 do
Params.Add(Switch + CurPath + SubDirs[i]); begin
Dir:=CurPath + SubDirs[i];
if IsRelative then
Dir:=CreateRelativePath(Dir,BasePath,true);
Params.Add(Switch + Dir);
end;
end; end;
end else end else
Params.Add(Switch + CurPath); Params.Add(Switch + CurPath);
end; end;
StartPos:=EndPos+1;
end; end;
end; end;
@ -2620,7 +2633,7 @@ var
DefaultTargetOS: string; DefaultTargetOS: string;
DefaultTargetCPU: string; DefaultTargetCPU: string;
RealCompilerFilename: String; RealCompilerFilename: String;
CurNamespaces: string; CurNamespaces, BasePath: string;
CurFPCMsgFile: TFPCMsgFilePoolItem; CurFPCMsgFile: TFPCMsgFilePoolItem;
Quiet: Boolean; Quiet: Boolean;
Kind: TPascalCompiler; Kind: TPascalCompiler;
@ -2933,18 +2946,20 @@ begin
CurOutputDir:=''; CurOutputDir:='';
if not (ccloNoMacroParams in Flags) then if not (ccloNoMacroParams in Flags) then
begin begin
BasePath:=AppendPathDelim(BaseDirectory);
// include path // include path
CurIncludePath:=GetIncludePath(not (ccloAbsolutePaths in Flags), CurIncludePath:=GetIncludePath(not (ccloAbsolutePaths in Flags),
coptParsed,false); coptParsed,false);
if (CurIncludePath <> '') then if (CurIncludePath <> '') then
ConvertSearchPathToCmdParams('-Fi', CurIncludePath, Result); ConvertSearchPathToCmdParams('-Fi', CurIncludePath, BasePath, Result);
// library path // library path
if (not (ccloNoLinkerOpts in Flags)) then begin if (not (ccloNoLinkerOpts in Flags)) then begin
CurLibraryPath:=GetLibraryPath(not (ccloAbsolutePaths in Flags), CurLibraryPath:=GetLibraryPath(not (ccloAbsolutePaths in Flags),
coptParsed,false); coptParsed,false);
if (CurLibraryPath <> '') then if (CurLibraryPath <> '') then
ConvertSearchPathToCmdParams('-Fl', CurLibraryPath, Result); ConvertSearchPathToCmdParams('-Fl', CurLibraryPath, BasePath, Result);
end; end;
// namespaces // namespaces
@ -2956,12 +2971,11 @@ begin
CurObjectPath:=GetObjectPath(not (ccloAbsolutePaths in Flags), CurObjectPath:=GetObjectPath(not (ccloAbsolutePaths in Flags),
coptParsed,false); coptParsed,false);
if (CurObjectPath <> '') then if (CurObjectPath <> '') then
ConvertSearchPathToCmdParams('-Fo', CurObjectPath, Result); ConvertSearchPathToCmdParams('-Fo', CurObjectPath, BasePath, Result);
// unit path // unit path
CurUnitPath:=GetUnitPath(not (ccloAbsolutePaths in Flags)); CurUnitPath:=GetUnitPath(not (ccloAbsolutePaths in Flags));
//debugln('TBaseCompilerOptions.MakeOptionsString A ',dbgsName(Self),' CurUnitPath="',CurUnitPath,'"'); ConvertSearchPathToCmdParams('-Fu', CurUnitPath, BasePath, Result);
ConvertSearchPathToCmdParams('-Fu', CurUnitPath, Result);
{ CompilerPath - Nothing needs to be done with this one } { CompilerPath - Nothing needs to be done with this one }