physX3.inc 5.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112
  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. beginModule( 'physX3' );
  24. // Look for the optional global from the project.conf.
  25. global $PHYSX3_SDK_PATH;
  26. if (!$PHYSX3_SDK_PATH)
  27. {
  28. // First look for an environment var.
  29. $PHYSX3_SDK_PATH = getenv( "TORQUE_PHYSX3_PATH" );
  30. if (strlen($PHYSX3_SDK_PATH) == 0 || !file_exists($PHYSX3_SDK_PATH))
  31. {
  32. // Sometimes users get confused and use this var.
  33. $PHYSX3_SDK_PATH = getenv( "PHYSX3_SDK_PATH" );
  34. if (strlen($PHYSX3_SDK_PATH) == 0 || !file_exists($PHYSX3_SDK_PATH))
  35. {
  36. // Since neither environment var worked try for
  37. $PHYSX3_SDK_PATH = getenv("ProgramFiles") . "/NVIDIA Corporation/NVIDIA PhysX SDK/v3.3.0_win";
  38. // Last channce... try the x86 program files
  39. if (!file_exists($PHYSX_SDK_PATH))
  40. $PHYSX3_SDK_PATH = getenv("ProgramFiles(x86)") . "/NVIDIA Corporation/NVIDIA PhysX SDK/v3.3.0_win";
  41. }
  42. }
  43. // We need forward slashes for paths.
  44. $PHYSX3_SDK_PATH = str_replace( "\\", "/", $PHYSX3_SDK_PATH);
  45. // Remove trailing slashes.
  46. $PHYSX3_SDK_PATH = rtrim($PHYSX3_SDK_PATH, " /");
  47. }
  48. // If we still don't have the SDK path then let the user know.
  49. if (!file_exists($PHYSX3_SDK_PATH))
  50. {
  51. trigger_error(
  52. "\n*******************************************************************".
  53. "\n".
  54. "\n We were not able to find a valid path to the PhysX 3 SDK!".
  55. "\n".
  56. "\n You must install the latest PhysX3 SDK and set the path via a".
  57. "\n \$PHYSX3_SDK_PATH variable in your buildFiles/project.conf file".
  58. "\n or by setting the TORQUE_PHYSX3_PATH system environment variable".
  59. "\n (may require a reboot).".
  60. "\n".
  61. "\n*******************************************************************".
  62. "\n", E_USER_ERROR );
  63. }
  64. addProjectDefine( "TORQUE_PHYSICS_PHYSX3" );
  65. addProjectDefine( "TORQUE_PHYSICS_ENABLED" );
  66. // Source
  67. addEngineSrcDir( "T3D/physics/physx3" );
  68. addEngineSrcDir( "T3D/physics/physx3/Cloth" );
  69. addEngineSrcDir( "T3D/physics/physx3/Particles" );
  70. // Includes
  71. addIncludePath( $PHYSX3_SDK_PATH . "/Include" );
  72. addIncludePath( $PHYSX3_SDK_PATH . "/Include/extensions" );
  73. addIncludePath( $PHYSX3_SDK_PATH . "/Include/foundation" );
  74. addIncludePath( $PHYSX3_SDK_PATH . "/Include/characterkinematic" );
  75. addIncludePath( $PHYSX3_SDK_PATH . "/Include/common" );
  76. // Libs
  77. addProjectLibDir( $PHYSX3_SDK_PATH . "/Lib/win32" );
  78. addProjectLibInput( "PhysX3_x86.lib","PhysX3CHECKED_x86.lib" );
  79. addProjectLibInput( "PhysX3Common_x86.lib","PhysX3CommonCHECKED_x86.lib");
  80. addProjectLibInput( "PhysX3Extensions.lib","PhysX3ExtensionsCHECKED.lib" );
  81. addProjectLibInput( "PhysX3Cooking_x86.lib","PhysX3CookingCHECKED_x86.lib");
  82. addProjectLibInput( "PxTask.lib","PxTaskCHECKED.lib" );
  83. addProjectLibInput( "PhysX3CharacterKinematic_x86.lib","PhysX3CharacterKinematicCHECKED_x86.lib" );
  84. addProjectLibInput( "PhysXVisualDebuggerSDK.lib", "PhysXVisualDebuggerSDKCHECKED.lib");
  85. addProjectLibInput( "PhysXProfileSDK.lib", "PhysXProfileSDKCHECKED.lib");
  86. // File Copy
  87. copyFileToProject( $PHYSX3_SDK_PATH . "/Bin/win32/nvToolsExt32_1.dll", "/game/nvToolsExt32_1.dll" );
  88. copyFileToProject( $PHYSX3_SDK_PATH . "/Bin/win32/PhysX3_x86.dll", "/game/PhysX3_x86.dll" );
  89. copyFileToProject( $PHYSX3_SDK_PATH . "/Bin/win32/PhysX3CharacterKinematic_x86.dll", "/game/PhysX3CharacterKinematic_x86.dll" );
  90. copyFileToProject( $PHYSX3_SDK_PATH . "/Bin/win32/PhysX3CharacterKinematicCHECKED_x86.dll", "/game/PhysX3CharacterKinematicCHECKED_x86.dll" );
  91. copyFileToProject( $PHYSX3_SDK_PATH . "/Bin/win32/PhysX3CHECKED_x86.dll", "/game/PhysX3CHECKED_x86.dll" );
  92. copyFileToProject( $PHYSX3_SDK_PATH . "/Bin/win32/PhysX3Common_x86.dll", "/game/PhysX3Common_x86.dll" );
  93. copyFileToProject( $PHYSX3_SDK_PATH . "/Bin/win32/PhysX3CommonCHECKED_x86.dll", "/game/PhysX3CommonCHECKED_x86.dll" );
  94. copyFileToProject( $PHYSX3_SDK_PATH . "/Bin/win32/PhysX3Cooking_x86.dll", "/game/PhysX3Cooking_x86.dll" );
  95. copyFileToProject( $PHYSX3_SDK_PATH . "/Bin/win32/PhysX3CookingCHECKED_x86.dll", "/game/PhysX3CookingCHECKED_x86.dll" );
  96. endModule();
  97. ?>