projectparser.pas 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122
  1. {
  2. projectparser.pas
  3. Parses the project file
  4. Copyright (C) 2006-2007 Felipe Monteiro de Carvalho
  5. This file is part of MkSymbian build tool.
  6. MkSymbian is free software;
  7. you can redistribute it and/or modify it under the
  8. terms of the GNU General Public License version 2
  9. as published by the Free Software Foundation.
  10. MkSymbian is distributed in the hope
  11. that it will be useful, but WITHOUT ANY WARRANTY; without even
  12. the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
  13. PURPOSE. See the GNU General Public License for more details.
  14. Please note that the General Public License version 2 does not permit
  15. incorporating MkSymbian into proprietary programs.
  16. }
  17. unit projectparser;
  18. {$ifdef fpc}
  19. {$mode delphi}{$H+}
  20. {$endif}
  21. interface
  22. uses
  23. Classes, SysUtils, IniFiles,
  24. constants;
  25. type
  26. { TProject }
  27. TProject = class(TObject)
  28. public
  29. opts: TMkSymbianOptions;
  30. { Main section }
  31. ExeName, Language, ProjectType, SDK, SDKVersion: string;
  32. Emulator: Boolean;
  33. { FPC section }
  34. CompilerPath, AssemblerPath, RTLUnitsDir: string;
  35. { UIDs section }
  36. UID2, UID3: string;
  37. { Files section }
  38. MainSource, MainSourceNoExt, MainResource, RegResource: string;
  39. { Objects section }
  40. ObjectFiles: TStringList;
  41. public
  42. constructor Create;
  43. destructor Destroy; override;
  44. procedure ParseFile;
  45. end;
  46. var
  47. vProject: TProject;
  48. implementation
  49. { TProject }
  50. constructor TProject.Create;
  51. begin
  52. inherited Create;
  53. ObjectFiles := TStringList.Create;
  54. end;
  55. destructor TProject.Destroy;
  56. begin
  57. ObjectFiles.Free;
  58. inherited Destroy;
  59. end;
  60. {*******************************************************************
  61. * TProject.ParseFile ()
  62. *
  63. * DESCRIPTION: Parses the project file
  64. *
  65. * PARAMETERS: None
  66. *
  67. * RETURNS: Nothing
  68. *
  69. *******************************************************************}
  70. procedure TProject.ParseFile;
  71. var
  72. IniFile: TIniFile;
  73. begin
  74. IniFile := TIniFile.Create(opts.ProjectFile);
  75. try
  76. ExeName := IniFile.ReadString(STR_PRJ_Files, STR_PRJ_ExeName, 'default.exe');
  77. Language := IniFile.ReadString(STR_PRJ_Files, STR_PRJ_Language, 'Pascal');
  78. ProjectType := IniFile.ReadString(STR_PRJ_Files, STR_PRJ_ProjectType, 'EXE');
  79. SDK := IniFile.ReadString(STR_PRJ_Files, STR_PRJ_SDK, 'UIQ');
  80. SDKVersion := IniFile.ReadString(STR_PRJ_Files, STR_PRJ_SDKVersion, '2.1');
  81. Emulator := IniFile.ReadBool(STR_PRJ_Files, STR_PRJ_Emulator, False);
  82. CompilerPath := IniFile.ReadString(STR_PRJ_FPC, STR_PRJ_CompilerPath, 'C:\Programas\fpc21\compiler\ppc386.exe');
  83. AssemblerPath := IniFile.ReadString(STR_PRJ_FPC, STR_PRJ_AssemblerPath, 'C:\Programas\lazarus20\fpc\2.1.5\bin\i386-win32\as.exe');
  84. RTLUnitsDir := IniFile.ReadString(STR_PRJ_FPC, STR_PRJ_RTLUnitsDir, 'C:\Programas\fpc21\rtl\units\i386-symbian\');
  85. UID2 := IniFile.ReadString(STR_PRJ_UIDs, STR_PRJ_UID2, '0x100039CE');
  86. UID3 := IniFile.ReadString(STR_PRJ_UIDs, STR_PRJ_UID3, '0xE1000002');
  87. MainSource := IniFile.ReadString(STR_PRJ_Files, STR_PRJ_MainSource, 'default.pas');
  88. MainSourceNoExt := ExtractFileExt(MainSource);
  89. MainResource := IniFile.ReadString(STR_PRJ_Files, STR_PRJ_MainResource, 'default.rss');
  90. RegResource := IniFile.ReadString(STR_PRJ_Files, STR_PRJ_RegResource, 'default_reg.rss');
  91. IniFile.ReadSection(STR_PRJ_Objects, ObjectFiles);
  92. finally
  93. IniFile.Free;
  94. end;
  95. end;
  96. end.