projectparser.pas 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117
  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: string;
  32. { FPC section }
  33. CompilerPath, AssemblerPath, RTLUnitsDir: string;
  34. { UIDs section }
  35. UID2, UID3: string;
  36. { Files section }
  37. MainSource, MainSourceNoExt, MainResource, RegResource: string;
  38. { Objects section }
  39. ObjectFiles: TStringList;
  40. public
  41. constructor Create;
  42. destructor Destroy; override;
  43. procedure ParseFile;
  44. end;
  45. var
  46. vProject: TProject;
  47. implementation
  48. { TProject }
  49. constructor TProject.Create;
  50. begin
  51. inherited Create;
  52. ObjectFiles := TStringList.Create;
  53. end;
  54. destructor TProject.Destroy;
  55. begin
  56. ObjectFiles.Free;
  57. inherited Destroy;
  58. end;
  59. {*******************************************************************
  60. * TProject.ParseFile ()
  61. *
  62. * DESCRIPTION: Parses the project file
  63. *
  64. * PARAMETERS: None
  65. *
  66. * RETURNS: Nothing
  67. *
  68. *******************************************************************}
  69. procedure TProject.ParseFile;
  70. var
  71. IniFile: TIniFile;
  72. begin
  73. IniFile := TIniFile.Create(opts.ProjectFile);
  74. try
  75. ExeName := IniFile.ReadString(STR_PRJ_Files, STR_PRJ_ExeName, 'default.exe');
  76. Language := IniFile.ReadString(STR_PRJ_Files, STR_PRJ_Language, 'Pascal');
  77. CompilerPath := IniFile.ReadString(STR_PRJ_FPC, STR_PRJ_CompilerPath, 'C:\Programas\fpc21\compiler\ppc386.exe');
  78. AssemblerPath := IniFile.ReadString(STR_PRJ_FPC, STR_PRJ_AssemblerPath, 'C:\Programas\lazarus20\fpc\2.1.5\bin\i386-win32\as.exe');
  79. RTLUnitsDir := IniFile.ReadString(STR_PRJ_FPC, STR_PRJ_RTLUnitsDir, 'C:\Programas\fpc21\rtl\units\i386-symbian\');
  80. UID2 := IniFile.ReadString(STR_PRJ_UIDs, STR_PRJ_UID2, '0x100039CE');
  81. UID3 := IniFile.ReadString(STR_PRJ_UIDs, STR_PRJ_UID3, '0xE1000002');
  82. MainSource := IniFile.ReadString(STR_PRJ_Files, STR_PRJ_MainSource, 'default.pas');
  83. MainSourceNoExt := ExtractFileExt(MainSource);
  84. MainResource := IniFile.ReadString(STR_PRJ_Files, STR_PRJ_MainResource, 'default.rss');
  85. RegResource := IniFile.ReadString(STR_PRJ_Files, STR_PRJ_RegResource, 'default_reg.rss');
  86. IniFile.ReadSection(STR_PRJ_Objects, ObjectFiles);
  87. finally
  88. IniFile.Free;
  89. end;
  90. end;
  91. end.