codetools: SImpleInit: allow overriding TargetOS

git-svn-id: trunk@17715 -
This commit is contained in:
mattias 2008-12-07 22:39:47 +00:00
parent 991a580e12
commit ef52dfede9
3 changed files with 20 additions and 2 deletions

View File

@ -849,6 +849,16 @@ var
FPCSrcDefines: TDefineTemplate; FPCSrcDefines: TDefineTemplate;
LazarusSrcDefines: TDefineTemplate; LazarusSrcDefines: TDefineTemplate;
ATestPascalFile: String; ATestPascalFile: String;
CurFPCOptions: String;
procedure AddFPCOption(s: string);
begin
if s='' then exit;
if CurFPCOptions<>'' then
CurFPCOptions:=CurFPCOptions+' ';
CurFPCOptions:=CurFPCOptions+s;
end;
begin begin
// set global values // set global values
with GlobalValues do begin with GlobalValues do begin
@ -866,10 +876,17 @@ begin
ATestPascalFile:=Config.TestPascalFile; ATestPascalFile:=Config.TestPascalFile;
if ATestPascalFile='' then if ATestPascalFile='' then
ATestPascalFile:=GetTempFilename('fpctest.pas',''); ATestPascalFile:=GetTempFilename('fpctest.pas','');
FPCDefines:=CreateFPCTemplate(Config.FPCPath, Config.FPCOptions, CurFPCOptions:=Config.FPCOptions;
if TargetOS<>'' then AddFPCOption('-T'+TargetOS);
if TargetProcessor<>'' then AddFPCOption('-Op'+TargetProcessor);
FPCDefines:=CreateFPCTemplate(Config.FPCPath, CurFPCOptions,
ATestPascalFile, ATestPascalFile,
FPCUnitPath, TargetOS, TargetProcessor, FPCUnitPath, TargetOS, TargetProcessor,
nil); nil);
if Config.TargetOS='' then
Config.TargetOS:=TargetOS;
if Config.TargetProcessor='' then
Config.TargetProcessor:=TargetProcessor;
if FPCDefines=nil then begin if FPCDefines=nil then begin
raise Exception.Create('TCodeToolManager.Init: Unable to execute '+Config.FPCPath+' to get compiler values'); raise Exception.Create('TCodeToolManager.Init: Unable to execute '+Config.FPCPath+' to get compiler values');
end; end;

View File

@ -2971,7 +2971,7 @@ var CmdLine: string;
Step: String; Step: String;
begin begin
Result:=nil; Result:=nil;
//DebugLn('TDefinePool.CreateFPCTemplate PPC386Path="',CompilerPath,'" PPCOptions="',CompilerOptions,'"'); DebugLn('TDefinePool.CreateFPCTemplate PPC386Path="',CompilerPath,'" FPCOptions="',CompilerOptions,'"');
if TestPascalFile='' then begin if TestPascalFile='' then begin
DebugLn(['WARNING: TDefinePool.CreateFPCTemplate TestPascalFile empty']); DebugLn(['WARNING: TDefinePool.CreateFPCTemplate TestPascalFile empty']);
end; end;

View File

@ -17,6 +17,7 @@ var
begin begin
// setup the Options // setup the Options
CodeToolBoss.SimpleInit(ConfigFilename); CodeToolBoss.SimpleInit(ConfigFilename);
writeln('AAA ',CodeToolBoss.GetIncludePathForDirectory('/home/mattias/pascal/fpc_sources/23/fpc/rtl/win32'));
// Example: find declaration of 'TObject' // Example: find declaration of 'TObject'