BuildWindows.cpp 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  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. #include <Atomic/IO/FileSystem.h>
  5. #include "../ToolSystem.h"
  6. #include "../ToolEnvironment.h"
  7. #include "../Project/Project.h"
  8. #include "BuildWindows.h"
  9. #include "BuildSystem.h"
  10. namespace ToolCore
  11. {
  12. BuildWindows::BuildWindows(Context * context, Project *project) : BuildBase(context, project, PLATFORMID_WINDOWS)
  13. {
  14. }
  15. BuildWindows::~BuildWindows()
  16. {
  17. }
  18. void BuildWindows::Initialize()
  19. {
  20. ToolSystem* tsystem = GetSubsystem<ToolSystem>();
  21. Project* project = tsystem->GetProject();
  22. Vector<String> defaultResourcePaths;
  23. GetDefaultResourcePaths(defaultResourcePaths);
  24. String projectResources = project->GetResourcePath();
  25. for (unsigned i = 0; i < defaultResourcePaths.Size(); i++)
  26. {
  27. AddResourceDir(defaultResourcePaths[i]);
  28. }
  29. // TODO: smart filtering of cache
  30. AddResourceDir(project->GetProjectPath() + "Cache/");
  31. AddResourceDir(projectResources);
  32. BuildResourceEntries();
  33. }
  34. void BuildWindows::Build(const String& buildPath)
  35. {
  36. ToolEnvironment* tenv = GetSubsystem<ToolEnvironment>();
  37. buildPath_ = AddTrailingSlash(buildPath) + GetBuildSubfolder();
  38. Initialize();
  39. BuildSystem* buildSystem = GetSubsystem<BuildSystem>();
  40. FileSystem* fileSystem = GetSubsystem<FileSystem>();
  41. if (fileSystem->DirExists(buildPath_))
  42. fileSystem->RemoveDir(buildPath_, true);
  43. String rootSourceDir = tenv->GetRootSourceDir();
  44. String playerBinary = tenv->GetPlayerBinary();
  45. String d3d9dll = GetPath(playerBinary) + "/D3DCompiler_47.dll";
  46. fileSystem->CreateDir(buildPath_);
  47. fileSystem->CreateDir(buildPath_ + "/AtomicPlayer_Resources");
  48. String resourcePackagePath = buildPath_ + "/AtomicPlayer_Resources/AtomicResources.pak";
  49. GenerateResourcePackage(resourcePackagePath);
  50. fileSystem->Copy(playerBinary, buildPath_ + "/AtomicPlayer.exe");
  51. fileSystem->Copy(d3d9dll, buildPath_ + "/D3DCompiler_47.dll");
  52. buildSystem->BuildComplete(PLATFORMID_WINDOWS, buildPath_);
  53. }
  54. }