欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

How to use VS2019 to Compile PhysX-4.0.0

程序员文章站 2022-07-02 19:20:44
...

1. 编译工程设置
添加vs2019配置选项到编译python中
cmake_generate_projects.py

 def getPlatformCMakeParams(self):
        outString = ' '
        if self.compiler == 'vc12':
            outString = outString + '-G \"Visual Studio 12 2013\"'
        elif self.compiler == 'vc14':
            outString = outString + '-G \"Visual Studio 14 2015\"'
        elif self.compiler == 'vc15':
            outString = outString + '-G \"Visual Studio 15 2017\"'
        elif self.compiler == 'vc16':
            outString = outString + '-G \"Visual Studio 16 2019\"'

新建文件 PhysX-4.0.0\physx\buildtools\presets\public\vc16win64.xml

<?xml version="1.0" encoding="utf-8"?>
<preset name="vc16win64" comment="VC16 Win64 PhysX general settings">
  <platform targetPlatform="win64" compiler="vc16" />
  <CMakeSwitches>
    <cmakeSwitch name="PX_BUILDSNIPPETS" value="True" comment="Generate the snippets" />
    <cmakeSwitch name="PX_BUILDPUBLICSAMPLES" value="True" comment="Generate the samples projects" />
    <cmakeSwitch name="PX_GENERATE_STATIC_LIBRARIES" value="False" comment="Generate static libraries" />
    <cmakeSwitch name="NV_USE_STATIC_WINCRT" value="True" comment="Use the statically linked windows CRT" />
    <cmakeSwitch name="NV_USE_DEBUG_WINCRT" value="True" comment="Use the debug version of the CRT" />
    <cmakeSwitch name="PX_FLOAT_POINT_PRECISE_MATH" value="False" comment="Float point precise math" />
  </CMakeSwitches>
  <CMakeParams>
    <cmakeParam name="CMAKE_INSTALL_PREFIX" value="install/vc16win64/PhysX" comment="Install path relative to PhysX SDK root" />
  </CMakeParams>
</preset>

2. 编译错误设置
错误1:fatal error C1083: Cannot open include file: ‘typeinfo.h’
解决:#include <typeinfo.h> 改为 #include <typeinfo>

错误2: error C2039: “type_info”: 不是 “std” 的成员
解决:添加文件头 #include <typeinfo>

错误3:Cannot open include file: ‘d3dx9.h’:
解决:把以下目录添加到"C/C+±>常规-> 附加包含目录"中
D:\Program Files (x86)\Microsoft DirectX SDK (June 2010)\Include

错误4:error C2220: 以下警告被视为错误
解决:"C/C+±>常规->将警告视为错误:否“

相关标签: physx 物理引擎

上一篇: Swift Tips

下一篇: swift Tips