Add scripts for importing the PhysX sources
The bundled PhysX copy has always been a subset of the upstream SDK,
made by hand: everything but the sources and the headers is left out,
and so are the parts we do not build. Doing that by hand is both tedious
and easy to get wrong, so add the script that does it, copy_sources.py.
What it leaves out, and why:
- The build system and the generated PxConfig.h, since we have our own
CMake project for the library.
- The GPU implementation, its loader and the CUDA context manager. Qt
Quick 3D Physics only runs the CPU simulation, and never ships the
PhysXGpu library the GPU pipeline would need, so PhysX is built with
DISABLE_CUDA_PHYSX. The public headers under include/cudamanager and
include/gpu are kept, since the other public headers include them
unconditionally.
- The vehicle library, which backs no Qt Quick 3D Physics type. Skipping
it also keeps the number of sources, and so the length of the command
lines the build system generates from them, down, which the Windows
builds have had trouble with before.
- OmniPVD and the old PVD. PX_SUPPORT_PVD is not defined in this build,
so every PVD call site in PhysX is compiled out already, and OmniPVD
is built with PX_SUPPORT_OMNI_PVD=0 as in the upstream release
configuration.
- Serialization and the metadata tables that only it and PVD read. We
cook meshes and load them through the cooking API, and never touch
PxSerialization or RepX. This also means we do not have to teach
SnSerialUtils.cpp about the platforms Qt supports but PhysX does not
know about: it fails to build with "Unknown binary platform" on
WebAssembly, macOS on arm64, iOS and 32-bit ARM Android.
Three headers from those directories are kept, since code we do build
includes them: NpPhysics.h includes PsPvd.h even though it only names
the type behind PX_SUPPORT_PVD, the string table extension is written in
terms of PxProfileAllocatorWrapper, and the default streams use the
fopen() wrapper in SnFile.h. All three only depend on the foundation.
find_includes.py, which lists the files for the CMake project, is taught
to write the source and include directory lists into CMakeLists.txt
itself instead of printing them for pasting, so that the lists cannot
drift from what copy_sources.py put in the directory. Each list is
replaced as a whole, so anything that was in it is gone, and it is
written between BEGIN GENERATED and END GENERATED markers that say as
much in the file itself. The lists are found by the calls they belong to
rather than by those markers, so a missing one is added and a mangled
one does no harm.
It also has to learn the PhysX 5 layout, where pxshared is gone and the
foundation sources moved to source/foundation, which leaves the platform
specific files in directories no longer named after the platform.
The markers go around the lists as they are now, which is the only
change either script makes to the sources here: the lists themselves
come out of find_includes.py byte for byte as they were pasted in by
hand, so nothing else about the build changes. Importing PhysX 5.9.0
with the scripts is a later commit.
Change-Id: I476b4da623f097183eb4155abc7b5daee30d4d26
Reviewed-by: Kristoffer Skau <kristoffer.skau@qt.io>