projectGenerator.php 2.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192
  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. //
  24. // Hello, hello...
  25. //
  26. echo( "Welcome to projectGenerator 0.9\n" );
  27. echo( "Copyright (c) 2012 GarageGames, LLC\n" );
  28. echo( "Released under a MIT license.\n" );
  29. echo( "\n" );
  30. //
  31. // Configure error logging
  32. //
  33. error_reporting( E_ALL & ~E_NOTICE );
  34. //
  35. // Requires
  36. //
  37. require_once( "classes/BuildTarget.php" );
  38. require_once( "btargets/targets.inc" );
  39. require_once( "classes/Generator.php" );
  40. require_once( "projectGenUtils.inc" );
  41. require_once( "smarty/Smarty.class.php" );
  42. //
  43. // Initialization
  44. //
  45. $g_cwd = realpath( dirname( $_SERVER[ 'PHP_SELF' ] ) );
  46. echo( " CWD = " . $g_cwd . "\n" );
  47. //
  48. // Load, instantiate, and configure the smarty template engine.
  49. //
  50. echo( " - Loading Smarty...\n" );
  51. $tpl = new Smarty();
  52. $tpl->template_dir = $g_cwd . "/templates";
  53. $tpl->compile_dir = $g_cwd . "/templates_c";
  54. $tpl->clear_all_cache();
  55. // By default we assume that the root of the Torque SDK
  56. // is located two folders up from the CWD. That is unless
  57. // another path is passed in the command line.
  58. $torqueRoot = "../..";
  59. if ( $argc >= 3 )
  60. $torqueRoot = str_replace( "\\", "/", $argv[2] );
  61. // Kick off the generator
  62. T3D_Generator::init( $torqueRoot );
  63. // Ready to read our config file.
  64. echo( " - Loading config file " . realpath($argv[1])."\n" );
  65. require( $argv[ 1 ] );
  66. // Generate all projects
  67. T3D_Generator::generateProjects( $tpl );
  68. // Now the solutions (if any)
  69. $tpl->clear_all_cache();
  70. T3D_Generator::generateSolutions( $tpl );
  71. // finally write out the sample.html for web deployment (if any)
  72. WebPlugin::writeSampleHtml();
  73. exit;
  74. ?>