Files
PhysX4.1/physx/documentation/PhysXGuide/Manual/BuildingWithPhysX.html
2025-11-28 23:13:44 +05:30

332 lines
15 KiB
HTML

<!DOCTYPE html>
<!--[if IE 8]><html class="no-js lt-ie9" lang="" > <![endif]-->
<!--[if gt IE 8]><!--> <html class="no-js" lang="" > <!--<![endif]-->
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Building with PhysX &mdash; NVIDIA PhysX SDK 4.1 Documentation</title>
<link rel="shortcut icon" href="_static/images/favicon.ico"/>
<link rel="stylesheet" href="../_static/pygments.css" type="text/css" />
<link rel="stylesheet" href="../_static/breathe.css" type="text/css" />
<link rel="next" title="The PhysX API" href="API.html" />
<link rel="prev" title="Snippets" href="HelloWorld.html" />
<link href="../_static/css/nvidia_theme.css" rel="stylesheet" type="text/css">
<style>
.wy-nav-content::before {
content: "PhysX 4.1 SDK Guide";
}
</style>
<script src="../_static/js/modernizr.min.js"></script>
</head>
<body class="wy-body-for-nav">
<div class="wy-grid-for-nav">
<nav data-toggle="wy-nav-shift" class="wy-nav-side">
<div class="wy-side-scroll">
<div class="wy-side-nav-search">
<a href="../Index.html" class="icon icon-home"> Python
</a>
<div role="search">
<form id="rtd-search-form" class="wy-form" action="../search.html" method="get">
<input type="text" name="q" placeholder="Search docs" />
<input type="hidden" name="check_keywords" value="yes" />
<input type="hidden" name="area" value="default" />
</form>
</div>
</div>
<div class="wy-menu wy-menu-vertical" data-spy="affix" role="navigation" aria-label="main navigation">
<ul class="current">
<li class="toctree-l1 current"><a class="reference internal" href="Index.html">User's Guide</a><ul class="current">
<li class="toctree-l2"><a class="reference internal" href="License.html">PhysX License</a></li>
<li class="toctree-l2"><a class="reference internal" href="Introduction.html">Welcome to PhysX</a></li>
<li class="toctree-l2"><a class="reference internal" href="HelloWorld.html">Snippets</a></li>
<li class="toctree-l2 current"><a class="current reference internal" href="">Building with PhysX</a><ul>
<li class="toctree-l3"><a class="reference internal" href="#generating-projects-with-cmake">Generating projects with CMake</a></li>
<li class="toctree-l3"><a class="reference internal" href="#build-configurations">Build Configurations</a></li>
<li class="toctree-l3"><a class="reference internal" href="#header-files">Header Files</a></li>
<li class="toctree-l3"><a class="reference internal" href="#redistribution">Redistribution</a></li>
<li class="toctree-l3"><a class="reference internal" href="#customize-cmake-presets">Customize CMake presets</a></li>
</ul>
</li>
<li class="toctree-l2"><a class="reference internal" href="API.html">The PhysX API</a></li>
<li class="toctree-l2"><a class="reference internal" href="Startup.html">Startup and Shutdown</a></li>
<li class="toctree-l2"><a class="reference internal" href="Threading.html">Threading</a></li>
<li class="toctree-l2"><a class="reference internal" href="Geometry.html">Geometry</a></li>
<li class="toctree-l2"><a class="reference internal" href="RigidBodyOverview.html">Rigid Body Overview</a></li>
<li class="toctree-l2"><a class="reference internal" href="RigidBodyCollision.html">Rigid Body Collision</a></li>
<li class="toctree-l2"><a class="reference internal" href="RigidBodyDynamics.html">Rigid Body Dynamics</a></li>
<li class="toctree-l2"><a class="reference internal" href="Simulation.html">Simulation</a></li>
<li class="toctree-l2"><a class="reference internal" href="AdvancedCollisionDetection.html">Advanced Collision Detection</a></li>
<li class="toctree-l2"><a class="reference internal" href="Joints.html">Joints</a></li>
<li class="toctree-l2"><a class="reference internal" href="Articulations.html">Articulations</a></li>
<li class="toctree-l2"><a class="reference internal" href="Articulations.html#maximal-coordinate-and-reduced-articulations">Maximal Coordinate and Reduced Articulations</a></li>
<li class="toctree-l2"><a class="reference internal" href="Articulations.html#maximal-coordinate-articulations">Maximal Coordinate Articulations</a></li>
<li class="toctree-l2"><a class="reference internal" href="Articulations.html#reduced-coordinate-articulations">Reduced Coordinate Articulations</a></li>
<li class="toctree-l2"><a class="reference internal" href="OriginShift.html">Scene Origin</a></li>
<li class="toctree-l2"><a class="reference internal" href="GPURigidBodies.html">GPU Rigid Bodies</a></li>
<li class="toctree-l2"><a class="reference internal" href="GeometryQueries.html">Geometry Queries</a></li>
<li class="toctree-l2"><a class="reference internal" href="SceneQueries.html">Scene Queries</a></li>
<li class="toctree-l2"><a class="reference internal" href="Vehicles.html">Vehicles</a></li>
<li class="toctree-l2"><a class="reference internal" href="CharacterControllers.html">Character Controllers</a></li>
<li class="toctree-l2"><a class="reference internal" href="DebugVisualization.html">Debug Visualization</a></li>
<li class="toctree-l2"><a class="reference internal" href="VisualDebugger.html">PhysX Visual Debugger (PVD)</a></li>
<li class="toctree-l2"><a class="reference internal" href="Statistics.html">Simulation Statistics</a></li>
<li class="toctree-l2"><a class="reference internal" href="Serialization.html">Serialization</a></li>
<li class="toctree-l2"><a class="reference internal" href="ExtendingSerialization.html">Extending Serialization</a></li>
<li class="toctree-l2"><a class="reference internal" href="BestPractices.html">Best Practices Guide</a></li>
<li class="toctree-l2"><a class="reference internal" href="MigrationFrom28.html">Migrating From PhysX SDK 2.x to 3.x</a></li>
<li class="toctree-l2"><a class="reference internal" href="MigrationTo33.html">Migrating From PhysX SDK 3.2 to 3.3</a></li>
<li class="toctree-l2"><a class="reference internal" href="MigrationTo34.html">Migrating From PhysX SDK 3.3 to 3.4</a></li>
<li class="toctree-l2"><a class="reference internal" href="MigrationTo40.html">Migrating From PhysX SDK 3.4 to 4.0</a></li>
</ul>
</li>
</ul>
</div>
</div>
</nav>
<section data-toggle="wy-nav-shift" class="wy-nav-content-wrap">
<nav class="wy-nav-top" aria-label="top navigation">
<i data-toggle="wy-nav-top" class="fa fa-bars"></i>
<a href="../Index.html">Python</a>
</nav>
<div class="wy-nav-content">
<div class="rst-content">
<div role="navigation" aria-label="breadcrumbs navigation">
<ul class="wy-breadcrumbs">
<li><a href="../Index.html">Docs</a> &raquo;</li>
<li><a href="Index.html">User's Guide</a> &raquo;</li>
<li>Building with PhysX</li>
<li class="wy-breadcrumbs-aside">
</li>
</ul>
<hr/>
</div>
<div role="main" class="document" itemscope="itemscope" itemtype="http://schema.org/Article">
<div itemprop="articleBody">
<div class="section" id="building-with-physx">
<span id="id1"></span><h1>Building with PhysX<a class="headerlink" href="#building-with-physx" title="Permalink to this headline"></a></h1>
<div class="section" id="generating-projects-with-cmake">
<h2>Generating projects with CMake<a class="headerlink" href="#generating-projects-with-cmake" title="Permalink to this headline"></a></h2>
<p>PhysX uses CMake to generate build configuration files (e.g. Microsoft Visual Studio Solutions) for all supported platforms. The PhysX distribution comes with default CMake parameter sets called <strong>presets</strong>.
The build configuration files can be generated with the script <strong>generate_projects</strong> in the distributions &quot;physx/&quot; directory. This script either prompts for a preset or accepts a preset as a command line parameter. The resulting build configuration files are generated under &quot;physx/compiler/&quot;.</p>
<p>PhysX binaries (including static libraries) are placed into &quot;bin/&lt;platform&gt;.&lt;target&gt;.&lt;compiler&gt;.&lt;runtime&gt;/&lt;configuration&gt;/&quot; directories, for example the vc14win64 checked build puts binaries into &quot;bin/win.x86_32.vc140.mt/checked/&quot;.</p>
</div>
<div class="section" id="build-configurations">
<h2>Build Configurations<a class="headerlink" href="#build-configurations" title="Permalink to this headline"></a></h2>
<p>The SDK has four build configurations available, designed for different stages of development and deployment.</p>
<ul class="simple">
<li>the <em>debug</em> build can be useful for error analysis, but contains asserts used for SDK development which some customers may find too intrusive for daily use. Optimizations are turned off for this configuration.</li>
<li>the <em>checked</em> build contains code to detect invalid parameters, API race conditions, and other incorrect uses of the API which might otherwise cause mysterious crashes or failures in simulation.</li>
<li>the <em>profile</em> build omits the checks, but still has PVD and memory instrumentation.</li>
<li>the <em>release</em> build is built for minimal footprint and maximum speed. It omits most checks and instrumentation.</li>
</ul>
<p>Simulation works the same way in all of them, and all are compiled with high optimization levels (except debug configuration).</p>
<div class="admonition note">
<p class="first admonition-title">Note</p>
<p class="last">We strongly recommend that you use the checked build as the primary configuration for day-to-day development and QA.</p>
</div>
<div class="admonition note">
<p class="first admonition-title">Note</p>
<p class="last">PhysX libraries of different build configurations (e.g. the DEBUG version of PhysXVehicle and the CHECKED version of PhysXVisualDebuggerSDK) should never be mixed in an application because this will result a CRT conflict.</p>
</div>
</div>
<div class="section" id="header-files">
<span id="id2"></span><h2>Header Files<a class="headerlink" href="#header-files" title="Permalink to this headline"></a></h2>
<p>To build your own PhysX app, you will need to add some include paths and libraries to your project makefile or IDE.</p>
<p>Users should specify the root &quot;include/&quot; and corresponding &quot;bin/&quot; folders in the additional include, and library directories of their build configuration respectively. There is a combined include header available as:</p>
<div class="highlight-c++"><div class="highlight"><pre><span class="cp">#include &quot;PxPhysicsAPI.h&quot;</span>
</pre></div>
</div>
<p>This will include the entire PhysX API including core, extensions, vehicles, etc. It is also possible to include subsets of the SDK if preferred, for example:</p>
<div class="highlight-c++"><div class="highlight"><pre><span class="cp">#include &quot;vehicle/PxVehicleSDK.h&quot;</span>
</pre></div>
</div>
</div>
<div class="section" id="redistribution">
<span id="id3"></span><h2>Redistribution<a class="headerlink" href="#redistribution" title="Permalink to this headline"></a></h2>
<p>On the Windows platform, you need to redistribute some of our DLLs to end users as part of your application:</p>
<ul class="simple">
<li>PhysXCommon_*.dll - will always be needed.</li>
<li>PhysX_*.dll - will always be needed.</li>
<li>PhysXFoundation_*.dll - will always be needed.</li>
<li>PhysXCooking_*.dll - you only need to bundle if your application cooks geometry data on the fly.</li>
<li>PhysXGPU_*.dll - is only needed if your application runs some simulation on the GPU.</li>
</ul>
<p>Where * is a platform specific suffix, e.g. 32 or 64. You will need one or the other depending on whether your application is built in 64 bit mode.</p>
</div>
<div class="section" id="customize-cmake-presets">
<h2>Customize CMake presets<a class="headerlink" href="#customize-cmake-presets" title="Permalink to this headline"></a></h2>
<p>It is possible to customize the CMake presets, which are stored in &quot;physx/buildtools/presets/public/&quot;. Each XML file represents one preset, depending on the platform some CMake switches can be toggled.</p>
<p>General switches:</p>
<ul class="simple">
<li>PX_BUILDSNIPPETS - specify whether the PhysX Snippets should be added to the build configuration - default True</li>
</ul>
<p>Windows switches:</p>
<ul class="simple">
<li>PX_GENERATE_STATIC_LIBRARIES - it is possible to switch the PhysX build to output static libs instead of DLLs - default False</li>
<li>NV_USE_STATIC_WINCRT - sets static or dynamic runtime usage - default True</li>
<li>NV_USE_DEBUG_WINCRT - specify whether debug CRT should be used - default True</li>
<li>PX_FLOAT_POINT_PRECISE_MATH - it is possible to switch to precise math rather than fast math, this is beneficial especially for robotics projects, which do require higher precision - default False</li>
</ul>
<p>Some switches like PX_GENERATE_STATIC_LIBRARIES may result in a need for additional defines to be set within your application. In this case you can include in your application PxConfig.h header, which is generated during generate projects.</p>
</div>
</div>
</div>
</div>
<footer>
<div class="rst-footer-buttons" role="navigation" aria-label="footer navigation">
<a href="API.html" class="btn btn-neutral float-right" title="The PhysX API" accesskey="n" rel="next">Next <span class="fa fa-arrow-circle-right"></span></a>
<a href="HelloWorld.html" class="btn btn-neutral" title="Snippets" accesskey="p" rel="prev"><span class="fa fa-arrow-circle-left"></span> Previous</a>
</div>
<hr/>
<div role="contentinfo">
<p>
&copy; Copyright 2008-2021 NVIDIA Corporation, 2788 San Tomas Expressway, Santa Clara, CA 95051 U.S.A. All rights reserved
</p>
</div>
</footer>
</div>
</div>
</section>
</div>
<script type="text/javascript">
var DOCUMENTATION_OPTIONS = {
URL_ROOT:'../',
VERSION:'4.1',
LANGUAGE:'',
COLLAPSE_INDEX:false,
FILE_SUFFIX:'.html',
HAS_SOURCE: true,
SOURCELINK_SUFFIX: ''
};
</script>
<script type="text/javascript" src="../_static/jquery.js"></script>
<script type="text/javascript" src="../_static/underscore.js"></script>
<script type="text/javascript" src="../_static/doctools.js"></script>
<script type="text/javascript" src="../_static/js/theme.js"></script>
<script type="text/javascript">
jQuery(function () {
SphinxRtdTheme.Navigation.enable(false);
});
</script>
</body>
</html>