Skip to content

Commit 24568c8

Browse files
committed
Build PhysX GPU binaries on Windows
1 parent 750dd73 commit 24568c8

2 files changed

Lines changed: 53 additions & 17 deletions

File tree

.github/workflows/BuildPhysX.yml

Lines changed: 34 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ jobs:
1414
strategy:
1515
fail-fast: false
1616
matrix:
17-
os: [windows-latest, ubuntu-latest]
17+
os: [windows-2022, ubuntu-latest]
1818
config: [debug, release, profile, checked]
1919

2020
steps:
@@ -25,61 +25,78 @@ jobs:
2525
ref: 107.0-physx-5.6.0
2626

2727
# === WINDOWS ===
28+
- name: Install CUDA Toolkit (Windows)
29+
if: runner.os == 'Windows'
30+
uses: Jimver/cuda-toolkit@v0.2.35
31+
with:
32+
cuda: '12.5.0'
33+
method: network
34+
sub-packages: '["nvcc", "cudart", "visual_studio_integration"]'
35+
log-file-suffix: '${{ matrix.os }}-${{ matrix.config }}.txt'
36+
2837
- name: Download preset (Windows)
29-
if: matrix.os == 'windows-latest'
38+
if: runner.os == 'Windows'
3039
run: |
31-
curl -L -o vc17win64-cpu-only-md.xml https://raw.githubusercontent.com/Lumengine/PhysXBuild/main/vc17win64-cpu-only-md.xml
32-
cp vc17win64-cpu-only-md.xml ./physx/buildtools/presets/public/
40+
curl -L -o vc17win64-gpu-md.xml https://raw.githubusercontent.com/Lumengine/PhysXBuild/main/vc17win64-gpu-md.xml
41+
cp vc17win64-gpu-md.xml ./physx/buildtools/presets/public/
3342
3443
- name: Generate Projects (Windows)
35-
if: matrix.os == 'windows-latest'
36-
run: ./generate_projects.bat vc17win64-cpu-only-md
44+
if: runner.os == 'Windows'
45+
run: ./generate_projects.bat vc17win64-gpu-md
3746
working-directory: physx
3847

3948
- name: Build (Windows)
40-
if: matrix.os == 'windows-latest'
41-
run: cmake --build ./compiler/vc17win64-cpu-only-md --config ${{ matrix.config }}
49+
if: runner.os == 'Windows'
50+
run: cmake --build ./compiler/vc17win64-gpu-md --config ${{ matrix.config }}
4251
working-directory: physx
4352

4453
- name: Package (Windows)
45-
if: matrix.os == 'windows-latest'
54+
if: runner.os == 'Windows'
4655
id: package-windows
4756
shell: bash
4857
run: |
49-
mkdir -p output/bin output/lib
50-
binArchiveName="PhysX-5.6.0.win.x86_64.vc143.md.${{ matrix.config }}.zip"
58+
mkdir -p output/bin output/lib output/include output/documentation
59+
binArchiveName="Physx-5.6.0.win.x86_64.vc143.md.${{ matrix.config }}.zip"
5160
echo "PHYSX_BINARY_ARCHIVE=$binArchiveName" >> "$GITHUB_OUTPUT"
5261
cp physx/bin/win.x86_64.vc143.md/${{ matrix.config }}/*.dll output/bin/
5362
cp physx/bin/win.x86_64.vc143.md/${{ matrix.config }}/*.lib output/lib/
54-
7z a "$binArchiveName" ./output/bin/ ./output/lib/ ./physx/include/ ./physx/documentation/
63+
cp -r physx/include/* output/include/
64+
cp -r physx/documentation/* output/documentation/ 2>/dev/null || true
65+
if [ -n "${CUDA_PATH:-}" ]; then
66+
cuda_bin="$(cygpath -u "$CUDA_PATH")/bin"
67+
cp "$cuda_bin"/cudart64_*.dll output/bin/ 2>/dev/null || true
68+
fi
69+
test -f output/bin/PhysXGpu_64.dll
70+
test -f output/bin/PhysXDevice64.dll
71+
(cd output && 7z a "../$binArchiveName" ./bin/ ./lib/ ./include/ ./documentation/)
5572
5673
# === LINUX ===
5774
- name: Install dependencies (Linux)
58-
if: matrix.os == 'ubuntu-latest'
75+
if: runner.os == 'Linux'
5976
run: |
6077
sudo apt update
6178
sudo apt install -y ninja-build cmake clang python3
6279
6380
- name: Download preset (Linux)
64-
if: matrix.os == 'ubuntu-latest'
81+
if: runner.os == 'Linux'
6582
run: |
6683
curl -L -o linux-clang-cpu-only-nosnippets.xml https://raw.githubusercontent.com/Lumengine/PhysXBuild/main/linux-clang-cpu-only-nosnippets.xml
6784
cp linux-clang-cpu-only-nosnippets.xml ./physx/buildtools/presets/public/
6885
6986
- name: Generate Projects (Linux)
70-
if: matrix.os == 'ubuntu-latest'
87+
if: runner.os == 'Linux'
7188
run: |
7289
chmod +x ./generate_projects.sh
7390
./generate_projects.sh linux-clang-cpu-only-nosnippets
7491
working-directory: physx
7592

7693
- name: Build (Linux)
77-
if: matrix.os == 'ubuntu-latest'
94+
if: runner.os == 'Linux'
7895
run: cmake --build ./compiler/linux-clang-cpu-only-nosnippets-${{ matrix.config }}
7996
working-directory: physx
8097

8198
- name: Package (Linux)
82-
if: matrix.os == 'ubuntu-latest'
99+
if: runner.os == 'Linux'
83100
id: package-linux
84101
run: |
85102
mkdir -p output/lib output/include output/documentation

vc17win64-gpu-md.xml

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<preset name="vc17win64-gpu-md" comment="VC17 Win64 PhysX general settings (GPU, dynamic CRT)">
3+
<platform targetPlatform="win64" compiler="vc17" />
4+
<CMakeSwitches>
5+
<cmakeSwitch name="PX_BUILDSNIPPETS" value="True" comment="Generate the snippets" />
6+
<cmakeSwitch name="PX_BUILDPVDRUNTIME" value="True" comment="Generate the OmniPVD project" />
7+
<cmakeSwitch name="PX_GENERATE_GPU_PROJECTS" value="True" comment="Generate the GPU projects" />
8+
<cmakeSwitch name="PX_GENERATE_GPU_PROJECTS_ONLY" value="False" comment="Generate both CPU and GPU projects" />
9+
<cmakeSwitch name="PX_GENERATE_GPU_REDUCED_ARCHITECTURES" value="False" comment="Generate the full CUDA architecture set for distribution binaries" />
10+
<cmakeSwitch name="PX_GENERATE_STATIC_LIBRARIES" value="False" comment="Generate shared libraries" />
11+
<cmakeSwitch name="PX_GENERATE_GPU_STATIC_LIBRARIES" value="False" comment="Generate PhysXGpu as a DLL" />
12+
<cmakeSwitch name="NV_USE_STATIC_WINCRT" value="False" comment="Use the dynamically linked Windows CRT" />
13+
<cmakeSwitch name="NV_USE_DEBUG_WINCRT" value="True" comment="Use the debug version of the CRT for debug builds" />
14+
<cmakeSwitch name="PX_FLOAT_POINT_PRECISE_MATH" value="False" comment="Float point precise math" />
15+
</CMakeSwitches>
16+
<CMakeParams>
17+
<cmakeParam name="CMAKE_INSTALL_PREFIX" value="install/vc17win64-gpu-md/PhysX" comment="Install path relative to PhysX SDK root" />
18+
</CMakeParams>
19+
</preset>

0 commit comments

Comments
 (0)