BuildBase.h 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  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. #include "../Platform/Platform.h"
  8. using namespace Atomic;
  9. namespace ToolCore
  10. {
  11. class ResourcePackager;
  12. class Project;
  13. class BuildBase : public Object
  14. {
  15. OBJECT(BuildBase);
  16. public:
  17. BuildBase(Context* context, Project* project, PlatformID platform);
  18. virtual ~BuildBase();
  19. virtual void Build(const String& buildPath) = 0;
  20. // some platforms may want to do their own packaging of resources
  21. virtual bool UseResourcePackager() { return true; }
  22. virtual String GetBuildSubfolder() = 0;
  23. // add in search order, first added is first searched
  24. // will warn on name conflicts
  25. void AddResourceDir(const String& dir);
  26. void BuildLog(const String& message);
  27. void BuildWarn(const String& warning);
  28. void BuildError(const String& error);
  29. /// Converts subprocess output event to a buildoutput event
  30. void HandleSubprocessOutputEvent(StringHash eventType, VariantMap& eventData);
  31. protected:
  32. void SendBuildFailure(const String& message);
  33. void GenerateResourcePackage(const String& resourcePackagePath);
  34. void BuildResourceEntries();
  35. void GetDefaultResourcePaths(Vector<String>& paths);
  36. String buildPath_;
  37. PODVector<BuildResourceEntry*> resourceEntries_;
  38. bool containsMDL_;
  39. private:
  40. PlatformID platformID_;
  41. Vector<String> buildLog_;
  42. Vector<String> buildWarnings_;
  43. Vector<String> buildErrors_;
  44. void ScanResourceDirectory(const String& resourceDir);
  45. SharedPtr<Project> project_;
  46. SharedPtr<ResourcePackager> resourcePackager_;
  47. Vector<String> resourceDirs_;
  48. };
  49. }