ToolEnvironment.h 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123
  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. #pragma once
  8. #include <Atomic/Core/Object.h>
  9. #include "ToolPrefs.h"
  10. using namespace Atomic;
  11. namespace ToolCore
  12. {
  13. // the tool environment contains paths for various
  14. // binaries, data paths, example folder, etc
  15. // it is either built from the cli, AtomicEditor, environment variables,
  16. // or a json config file, this avoids needing to symlink folders, etc
  17. class ToolEnvironment : public Object
  18. {
  19. OBJECT(ToolEnvironment)
  20. public:
  21. ToolEnvironment(Context* context);
  22. virtual ~ToolEnvironment();
  23. bool InitFromPackage();
  24. // dev build init env from json
  25. bool InitFromJSON(bool atomicTool = false);
  26. /// Root source and build directories for development source tree builds
  27. void SetRootSourceDir(const String& sourceDir);
  28. void SetRootBuildDir(const String& buildDir, bool setBinaryPaths = false);
  29. ToolPrefs* GetToolPrefs() { return toolPrefs_; }
  30. void SaveToolPrefs() { toolPrefs_->Save(); }
  31. void LoadToolPrefs() { toolPrefs_->Load(); }
  32. const String& GetRootSourceDir() { return rootSourceDir_; }
  33. const String& GetRootBuildDir() { return rootBuildDir_; }
  34. /// Binaries
  35. const String& GetEditorBinary() { return editorBinary_; }
  36. const String& GetPlayerBinary() { return playerBinary_; }
  37. const String& GetToolBinary() { return toolBinary_; }
  38. /// Resource directories
  39. const String& GetCoreDataDir() { return resourceCoreDataDir_; }
  40. const String& GetPlayerDataDir() { return resourcePlayerDataDir_; }
  41. const String& GetEditorDataDir() { return resourceEditorDataDir_; }
  42. /// Data directories
  43. const String& GetDeploymentDataDir() { return toolBinary_; }
  44. const String& GetToolDataDir() { return toolDataDir_; }
  45. const String& GetDevConfigFilename();
  46. // OSX
  47. const String& GetPlayerAppFolder() { return playerAppFolder_; }
  48. // iOS
  49. String GetIOSDeployBinary();
  50. void Dump();
  51. private:
  52. // root source directory (for development builds)
  53. String rootSourceDir_;
  54. // root build directory (for development builds)
  55. String rootBuildDir_;
  56. // path to the Atomic Editor binary
  57. String editorBinary_;
  58. // path to Atomic player binary used when running content from the editor or cli
  59. String playerBinary_;
  60. // path to Atomic player app (OSX)
  61. String playerAppFolder_;
  62. // path to the AtomicTool command line binary
  63. String toolBinary_;
  64. String toolDataDir_;
  65. // resources
  66. String resourceCoreDataDir_;
  67. String resourcePlayerDataDir_;
  68. String resourceEditorDataDir_;
  69. // deployment
  70. // static deployment data directory
  71. String deploymentDataDir_;
  72. // whether to use individual build folders, or the deployment data dir for binaries
  73. bool useBuildDirs_;
  74. String macBuildDir_;
  75. String windowsBuildDir_;
  76. String linuxBuildDir_;
  77. String androidBuildDir_;
  78. String iosBuildDir_;
  79. String webBuildDir_;
  80. String devConfigFilename_;
  81. SharedPtr<ToolPrefs> toolPrefs_;
  82. };
  83. }