Improved mksymbian

git-svn-id: trunk@7968 -
This commit is contained in:
sekelsenmat 2007-07-06 11:04:55 +00:00
parent 826ba045f1
commit a62655b5ef
3 changed files with 45 additions and 11 deletions

View File

@ -40,7 +40,7 @@ type
private private
AProcess: TProcess; AProcess: TProcess;
CurrentDirectory: string; CurrentDirectory: string;
MakeFolder, MakePartialFolder: string; MakeFolder, MakePartialFolder, BindingsUnitsFolder: string;
public public
opts: TMkSymbianOptions; opts: TMkSymbianOptions;
constructor Create; constructor Create;
@ -82,6 +82,9 @@ begin
CurrentDirectory := ExtractFilePath(ParamStr(0)); CurrentDirectory := ExtractFilePath(ParamStr(0));
MakePartialFolder := Copy(CurrentDirectory, 3, Length(CurrentDirectory) - 2); MakePartialFolder := Copy(CurrentDirectory, 3, Length(CurrentDirectory) - 2);
MakeFolder := IncludeTrailingBackslash(CurrentDirectory); MakeFolder := IncludeTrailingBackslash(CurrentDirectory);
{ When compiling the bindings we use a relative directory to get the output dir }
BindingsUnitsFolder := MakeFolder + '../../units/i386-symbian/';
AProcess.Options := AProcess.Options + [poWaitOnExit]; AProcess.Options := AProcess.Options + [poWaitOnExit];
end; end;
@ -144,8 +147,8 @@ end;
procedure TCompiler.MakeBuildPascal; procedure TCompiler.MakeBuildPascal;
var var
STR_LINK_FLAGSUDEB, STR_EPOCBLDUDEB, STR_LINK_OBJSUDEB: string; STR_LINK_FLAGSUDEB, STR_EPOCBLDUDEB, STR_LINK_OBJSUDEB: string;
STR_GAS: string;
STR_FPC_RTL_OBJECTS: string; STR_FPC_RTL_OBJECTS: string;
i: Integer;
begin begin
WriteLn(''); WriteLn('');
@ -168,8 +171,6 @@ begin
{ Compilation } { Compilation }
STR_GAS := 'C:\Programas\lazarus20\fpc\2.0.4\bin\i386-win32\as.exe';
WriteLn(''); WriteLn('');
WriteLn('Compiling file ' + vProject.MainSource); WriteLn('Compiling file ' + vProject.MainSource);
WriteLn(''); WriteLn('');
@ -183,7 +184,7 @@ begin
WriteLn('Assembling file QPasHello.s'); WriteLn('Assembling file QPasHello.s');
WriteLn(''); WriteLn('');
AProcess.CommandLine := STR_GAS + ' QPasHello.s -o QPasHello.o'; AProcess.CommandLine := vProject.AssemblerPath + ' QPasHello.s -o QPasHello.o';
WriteLn(AProcess.CommandLine); WriteLn(AProcess.CommandLine);
AProcess.Execute; AProcess.Execute;
@ -199,7 +200,14 @@ begin
vSDKUtil.SDKPartialFolder + 'EPOC32\RELEASE\WINSCW\UDEB\EUSER.LIB ' + vSDKUtil.SDKPartialFolder + 'EPOC32\RELEASE\WINSCW\UDEB\EUSER.LIB ' +
'-o "' + MakeFolder + 'QPasHello.exe" -noimplib'; '-o "' + MakeFolder + 'QPasHello.exe" -noimplib';
STR_EPOCBLDUDEB := MakeFolder + 'WINSCW\UDEB'; STR_EPOCBLDUDEB := MakeFolder + 'WINSCW\UDEB';
STR_LINK_OBJSUDEB := 'QPasHello.o ' + UID_OBJECT_FILENAME;
STR_LINK_OBJSUDEB :=
' ' + MakeFolder + UID_OBJECT_FILENAME;
for i := 0 to vProject.ObjectFiles.Count - 1 do
STR_LINK_OBJSUDEB := STR_LINK_OBJSUDEB +
' ' + MakeFolder + vProject.ObjectFiles.Strings[i];
STR_FPC_RTL_OBJECTS := STR_FPC_RTL_OBJECTS :=
' ' + vProject.RTLUnitsDir + 'system.o' + ' ' + vProject.RTLUnitsDir + 'system.o' +
' ' + vProject.RTLUnitsDir + 'symbian.o' + ' ' + vProject.RTLUnitsDir + 'symbian.o' +
@ -213,7 +221,7 @@ begin
AProcess.CommandLine := vSDKUtil.SDKFolder + Str_Path_CWTools + AProcess.CommandLine := vSDKUtil.SDKFolder + Str_Path_CWTools +
'mwldsym2.exe ' + STR_LINK_FLAGSUDEB + 'mwldsym2.exe ' + STR_LINK_FLAGSUDEB +
' -l ' + STR_EPOCBLDUDEB + ' -l ' + MakeFolder +
' -search ' + STR_LINK_OBJSUDEB + STR_FPC_RTL_OBJECTS; ' -search ' + STR_LINK_OBJSUDEB + STR_FPC_RTL_OBJECTS;
WriteLn(AProcess.CommandLine); WriteLn(AProcess.CommandLine);
AProcess.Execute; AProcess.Execute;
@ -312,6 +320,8 @@ end;
* *
* DESCRIPTION: Builds and links the C interface for the symbian libraries * DESCRIPTION: Builds and links the C interface for the symbian libraries
* *
* Note the we use a output directory relative to the current directory
*
* PARAMETERS: None * PARAMETERS: None
* *
* RETURNS: Nothing * RETURNS: Nothing
@ -321,7 +331,10 @@ procedure TCompiler.MakeBuildBindings;
var var
STR_CWUFLAGS, STR_CWDEFS, STR_INCDIR, STR_CWUDEB, STR_CWCOMPILER: string; STR_CWUFLAGS, STR_CWDEFS, STR_INCDIR, STR_CWUDEB, STR_CWCOMPILER: string;
begin begin
{ Makes sure that the output directory exists }
SysUtils.ForceDirectories(BindingsUnitsFolder);
{ Compilation } { Compilation }
STR_CWUFLAGS := '-wchar_t off -align 4 -warnings on ' + STR_CWUFLAGS := '-wchar_t off -align 4 -warnings on ' +
@ -339,12 +352,11 @@ begin
WriteLn('Compiling file pbeexe.cpp'); WriteLn('Compiling file pbeexe.cpp');
WriteLn(''); WriteLn('');
AProcess.CommandLine := STR_CWUDEB + ' -o "' + MakePartialFolder + 'pbeexe.o" ' + AProcess.CommandLine := STR_CWUDEB +
' -o "' + BindingsUnitsFolder + 'pbeexe.o" ' +
'-c "' + MakePartialFolder + 'pbeexe.cpp"'; '-c "' + MakePartialFolder + 'pbeexe.cpp"';
WriteLn(AProcess.CommandLine); WriteLn(AProcess.CommandLine);
AProcess.Execute; AProcess.Execute;
FileCopy(MakePartialFolder + 'pbeexe.o', vProject.RTLUnitsDir + 'pbeexe.o');
end; end;
{******************************************************************* {*******************************************************************

View File

@ -84,6 +84,7 @@ const
STR_PRJ_Emulator = 'Emulator'; STR_PRJ_Emulator = 'Emulator';
STR_PRJ_CompilerPath = 'CompilerPath'; STR_PRJ_CompilerPath = 'CompilerPath';
STR_PRJ_AssemblerPath = 'AssemblerPath';
STR_PRJ_RTLUnitsDir = 'RTLUnitsDir'; STR_PRJ_RTLUnitsDir = 'RTLUnitsDir';
STR_PRJ_UID2 = 'UID2'; STR_PRJ_UID2 = 'UID2';

View File

@ -42,12 +42,16 @@ type
{ Main section } { Main section }
ExeName, Language: string; ExeName, Language: string;
{ FPC section } { FPC section }
CompilerPath, RTLUnitsDir: string; CompilerPath, AssemblerPath, RTLUnitsDir: string;
{ UIDs section } { UIDs section }
UID2, UID3: string; UID2, UID3: string;
{ Files section } { Files section }
MainSource, MainSourceNoExt, MainResource: string; MainSource, MainSourceNoExt, MainResource: string;
{ Objects section }
ObjectFiles: TStringList;
public public
constructor Create;
destructor Destroy; override;
procedure ParseFile; procedure ParseFile;
end; end;
@ -58,6 +62,20 @@ implementation
{ TProject } { TProject }
constructor TProject.Create;
begin
inherited Create;
ObjectFiles := TStringList.Create;
end;
destructor TProject.Destroy;
begin
ObjectFiles.Free;
inherited Destroy;
end;
{******************************************************************* {*******************************************************************
* TProject.ParseFile () * TProject.ParseFile ()
* *
@ -78,6 +96,7 @@ begin
Language := IniFile.ReadString(STR_PRJ_Files, STR_PRJ_Language, 'Pascal'); Language := IniFile.ReadString(STR_PRJ_Files, STR_PRJ_Language, 'Pascal');
CompilerPath := IniFile.ReadString(STR_PRJ_FPC, STR_PRJ_CompilerPath, 'C:\Programas\fpc21\compiler\ppc386.exe'); CompilerPath := IniFile.ReadString(STR_PRJ_FPC, STR_PRJ_CompilerPath, 'C:\Programas\fpc21\compiler\ppc386.exe');
AssemblerPath := IniFile.ReadString(STR_PRJ_FPC, STR_PRJ_AssemblerPath, 'C:\Programas\lazarus20\fpc\2.1.5\bin\i386-win32\as.exe');
RTLUnitsDir := IniFile.ReadString(STR_PRJ_FPC, STR_PRJ_RTLUnitsDir, 'C:\Programas\fpc21\rtl\units\i386-symbian\'); RTLUnitsDir := IniFile.ReadString(STR_PRJ_FPC, STR_PRJ_RTLUnitsDir, 'C:\Programas\fpc21\rtl\units\i386-symbian\');
UID2 := IniFile.ReadString(STR_PRJ_UIDs, STR_PRJ_UID2, '0x100039CE'); UID2 := IniFile.ReadString(STR_PRJ_UIDs, STR_PRJ_UID2, '0x100039CE');
@ -86,6 +105,8 @@ begin
MainSource := IniFile.ReadString(STR_PRJ_Files, STR_PRJ_MainSource, 'default.pas'); MainSource := IniFile.ReadString(STR_PRJ_Files, STR_PRJ_MainSource, 'default.pas');
MainSourceNoExt := ExtractFileExt(MainSource); MainSourceNoExt := ExtractFileExt(MainSource);
MainResource := IniFile.ReadString(STR_PRJ_Files, STR_PRJ_MainResource, 'default.rss'); MainResource := IniFile.ReadString(STR_PRJ_Files, STR_PRJ_MainResource, 'default.rss');
IniFile.ReadSection(STR_PRJ_Objects, ObjectFiles);
finally finally
IniFile.Free; IniFile.Free;
end; end;