BootApp.h 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  1. #pragma once
  2. #include "BeefBoot.h"
  3. #include "BeefySysLib/FileStream.h"
  4. #include "BeefySysLib/util/CritSect.h"
  5. #include "BeefySysLib/util/String.h"
  6. #include "BeefySysLib/util/Array.h"
  7. #include "Compiler/BfSystem.h"
  8. NS_BF_BEGIN
  9. enum OutputPri
  10. {
  11. OutputPri_Low,
  12. OutputPri_Normal,
  13. OutputPri_High,
  14. OutputPri_Warning,
  15. OutputPri_Error,
  16. OutputPri_Critical
  17. };
  18. enum Verbosity
  19. {
  20. Verbosity_Quiet,
  21. Verbosity_Minimal,
  22. Verbosity_Normal,
  23. Verbosity_Detailed,
  24. Verbosity_Diagnostic,
  25. };
  26. class BootApp
  27. {
  28. public:
  29. CritSect mLogCritSect;
  30. FileStream mLogFile;
  31. Verbosity mVerbosity;
  32. BfTargetType mTargetType;
  33. String mTargetTriple;
  34. bool mHadCmdLine;
  35. bool mShowedHelp;
  36. bool mHadErrors;
  37. Array<String> mRequestedSrc;
  38. BfOptLevel mOptLevel;
  39. BfToolsetType mToolset;
  40. bool mEmitIR;
  41. String mBuildDir;
  42. String mWorkingDir;
  43. String mDefines;
  44. String mStartupObject;
  45. String mTargetPath;
  46. String mLinkParams;
  47. BfAsmKind mAsmKind;
  48. void* mSystem;
  49. void* mCompiler;
  50. void* mProject;
  51. void* mPassInstance;
  52. bool mIsCERun;
  53. void* mCELibProject;
  54. String mCESrc;
  55. String mCEDest;
  56. public:
  57. void Fail(const String & error);
  58. void OutputLine(const String& text, OutputPri outputPri = OutputPri_Normal);
  59. bool QueueRun(const String& fileName, const String& args, const String& workingDir, BfpSpawnFlags extraFlags);
  60. bool CopyFile(const StringImpl& srcPath, const StringImpl& destPath);
  61. void QueueFile(const StringImpl& path, void* project);
  62. void QueuePath(const StringImpl& path);
  63. void DoCompile();
  64. void DoLinkMS();
  65. void DoLinkGNU();
  66. public:
  67. BootApp();
  68. ~BootApp();
  69. bool HandleCmdLine(const String& cmd, const String& param);
  70. bool Init();
  71. bool Compile();
  72. };
  73. extern BootApp* gApp;
  74. NS_BF_END