BuildWindows.cpp 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133
  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)
  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. /*
  55. void BuildWindows::Build(const String& buildPath)
  56. {
  57. ToolSystem* tsystem = GetSubsystem<ToolSystem>();
  58. buildPath_ = AddTrailingSlash(buildPath) + GetBuildSubfolder();
  59. Initialize();
  60. BuildSystem* buildSystem = GetSubsystem<BuildSystem>();
  61. FileSystem* fileSystem = GetSubsystem<FileSystem>();
  62. if (fileSystem->DirExists(buildPath_))
  63. fileSystem->RemoveDir(buildPath_, true);
  64. String dataPath = tsystem->GetDataPath();
  65. String appSrcPath = dataPath + "Deployment/MacOS/AtomicPlayer.app";
  66. fileSystem->CreateDir(buildPath_);
  67. buildPath_ += "/AtomicPlayer.app";
  68. fileSystem->CreateDir(buildPath_);
  69. fileSystem->CreateDir(buildPath_ + "/Contents");
  70. fileSystem->CreateDir(buildPath_ + "/Contents/MacOS");
  71. fileSystem->CreateDir(buildPath_ + "/Contents/Resources");
  72. String resourcePackagePath = buildPath_ + "/Contents/Resources/AtomicResources.pak";
  73. GenerateResourcePackage(resourcePackagePath);
  74. fileSystem->Copy(appSrcPath + "/Contents/Resources/Atomic.icns", buildPath_ + "/Contents/Resources/Atomic.icns");
  75. fileSystem->Copy(appSrcPath + "/Contents/Info.plist", buildPath_ + "/Contents/Info.plist");
  76. fileSystem->Copy(appSrcPath + "/Contents/MacOS/AtomicPlayer", buildPath_ + "/Contents/MacOS/AtomicPlayer");
  77. #ifdef ATOMIC_PLATFORM_OSX
  78. Vector<String> args;
  79. args.Push("+x");
  80. args.Push(buildPath_ + "/Contents/MacOS/AtomicPlayer");
  81. fileSystem->SystemRun("chmod", args);
  82. #endif
  83. buildPath_ = buildPath + "/Mac-Build";
  84. buildSystem->BuildComplete(PLATFORMID_MAC, buildPath_);
  85. }
  86. */
  87. }