BootApp.h 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  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. bool mHadCmdLine;
  34. bool mShowedHelp;
  35. bool mHadErrors;
  36. Array<String> mRequestedSrc;
  37. BfOptLevel mOptLevel;
  38. BfToolsetType mToolset;
  39. bool mEmitIR;
  40. String mBuildDir;
  41. String mWorkingDir;
  42. String mDefines;
  43. String mStartupObject;
  44. String mTargetPath;
  45. String mLinkParams;
  46. void* mSystem;
  47. void* mCompiler;
  48. void* mProject;
  49. void* mPassInstance;
  50. public:
  51. void Fail(const String & error);
  52. void OutputLine(const String& text, OutputPri outputPri = OutputPri_Normal);
  53. bool QueueRun(const String& fileName, const String& args, const String& workingDir, BfpSpawnFlags extraFlags);
  54. void QueueFile(const StringImpl& path);
  55. void QueuePath(const StringImpl& path);
  56. void DoCompile();
  57. void DoLinkMS();
  58. void DoLinkGNU();
  59. public:
  60. BootApp();
  61. ~BootApp();
  62. bool HandleCmdLine(const String& cmd, const String& param);
  63. bool Init();
  64. bool Compile();
  65. };
  66. extern BootApp* gApp;
  67. NS_BF_END