ToolEnvironment.h 2.9 KB

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