BuildBase.h 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. // Copyright (c) 2014-2015, THUNDERBEAST GAMES LLC All rights reserved
  2. // Please see LICENSE.md in repository root for license information
  3. // https://github.com/AtomicGameEngine/AtomicGameEngine
  4. #pragma once
  5. #include <Atomic/Core/Object.h>
  6. #include "BuildTypes.h"
  7. using namespace Atomic;
  8. namespace ToolCore
  9. {
  10. class ResourcePackager;
  11. class Project;
  12. class BuildBase : public Object
  13. {
  14. OBJECT(BuildBase);
  15. public:
  16. BuildBase(Context* context, Project* project);
  17. virtual ~BuildBase();
  18. virtual void Build(const String& buildPath) = 0;
  19. // some platforms may want to do their own packaging of resources
  20. virtual bool UseResourcePackager() { return true; }
  21. virtual String GetBuildSubfolder() = 0;
  22. // add in search order, first added is first searched
  23. // will warn on name conflicts
  24. void AddResourceDir(const String& dir);
  25. void BuildLog(const String& message);
  26. void BuildWarn(const String& warning);
  27. void BuildError(const String& error);
  28. /// Converts subprocess output event to a buildoutput event
  29. void HandleSubprocessOutputEvent(StringHash eventType, VariantMap& eventData);
  30. protected:
  31. void GenerateResourcePackage(const String& resourcePackagePath);
  32. void BuildResourceEntries();
  33. void GetDefaultResourcePaths(Vector<String>& paths);
  34. String buildPath_;
  35. PODVector<BuildResourceEntry*> resourceEntries_;
  36. bool containsMDL_;
  37. private:
  38. Vector<String> buildLog_;
  39. Vector<String> buildWarnings_;
  40. Vector<String> buildErrors_;
  41. void ScanResourceDirectory(const String& resourceDir);
  42. SharedPtr<Project> project_;
  43. SharedPtr<ResourcePackager> resourcePackager_;
  44. Vector<String> resourceDirs_;
  45. };
  46. }