ProjectBuildSettings.h 8.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263
  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 <Atomic/Resource/JSONValue.h>
  25. using namespace Atomic;
  26. namespace ToolCore
  27. {
  28. class MacBuildSettings : public RefCounted
  29. {
  30. ATOMIC_REFCOUNTED(MacBuildSettings)
  31. public:
  32. MacBuildSettings() {}
  33. const String& GetAppName() const { return appName_; }
  34. const String& GetPackageName() const { return packageName_; }
  35. const String& GetCompanyName() const { return companyName_; }
  36. const String& GetProductName() const { return productName_; }
  37. void SetAppName(const String& name) { appName_ = name; }
  38. void SetPackageName(const String& packageName) { packageName_ = packageName; }
  39. void SetCompanyName(const String& companyName) { companyName_ = companyName; }
  40. void SetProductName(const String& productName) { productName_ = productName; }
  41. void Write(JSONValue& parent);
  42. void Read(JSONValue& parent);
  43. private:
  44. String appName_;
  45. String packageName_;
  46. String companyName_;
  47. String productName_;
  48. };
  49. class WebBuildSettings : public RefCounted
  50. {
  51. ATOMIC_REFCOUNTED(WebBuildSettings)
  52. public:
  53. WebBuildSettings() {}
  54. const String& GetAppName() const { return appName_; }
  55. const String& GetPackageName() const { return packageName_; }
  56. const String& GetCompanyName() const { return companyName_; }
  57. const String& GetProductName() const { return productName_; }
  58. void SetAppName(const String& name) { appName_ = name; }
  59. void SetPackageName(const String& packageName) { packageName_ = packageName; }
  60. void SetCompanyName(const String& companyName) { companyName_ = companyName; }
  61. void SetProductName(const String& productName) { productName_ = productName; }
  62. void Write(JSONValue& parent);
  63. void Read(JSONValue& parent);
  64. private:
  65. String appName_;
  66. String packageName_;
  67. String companyName_;
  68. String productName_;
  69. };
  70. class WindowsBuildSettings : public RefCounted
  71. {
  72. ATOMIC_REFCOUNTED(WindowsBuildSettings)
  73. public:
  74. WindowsBuildSettings() {}
  75. const String& GetAppName() const { return appName_; }
  76. const String& GetPackageName() const { return packageName_; }
  77. const String& GetCompanyName() const { return companyName_; }
  78. const String& GetProductName() const { return productName_; }
  79. void SetAppName(const String& name) { appName_ = name; }
  80. void SetPackageName(const String& packageName) { packageName_ = packageName; }
  81. void SetCompanyName(const String& companyName) { companyName_ = companyName; }
  82. void SetProductName(const String& productName) { productName_ = productName; }
  83. void Write(JSONValue& parent);
  84. void Read(JSONValue& parent);
  85. private:
  86. String appName_;
  87. String packageName_;
  88. String companyName_;
  89. String productName_;
  90. };
  91. class AndroidBuildSettings : public RefCounted
  92. {
  93. ATOMIC_REFCOUNTED(AndroidBuildSettings)
  94. public:
  95. AndroidBuildSettings() {}
  96. const String& GetAppName() const { return appName_; }
  97. const String& GetPackageName() const { return packageName_; }
  98. const String& GetCompanyName() const { return companyName_; }
  99. const String& GetProductName() const { return productName_; }
  100. const String& GetSDKVersion() const { return targetSDKVersion_; }
  101. const String& GetMinSDKVersion() const { return minSDKVersion_; }
  102. const String& GetActivityName() const { return activityName_; }
  103. const String& GetIconPath() const { return iconPath_; }
  104. void SetAppName(const String& name) { appName_ = name; }
  105. void SetPackageName(const String& packageName) { packageName_ = packageName; }
  106. void SetCompanyName(const String& companyName) { companyName_ = companyName; }
  107. void SetProductName(const String& productName) { productName_ = productName; }
  108. void SetSDKVersion(const String& value) { targetSDKVersion_ = value; }
  109. void SetMinSDKVersion(const String& value) { minSDKVersion_ = value; }
  110. void SetActivityName(const String& value) { activityName_ = value; }
  111. void SetIconPath(const String& value) { iconPath_ = value; }
  112. void Write(JSONValue& parent);
  113. void Read(JSONValue& parent);
  114. private:
  115. String appName_;
  116. String packageName_;
  117. String companyName_;
  118. String productName_;
  119. String targetSDKVersion_;
  120. String minSDKVersion_;
  121. String activityName_;
  122. String iconPath_;
  123. };
  124. class IOSBuildSettings : public RefCounted
  125. {
  126. ATOMIC_REFCOUNTED(IOSBuildSettings)
  127. public:
  128. IOSBuildSettings() {}
  129. const String& GetAppName() const { return appName_; }
  130. const String& GetPackageName() const { return packageName_; }
  131. const String& GetCompanyName() const { return companyName_; }
  132. const String& GetProductName() const { return productName_; }
  133. const String& GetProvisionFile() const { return provisionFile_; }
  134. const String& GetAppIDPrefix() const { return appidPrefix_; }
  135. void SetAppName(const String& name) { appName_ = name; }
  136. void SetPackageName(const String& packageName) { packageName_ = packageName; }
  137. void SetCompanyName(const String& companyName) { companyName_ = companyName; }
  138. void SetProductName(const String& productName) { productName_ = productName; }
  139. void SetProvisionFile(const String& value) { provisionFile_ = value; }
  140. void SetAppIDPrefix(const String& value) { appidPrefix_ = value; }
  141. void Write(JSONValue& parent);
  142. void Read(JSONValue& parent);
  143. private:
  144. String appName_;
  145. String packageName_;
  146. String companyName_;
  147. String productName_;
  148. String provisionFile_;
  149. String appidPrefix_;
  150. };
  151. class LinuxBuildSettings : public RefCounted
  152. {
  153. ATOMIC_REFCOUNTED(LinuxBuildSettings)
  154. public:
  155. LinuxBuildSettings() {}
  156. const String& GetAppName() const { return appName_; }
  157. const String& GetPackageName() const { return packageName_; }
  158. const String& GetCompanyName() const { return companyName_; }
  159. const String& GetProductName() const { return productName_; }
  160. void SetAppName(const String& name) { appName_ = name; }
  161. void SetPackageName(const String& packageName) { packageName_ = packageName; }
  162. void SetCompanyName(const String& companyName) { companyName_ = companyName; }
  163. void SetProductName(const String& productName) { productName_ = productName; }
  164. void Write(JSONValue& parent);
  165. void Read(JSONValue& parent);
  166. private:
  167. String appName_;
  168. String packageName_;
  169. String companyName_;
  170. String productName_;
  171. };
  172. class ProjectBuildSettings : public Object
  173. {
  174. ATOMIC_OBJECT(ProjectBuildSettings, Object);
  175. public:
  176. /// Construct.
  177. ProjectBuildSettings(Context* context);
  178. /// Destruct.
  179. virtual ~ProjectBuildSettings();
  180. MacBuildSettings* GetMacBuildSettings() { return macBuildSettings_; }
  181. WindowsBuildSettings* GetWindowsBuildSettings() { return windowsBuildSettings_; }
  182. WebBuildSettings* GetWebBuildSettings() { return webBuildSettings_; }
  183. AndroidBuildSettings* GetAndroidBuildSettings() { return androidBuildSettings_; }
  184. IOSBuildSettings* GetIOSBuildSettings() { return iosBuildSettings_; }
  185. LinuxBuildSettings* GetLinuxBuildSettings() { return linuxBuildSettings_; }
  186. bool Load(const String& path);
  187. void Save(const String& path);
  188. private:
  189. SharedPtr<MacBuildSettings> macBuildSettings_;
  190. SharedPtr<WindowsBuildSettings> windowsBuildSettings_;
  191. SharedPtr<WebBuildSettings> webBuildSettings_;
  192. SharedPtr<AndroidBuildSettings> androidBuildSettings_;
  193. SharedPtr<IOSBuildSettings> iosBuildSettings_;
  194. SharedPtr<LinuxBuildSettings> linuxBuildSettings_;
  195. };
  196. }