| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156 |
- //
- // Copyright (c) 2014-2016 THUNDERBEAST GAMES LLC
- //
- // Permission is hereby granted, free of charge, to any person obtaining a copy
- // of this software and associated documentation files (the "Software"), to deal
- // in the Software without restriction, including without limitation the rights
- // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- // copies of the Software, and to permit persons to whom the Software is
- // furnished to do so, subject to the following conditions:
- //
- // The above copyright notice and this permission notice shall be included in
- // all copies or substantial portions of the Software.
- //
- // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
- // THE SOFTWARE.
- //
- #pragma once
- #include <Atomic/Core/Object.h>
- #include "ToolPrefs.h"
- using namespace Atomic;
- namespace ToolCore
- {
- // the tool environment contains paths for various
- // binaries, data paths, example folder, etc
- // it is either built from the cli, AtomicEditor, environment variables,
- // or a json config file, this avoids needing to symlink folders, etc
- class ToolEnvironment : public Object
- {
- ATOMIC_OBJECT(ToolEnvironment, Object)
- public:
- ToolEnvironment(Context* context);
- virtual ~ToolEnvironment();
- bool Initialize(bool cli = false);
- /// Root source and build directories for development source tree builds
- void SetRootSourceDir(const String& sourceDir);
- void SetRootBuildDir(const String& buildDir, bool setBinaryPaths = false);
- ToolPrefs* GetToolPrefs() { return toolPrefs_; }
- void SaveToolPrefs() { toolPrefs_->Save(); }
- void LoadToolPrefs() { toolPrefs_->Load(); }
- const String& GetRootSourceDir() { return rootSourceDir_; }
- const String& GetRootBuildDir() { return rootBuildDir_; }
- /// Binaries
- const String& GetEditorBinary() { return editorBinary_; }
- const String& GetPlayerBinary() { return playerBinary_; }
- const String& GetToolBinary() { return toolBinary_; }
- /// Resource directories
- const String& GetCoreDataDir() { return resourceCoreDataDir_; }
- const String& GetPlayerDataDir() { return resourcePlayerDataDir_; }
- const String& GetEditorDataDir() { return resourceEditorDataDir_; }
- /// Data directories
- const String& GetDeploymentDataDir() { return toolBinary_; }
- const String& GetToolDataDir() { return toolDataDir_; }
- // Returns true if we running from a command line tool (aka: AtomicTool)
- bool GetCLI() { return cli_; }
- // AtomicNET
- const String& GetAtomicNETRootDir() { return atomicNETRootDir_; }
- const String& GetAtomicNETCoreAssemblyDir() { return atomicNETCoreAssemblyDir_; }
- const String& GetAtomicNETNuGetBinary() { return atomicNETNuGetBinary_; }
- const String& GetMonoExecutableDir() { return monoExecutableDir_; }
- // OSX
- const String& GetPlayerAppFolder() { return playerAppFolder_; }
- // iOS
- String GetIOSDeployBinary();
- void Dump();
- static void SetBootstrapping() { bootstrapping_ = true; }
- private:
- bool InitFromDistribution();
- // Whether we are running from a command line tool, such as AtomicTool
- bool cli_;
- // root source directory (for development builds)
- String rootSourceDir_;
- // root build directory (for development builds)
- String rootBuildDir_;
- // path to the Atomic Editor binary
- String editorBinary_;
- // path to Atomic player binary used when running content from the editor or cli
- String playerBinary_;
- // path to Atomic player app (OSX)
- String playerAppFolder_;
- // path to the AtomicTool command line binary
- String toolBinary_;
- String toolDataDir_;
- // resources
- String resourceCoreDataDir_;
- String resourcePlayerDataDir_;
- String resourceEditorDataDir_;
- // deployment
- // static deployment data directory
- String deploymentDataDir_;
- // whether to use individual build folders, or the deployment data dir for binaries
- bool useBuildDirs_;
- String macBuildDir_;
- String windowsBuildDir_;
- String linuxBuildDir_;
- String androidBuildDir_;
- String iosBuildDir_;
- String webBuildDir_;
- // AtomicNET
- String atomicNETRootDir_;
- String atomicNETCoreAssemblyDir_;
- String atomicNETNuGetBinary_;
- String monoExecutableDir_;
- SharedPtr<ToolPrefs> toolPrefs_;
- static bool bootstrapping_;
- };
- }
|