ToolEnvironment.h 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152
  1. //
  2. // Copyright (c) 2014-2016 THUNDERBEAST GAMES LLC
  3. //
  4. // Permission is hereby granted, free of charge, to any person obtaining a copy
  5. // of this software and associated documentation files (the "Software"), to deal
  6. // in the Software without restriction, including without limitation the rights
  7. // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  8. // copies of the Software, and to permit persons to whom the Software is
  9. // furnished to do so, subject to the following conditions:
  10. //
  11. // The above copyright notice and this permission notice shall be included in
  12. // all copies or substantial portions of the Software.
  13. //
  14. // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  15. // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  16. // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  17. // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  18. // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  19. // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  20. // THE SOFTWARE.
  21. //
  22. #pragma once
  23. #include <Atomic/Core/Object.h>
  24. #include "ToolPrefs.h"
  25. using namespace Atomic;
  26. namespace ToolCore
  27. {
  28. // the tool environment contains paths for various
  29. // binaries, data paths, example folder, etc
  30. // it is either built from the cli, AtomicEditor, environment variables,
  31. // or a json config file, this avoids needing to symlink folders, etc
  32. class ToolEnvironment : public Object
  33. {
  34. OBJECT(ToolEnvironment)
  35. public:
  36. ToolEnvironment(Context* context);
  37. virtual ~ToolEnvironment();
  38. bool InitFromPackage();
  39. // dev build init env from json
  40. bool InitFromJSON(bool atomicTool = false);
  41. /// Root source and build directories for development source tree builds
  42. void SetRootSourceDir(const String& sourceDir);
  43. void SetRootBuildDir(const String& buildDir, bool setBinaryPaths = false);
  44. ToolPrefs* GetToolPrefs() { return toolPrefs_; }
  45. void SaveToolPrefs() { toolPrefs_->Save(); }
  46. void LoadToolPrefs() { toolPrefs_->Load(); }
  47. const String& GetRootSourceDir() { return rootSourceDir_; }
  48. const String& GetRootBuildDir() { return rootBuildDir_; }
  49. /// Binaries
  50. const String& GetEditorBinary() { return editorBinary_; }
  51. const String& GetPlayerBinary() { return playerBinary_; }
  52. const String& GetToolBinary() { return toolBinary_; }
  53. /// Resource directories
  54. const String& GetCoreDataDir() { return resourceCoreDataDir_; }
  55. const String& GetPlayerDataDir() { return resourcePlayerDataDir_; }
  56. const String& GetEditorDataDir() { return resourceEditorDataDir_; }
  57. /// Data directories
  58. const String& GetDeploymentDataDir() { return toolBinary_; }
  59. const String& GetToolDataDir() { return toolDataDir_; }
  60. const String& GetDevConfigFilename();
  61. // AtomicNET
  62. const String& GetAtomicNETRootDir() { return atomicNETRootDir_; }
  63. const String& GetAtomicNETCoreAssemblyDir() { return atomicNETCoreAssemblyDir_; }
  64. const String& GetAtomicNETNuGetBinary() { return atomicNETNuGetBinary_; }
  65. const String& GetAtomicNETManagedPlayerBinary() { return atomicNETManagedPlayerBinary_; }
  66. // OSX
  67. const String& GetPlayerAppFolder() { return playerAppFolder_; }
  68. // iOS
  69. String GetIOSDeployBinary();
  70. void Dump();
  71. private:
  72. // root source directory (for development builds)
  73. String rootSourceDir_;
  74. // root build directory (for development builds)
  75. String rootBuildDir_;
  76. // path to the Atomic Editor binary
  77. String editorBinary_;
  78. // path to Atomic player binary used when running content from the editor or cli
  79. String playerBinary_;
  80. // path to Atomic player app (OSX)
  81. String playerAppFolder_;
  82. // path to the AtomicTool command line binary
  83. String toolBinary_;
  84. String toolDataDir_;
  85. // resources
  86. String resourceCoreDataDir_;
  87. String resourcePlayerDataDir_;
  88. String resourceEditorDataDir_;
  89. // deployment
  90. // static deployment data directory
  91. String deploymentDataDir_;
  92. // whether to use individual build folders, or the deployment data dir for binaries
  93. bool useBuildDirs_;
  94. String macBuildDir_;
  95. String windowsBuildDir_;
  96. String linuxBuildDir_;
  97. String androidBuildDir_;
  98. String iosBuildDir_;
  99. String webBuildDir_;
  100. String devConfigFilename_;
  101. // AtomicNET
  102. String atomicNETRootDir_;
  103. String atomicNETCoreAssemblyDir_;
  104. String atomicNETNuGetBinary_;
  105. String atomicNETManagedPlayerBinary_;
  106. SharedPtr<ToolPrefs> toolPrefs_;
  107. };
  108. }