FuzzApp.h 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. #pragma once
  2. #include "BeefFuzz.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. class FuzzApp
  10. {
  11. public:
  12. BfTargetType mTargetType;
  13. String mTargetTriple;
  14. BfOptLevel mOptLevel;
  15. BfToolsetType mToolset;
  16. String mBuildDir;
  17. String mWorkingDir;
  18. String mDefines;
  19. String mStartupObject;
  20. String mTargetPath;
  21. String mLinkParams;
  22. void* mSystem;
  23. void* mCompiler;
  24. void* mProject;
  25. void* mPassInstance;
  26. bool mIsCERun;
  27. void* mCELibProject;
  28. String mCEDest;
  29. public:
  30. bool CopyFile(const StringImpl& srcPath, const StringImpl& destPath);
  31. bool QueueFile(const char* data, size_t len);
  32. bool QueuePath(const StringImpl& path);
  33. public:
  34. FuzzApp();
  35. ~FuzzApp();
  36. void SetTargetType(BfTargetType value) { mTargetType = value; }
  37. void SetTargetTriple(const String& value) { mTargetTriple = value; }
  38. void SetOptLevel(BfOptLevel value) { mOptLevel = value; }
  39. void SetToolset(BfToolsetType value) { mToolset = value; }
  40. void SetBuildDir(const String& value) { mBuildDir = value; }
  41. void SetWorkingDir(const String& value) { mWorkingDir = value; }
  42. void AddDefine(const String& value) { mDefines += mDefines.IsEmpty() ? value : "\n" + value; }
  43. void SetStartupObject(const String& value) { mStartupObject = value; }
  44. void SetTargetPath(const String& value) { mTargetPath = value; }
  45. void SetLinkParams(const String& value) { mLinkParams = value; }
  46. void SetCEDest(const String& value) { mCEDest = value; }
  47. bool Init();
  48. void PrepareCompiler();
  49. bool Compile();
  50. void ReleaseCompiler();
  51. };
  52. extern FuzzApp* gApp;
  53. NS_BF_END