Enable these options for all platforms that use GCC.
They do not seem to significantly affect build times on our codebase,
while resulting in a slight 2-3% performance increase on low-end devices,
such as RG-99.
Another option that improves performance. From GCC documentation:
> Stream extra information needed for aggressive devirtualization when running the link-time optimizer in local transformation mode. This option enables more devirtualization but significantly increases the size of streamed data. For this reason it is disabled by default.
If a config directory did not exist, the ini file was
not saved at all.
Only implemented for targets that support `std::filesystem` or `std::experimental::filesystem`.
These are all the targets except nxdk and iOS (only supported on iOS 13+).
From GCC documentation:
> Perform interprocedural pointer analysis and interprocedural modification and reference analysis.
> This option can cause excessive memory and compile-time usage on large compilation units.
> It is not enabled by default at any optimization level.
Also forces the CMake generation to `make` because `ninja` gets into an
infinite loop for some reason on my laptop.
A PGO'd binary can be built as follows:
1. Build with `-DDEVILUTIONX_PROFILE_GENERATE=ON`.
3. Run the timedemo.
4. Build with `-DDEVILUTIONX_PROFILE_USE=ON`.
By default, the profile directory is at `${HOME}/devilutionx-profile`
Example for the RG99:
```bash
# Build the OPK for profiling data collection:
TOOLCHAIN=/opt/rs90-toolchain Packaging/OpenDingux/build.sh rg99 --profile-generate
# Copy the OPK to RG99:
scp -O build-rg99/devilutionx-rg99.opk rg99:/media/sdcard/apps
# Now, run the OPK. It will run the timedemo instead of the actual game and will take a couple of hours.
# ☕☕☕
# Copy the profiling data from RG99
scp -r -O rg99:/media/data/local/home/devilutionx-profile /tmp/devilutionx-profile
# Build the OPK use the collected profiling data:
TOOLCHAIN=/opt/rs90-toolchain Packaging/OpenDingux/build.sh rg99 --profile-use --profile-dir /tmp/devilutionx-profile
# Copy the resulting binary back to RG99
scp -O build-rg99/devilutionx-rg99.opk rg99:/media/sdcard/apps
```
`-O2` increases the binary size by 0.5 MiB which we can now afford.
Increasing buffer size to `768` improves performance (seems to be the
sweet spot).
15-20 FPS in dungeon on the max-mem OD fork.
1. Remove `find_package(BZip2 REQUIRED)` from Dependencies.cmake
because it is not used by devilutionx directly (it's a libmpq dependency).
2. For emscripten, use the built-in version of bzip2.
3. Reverts 0b4705cf1c, which added
a redundant `find_package(ZLIB REQUIRED)` to `Dependencies.cmake`.
* CMake: 3rdParty/zlib fixes
1. zlib already provides a CMakeLists.txt, use it.
2. Stub find_package for source build. ZLIB is used by libpng via `find_package(ZLIB)`.
3. amiga.cmake: Remove `find_package(ZLIB)`.
* Update UWP build directory for zlibstatic.lib
Co-authored-by: staphen <staphen@gmail.com>
https://github.com/diasurgical/devilutionx-mpq-tools produces an unpacked MPQ
with all the graphics converted to CLX and the unused files removed.
This is primarily useful on RAM-constrained platforms, such as PS2,
because it eliminates the MPQ overhead.
Adds a build option to load from such unpacked directories instead of the MPQ.
These directories are searched for in the same locations
where the MPQs would be searched for otherwise.
Example directory layout:
* /usr/local/share/diasurgical/devilutionx/diabdat/ -- unpacked and converted diabdat.mpq
* /usr/local/share/diasurgical/devilutionx/hellfire/ -- unpacked and converted hellfire MPQs (all of them merged into 1 directory)
* /usr/local/share/diasurgical/devilutionx/fonts/ -- unpacked fonts.mpq
* /usr/local/share/diasurgical/devilutionx/pl/ -- unpacked pl.mpq
These directory structure is produced by calling `unpack_and_minify_mpq`
`PKG_CONFIG_EXECUTABLE` must be a cache variable, otherwise only the first call to `find_program(PkgConfig)` succeeds.
Also bumps the CI environment to Ubuntu 22.04, because Ubuntu 20.04
version of mingw pkgconfig is bugged.
SDL2 2.24.0 has a bug in its cmake for macOS: https://github.com/libsdl-org/SDL/issues/6119
This bug has already been fixed upstream. This is a workaround until the
next version of SDL2 is released.