BuildWindows.cpp 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  1. //
  2. // Copyright (c) 2014-2015, THUNDERBEAST GAMES LLC All rights reserved
  3. // LICENSE: Atomic Game Engine Editor and Tools EULA
  4. // Please see LICENSE_ATOMIC_EDITOR_AND_TOOLS.md in repository root for
  5. // license information: https://github.com/AtomicGameEngine/AtomicGameEngine
  6. //
  7. #include <Atomic/IO/FileSystem.h>
  8. #include "../ToolSystem.h"
  9. #include "../ToolEnvironment.h"
  10. #include "../Project/Project.h"
  11. #include "BuildWindows.h"
  12. #include "BuildSystem.h"
  13. namespace ToolCore
  14. {
  15. BuildWindows::BuildWindows(Context * context, Project *project) : BuildBase(context, project, PLATFORMID_WINDOWS)
  16. {
  17. }
  18. BuildWindows::~BuildWindows()
  19. {
  20. }
  21. void BuildWindows::Initialize()
  22. {
  23. ToolSystem* tsystem = GetSubsystem<ToolSystem>();
  24. Project* project = tsystem->GetProject();
  25. Vector<String> defaultResourcePaths;
  26. GetDefaultResourcePaths(defaultResourcePaths);
  27. String projectResources = project->GetResourcePath();
  28. for (unsigned i = 0; i < defaultResourcePaths.Size(); i++)
  29. {
  30. AddResourceDir(defaultResourcePaths[i]);
  31. }
  32. // TODO: smart filtering of cache
  33. AddResourceDir(project->GetProjectPath() + "Cache/");
  34. AddResourceDir(projectResources);
  35. BuildResourceEntries();
  36. }
  37. void BuildWindows::Build(const String& buildPath)
  38. {
  39. ToolEnvironment* tenv = GetSubsystem<ToolEnvironment>();
  40. buildPath_ = AddTrailingSlash(buildPath) + GetBuildSubfolder();
  41. Initialize();
  42. BuildSystem* buildSystem = GetSubsystem<BuildSystem>();
  43. FileSystem* fileSystem = GetSubsystem<FileSystem>();
  44. if (fileSystem->DirExists(buildPath_))
  45. fileSystem->RemoveDir(buildPath_, true);
  46. String rootSourceDir = tenv->GetRootSourceDir();
  47. String playerBinary = tenv->GetPlayerBinary();
  48. String d3d9dll = GetPath(playerBinary) + "/D3DCompiler_47.dll";
  49. fileSystem->CreateDir(buildPath_);
  50. fileSystem->CreateDir(buildPath_ + "/AtomicPlayer_Resources");
  51. String resourcePackagePath = buildPath_ + "/AtomicPlayer_Resources/AtomicResources.pak";
  52. GenerateResourcePackage(resourcePackagePath);
  53. fileSystem->Copy(playerBinary, buildPath_ + "/AtomicPlayer.exe");
  54. fileSystem->Copy(d3d9dll, buildPath_ + "/D3DCompiler_47.dll");
  55. buildSystem->BuildComplete(PLATFORMID_WINDOWS, buildPath_);
  56. }
  57. }