Torque3D.php 9.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267
  1. <?php
  2. //-----------------------------------------------------------------------------
  3. // Copyright (c) 2012 GarageGames, LLC
  4. //
  5. // Permission is hereby granted, free of charge, to any person obtaining a copy
  6. // of this software and associated documentation files (the "Software"), to
  7. // deal in the Software without restriction, including without limitation the
  8. // rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
  9. // sell copies of the Software, and to permit persons to whom the Software is
  10. // furnished to do so, subject to the following conditions:
  11. //
  12. // The above copyright notice and this permission notice shall be included in
  13. // all copies or substantial portions of the Software.
  14. //
  15. // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  16. // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  17. // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  18. // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  19. // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
  20. // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
  21. // IN THE SOFTWARE.
  22. //-----------------------------------------------------------------------------
  23. // This class wraps up some project generator specific stuff for the Torque 3D project itself
  24. // simplifying the per project setup, while still allowing the engine to have modules plugged in
  25. class Torque3D
  26. {
  27. static $sharedConfig = true;
  28. static $projectName = "";
  29. static function includeDefaultLibs()
  30. {
  31. // Libs
  32. includeLib( 'mng' );
  33. includeLib( 'png' );
  34. includeLib( 'ungif' );
  35. includeLib( 'zlib' );
  36. includeLib( 'jpeg' );
  37. includeLib( 'tinyxml' );
  38. includeLib( 'opcode' );
  39. includeLib( 'squish' );
  40. includeLib( 'collada_dom' );
  41. includeLib( 'pcre' );
  42. includeLib( 'convexDecomp' );
  43. // Use FMOD on consoles
  44. if ( T3D_Generator::$platform != "360" && T3D_Generator::$platform != "ps3" )
  45. {
  46. includeLib( 'libvorbis' );
  47. includeLib( 'libogg' );
  48. includeLib( 'libtheora' );
  49. }
  50. }
  51. static function beginConfig( $platform, $projectName )
  52. {
  53. setPlatform( $platform );
  54. beginProject( $projectName, self::$sharedConfig );
  55. self::includeDefaultLibs();
  56. $ext = "DLL";
  57. if ( T3D_Generator::$platform == "mac" )
  58. $ext = "Bundle";
  59. //some platforms will not want a shared config
  60. if ( T3D_Generator::$platform == "360" || T3D_Generator::$platform == "ps3" )
  61. self::$sharedConfig = false;
  62. //begin either a shared lib config, or a static app config
  63. if ( self::$sharedConfig )
  64. beginSharedLibConfig( getGameProjectName().' '.$ext, '{C0FCDFF9-E125-412E-87BC-2D89DB971CAB}', 'game', getGameProjectName() );
  65. else
  66. beginAppConfig( getGameProjectName(), '{C0FCDFF9-E125-412E-87BC-2D89DB971CAB}', 'game', getGameProjectName() );
  67. /// Prefs
  68. addProjectDefine( 'TORQUE_SHADERGEN' );
  69. addProjectDefine( 'TORQUE_UNICODE' );
  70. if ( self::$sharedConfig )
  71. addProjectDefine( 'TORQUE_SHARED' );
  72. /// For OPCODE
  73. addProjectDefine( 'BAN_OPCODE_AUTOLINK' );
  74. addProjectDefine( 'ICE_NO_DLL' );
  75. addProjectDefine( 'TORQUE_OPCODE' );
  76. // For libTomCrypt
  77. addProjectDefine( 'LTC_NO_PROTOTYPES' );
  78. // Additional includes
  79. addIncludePath( "../../game/shaders" );
  80. addLibIncludePath( "lmng" );
  81. addLibIncludePath( "lpng" );
  82. addLibIncludePath( "ljpeg" );
  83. addLibIncludePath( "lungif" );
  84. addLibIncludePath( "zlib" );
  85. addLibIncludePath( "tinyxml" );
  86. addLibIncludePath( "opcode" );
  87. addLibIncludePath( "squish" );
  88. addLibIncludePath( 'convexDecomp' );
  89. if ( T3D_Generator::$platform != "360" && T3D_Generator::$platform != "ps3" )
  90. {
  91. addLibIncludePath( "libvorbis/include" );
  92. addLibIncludePath( "libogg/include" );
  93. addLibIncludePath( "libtheora/include" );
  94. }
  95. // Modules
  96. includeModule( 'core' );
  97. includeModule( 'dsound' );
  98. includeModule( 'fmod');
  99. includeModule( 'T3D' );
  100. includeModule( 'advancedLighting' );
  101. includeModule( 'basicLighting' );
  102. includeModule( 'collada' );
  103. if ( T3D_Generator::$platform != "360" && T3D_Generator::$platform != "ps3" )
  104. {
  105. includeModule( 'vorbis' );
  106. includeModule( 'theora' );
  107. }
  108. if(T3D_Generator::$platform == "mac" || T3D_Generator::$platform == "win32")
  109. includeModule( 'openal' );
  110. // Dependencies
  111. addProjectDependency( 'lmng' );
  112. addProjectDependency( 'lpng' );
  113. addProjectDependency( 'lungif' );
  114. addProjectDependency( 'ljpeg' );
  115. addProjectDependency( 'zlib' );
  116. addProjectDependency( 'tinyxml' );
  117. addProjectDependency( 'opcode' );
  118. addProjectDependency( 'squish' );
  119. addProjectDependency( 'collada_dom' );
  120. addProjectDependency( 'pcre' );
  121. addProjectDependency( 'convexDecomp' );
  122. if ( T3D_Generator::$platform != "360" && T3D_Generator::$platform != "ps3" )
  123. {
  124. addProjectDependency( 'libvorbis' );
  125. addProjectDependency( 'libogg' );
  126. addProjectDependency( 'libtheora' );
  127. }
  128. if ( T3D_Generator::$platform == "mac" )
  129. {
  130. addProjectDefine( '__MACOSX__' );
  131. addProjectDefine( 'LTM_DESC' );
  132. }
  133. if (T3D_Generator::$platform == "win32")
  134. {
  135. setProjectModuleDefinitionFile('../../' . getLibSrcDir() . 'Torque3D/msvc/torque3d.def');
  136. addProjectDefine( 'UNICODE' );
  137. addProjectDefine( 'INITGUID' );
  138. addProjectDefine( '_CRT_SECURE_NO_DEPRECATE' );
  139. addProjectLibInput('COMCTL32.LIB');
  140. addProjectLibInput('COMDLG32.LIB');
  141. addProjectLibInput('USER32.LIB');
  142. addProjectLibInput('ADVAPI32.LIB');
  143. addProjectLibInput('GDI32.LIB');
  144. addProjectLibInput('WINMM.LIB');
  145. addProjectLibInput('WS2_32.LIB');
  146. addProjectLibInput('vfw32.lib');
  147. addProjectLibInput('Imm32.lib');
  148. addProjectLibInput('d3d9.lib');
  149. addProjectLibInput('d3dx9.lib');
  150. addProjectLibInput('DxErr.lib');
  151. addProjectLibInput('ole32.lib');
  152. addProjectLibInput('shell32.lib');
  153. addProjectLibInput('oleaut32.lib');
  154. addProjectLibInput('version.lib');
  155. }
  156. // Include project specific sources in the project/buildFiles/config/projectCode.conf
  157. $projectCode = realpath($argv[1])."/buildFiles/config/projectCode.conf";
  158. echo( "\n - Loading project code configuration from ".$projectCode."\n");
  159. include $projectCode;
  160. }
  161. static function endConfig()
  162. {
  163. //end shared/static config
  164. if ( self::$sharedConfig )
  165. endSharedLibConfig();
  166. else
  167. endAppConfig();
  168. //add the shared application only if this is a shared config
  169. if ( self::$sharedConfig )
  170. {
  171. /////// Application Config
  172. beginSharedAppConfig( getGameProjectName(), '{CDECDFF9-E125-523F-87BC-2D89DB971CAB}' );
  173. addProjectDefine( 'TORQUE_SHARED' );
  174. addEngineSrcDir( 'main' );
  175. if (T3D_Generator::$platform == "win32")
  176. {
  177. addProjectDefine( 'WIN32' );
  178. addProjectDependency( getGameProjectName() . ' DLL' );
  179. }
  180. if (T3D_Generator::$platform == "mac")
  181. {
  182. addProjectDefine( '__MACOSX__' );
  183. addProjectDependency( getGameProjectName() . ' Bundle' );
  184. addProjectDependency( getGameProjectName() . ' Plugin' );
  185. }
  186. endSharedAppConfig();
  187. }
  188. // Add solution references for Visual Studio projects
  189. if (T3D_Generator::$platform == "win32" || T3D_Generator::$platform == "360" || T3D_Generator::$platform == "ps3")
  190. {
  191. if ( !self::$sharedConfig )
  192. beginSolutionConfig( getGameProjectName(), '{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}' );
  193. addSolutionProjectRef( getGameProjectName() );
  194. if ( self::$sharedConfig )
  195. addSolutionProjectRef( getGameProjectName() . ' DLL' );
  196. addSolutionProjectRef( 'collada_dom' );
  197. addSolutionProjectRef( 'ljpeg' );
  198. addSolutionProjectRef( 'lmng' );
  199. addSolutionProjectRef( 'lpng' );
  200. addSolutionProjectRef( 'lungif' );
  201. addSolutionProjectRef( 'opcode' );
  202. addSolutionProjectRef( 'pcre' );
  203. addSolutionProjectRef( 'squish' );
  204. addSolutionProjectRef( 'tinyxml' );
  205. addSolutionProjectRef( 'zlib' );
  206. addSolutionProjectRef( 'convexDecomp' );
  207. if (T3D_Generator::$platform == "win32")
  208. {
  209. addSolutionProjectRef( 'libogg' );
  210. addSolutionProjectRef( 'libvorbis' );
  211. addSolutionProjectRef( 'libtheora' );
  212. }
  213. if ( !self::$sharedConfig )
  214. endSolutionConfig();
  215. }
  216. endProject(self::$sharedConfig);
  217. }
  218. }
  219. ?>