ci: build PhysX SDK 5.6.1 (was 5.6.0) #36
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Build PhysX | |
| on: | |
| push: | |
| tags: | |
| - 'v[0-9]+.[0-9]+.[0-9]+*' | |
| workflow_dispatch: | |
| jobs: | |
| build: | |
| name: Build ${{ matrix.os }} - ${{ matrix.config }} | |
| runs-on: ${{ matrix.os }} | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| os: [windows-2022, ubuntu-latest] | |
| config: [debug, release, profile, checked] | |
| steps: | |
| - name: Resolve version | |
| id: ver | |
| shell: bash | |
| run: | | |
| ref="${GITHUB_REF_NAME:-}" | |
| if [ -z "$ref" ] || [ "$ref" = "main" ]; then | |
| ref="v0.0.0-dev" | |
| fi | |
| version="${ref#v}" | |
| echo "version=$version" >> "$GITHUB_OUTPUT" | |
| echo "Resolved version: $version" | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| with: | |
| repository: NVIDIA-Omniverse/PhysX | |
| ref: 107.3-physx-5.6.1 | |
| # === WINDOWS === | |
| - name: Install CUDA Toolkit (Windows) | |
| if: runner.os == 'Windows' | |
| uses: Jimver/cuda-toolkit@v0.2.35 | |
| with: | |
| cuda: '12.5.0' | |
| method: network | |
| sub-packages: '["nvcc", "cudart", "visual_studio_integration"]' | |
| log-file-suffix: '${{ matrix.os }}-${{ matrix.config }}.txt' | |
| - name: Download preset (Windows) | |
| if: runner.os == 'Windows' | |
| run: | | |
| curl -L -o vc17win64-gpu-md.xml https://raw.githubusercontent.com/Lumengine/PhysXBuild/main/vc17win64-gpu-md.xml | |
| cp vc17win64-gpu-md.xml ./physx/buildtools/presets/public/ | |
| - name: Generate Projects (Windows) | |
| if: runner.os == 'Windows' | |
| run: ./generate_projects.bat vc17win64-gpu-md | |
| working-directory: physx | |
| - name: Patch CUDA arches + nvcc threading (Windows) | |
| if: runner.os == 'Windows' | |
| shell: bash | |
| working-directory: physx | |
| run: | | |
| # The 16 GB GitHub Windows runner cannot fit the full PhysX arch matrix: | |
| # PhysX 5.6 emits --generate-code for sm_75/80/86/89/90 plus `-t0`, which | |
| # spawns one ptxas per arch in parallel and crashes ptxas with | |
| # ACCESS_VIOLATION (memory exhaustion). PX_GENERATE_GPU_REDUCED_ARCHITECTURES | |
| # only drops sm_70, not enough. | |
| # | |
| # Strategy: keep sm_75 only and rely on PTX JIT to cover Ampere/Ada/Hopper | |
| # at first launch, then force nvcc to serialize ptxas per .cu file (-t1). | |
| shopt -s globstar nullglob | |
| changed=0 | |
| for f in compiler/vc17win64-gpu-md/**/*.vcxproj; do | |
| # Strip sm_80 / sm_86 / sm_89 / sm_90 generate-code entries. | |
| # NB: `#` delimiter avoids clashing with `|` alternation inside the | |
| # pattern (which `s|...|` would mis-parse as the end of the regex). | |
| sed -i -E 's# --generate-code=arch=compute_(80|86|89|90),code=\[[^]]+\]##g' "$f" | |
| # Serialize ptxas threads per nvcc invocation. | |
| sed -i 's| -t0 | -t1 |g' "$f" | |
| changed=$((changed+1)) | |
| done | |
| echo "Patched $changed .vcxproj file(s)." | |
| # Sanity check: a GPU project's nvcc command should now reference only sm_75. | |
| gpu_proj="$(ls compiler/vc17win64-gpu-md/sdk_gpu_source_bin/PhysXBroadphaseGpu.vcxproj 2>/dev/null || true)" | |
| if [ -n "$gpu_proj" ]; then | |
| echo "=== generate-code lines remaining in PhysXBroadphaseGpu.vcxproj ===" | |
| grep -oE -- '--generate-code=arch=compute_[0-9]+,code=\[[^]]+\]' "$gpu_proj" | sort -u | |
| fi | |
| - name: Build (Windows) | |
| if: runner.os == 'Windows' | |
| # --parallel 2 caps msbuild to two .vcxproj at once; combined with -t1 this | |
| # keeps RAM usage well under 16 GB on the runner. | |
| run: cmake --build ./compiler/vc17win64-gpu-md --config ${{ matrix.config }} --parallel 2 | |
| working-directory: physx | |
| - name: Package (Windows) | |
| if: runner.os == 'Windows' | |
| id: package-windows | |
| shell: bash | |
| env: | |
| PHYSX_VERSION: ${{ steps.ver.outputs.version }} | |
| run: | | |
| mkdir -p output/bin output/lib output/include output/documentation | |
| binArchiveName="Physx-${PHYSX_VERSION}.win.x86_64.vc143.md.${{ matrix.config }}.zip" | |
| echo "PHYSX_BINARY_ARCHIVE=$binArchiveName" >> "$GITHUB_OUTPUT" | |
| cp physx/bin/win.x86_64.vc143.md/${{ matrix.config }}/*.dll output/bin/ | |
| cp physx/bin/win.x86_64.vc143.md/${{ matrix.config }}/*.lib output/lib/ | |
| cp -r physx/include/* output/include/ | |
| cp -r physx/documentation/* output/documentation/ 2>/dev/null || true | |
| # PhysXDevice64.dll is a prebuilt redistributable in some PhysX SDK drops. | |
| # Search the whole physx/bin tree and copy if found (do not fail if absent). | |
| found_device="$(find physx/bin -type f -name 'PhysXDevice64.dll' -print -quit 2>/dev/null || true)" | |
| if [ -n "$found_device" ]; then | |
| cp "$found_device" output/bin/ | |
| fi | |
| if [ -n "${CUDA_PATH:-}" ]; then | |
| cuda_bin="$(cygpath -u "$CUDA_PATH")/bin" | |
| cp "$cuda_bin"/cudart64_*.dll output/bin/ 2>/dev/null || true | |
| fi | |
| # PhysXGpu_64.dll is the GPU build's required artifact. Hard-fail if missing. | |
| test -f output/bin/PhysXGpu_64.dll | |
| echo "=== Contents of output/bin/ ===" | |
| ls -la output/bin/ | |
| (cd output && 7z a "../$binArchiveName" ./bin/ ./lib/ ./include/ ./documentation/) | |
| # === LINUX === | |
| - name: Install dependencies (Linux) | |
| if: runner.os == 'Linux' | |
| run: | | |
| sudo apt update | |
| sudo apt install -y ninja-build cmake clang python3 | |
| - name: Download preset (Linux) | |
| if: runner.os == 'Linux' | |
| run: | | |
| curl -L -o linux-clang-cpu-only-nosnippets.xml https://raw.githubusercontent.com/Lumengine/PhysXBuild/main/linux-clang-cpu-only-nosnippets.xml | |
| cp linux-clang-cpu-only-nosnippets.xml ./physx/buildtools/presets/public/ | |
| - name: Generate Projects (Linux) | |
| if: runner.os == 'Linux' | |
| run: | | |
| chmod +x ./generate_projects.sh | |
| ./generate_projects.sh linux-clang-cpu-only-nosnippets | |
| working-directory: physx | |
| - name: Build (Linux) | |
| if: runner.os == 'Linux' | |
| run: cmake --build ./compiler/linux-clang-cpu-only-nosnippets-${{ matrix.config }} | |
| working-directory: physx | |
| - name: Package (Linux) | |
| if: runner.os == 'Linux' | |
| id: package-linux | |
| env: | |
| PHYSX_VERSION: ${{ steps.ver.outputs.version }} | |
| run: | | |
| mkdir -p output/lib output/include output/documentation | |
| binArchiveName="PhysX-${PHYSX_VERSION}.linux.x86_64.clang.${{ matrix.config }}.tar.gz" | |
| echo "PHYSX_BINARY_ARCHIVE=$binArchiveName" >> "$GITHUB_OUTPUT" | |
| cp physx/bin/linux.clang/${{ matrix.config }}/*.a output/lib/ 2>/dev/null || true | |
| cp -r physx/include/* output/include/ | |
| cp -r physx/documentation/* output/documentation/ 2>/dev/null || true | |
| tar -czf "$binArchiveName" -C output . | |
| echo "=== Contents of output/lib/ ===" | |
| ls -la output/lib/ | |
| # === PUBLISH === | |
| - name: Publish | |
| uses: softprops/action-gh-release@v1 | |
| with: | |
| files: | | |
| ${{ steps.package-windows.outputs.PHYSX_BINARY_ARCHIVE }} | |
| ${{ steps.package-linux.outputs.PHYSX_BINARY_ARCHIVE }} | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |