BuildMac.cpp 2.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  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 "../Project/Project.h"
  7. #include "BuildMac.h"
  8. #include "BuildSystem.h"
  9. namespace ToolCore
  10. {
  11. BuildMac::BuildMac(Context * context, Project *project) : BuildBase(context, project)
  12. {
  13. }
  14. BuildMac::~BuildMac()
  15. {
  16. }
  17. void BuildMac::Initialize()
  18. {
  19. ToolSystem* tsystem = GetSubsystem<ToolSystem>();
  20. Project* project = tsystem->GetProject();
  21. String dataPath = tsystem->GetDataPath();
  22. String projectResources = project->GetResourcePath();
  23. String coreDataFolder = dataPath + "CoreData/";
  24. AddResourceDir(coreDataFolder);
  25. AddResourceDir(projectResources);
  26. BuildResourceEntries();
  27. }
  28. void BuildMac::Build(const String& buildPath)
  29. {
  30. ToolSystem* tsystem = GetSubsystem<ToolSystem>();
  31. buildPath_ = AddTrailingSlash(buildPath) + GetBuildSubfolder();
  32. Initialize();
  33. BuildSystem* buildSystem = GetSubsystem<BuildSystem>();
  34. FileSystem* fileSystem = GetSubsystem<FileSystem>();
  35. if (fileSystem->DirExists(buildPath_))
  36. fileSystem->RemoveDir(buildPath_, true);
  37. String dataPath = tsystem->GetDataPath();
  38. String appSrcPath = dataPath + "Deployment/MacOS/AtomicPlayer.app";
  39. fileSystem->CreateDir(buildPath_);
  40. buildPath_ += "/AtomicPlayer.app";
  41. fileSystem->CreateDir(buildPath_);
  42. fileSystem->CreateDir(buildPath_ + "/Contents");
  43. fileSystem->CreateDir(buildPath_ + "/Contents/MacOS");
  44. fileSystem->CreateDir(buildPath_ + "/Contents/Resources");
  45. String resourcePackagePath = buildPath_ + "/Contents/Resources/AtomicResources.pak";
  46. GenerateResourcePackage(resourcePackagePath);
  47. fileSystem->Copy(appSrcPath + "/Contents/Resources/Atomic.icns", buildPath_ + "/Contents/Resources/Atomic.icns");
  48. fileSystem->Copy(appSrcPath + "/Contents/Info.plist", buildPath_ + "/Contents/Info.plist");
  49. fileSystem->Copy(appSrcPath + "/Contents/MacOS/AtomicPlayer", buildPath_ + "/Contents/MacOS/AtomicPlayer");
  50. #ifdef ATOMIC_PLATFORM_OSX
  51. Vector<String> args;
  52. args.Push("+x");
  53. args.Push(buildPath_ + "/Contents/MacOS/AtomicPlayer");
  54. fileSystem->SystemRun("chmod", args);
  55. #endif
  56. buildPath_ = buildPath + "/Mac-Build";
  57. buildSystem->BuildComplete(PLATFORMID_MAC, buildPath_);
  58. }
  59. }