BuildWindows.cpp 2.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  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 "AtomicEditor.h"
  5. #include <Atomic/IO/FileSystem.h>
  6. #include "../AEEditor.h"
  7. #include "../Project/AEProject.h"
  8. #include "../Project/ProjectUtils.h"
  9. #include "License/AELicenseSystem.h"
  10. #include "BuildSystem.h"
  11. #include "BuildWindows.h"
  12. namespace AtomicEditor
  13. {
  14. BuildWindows::BuildWindows(Context * context) : BuildBase(context)
  15. {
  16. }
  17. BuildWindows::~BuildWindows()
  18. {
  19. }
  20. void BuildWindows::Initialize()
  21. {
  22. Editor* editor = GetSubsystem<Editor>();
  23. Project* project = editor->GetProject();
  24. FileSystem* fileSystem = GetSubsystem<FileSystem>();
  25. #ifdef ATOMIC_PLATFORM_WINDOWS
  26. String bundleResources = fileSystem->GetProgramDir();
  27. #else
  28. String bundleResources = fileSystem->GetAppBundleResourceFolder();
  29. #endif
  30. String projectResources = project->GetResourcePath();
  31. String coreDataFolder = bundleResources + "CoreData/";
  32. AddResourceDir(coreDataFolder);
  33. AddResourceDir(projectResources);
  34. BuildResourceEntries();
  35. }
  36. void BuildWindows::Build(const String& buildPath)
  37. {
  38. buildPath_ = buildPath + "/Windows-Build";
  39. Initialize();
  40. BuildSystem* buildSystem = GetSubsystem<BuildSystem>();
  41. // BEGIN LICENSE MANAGEMENT
  42. LicenseSystem *licenseSystem = GetSubsystem<LicenseSystem>();
  43. if (licenseSystem->IsStandardLicense())
  44. {
  45. if (containsMDL_)
  46. {
  47. buildSystem->BuildComplete(AE_PLATFORM_WINDOWS, buildPath_, false, true);
  48. return;
  49. }
  50. }
  51. // END LICENSE MANAGEMENT
  52. FileSystem* fileSystem = GetSubsystem<FileSystem>();
  53. if (fileSystem->DirExists(buildPath_))
  54. fileSystem->RemoveDir(buildPath_, true);
  55. #ifdef ATOMIC_PLATFORM_WINDOWS
  56. String buildSourceDir = fileSystem->GetProgramDir();
  57. #else
  58. String buildSourceDir = fileSystem->GetAppBundleResourceFolder();
  59. #endif
  60. buildSourceDir += "Deployment/Win64";
  61. fileSystem->CreateDir(buildPath_);
  62. fileSystem->CreateDir(buildPath_ + "/AtomicPlayer_Resources");
  63. String resourcePackagePath = buildPath_ + "/AtomicPlayer_Resources/AtomicResources.pak";
  64. GenerateResourcePackage(resourcePackagePath);
  65. fileSystem->Copy(buildSourceDir + "/AtomicPlayer.exe", buildPath_ + "/AtomicPlayer.exe");
  66. fileSystem->Copy(buildSourceDir + "/D3DCompiler_47.dll", buildPath_ + "/D3DCompiler_47.dll");
  67. buildSystem->BuildComplete(AE_PLATFORM_WINDOWS, buildPath_);
  68. }
  69. }