mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-07 02:48:17 +02:00
Added Symbian build tool
git-svn-id: trunk@7958 -
This commit is contained in:
parent
9fedea7b9f
commit
4caa18e29a
9
.gitattributes
vendored
9
.gitattributes
vendored
@ -8597,6 +8597,15 @@ utils/h2pas/yyparse.cod -text
|
||||
utils/kalyptus/kalyptus -text
|
||||
utils/kalyptus/kalyptusCxxToPas.pm -text
|
||||
utils/kalyptus/kalyptusDataDict.pm -text
|
||||
utils/mksymbian/Makefile.fpc -text
|
||||
utils/mksymbian/cfgfile.pas -text
|
||||
utils/mksymbian/cmdline.pas -text
|
||||
utils/mksymbian/compiler.pas -text
|
||||
utils/mksymbian/constants.pas -text
|
||||
utils/mksymbian/mksymbian.lpi -text
|
||||
utils/mksymbian/mksymbian.pas -text
|
||||
utils/mksymbian/projectparser.pas -text
|
||||
utils/mksymbian/sdkutil.pas -text
|
||||
utils/postw32.pp svneol=native#text/plain
|
||||
utils/ppdep.pp svneol=native#text/plain
|
||||
utils/ptop.pp svneol=native#text/plain
|
||||
|
24
utils/mksymbian/Makefile.fpc
Normal file
24
utils/mksymbian/Makefile.fpc
Normal file
@ -0,0 +1,24 @@
|
||||
#
|
||||
# Makefile.fpc for Free Pascal Symbian Build Tool
|
||||
#
|
||||
|
||||
[target]
|
||||
programs=mksymbian
|
||||
|
||||
[clean]
|
||||
units=cfgfile cmdline compiler constants projectparser sdkutil
|
||||
|
||||
[require]
|
||||
packages=
|
||||
|
||||
[compiler]
|
||||
|
||||
[install]
|
||||
fpcpackage=y
|
||||
|
||||
[default]
|
||||
fpcdir=../..
|
||||
|
||||
[rules]
|
||||
.NOTPARALLEL:
|
||||
mksymbian$(EXEEXT): mksymbian.pas
|
37
utils/mksymbian/cfgfile.pas
Normal file
37
utils/mksymbian/cfgfile.pas
Normal file
@ -0,0 +1,37 @@
|
||||
{
|
||||
cfgfile.pas
|
||||
|
||||
Config file methods
|
||||
|
||||
Copyright (C) 2006-2007 Felipe Monteiro de Carvalho
|
||||
|
||||
This file is part of MkSymbian build tool.
|
||||
|
||||
MkSymbian is free software;
|
||||
you can redistribute it and/or modify it under the
|
||||
terms of the GNU General Public License version 2
|
||||
as published by the Free Software Foundation.
|
||||
|
||||
MkSymbian is distributed in the hope
|
||||
that it will be useful, but WITHOUT ANY WARRANTY; without even
|
||||
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
|
||||
PURPOSE. See the GNU General Public License for more details.
|
||||
|
||||
Please note that the General Public License version 2 does not permit
|
||||
incorporating MkSymbian into proprietary programs.
|
||||
}
|
||||
unit cfgfile;
|
||||
|
||||
{$ifdef fpc}
|
||||
{$mode delphi}{$H+}
|
||||
{$endif}
|
||||
|
||||
interface
|
||||
|
||||
uses
|
||||
Classes, SysUtils;
|
||||
|
||||
implementation
|
||||
|
||||
end.
|
||||
|
138
utils/mksymbian/cmdline.pas
Normal file
138
utils/mksymbian/cmdline.pas
Normal file
@ -0,0 +1,138 @@
|
||||
{
|
||||
cmdline.pas
|
||||
|
||||
Command line parsing methods
|
||||
|
||||
Copyright (C) 2006-2007 Felipe Monteiro de Carvalho
|
||||
|
||||
This file is part of MkSymbian build tool.
|
||||
|
||||
MkSymbian is free software;
|
||||
you can redistribute it and/or modify it under the
|
||||
terms of the GNU General Public License version 2
|
||||
as published by the Free Software Foundation.
|
||||
|
||||
MkSymbian is distributed in the hope
|
||||
that it will be useful, but WITHOUT ANY WARRANTY; without even
|
||||
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
|
||||
PURPOSE. See the GNU General Public License for more details.
|
||||
|
||||
Please note that the General Public License version 2 does not permit
|
||||
incorporating MkSymbian into proprietary programs.
|
||||
}
|
||||
unit cmdline;
|
||||
|
||||
{$ifdef fpc}
|
||||
{$mode delphi}{$H+}
|
||||
{$endif}
|
||||
|
||||
interface
|
||||
|
||||
uses
|
||||
Classes, SysUtils,
|
||||
constants;
|
||||
|
||||
type
|
||||
|
||||
{ TCmdLine }
|
||||
|
||||
TCmdLine = class(TObject)
|
||||
public
|
||||
procedure Usage;
|
||||
procedure ShowPath;
|
||||
procedure ParseCmdLineOptions(var opts: TMkSymbianOptions);
|
||||
end;
|
||||
|
||||
var
|
||||
vCmdLine: TCmdLine;
|
||||
|
||||
implementation
|
||||
|
||||
uses sdkutil, projectparser;
|
||||
|
||||
{ TCmdLine }
|
||||
|
||||
{*******************************************************************
|
||||
* TCmdLine.Usage ()
|
||||
*
|
||||
* DESCRIPTION: Shows a usage message for the tool
|
||||
*
|
||||
* PARAMETERS: None
|
||||
*
|
||||
* RETURNS: Nothing
|
||||
*
|
||||
*******************************************************************}
|
||||
procedure TCmdLine.Usage;
|
||||
begin
|
||||
WriteLn('mksymbian - Build tool for Free Pascal for SymbianOS');
|
||||
WriteLn('');
|
||||
WriteLn('The parameters you specifyed are wrong.');
|
||||
WriteLn('');
|
||||
WriteLn('Usage: mksymbian [command] [project file]');
|
||||
WriteLn('');
|
||||
WriteLn('Possible commands: ');
|
||||
WriteLn('');
|
||||
WriteLn('build - Builds a application');
|
||||
WriteLn('bindings - Builds the c++ bindings for pascal');
|
||||
WriteLn('showpath - Show the paths the tool is using');
|
||||
WriteLn('');
|
||||
end;
|
||||
|
||||
{*******************************************************************
|
||||
* TCmdLine.ShowPath ()
|
||||
*
|
||||
* DESCRIPTION: Shows in which paths (sdk, fpc, etc) mksymbian is using
|
||||
*
|
||||
* PARAMETERS: None
|
||||
*
|
||||
* RETURNS: Nothing
|
||||
*
|
||||
*******************************************************************}
|
||||
procedure TCmdLine.ShowPath;
|
||||
begin
|
||||
WriteLn('mksymbian - Build tool for Free Pascal for SymbianOS');
|
||||
WriteLn('');
|
||||
WriteLn('Location of UIQ 3 SDK: ' + vSDKUtil.SDKFolder);
|
||||
WriteLn('Location of Free Pascal Compiler: ' + vProject.CompilerPath);
|
||||
WriteLn('');
|
||||
end;
|
||||
|
||||
{*******************************************************************
|
||||
* TCmdLine.ParseCmdLineOptions ()
|
||||
*
|
||||
* DESCRIPTION: Parses the command line options utilized to call mksymbian
|
||||
*
|
||||
* PARAMETERS: None
|
||||
*
|
||||
* RETURNS: Nothing
|
||||
*
|
||||
*******************************************************************}
|
||||
procedure TCmdLine.ParseCmdLineOptions(var opts: TMkSymbianOptions);
|
||||
begin
|
||||
FillChar(opts, SizeOf(TMkSymbianOptions), #0);
|
||||
|
||||
if (ParamCount = 0) then
|
||||
begin
|
||||
Usage;
|
||||
Exit;
|
||||
end;
|
||||
|
||||
opts.ProjectFile := ParamStr(2);
|
||||
|
||||
if CompareText(ParamStr(1), paramBuild) = 0 then opts.task := stBuildApp
|
||||
else if CompareText(ParamStr(1), paramBindings) = 0 then opts.task := stBuildBindings
|
||||
else if CompareText(ParamStr(1), paramShowPath) = 0 then
|
||||
begin
|
||||
opts.task := stNothing;
|
||||
vProject.ParseFile;
|
||||
ShowPath;
|
||||
end
|
||||
else
|
||||
begin
|
||||
opts.task := stNothing;
|
||||
Usage;
|
||||
end;
|
||||
end;
|
||||
|
||||
end.
|
||||
|
480
utils/mksymbian/compiler.pas
Normal file
480
utils/mksymbian/compiler.pas
Normal file
@ -0,0 +1,480 @@
|
||||
{
|
||||
compiler.pas
|
||||
|
||||
Compiling, Linking and Registering in Emulator methods
|
||||
|
||||
Copyright (C) 2006-2007 Felipe Monteiro de Carvalho
|
||||
|
||||
This file is part of MkSymbian build tool.
|
||||
|
||||
MkSymbian is free software;
|
||||
you can redistribute it and/or modify it under the
|
||||
terms of the GNU General Public License version 2
|
||||
as published by the Free Software Foundation.
|
||||
|
||||
MkSymbian is distributed in the hope
|
||||
that it will be useful, but WITHOUT ANY WARRANTY; without even
|
||||
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
|
||||
PURPOSE. See the GNU General Public License for more details.
|
||||
|
||||
Please note that the General Public License version 2 does not permit
|
||||
incorporating MkSymbian into proprietary programs.
|
||||
}
|
||||
unit compiler;
|
||||
|
||||
{$ifdef fpc}
|
||||
{$mode delphi}{$H+}
|
||||
{$endif}
|
||||
|
||||
interface
|
||||
|
||||
uses
|
||||
Classes, SysUtils, Process,
|
||||
constants;
|
||||
|
||||
type
|
||||
|
||||
{ TCompiler }
|
||||
|
||||
TCompiler = class(TObject)
|
||||
private
|
||||
AProcess: TProcess;
|
||||
CurrentDirectory: string;
|
||||
MakeFolder, MakePartialFolder: string;
|
||||
public
|
||||
opts: TMkSymbianOptions;
|
||||
constructor Create;
|
||||
destructor Destroy; override;
|
||||
procedure FileCopy(source, dest: string);
|
||||
procedure MakeBuildPascal;
|
||||
procedure MakeBuildCpp;
|
||||
procedure MakeBuildBindings;
|
||||
procedure BuildUIDFile;
|
||||
procedure BuildResource(AFileName: string);
|
||||
procedure RegisterInEmulator;
|
||||
end;
|
||||
|
||||
var
|
||||
vCompiler: TCompiler;
|
||||
|
||||
implementation
|
||||
|
||||
uses sdkutil, projectparser;
|
||||
|
||||
{ TCompiler }
|
||||
|
||||
{*******************************************************************
|
||||
* TCompiler.Create ()
|
||||
*
|
||||
* DESCRIPTION: Initializes the compiler controlling object
|
||||
*
|
||||
* PARAMETERS: None
|
||||
*
|
||||
* RETURNS: Nothing
|
||||
*
|
||||
*******************************************************************}
|
||||
constructor TCompiler.Create;
|
||||
begin
|
||||
inherited Create;
|
||||
|
||||
AProcess := TProcess.Create(nil);
|
||||
|
||||
CurrentDirectory := ExtractFilePath(ParamStr(0));
|
||||
MakePartialFolder := Copy(CurrentDirectory, 3, Length(CurrentDirectory) - 2);
|
||||
MakeFolder := IncludeTrailingBackslash(CurrentDirectory);
|
||||
|
||||
AProcess.Options := AProcess.Options + [poWaitOnExit];
|
||||
end;
|
||||
|
||||
{*******************************************************************
|
||||
* TCompiler.Destroy ()
|
||||
*
|
||||
* DESCRIPTION: Finalizes the compiler controlling object
|
||||
*
|
||||
* PARAMETERS: None
|
||||
*
|
||||
* RETURNS: Nothing
|
||||
*
|
||||
*******************************************************************}
|
||||
destructor TCompiler.Destroy;
|
||||
begin
|
||||
AProcess.Free;
|
||||
|
||||
inherited Destroy;
|
||||
end;
|
||||
|
||||
{*******************************************************************
|
||||
* TCompiler.FileCopy ()
|
||||
*
|
||||
* DESCRIPTION: Copyes a file from source to dest
|
||||
*
|
||||
* PARAMETERS: source - Source file
|
||||
* dest - Destination file
|
||||
*
|
||||
* RETURNS: Nothing
|
||||
*
|
||||
*******************************************************************}
|
||||
procedure TCompiler.FileCopy(source, dest: string);
|
||||
var
|
||||
SourceStream, DestStream: TFileStream;
|
||||
begin
|
||||
SourceStream := TFileStream.Create(source, fmOpenRead);
|
||||
try
|
||||
DestStream := TFileStream.Create(dest, fmCreate);
|
||||
try
|
||||
DestStream.CopyFrom(SourceStream, 0);
|
||||
finally
|
||||
DestStream.Free;
|
||||
end;
|
||||
finally
|
||||
SourceStream.Free;
|
||||
end;
|
||||
end;
|
||||
|
||||
{*******************************************************************
|
||||
* TCompiler.MakeBuildPascal ()
|
||||
*
|
||||
* DESCRIPTION: Builds and links a Object Pascal project
|
||||
*
|
||||
* PARAMETERS: None
|
||||
*
|
||||
* RETURNS: Nothing
|
||||
*
|
||||
*******************************************************************}
|
||||
procedure TCompiler.MakeBuildPascal;
|
||||
var
|
||||
STR_LINK_FLAGSUDEB, STR_EPOCBLDUDEB, STR_LINK_OBJSUDEB: string;
|
||||
STR_GAS: string;
|
||||
STR_FPC_RTL_OBJECTS: string;
|
||||
begin
|
||||
|
||||
WriteLn('');
|
||||
WriteLn('Preparations for compiling');
|
||||
WriteLn('');
|
||||
|
||||
// First command
|
||||
|
||||
{ AProcess.CommandLine := 'perl -S makmake.pl -D ' + MakePartialFolder + 'QHELLOWORLD WINSCW';
|
||||
WriteLn(AProcess.CommandLine);
|
||||
AProcess.Execute;}
|
||||
|
||||
{ Creation of directories }
|
||||
|
||||
ForceDirectories(vSDKUtil.SDKFolder + 'EPOC32\DATA\Z\private\10003a3f\apps');
|
||||
|
||||
ForceDirectories(vSDKUtil.SDKFolder + 'EPOC32\RELEASE\WINSCW\UDEB\Z\private\10003a3f\apps');
|
||||
|
||||
ForceDirectories(MakeFolder + 'WINSCW\UDEB');
|
||||
|
||||
{ Compilation }
|
||||
|
||||
STR_GAS := 'C:\Programas\lazarus20\fpc\2.0.4\bin\i386-win32\as.exe';
|
||||
|
||||
WriteLn('');
|
||||
WriteLn('Compiling file ' + vProject.MainSource);
|
||||
WriteLn('');
|
||||
|
||||
AProcess.CommandLine := vProject.CompilerPath + ' -a -s -Fu' + vProject.RTLUnitsDir +
|
||||
' -Tsymbian QPasHello.pas';
|
||||
WriteLn(AProcess.CommandLine);
|
||||
AProcess.Execute;
|
||||
|
||||
WriteLn('');
|
||||
WriteLn('Assembling file QPasHello.s');
|
||||
WriteLn('');
|
||||
|
||||
AProcess.CommandLine := STR_GAS + ' QPasHello.s -o QPasHello.o';
|
||||
WriteLn(AProcess.CommandLine);
|
||||
AProcess.Execute;
|
||||
|
||||
{ UID File }
|
||||
|
||||
BuildUIDFile;
|
||||
|
||||
{ Linking }
|
||||
|
||||
STR_LINK_FLAGSUDEB := '-msgstyle gcc -stdlib "' +
|
||||
vSDKUtil.SDKPartialFolder + 'EPOC32\RELEASE\WINSCW\UDEB\EEXE.LIB" -m' +
|
||||
' "?_E32Bootstrap@@YGXXZ" -subsystem windows -g ' +
|
||||
vSDKUtil.SDKPartialFolder + 'EPOC32\RELEASE\WINSCW\UDEB\EUSER.LIB ' +
|
||||
'-o "' + MakeFolder + 'QPasHello.exe" -noimplib';
|
||||
STR_EPOCBLDUDEB := MakeFolder + 'WINSCW\UDEB';
|
||||
STR_LINK_OBJSUDEB := 'QPasHello.o ' + UID_OBJECT_FILENAME;
|
||||
STR_FPC_RTL_OBJECTS :=
|
||||
' ' + vProject.RTLUnitsDir + 'system.o' +
|
||||
' ' + vProject.RTLUnitsDir + 'symbian.o' +
|
||||
' ' + vProject.RTLUnitsDir + 'ctypes.o' +
|
||||
' ' + vProject.RTLUnitsDir + 'objpas.o' +
|
||||
' ' + vProject.RTLUnitsDir + 'pbeexe.o';
|
||||
|
||||
WriteLn('');
|
||||
WriteLn('Linking stage');
|
||||
WriteLn('');
|
||||
|
||||
AProcess.CommandLine := vSDKUtil.SDKFolder + Str_Path_CWTools +
|
||||
'mwldsym2.exe ' + STR_LINK_FLAGSUDEB +
|
||||
' -l ' + STR_EPOCBLDUDEB +
|
||||
' -search ' + STR_LINK_OBJSUDEB + STR_FPC_RTL_OBJECTS;
|
||||
WriteLn(AProcess.CommandLine);
|
||||
AProcess.Execute;
|
||||
|
||||
FileCopy(MakeFolder + 'QPasHello.exe',
|
||||
vSDKUtil.SDKPartialFolder + 'EPOC32\RELEASE\WINSCW\UDEB\' + 'QPasHello.exe');
|
||||
end;
|
||||
|
||||
{*******************************************************************
|
||||
* TCompiler.MakeBuildCpp ()
|
||||
*
|
||||
* DESCRIPTION: Builds and links a C++ project
|
||||
*
|
||||
* PARAMETERS: None
|
||||
*
|
||||
* RETURNS: Nothing
|
||||
*
|
||||
*******************************************************************}
|
||||
procedure TCompiler.MakeBuildCpp;
|
||||
var
|
||||
STR_LINK_FLAGSUDEB, STR_EPOCBLDUDEB, STR_LINK_OBJSUDEB,
|
||||
STR_CWUFLAGS, STR_CWDEFS, STR_INCDIR, STR_CWUDEB: string;
|
||||
begin
|
||||
|
||||
WriteLn('');
|
||||
WriteLn('Preparations for compiling');
|
||||
WriteLn('');
|
||||
|
||||
// First command
|
||||
|
||||
AProcess.CommandLine := 'perl -S makmake.pl -D ' + MakePartialFolder + 'QHELLOWORLD WINSCW';
|
||||
WriteLn(AProcess.CommandLine);
|
||||
AProcess.Execute;
|
||||
|
||||
{ Creation of directories }
|
||||
|
||||
ForceDirectories(vSDKUtil.SDKFolder + 'EPOC32\DATA\Z\private\10003a3f\apps');
|
||||
|
||||
ForceDirectories(vSDKUtil.SDKFolder + 'EPOC32\RELEASE\WINSCW\UDEB\Z\private\10003a3f\apps');
|
||||
|
||||
ForceDirectories(MakeFolder + 'WINSCW\UDEB');
|
||||
|
||||
// TODO: Check if this can be safely removed
|
||||
// ForceDirectories(MakeFolder + 'QHelloWorld\WINSCW');
|
||||
|
||||
{ Compilation }
|
||||
|
||||
STR_CWUFLAGS := '-wchar_t off -align 4 -warnings on ' +
|
||||
'-w nohidevirtual,nounusedexpr -msgstyle gcc -enum int -str pool -exc ms -trigraphs on -nostdinc';
|
||||
STR_CWDEFS := '-d "__SYMBIAN32__" -d "__CW32__" -d "__WINS__" -d "__WINSCW__" -d "__EXE__" -d "__SUPPORT_CPP_EXCEPTIONS__" ';
|
||||
STR_INCDIR := '-cwd source -i- ' +
|
||||
'-i "' + vSDKUtil.SDKPartialFolder + 'EPOC32\include" ' +
|
||||
'-i "' + vSDKUtil.SDKPartialFolder + 'epoc32\include\variant" ' +
|
||||
'-i "' + vSDKUtil.SDKPartialFolder + 'epoc32\include\variant\ " ' +
|
||||
'-include "UIQ_3.0.hrh"';
|
||||
STR_CWUDEB := 'mwccsym2.exe -g -O0 -inline off ' + STR_CWUFLAGS + ' -d _DEBUG -d _UNICODE ' + STR_CWDEFS + STR_INCDIR;
|
||||
|
||||
WriteLn('');
|
||||
WriteLn('Compiling file ' + vProject.MainSource);
|
||||
WriteLn('');
|
||||
|
||||
AProcess.CommandLine := STR_CWUDEB +
|
||||
' -o "' + MakeFolder + 'WINSCW\UDEB\' + vProject.MainSourceNoExt + '.o"' +
|
||||
' -c "' + MakeFolder + 'src\' + vProject.MainSource + '"';
|
||||
WriteLn(AProcess.CommandLine);
|
||||
AProcess.Execute;
|
||||
|
||||
{ UID File }
|
||||
|
||||
BuildUIDFile;
|
||||
|
||||
{ Linking }
|
||||
|
||||
STR_LINK_FLAGSUDEB := '-msgstyle gcc' +
|
||||
' -stdlib "' + vSDKUtil.SDKPartialFolder + 'EPOC32\RELEASE\WINSCW\UDEB\EEXE.LIB"' +
|
||||
' -m "?_E32Bootstrap@@YGXXZ" -subsystem windows' +
|
||||
' -g ' + vSDKUtil.SDKPartialFolder + 'EPOC32\RELEASE\WINSCW\UDEB\EUSER.LIB' +
|
||||
' -o "' + vSDKUtil.SDKPartialFolder + 'EPOC32\RELEASE\WINSCW\UDEB\' + vProject.MainSourceNoExt + '.exe"' +
|
||||
' -noimplib';
|
||||
STR_EPOCBLDUDEB := MakeFolder + 'WINSCW\UDEB';
|
||||
STR_LINK_OBJSUDEB := vProject.MainSourceNoExt + '.o ' + UID_OBJECT_FILENAME;
|
||||
|
||||
WriteLn('');
|
||||
WriteLn('Linking stage');
|
||||
WriteLn('');
|
||||
|
||||
AProcess.CommandLine := 'mwldsym2.exe ' + STR_LINK_FLAGSUDEB +
|
||||
' -l ' + STR_EPOCBLDUDEB +
|
||||
' -search ' + STR_LINK_OBJSUDEB;
|
||||
WriteLn(AProcess.CommandLine);
|
||||
AProcess.Execute;
|
||||
end;
|
||||
|
||||
{*******************************************************************
|
||||
* TCompiler.MakeBuildBindings ()
|
||||
*
|
||||
* DESCRIPTION: Builds and links the C interface for the symbian libraries
|
||||
*
|
||||
* PARAMETERS: None
|
||||
*
|
||||
* RETURNS: Nothing
|
||||
*
|
||||
*******************************************************************}
|
||||
procedure TCompiler.MakeBuildBindings;
|
||||
var
|
||||
STR_CWUFLAGS, STR_CWDEFS, STR_INCDIR, STR_CWUDEB, STR_CWCOMPILER: string;
|
||||
begin
|
||||
|
||||
{ Compilation }
|
||||
|
||||
STR_CWUFLAGS := '-wchar_t off -align 4 -warnings on ' +
|
||||
'-w nohidevirtual,nounusedexpr -msgstyle gcc -enum int -str pool -exc ms -trigraphs on -nostdinc';
|
||||
STR_CWDEFS := '-d "__SYMBIAN32__" -d "__CW32__" -d "__WINS__" -d "__WINSCW__" -d "__EXE__" -d "__SUPPORT_CPP_EXCEPTIONS__" ';
|
||||
STR_INCDIR := '-cwd source -i-' +
|
||||
' -i "' + vSDKUtil.SDKPartialFolder + 'EPOC32\include"' +
|
||||
' -i "' + vSDKUtil.SDKPartialFolder + 'epoc32\include\variant"' +
|
||||
' -i "' + vSDKUtil.SDKPartialFolder + 'epoc32\include\variant\ "' +
|
||||
' -include "UIQ_3.0.hrh"';
|
||||
STR_CWCOMPILER := vSDKUtil.SDKFolder + Str_Path_CWTools + 'mwccsym2.exe';
|
||||
STR_CWUDEB := STR_CWCOMPILER + ' -g -O0 -inline off ' + STR_CWUFLAGS + ' -d _DEBUG -d _UNICODE ' + STR_CWDEFS + STR_INCDIR;
|
||||
|
||||
WriteLn('');
|
||||
WriteLn('Compiling file pbeexe.cpp');
|
||||
WriteLn('');
|
||||
|
||||
AProcess.CommandLine := STR_CWUDEB + ' -o "' + MakePartialFolder + 'pbeexe.o" ' +
|
||||
'-c "' + MakePartialFolder + 'pbeexe.cpp"';
|
||||
WriteLn(AProcess.CommandLine);
|
||||
AProcess.Execute;
|
||||
|
||||
FileCopy(MakePartialFolder + 'pbeexe.o', vProject.RTLUnitsDir + 'pbeexe.o');
|
||||
end;
|
||||
|
||||
{*******************************************************************
|
||||
* TCompiler.BuildUIDFile ()
|
||||
*
|
||||
* DESCRIPTION: Generates and compiles a UID file
|
||||
*
|
||||
* PARAMETERS: None
|
||||
*
|
||||
* RETURNS: Nothing
|
||||
*
|
||||
*******************************************************************}
|
||||
procedure TCompiler.BuildUIDFile;
|
||||
var
|
||||
Str_UIDFile: string;
|
||||
UIDFile: TFileStream;
|
||||
STR_CWUFLAGS, STR_CWDEFS, STR_INCDIR, STR_CWUDEB, STR_CWCOMPILER: string;
|
||||
begin
|
||||
{ First creates the UID file }
|
||||
|
||||
WriteLn('');
|
||||
WriteLn('Creating UID file');
|
||||
WriteLn('');
|
||||
|
||||
Str_UIDFile :=
|
||||
'// mksymbian-generated uid source file' + LineEnding +
|
||||
'#include <e32cmn.h>' + LineEnding +
|
||||
'#pragma data_seg(".SYMBIAN")' + LineEnding +
|
||||
'__EMULATOR_IMAGE_HEADER2(0x1000007a,' + vProject.UID2 + ',' + vProject.UID3 +
|
||||
',EPriorityForeground,0x00000000u,0x00000000u,0x01000001,0,0x00010000,0)' + LineEnding +
|
||||
'#pragma data_seg()' + LineEnding;
|
||||
|
||||
UIDFile := TFileStream.Create(UID_SOURCE_FILENAME, fmCreate);
|
||||
try
|
||||
UIDFile.Write(Pointer(Str_UIDFile)^, Length(Str_UIDFile));
|
||||
finally
|
||||
UIDFile.Free;
|
||||
end;
|
||||
|
||||
{ Compilation }
|
||||
|
||||
STR_CWUFLAGS := '-wchar_t off -align 4 -warnings on ' +
|
||||
'-w nohidevirtual,nounusedexpr -msgstyle gcc -enum int -str pool -exc ms -trigraphs on -nostdinc';
|
||||
STR_CWDEFS := '-d "__SYMBIAN32__" -d "__CW32__" -d "__WINS__" -d "__WINSCW__" -d "__EXE__" -d "__SUPPORT_CPP_EXCEPTIONS__" ';
|
||||
STR_INCDIR := '-cwd source -i- ' +
|
||||
' -i "' + vSDKUtil.SDKPartialFolder + 'EPOC32\include" ' +
|
||||
' -i "' + vSDKUtil.SDKPartialFolder + 'epoc32\include\variant" ' +
|
||||
' -i "' + vSDKUtil.SDKPartialFolder + 'epoc32\include\variant\ "' +
|
||||
' -include "UIQ_3.0.hrh"';
|
||||
STR_CWCOMPILER := vSDKUtil.SDKFolder + Str_Path_CWTools + 'mwccsym2.exe';
|
||||
STR_CWUDEB := STR_CWCOMPILER + ' -g -O0 -inline off ' + STR_CWUFLAGS + ' -d _DEBUG -d _UNICODE ' + STR_CWDEFS + STR_INCDIR;
|
||||
|
||||
WriteLn('');
|
||||
WriteLn('Compiling file ' + UID_SOURCE_FILENAME);
|
||||
WriteLn('');
|
||||
|
||||
AProcess.CommandLine := STR_CWUDEB +
|
||||
' -o "' + MakeFolder + UID_OBJECT_FILENAME + '"' +
|
||||
' -c "' + MakeFolder + UID_SOURCE_FILENAME + '"';
|
||||
WriteLn(AProcess.CommandLine);
|
||||
AProcess.Execute;
|
||||
end;
|
||||
|
||||
{*******************************************************************
|
||||
* TCompiler.BuildResource ()
|
||||
*
|
||||
* DESCRIPTION: Builds a resource file
|
||||
*
|
||||
* PARAMETERS: None
|
||||
*
|
||||
* RETURNS: Nothing
|
||||
*
|
||||
*******************************************************************}
|
||||
procedure TCompiler.BuildResource(AFileName: string);
|
||||
begin
|
||||
WriteLn('');
|
||||
WriteLn('Preprocessing resource file: ' + AFileName);
|
||||
WriteLn('');
|
||||
|
||||
AProcess.CommandLine := vSDKUtil.SDKFolder + Str_Path_Cpp +
|
||||
' -lang-c++' +
|
||||
' -I ' + vSDKUtil.SDKPartialFolder + 'EPOC32\include' +
|
||||
' -I ' + vSDKUtil.SDKPartialFolder + 'epoc32\include\variant' +
|
||||
' ' + MakeFolder + AFileName +
|
||||
' ' + MakeFolder + ChangeFileExt(AFileName, STR_RESOURCE_TMP_EXT);
|
||||
WriteLn(AProcess.CommandLine);
|
||||
AProcess.Execute;
|
||||
|
||||
WriteLn('');
|
||||
WriteLn('Building resource file: ' + AFileName);
|
||||
WriteLn('');
|
||||
|
||||
AProcess.CommandLine := vSDKUtil.SDKFolder + Str_Path_RComp +
|
||||
' -v -u' +
|
||||
' -o"' + MakeFolder + ChangeFileExt(AFileName, STR_RESOURCE_EXT) + '"' +
|
||||
' -s"' + MakeFolder + ChangeFileExt(AFileName, STR_RESOURCE_TMP_EXT) + '"';
|
||||
WriteLn(AProcess.CommandLine);
|
||||
AProcess.Execute;
|
||||
end;
|
||||
|
||||
{*******************************************************************
|
||||
* TCompiler.RegisterInEmulator ()
|
||||
*
|
||||
* DESCRIPTION: Registers a software in the emulator
|
||||
* At this point the resource file must already be compiled
|
||||
*
|
||||
* PARAMETERS: None
|
||||
*
|
||||
* RETURNS: Nothing
|
||||
*
|
||||
*******************************************************************}
|
||||
procedure TCompiler.RegisterInEmulator;
|
||||
var
|
||||
StrFrom, StrTo: string;
|
||||
begin
|
||||
WriteLn('');
|
||||
WriteLn('Registering the software on the emulator');
|
||||
WriteLn('');
|
||||
|
||||
StrFrom := MakeFolder + ChangeFileExt(vProject.MainResource, STR_RESOURCE_EXT);
|
||||
StrTo := vSDKUtil.SDKFolder + Str_Path_Emulator_Registration +
|
||||
ChangeFileExt(vProject.MainResource, STR_RESOURCE_EXT);
|
||||
|
||||
WriteLn('');
|
||||
WriteLn('Copying file: ', StrFrom);
|
||||
WriteLn('To: ', StrTo);
|
||||
WriteLn('');
|
||||
|
||||
FileCopy(StrFrom, StrTo);
|
||||
end;
|
||||
|
||||
end.
|
||||
|
105
utils/mksymbian/constants.pas
Normal file
105
utils/mksymbian/constants.pas
Normal file
@ -0,0 +1,105 @@
|
||||
{
|
||||
constants.pas
|
||||
|
||||
Constants
|
||||
|
||||
Copyright (C) 2006-2007 Felipe Monteiro de Carvalho
|
||||
|
||||
This file is part of MkSymbian build tool.
|
||||
|
||||
MkSymbian is free software;
|
||||
you can redistribute it and/or modify it under the
|
||||
terms of the GNU General Public License version 2
|
||||
as published by the Free Software Foundation.
|
||||
|
||||
MkSymbian is distributed in the hope
|
||||
that it will be useful, but WITHOUT ANY WARRANTY; without even
|
||||
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
|
||||
PURPOSE. See the GNU General Public License for more details.
|
||||
|
||||
Please note that the General Public License version 2 does not permit
|
||||
incorporating MkSymbian into proprietary programs.
|
||||
}
|
||||
unit constants;
|
||||
|
||||
{$ifdef fpc}
|
||||
{$mode delphi}{$H+}
|
||||
{$endif}
|
||||
|
||||
interface
|
||||
|
||||
uses
|
||||
Classes, SysUtils;
|
||||
|
||||
type
|
||||
|
||||
{ Options from the command line }
|
||||
|
||||
TMkSymbianTask = (stNothing, stBuildApp, stBuildBindings);
|
||||
|
||||
TMkSymbianOptions = record
|
||||
Task: TMkSymbianTask;
|
||||
ProjectFile: string;
|
||||
end;
|
||||
|
||||
{ Commands }
|
||||
|
||||
const
|
||||
paramBuild = 'build';
|
||||
paramBindings = 'bindings';
|
||||
paramShowPath = 'showpath';
|
||||
|
||||
{ Paths on the SDK }
|
||||
const
|
||||
Str_Path_CWTools = 'epoc32\tools\nokia_compiler\Symbian_Tools\Command_Line_Tools\';
|
||||
Str_Path_RComp = 'epoc32\tools\rcomp.exe';
|
||||
Str_Path_Cpp = 'epoc32\tools\scpp.exe';
|
||||
Str_Path_Emulator_Registration = 'epoc32\release\winscw\udeb\Z\private\10003a3f\apps\';
|
||||
|
||||
{ Other constants }
|
||||
const
|
||||
UID_SOURCE_FILENAME = 'QUID.cpp';
|
||||
UID_OBJECT_FILENAME = 'QUID.o';
|
||||
|
||||
STR_RESOURCE_TMP_EXT = '.pprsc';
|
||||
STR_RESOURCE_EXT = '.rsc';
|
||||
|
||||
{ Strings from the project file }
|
||||
const
|
||||
{ Sections }
|
||||
STR_PRJ_Main = 'Main';
|
||||
STR_PRJ_FPC = 'FPC';
|
||||
STR_PRJ_UIDs = 'UIDs';
|
||||
STR_PRJ_Files = 'Files';
|
||||
STR_PRJ_Objects = 'Objects';
|
||||
STR_PRJ_RTLObjects = 'RTLObjects';
|
||||
|
||||
{ Identifiers }
|
||||
STR_PRJ_EXEName = 'EXEName';
|
||||
STR_PRJ_Language = 'Language';
|
||||
STR_PRJ_CompilerDir = 'CompilerDir';
|
||||
STR_PRJ_ProjectType = 'ProjectType';
|
||||
STR_PRJ_SDK = 'SDK';
|
||||
STR_PRJ_SDKVersion = 'SDKVersion';
|
||||
STR_PRJ_Emulator = 'Emulator';
|
||||
|
||||
STR_PRJ_CompilerPath = 'CompilerPath';
|
||||
STR_PRJ_RTLUnitsDir = 'RTLUnitsDir';
|
||||
|
||||
STR_PRJ_UID2 = 'UID2';
|
||||
STR_PRJ_UID3 = 'UID3';
|
||||
|
||||
STR_PRJ_MainSource = 'mainsource';
|
||||
STR_PRJ_MainResource = 'mainresource';
|
||||
|
||||
STR_PRJ_File = 'file';
|
||||
|
||||
{ Options }
|
||||
|
||||
STR_OPT_Cpp = 'C++';
|
||||
STR_OPT_Pascal = 'Pascal';
|
||||
|
||||
implementation
|
||||
|
||||
end.
|
||||
|
79
utils/mksymbian/mksymbian.lpi
Normal file
79
utils/mksymbian/mksymbian.lpi
Normal file
@ -0,0 +1,79 @@
|
||||
<?xml version="1.0"?>
|
||||
<CONFIG>
|
||||
<ProjectOptions>
|
||||
<PathDelim Value="\"/>
|
||||
<Version Value="5"/>
|
||||
<General>
|
||||
<Flags>
|
||||
<MainUnitHasUsesSectionForAllUnits Value="False"/>
|
||||
<MainUnitHasCreateFormStatements Value="False"/>
|
||||
<MainUnitHasTitleStatement Value="False"/>
|
||||
</Flags>
|
||||
<SessionStorage Value="InProjectDir"/>
|
||||
<MainUnit Value="0"/>
|
||||
<IconPath Value="./"/>
|
||||
<TargetFileExt Value=".exe"/>
|
||||
</General>
|
||||
<VersionInfo>
|
||||
<ProjectVersion Value=""/>
|
||||
</VersionInfo>
|
||||
<PublishOptions>
|
||||
<Version Value="2"/>
|
||||
<IncludeFileFilter Value="*.(pas|pp|inc|lfm|lpr|lrs|lpi|lpk|sh|xml)"/>
|
||||
<ExcludeFileFilter Value="*.(bak|ppu|ppw|o|so);*~;backup"/>
|
||||
</PublishOptions>
|
||||
<RunParams>
|
||||
<local>
|
||||
<FormatVersion Value="1"/>
|
||||
<LaunchingApplication PathPlusParams="/usr/X11R6/bin/xterm -T 'Lazarus Run Output' -e $(LazarusDir)/tools/runwait.sh $(TargetCmdLine)"/>
|
||||
</local>
|
||||
</RunParams>
|
||||
<Units Count="7">
|
||||
<Unit0>
|
||||
<Filename Value="mksymbian.pas"/>
|
||||
<IsPartOfProject Value="True"/>
|
||||
<UnitName Value="mksymbian"/>
|
||||
</Unit0>
|
||||
<Unit1>
|
||||
<Filename Value="cmdline.pas"/>
|
||||
<IsPartOfProject Value="True"/>
|
||||
<UnitName Value="cmdline"/>
|
||||
</Unit1>
|
||||
<Unit2>
|
||||
<Filename Value="constants.pas"/>
|
||||
<IsPartOfProject Value="True"/>
|
||||
<UnitName Value="constants"/>
|
||||
</Unit2>
|
||||
<Unit3>
|
||||
<Filename Value="cfgfile.pas"/>
|
||||
<IsPartOfProject Value="True"/>
|
||||
<UnitName Value="cfgfile"/>
|
||||
</Unit3>
|
||||
<Unit4>
|
||||
<Filename Value="sdkutil.pas"/>
|
||||
<IsPartOfProject Value="True"/>
|
||||
<UnitName Value="sdkutil"/>
|
||||
</Unit4>
|
||||
<Unit5>
|
||||
<Filename Value="compiler.pas"/>
|
||||
<IsPartOfProject Value="True"/>
|
||||
<UnitName Value="compiler"/>
|
||||
</Unit5>
|
||||
<Unit6>
|
||||
<Filename Value="projectparser.pas"/>
|
||||
<IsPartOfProject Value="True"/>
|
||||
<UnitName Value="projectparser"/>
|
||||
</Unit6>
|
||||
</Units>
|
||||
</ProjectOptions>
|
||||
<CompilerOptions>
|
||||
<Version Value="5"/>
|
||||
<PathDelim Value="\"/>
|
||||
<CodeGeneration>
|
||||
<Generate Value="Faster"/>
|
||||
</CodeGeneration>
|
||||
<Other>
|
||||
<CompilerPath Value="$(CompPath)"/>
|
||||
</Other>
|
||||
</CompilerOptions>
|
||||
</CONFIG>
|
84
utils/mksymbian/mksymbian.pas
Normal file
84
utils/mksymbian/mksymbian.pas
Normal file
@ -0,0 +1,84 @@
|
||||
{
|
||||
mksymbian.pas
|
||||
|
||||
Main program file
|
||||
|
||||
Copyright (C) 2006-2007 Felipe Monteiro de Carvalho
|
||||
|
||||
This file is part of MkSymbian build tool.
|
||||
|
||||
MkSymbian is free software;
|
||||
you can redistribute it and/or modify it under the
|
||||
terms of the GNU General Public License version 2
|
||||
as published by the Free Software Foundation.
|
||||
|
||||
MkSymbian is distributed in the hope
|
||||
that it will be useful, but WITHOUT ANY WARRANTY; without even
|
||||
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
|
||||
PURPOSE. See the GNU General Public License for more details.
|
||||
|
||||
Please note that the General Public License version 2 does not permit
|
||||
incorporating MkSymbian into proprietary programs.
|
||||
}
|
||||
program mksymbian;
|
||||
|
||||
{$ifdef fpc}
|
||||
{$mode delphi}{$H+}
|
||||
{$endif}
|
||||
|
||||
{$apptype console}
|
||||
|
||||
uses
|
||||
Classes, SysUtils,
|
||||
cmdline, constants, cfgfile, sdkutil, compiler, projectparser;
|
||||
|
||||
var
|
||||
opts: TMkSymbianOptions;
|
||||
begin
|
||||
|
||||
vSDKUtil := TSDKUtil.Create;
|
||||
vCmdLine := TCmdLine.Create;
|
||||
vCompiler := TCompiler.Create;
|
||||
vProject := TProject.Create;
|
||||
|
||||
try
|
||||
vCmdLine.ParseCmdLineOptions(opts);
|
||||
|
||||
vCompiler.opts := opts;
|
||||
vProject.opts := opts;
|
||||
|
||||
case opts.task of
|
||||
|
||||
stBuildApp:
|
||||
begin
|
||||
vProject.ParseFile;
|
||||
|
||||
if CompareText(vProject.Language, STR_OPT_Cpp) = 0 then
|
||||
vCompiler.MakeBuildCpp
|
||||
else
|
||||
vCompiler.MakeBuildPascal;
|
||||
|
||||
vCompiler.BuildResource(vProject.MainResource);
|
||||
|
||||
vCompiler.RegisterInEmulator;
|
||||
end;
|
||||
|
||||
stBuildBindings:
|
||||
begin
|
||||
vProject.ParseFile;
|
||||
|
||||
vCompiler.MakeBuildBindings;
|
||||
end;
|
||||
|
||||
end;
|
||||
|
||||
finally
|
||||
vCmdLine.Free;
|
||||
vSDKUtil.Free;
|
||||
vCompiler.Free;
|
||||
vProject.Free;
|
||||
|
||||
end;
|
||||
|
||||
end.
|
||||
|
95
utils/mksymbian/projectparser.pas
Normal file
95
utils/mksymbian/projectparser.pas
Normal file
@ -0,0 +1,95 @@
|
||||
{
|
||||
projectparser.pas
|
||||
|
||||
Parses the project file
|
||||
|
||||
Copyright (C) 2006-2007 Felipe Monteiro de Carvalho
|
||||
|
||||
This file is part of MkSymbian build tool.
|
||||
|
||||
MkSymbian is free software;
|
||||
you can redistribute it and/or modify it under the
|
||||
terms of the GNU General Public License version 2
|
||||
as published by the Free Software Foundation.
|
||||
|
||||
MkSymbian is distributed in the hope
|
||||
that it will be useful, but WITHOUT ANY WARRANTY; without even
|
||||
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
|
||||
PURPOSE. See the GNU General Public License for more details.
|
||||
|
||||
Please note that the General Public License version 2 does not permit
|
||||
incorporating MkSymbian into proprietary programs.
|
||||
}
|
||||
unit projectparser;
|
||||
|
||||
{$ifdef fpc}
|
||||
{$mode delphi}{$H+}
|
||||
{$endif}
|
||||
|
||||
interface
|
||||
|
||||
uses
|
||||
Classes, SysUtils, IniFiles,
|
||||
constants;
|
||||
|
||||
type
|
||||
|
||||
{ TProject }
|
||||
|
||||
TProject = class(TObject)
|
||||
public
|
||||
opts: TMkSymbianOptions;
|
||||
{ Main section }
|
||||
ExeName, Language: string;
|
||||
{ FPC section }
|
||||
CompilerPath, RTLUnitsDir: string;
|
||||
{ UIDs section }
|
||||
UID2, UID3: string;
|
||||
{ Files section }
|
||||
MainSource, MainSourceNoExt, MainResource: string;
|
||||
public
|
||||
procedure ParseFile;
|
||||
end;
|
||||
|
||||
var
|
||||
vProject: TProject;
|
||||
|
||||
implementation
|
||||
|
||||
{ TProject }
|
||||
|
||||
{*******************************************************************
|
||||
* TProject.ParseFile ()
|
||||
*
|
||||
* DESCRIPTION: Parses the project file
|
||||
*
|
||||
* PARAMETERS: None
|
||||
*
|
||||
* RETURNS: Nothing
|
||||
*
|
||||
*******************************************************************}
|
||||
procedure TProject.ParseFile;
|
||||
var
|
||||
IniFile: TIniFile;
|
||||
begin
|
||||
IniFile := TIniFile.Create(opts.ProjectFile);
|
||||
try
|
||||
ExeName := IniFile.ReadString(STR_PRJ_Files, STR_PRJ_ExeName, 'default.exe');
|
||||
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');
|
||||
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');
|
||||
UID3 := IniFile.ReadString(STR_PRJ_UIDs, STR_PRJ_UID3, '0xE1000002');
|
||||
|
||||
MainSource := IniFile.ReadString(STR_PRJ_Files, STR_PRJ_MainSource, 'default.pas');
|
||||
MainSourceNoExt := ExtractFileExt(MainSource);
|
||||
MainResource := IniFile.ReadString(STR_PRJ_Files, STR_PRJ_MainResource, 'default.rss');
|
||||
finally
|
||||
IniFile.Free;
|
||||
end;
|
||||
end;
|
||||
|
||||
end.
|
||||
|
88
utils/mksymbian/sdkutil.pas
Normal file
88
utils/mksymbian/sdkutil.pas
Normal file
@ -0,0 +1,88 @@
|
||||
{
|
||||
sdkutil.pas
|
||||
|
||||
SDK utility methods
|
||||
|
||||
Copyright (C) 2006-2007 Felipe Monteiro de Carvalho
|
||||
|
||||
This file is part of MkSymbian build tool.
|
||||
|
||||
MkSymbian is free software;
|
||||
you can redistribute it and/or modify it under the
|
||||
terms of the GNU General Public License version 2
|
||||
as published by the Free Software Foundation.
|
||||
|
||||
MkSymbian is distributed in the hope
|
||||
that it will be useful, but WITHOUT ANY WARRANTY; without even
|
||||
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
|
||||
PURPOSE. See the GNU General Public License for more details.
|
||||
|
||||
Please note that the General Public License version 2 does not permit
|
||||
incorporating MkSymbian into proprietary programs.
|
||||
}
|
||||
unit sdkutil;
|
||||
|
||||
{$ifdef fpc}
|
||||
{$mode delphi}{$H+}
|
||||
{$endif}
|
||||
|
||||
interface
|
||||
|
||||
uses
|
||||
Classes, SysUtils, registry;
|
||||
|
||||
type
|
||||
|
||||
{ TSDKUtil }
|
||||
|
||||
TSDKUtil = class(TObject)
|
||||
private
|
||||
vSDKFolder, vSDKPartialFolder: string;
|
||||
public
|
||||
constructor Create;
|
||||
procedure LocateSDK;
|
||||
|
||||
property SDKFolder: string read vSDKFolder;
|
||||
property SDKPartialFolder: string read vSDKPartialFolder;
|
||||
end;
|
||||
|
||||
var
|
||||
vSDKUtil: TSDKUtil;
|
||||
|
||||
implementation
|
||||
|
||||
{ TSDKUtil }
|
||||
|
||||
procedure TSDKUtil.LocateSDK;
|
||||
var
|
||||
Reg: TRegistry;
|
||||
BufferStr: string;
|
||||
begin
|
||||
Reg := TRegistry.Create;
|
||||
|
||||
try
|
||||
Reg.RootKey := HKEY_LOCAL_MACHINE;
|
||||
if Reg.OpenKey('\SOFTWARE\Symbian\UIQ\SDK\UIQ3SDK', False) then
|
||||
begin
|
||||
BufferStr := Reg.ReadString('InstallPath');
|
||||
vSDKFolder := IncludeTrailingBackslash(BufferStr);
|
||||
vSDKPartialFolder := Copy(vSDKFolder, 3, Length(vSDKFolder) - 2);
|
||||
end
|
||||
else
|
||||
begin
|
||||
WriteLn(' ERROR: Could not locate the SDK, using default values');
|
||||
vSDKPartialFolder := '\Symbian\UIQ3SDK\';
|
||||
vSDKFolder := 'C:' + vSDKPartialFolder;
|
||||
end;
|
||||
finally
|
||||
Reg.Free;
|
||||
end;
|
||||
end;
|
||||
|
||||
constructor TSDKUtil.Create;
|
||||
begin
|
||||
LocateSDK;
|
||||
end;
|
||||
|
||||
end.
|
||||
|
Loading…
Reference in New Issue
Block a user