summaryrefslogtreecommitdiff
path: root/fpcsrc/utils/mksymbian/mksymbian.pas
blob: 2dccf9563e5ba75a050d318c57330331a58809b1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
{
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

  vProject := TProject.Create;
  vSDKUtil := TSDKUtil.Create;
  vCmdLine := TCmdLine.Create;
  vCompiler := TCompiler.Create;

  try
    vCmdLine.ParseCmdLineOptions(opts);
    
    vCompiler.opts := opts;
    vProject.opts := opts;

    case opts.task of

      stBuildApp:
      begin
        vProject.ParseFile;
        
        { compilation }
        
        if CompareText(vProject.Language, STR_OPT_Cpp) = 0 then
         vCompiler.MakeBuildCpp
        else
         vCompiler.MakeBuildPascal;

        if vSDKUtil.SDKVersion = sdkUIQ3 then
        begin
          { Main resource file }
        
          vCompiler.BuildResource(vProject.MainResource);

          vCompiler.InstallResource(vProject.MainResource);

          { Registration resource file }
        
          vCompiler.BuildResource(vProject.RegResource);

          vCompiler.RegisterInEmulator;
        end;
      end;

      stBuildBindings:
      begin
        vProject.ParseFile;

        vCompiler.MakeBuildBindings;
      end;
    end;
    
  finally
    vCmdLine.Free;
    vSDKUtil.Free;
    vCompiler.Free;
    vProject.Free;
  end;
end.