It is possible to build multiple Delphi projects at the same time using MSBuild and utilize the multiple cores on most modern CPUs. I had a need to build a large number of Delphi projects (the 100 cross platform samples) and I wanted to speed this up so I build a simple utility to do so. The utility is built in Delphi 10.3.3 FireMonkey and full source code is available. The project is set to build for Windows 64bit but it would also compile to other platforms like Windows 32bit, Android, IOS, OSX, Linux, and HTML5. I noticed that Windows treats a Windows 64bit executable in TaskManager differently than a Windows 32bit executable so that’s why I went with 64bit as the default. Basically, the utility uses the TDirectory.GetFiles function to pull in all of the DPROJ and CBPROJ files recursively from a directory. Once it has the list of files it uses TTask, MSBuild, and an ExecAndWait function to run multiple compiles of the different projects at the same time. It has an option to select how many CPUs (processes) to utilize at the same time (between 1 and 9). It’s possible it could go over 9 parallel compiles but the MSBuild command line it uses wouldn’t allow a two digit number (maybe it needs to be escaped). The command line parameter might be able to be left out. This utility makes no attempt to compile a single project in parallel. The utility does include an option to clean up the project after the build as the goal is to see if there are any build errors. Build errors are loaded into a Build Log tab. The utility supports building 10.3.3 projects but support for other versions could be added.
Download the full source code for the Delphi Parallel Build utility build in Delphi 10.3.3 FireMonkey over on Github.