IDE: Search in the right location for the compiled units in a Lazarus-package, compiled/installed by FPMake

git-svn-id: trunk@59720 -
This commit is contained in:
joost 2018-12-03 18:58:42 +00:00
parent 0c07ac1983
commit 0e016b16dc
4 changed files with 35 additions and 13 deletions

View File

@ -99,13 +99,11 @@ procedure Register;
var
OptionsGroup: Integer;
begin
FppkgOptions := TFppkgEnvironmentOptions.Create;
TFppkgEnvironmentOptions.GetInstance;
OptionsGroup := GetFreeIDEOptionsGroupIndex(GroupEditor);
RegisterIDEOptionsGroup(OptionsGroup, TFppkgEnvironmentOptions);
RegisterIDEOptionsEditor(OptionsGroup, TFppkgEnvironmentOptionsFrame, 1);
FppkgOptions.Load();
end;
{ TFppkgEnvironmentOptionsFrame }
@ -161,6 +159,11 @@ end;
class function TFppkgEnvironmentOptions.GetInstance: TAbstractIDEOptions;
begin
if not Assigned(FppkgOptions) then
begin
FppkgOptions := TFppkgEnvironmentOptions.Create;
FppkgOptions.Load();
end;
Result:=FppkgOptions;
end;

View File

@ -27,6 +27,7 @@ type
class function Instance: TFppkgHelper;
function HasPackage(const PackageName: string): Boolean;
procedure ListPackages(AList: TStringList);
function GetPackageUnitPath(const PackageName: string): string;
end;
implementation
@ -123,6 +124,14 @@ begin
{$ENDIF VER3_0}
end;
function TFppkgHelper.GetPackageUnitPath(const PackageName: string): string;
var
FppkgPackage: TFPPackage;
begin
FppkgPackage := FFPpkg.FindPackage(PackageName, pkgpkInstalled);
Result := FppkgPackage.PackagesStructure.GetUnitDirectory(FppkgPackage);
end;
finalization
GFppkgHelper.Free;
end.

View File

@ -53,7 +53,7 @@ uses
// IDE
EditDefineTree, CompilerOptions, CompOptsModes, IDEOptionDefs, ProjPackCommon,
LazarusIDEStrConsts, IDEProcs, TransferMacros, FileReferenceList,
PublishModule, ImgList;
PublishModule, ImgList, FppkgHelper, FppkgIntf;
type
TLazPackage = class;
@ -644,6 +644,7 @@ type
function NeedsDefineTemplates: boolean;
function SubstitutePkgMacros(const s: string; PlatformIndependent: boolean): string;
procedure WriteInheritedUnparsedOptions;
function GetActiveBuildMethod: TBuildMethod;
// files
function IndexOfPkgFile(PkgFile: TPkgFile): integer;
function SearchShortFilename(const ShortFilename: string;
@ -2143,7 +2144,7 @@ begin
if SysUtils.CompareText(MacroName,'PkgOutDir')=0 then begin
Handled:=true;
if Data=CompilerOptionMacroNormal then
s:=CompilerOptions.ParsedOpts.GetParsedValue(pcosOutputDir)
s:=GetOutputDirectory()
else
s:=CompilerOptions.ParsedOpts.GetParsedPIValue(pcosOutputDir);
exit;
@ -2215,6 +2216,17 @@ begin
end;
end;
function TLazPackage.GetActiveBuildMethod: TBuildMethod;
begin
Result:=BuildMethod;
if Result=bmBoth then begin
if Assigned(FppkgInterface) and FppkgInterface.UseFPMakeWhenPossible then
Result:=bmFPMake
else
Result:=bmLazarus;
end;
end;
function TLazPackage.GetAutoIncrementVersionOnBuild: boolean;
begin
Result:=lpfAutoIncrementVersionOnBuild in FFlags;
@ -3741,7 +3753,11 @@ end;
function TLazPackage.GetOutputDirectory(UseOverride: boolean = true): string;
begin
if HasDirectory then begin
Result:=CompilerOptions.ParsedOpts.GetParsedValue(pcosOutputDir,UseOverride);
if GetActiveBuildMethod = bmFPMake then begin
Result :=TFppkgHelper.Instance.GetPackageUnitPath(name);
end else begin
Result:=CompilerOptions.ParsedOpts.GetParsedValue(pcosOutputDir,UseOverride);
end;
end else
Result:='';
end;

View File

@ -4200,13 +4200,7 @@ begin
if (not APackage.CompilerOptions.SkipCompiler)
and (not (pcfDoNotCompilePackage in Flags)) then begin
BuildMethod:=APackage.BuildMethod;
if BuildMethod=bmBoth then begin
if Assigned(FppkgInterface) and FppkgInterface.UseFPMakeWhenPossible then
BuildMethod:=bmFPMake
else
BuildMethod:=bmLazarus;
end;
BuildMethod:=APackage.GetActiveBuildMethod;
if BuildMethod=bmLazarus then begin
CompilerFilename:=APackage.GetCompilerFilename;