Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for Visual Studio 2022 Win64 #577

Open
wants to merge 2 commits into
base: 4.1
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions physx/buildtools/cmake_generate_projects.py
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,10 @@ def getCMakeSwitches(self):
print('VS16CL:' + os.environ['VS160CLPATH'])
outString = outString + ' -DCUDA_HOST_COMPILER=' + \
os.environ['VS160CLPATH']
if self.compiler == 'vc17':
print('VS17CL:' + os.environ['VS170CLPATH'])
outString = outString + ' -DCUDA_HOST_COMPILER=' + \
os.environ['VS170CLPATH']

return outString

Expand All @@ -157,6 +161,8 @@ def getPlatformCMakeParams(self):
outString = outString + '-G \"Visual Studio 15 2017\"'
elif self.compiler == 'vc16':
outString = outString + '-G \"Visual Studio 16 2019\"'
elif self.compiler == 'vc17':
outString = outString + '-G \"Visual Studio 17 2022\"'
elif self.compiler == 'xcode':
outString = outString + '-G Xcode'
elif self.targetPlatform == 'android':
Expand Down Expand Up @@ -232,6 +238,14 @@ def getPlatformCMakeParams(self):
outString = outString + ' -T v142'
outString = outString + ' -DCMAKE_VS160PATH=' + \
os.environ['VS160PATH']
elif self.compiler == 'vc17':
# TODO: Toolchain file need to be created
outString = outString + ' -DCMAKE_TOOLCHAIN_FILE=' + \
os.environ['PM_CMakeModules_PATH'] + \
'/xboxone/XboxOneToolchainVC17.txt'
outString = outString + ' -T v143'
outString = outString + ' -DCMAKE_VS170PATH=' + \
os.environ['VS170PATH']
outString = outString + ' -DCMAKE_GENERATOR_PLATFORM=Durango'
outString = outString + ' -DSUPPRESS_SUFFIX=ON'
return outString
Expand All @@ -252,6 +266,14 @@ def getPlatformCMakeParams(self):
outString = outString + ' -T v142'
outString = outString + ' -DCMAKE_VS160PATH=' + \
os.environ['VS160PATH']
if self.compiler == 'vc17':
# TODO: Toolchain file need to be created
outString = outString + ' -DCMAKE_TOOLCHAIN_FILE=' + \
os.environ['PM_CMakeModules_PATH'] + \
'/xboxseriesx/XboxSeriesXToolchainVC17.txt'
outString = outString + ' -T v143'
outString = outString + ' -DCMAKE_VS170PATH=' + \
os.environ['VS160PATH']
outString = outString + ' -DCMAKE_GENERATOR_PLATFORM=Gaming.Xbox.Scarlett.x64'
outString = outString + ' -DSUPPRESS_SUFFIX=ON'
return outString
Expand Down
15 changes: 15 additions & 0 deletions physx/buildtools/presets/public/vc17win64.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<?xml version="1.0" encoding="utf-8"?>
<preset name="vc17win64" comment="VC17 Win64 PhysX general settings">
<platform targetPlatform="win64" compiler="vc17" />
<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/vc15win64/PhysX" comment="Install path relative to PhysX SDK root" />
</CMakeParams>
</preset>
17 changes: 17 additions & 0 deletions physx/generate_projects.bat
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,11 @@ for /f "usebackq tokens=*" %%i in (`"%PM_vswhere_PATH%\VsWhere.exe -version [16
set VS160PATH="%%i"
)

for /f "usebackq tokens=*" %%i in (`"%PM_vswhere_PATH%\VsWhere.exe -version [17.0,18.0) -latest -products * -requires Microsoft.VisualStudio.Component.VC.Tools.x86.x64 -property installationPath"`) do (
set Install2022Dir=%%i
set VS170PATH="%%i"
)

if exist "%Install2017Dir%\VC\Auxiliary\Build\Microsoft.VCToolsVersion.default.txt" (
pushd "%Install2017Dir%\VC\Auxiliary\Build\"
set /p Version=<Microsoft.VCToolsVersion.default.txt
Expand All @@ -86,6 +91,18 @@ if exist "%Install2019Dir%\VC\Auxiliary\Build\Microsoft.VCToolsVersion.default.t
popd
)

if exist "%Install2022Dir%\VC\Auxiliary\Build\Microsoft.VCToolsVersion.default.txt" (
pushd "%Install2022Dir%\VC\Auxiliary\Build\"
set /p Version=<Microsoft.VCToolsVersion.default.txt
for /f "delims=" %%x in (Microsoft.VCToolsVersion.default.txt) do (
if not %%x=="" (
rem Example hardcodes x64 as the host and target architecture, but you could parse it from arguments
set VS170CLPATH="%Install2022Dir%\VC\Tools\MSVC\%%x\bin\HostX64\x64\cl.exe"
)
)
popd
)

:ADDITIONAL_PARAMS_MISSING
pushd %~dp0
%PM_PYTHON% "%PHYSX_ROOT_DIR%/buildtools/cmake_generate_projects.py" %1
Expand Down