diff --git a/Building-OpenRCT2-on-MSYS2-MinGW.md b/Building-OpenRCT2-on-MSYS2-MinGW.md index d45289d..1daefb5 100644 --- a/Building-OpenRCT2-on-MSYS2-MinGW.md +++ b/Building-OpenRCT2-on-MSYS2-MinGW.md @@ -15,38 +15,55 @@ Package | Note(s) `mesa` | Commonly provided by Mesa or GPU vendors; only for UI client, can be disabled. `cmake` | `nlohmann-json` | >= 3.6.0 -`duktape` | Unless scripting is disabled. (Not available in MSYS2s package repo, see lower section) +`duktape` | Unless scripting is disabled. `benchmark` | Optional. Most required packages are prefixed in MSYS2s repos for the different MSYSTEMs, see the below section for the actual package names. Additionally, you can add support for Discord's Rich Presence API by cloning https://github.com/discordapp/discord-rpc into the root clone directory. Do note discord-rpc requires rapidjson, which [don't bother fixing their bugs](https://github.com/Tencent/rapidjson/issues/1205) and you may need the hackish workaround: [janisozaur/rapidjson/commit/20f8604ee6cd078c1cb2346148c69c0c2c160db2](https://github.com/janisozaur/rapidjson/commit/20f8604ee6cd078c1cb2346148c69c0c2c160db2) -### MinGW-64Bit +### MinGW64 ``` -pacman -S mingw-w64-x86_64-SDL2 mingw-w64-x86_64-freetype mingw-w64-x86_64-fontconfig mingw-w64-x86_64-libzip mingw-w64-x86_64-libpng mingw-w64-x86_64-speexdsp mingw-w64-x86_64-curl mingw-w64-x86_64-openssl mingw-w64-x86_64-icu mingw-w64-x86_64-zlib mingw-w64-x86_64-mesa mingw-w64-x86_64-cmake mingw-w64-x86_64-nlohmann-json +pacman -S mingw-w64-x86_64-SDL2 mingw-w64-x86_64-freetype mingw-w64-x86_64-fontconfig mingw-w64-x86_64-libzip mingw-w64-x86_64-libpng mingw-w64-x86_64-speexdsp mingw-w64-x86_64-curl mingw-w64-x86_64-openssl mingw-w64-x86_64-icu mingw-w64-x86_64-zlib mingw-w64-x86_64-mesa mingw-w64-x86_64-cmake mingw-w64-x86_64-nlohmann-json mingw-w64-x86_64-duktape ``` -Since `duktape` is not in MSYS2s repository I have made a package for MinGW-W64-x86_64, I recommend doing this in your home directory, however it doesn't really matter as it deletes the directory afterwords +### MinGW32 + ``` -git clone https://gist.github.com/18634d0f06090b4bc453aa6e81f3126b.git -cd 18634d0f06090b4bc453aa6e81f3126b -pacman -U mingw-w64-x86_64-duktape-2.7.0-1-any.pkg.tar.zst --noconfirm -cd ../ -rm -rf 18634d0f06090b4bc453aa6e81f3126b/ +pacman -S mingw-w64-i686-SDL2 mingw-w64-i686-freetype mingw-w64-i686-fontconfig mingw-w64-i686-libzip mingw-w64-i686-libpng mingw-w64-i686-speexdsp mingw-w64-i686-curl mingw-w64-i686-openssl mingw-w64-i686-icu mingw-w64-i686-zlib mingw-w64-i686-mesa mingw-w64-i686-cmake mingw-w64-i686-nlohmann-json mingw-w64-i686-duktape +``` + +### UCRT64 + +``` +pacman -S mingw-w64-ucrt-x86_64-SDL2 mingw-w64-ucrt-x86_64-freetype mingw-w64-ucrt-x86_64-fontconfig mingw-w64-ucrt-x86_64-libzip mingw-w64-ucrt-x86_64-libpng mingw-w64-ucrt-x86_64-speexdsp mingw-w64-ucrt-x86_64-curl mingw-w64-ucrt-x86_64-openssl mingw-w64-ucrt-x86_64-icu mingw-w64-ucrt-x86_64-zlib mingw-w64-ucrt-x86_64-mesa mingw-w64-ucrt-x86_64-cmake mingw-w64-ucrt-x86_64-nlohmann-json mingw-w64-ucrt-x86_64-duktape +``` + +### Clang64 + +``` +pacman -S mingw-w64-clang-x86_64-SDL2 mingw-w64-clang-x86_64-freetype mingw-w64-clang-x86_64-fontconfig mingw-w64-clang-x86_64-libzip mingw-w64-clang-x86_64-libpng mingw-w64-clang-x86_64-speexdsp mingw-w64-clang-x86_64-curl mingw-w64-clang-x86_64-openssl mingw-w64-clang-x86_64-icu mingw-w64-clang-x86_64-zlib mingw-w64-clang-x86_64-mesa mingw-w64-clang-x86_64-cmake mingw-w64-clang-x86_64-nlohmann-json mingw-w64-clang-x86_64-duktape +``` + +### Clang32 + +``` +pacman -S mingw-w64-clang-i686-SDL2 mingw-w64-clang-i686-freetype mingw-w64-clang-i686-fontconfig mingw-w64-clang-i686-libzip mingw-w64-clang-i686-libpng mingw-w64-clang-i686-speexdsp mingw-w64-clang-i686-curl mingw-w64-clang-i686-openssl mingw-w64-clang-i686-icu mingw-w64-clang-i686-zlib mingw-w64-clang-i686-mesa mingw-w64-clang-i686-cmake mingw-w64-clang-i686-nlohmann-json mingw-w64-clang-i686-duktape ``` ## Compiling +### GCC Toolchain + ``` mkdir build && cd build -cmake -DCMAKE_BUILD_TYPE=Debug $OPENRCT2_CMAKE_OPTS .. -G "MinGW Makefiles" # Remember to set any other build flags +cmake .. # Remember to set your build flags, e.g. -DCMAKE_BUILD_TYPE=RelWithDebInfo mingw32-make ``` This will generate a `openrct2` binary in the `build` directory. To run you have two options: `make install` or running it locally. -**DO NOT USE `make`, It does not work properly with the Msys/MinGW terminal!** +**DO NOT USE `make`, It does not build OpenRCT2 properly with the Msys/MinGW terminal!** ### make install `mingw32-make install` will download required resources (json objects, title sequences) and installs openrct2 under `/usr/local` by default, but `DESTDIR` will be properly honoured (see below). @@ -80,4 +97,26 @@ Just symlink the `data` directory in the current `build` directory, which is the ln -s ../data data ``` +### Clang +Building with clang works the same way as building with GCC, you just need to change the CXX environment variable. Keep in mind, that you need to have an empty build directory as cmake will not switch compilers after it has already generated a Makefile. +``` +mkdir build && cd build +export CXX=$(which clang++) # OpenRCT2 is purely a C++ project, there's no need to set CC +cmake .. +make +``` +See the optimization note above. + +### Ninja +You can switch from Make to Ninja, if you prefer: +``` +mkdir build && cd build +cmake .. -G Ninja # Any other arguments you want, for example -DCMAKE_BUILD_TYPE=RelWithDebInfo +ninja # No need to specify parallel, it does that automatically +DESTDIR=. ninja install +``` + +#### discord-rpc +[#6658](https://github.com/OpenRCT2/OpenRCT2/pull/6658) added support for discord-rpc, Discord's Rich Presence client library. It gets automatically picked up when cloned into the root of repository. + That should work, but it might require a little debugging. This is still quite finicky at the end of the day. \ No newline at end of file