Closed wait-wtf closed 1 year ago
The papermario decompers use ninja
as their build tool (see https://github.com/pmret/papermario/blob/master/tools/build/configure.py), seems to work well for them (although the N64 decomps are dealing with more than just an executable)
Nice, thanks for sharing. I didn't know Ninja integrates with Python that well. Worth considering for sure. cc @riidefi
mkw-sp also uses ninja – we should switch too.
@riidefi now that we use ninja, this can be closed
Thanks @em-eight 🎉
The build system currently runs compile jobs in parallel to decrease compile time. This achieved using the multiprocessing library. The multiprocessing library spawns additional instances of the Python interpreter that run independently.
This approach is quite fast, but it causes problems with stdout buffering and early termination: Ctrl+C signals and build errors are not handled properly. Instead of terminating, the build workers will continue to compile their whole job queue away. This makes it hard to see where an error occurs.
Modern Python has a nicer way to deal with this. The asyncio/subprocess library allows dispatching multiple subprocesses (compiler invocations) from the same interpreter instance. Stdout is handled asynchronously through an event loop.
So, let's either look into asyncio's subprocess functionalities, or consider using a full-fledged Python build system like SCons. GNU Make has been suggested* in the past but has been rejected due to concerns with Windows compatibility and maintainability (Makefiles are unforgiving and opaque at times).