From 2a7d9a640a1958925d557e1c315b70ae8ecdec32 Mon Sep 17 00:00:00 2001 From: That Human <81326222+That-Human-Being@users.noreply.github.com> Date: Thu, 7 Apr 2022 00:43:28 +0000 Subject: [PATCH] Mainly adapting the Linux instructions for use --- Building-OpenRCT2-on-MSYS2-MinGW.md | 82 +++++++++++++++++++++++++++++ 1 file changed, 82 insertions(+) create mode 100644 Building-OpenRCT2-on-MSYS2-MinGW.md diff --git a/Building-OpenRCT2-on-MSYS2-MinGW.md b/Building-OpenRCT2-on-MSYS2-MinGW.md new file mode 100644 index 0000000..d6d7f90 --- /dev/null +++ b/Building-OpenRCT2-on-MSYS2-MinGW.md @@ -0,0 +1,82 @@ +## Required Packages (General) +Required libraries include: +Package | Note(s) +------- | ------- +`sdl2` | Only for UI client. +`freetype` | Can be disabled. +`fontconfig` | Can be disabled. +`libzip` | >= 1.0 +`libpng` | >= 1.2 +`speexdsp` | Only for UI client. +`curl` | only if building with http support. +`openssl` | >= 1.0; Only if building with multiplayer support. +`icu` | >= 59.0 +`zlib` | +`gl` | 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) +Google Benchmark | Optional. + +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) + +### 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 +``` + +You will need to manually place [json_fwd.hpp](https://raw.githubusercontent.com/nlohmann/json/develop/include/nlohmann/json_fwd.hpp) in your `mingw64/include/nlohmann` folder + +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 +``` +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/ +``` + +## Compiling + +``` +mkdir build && cd build +cmake -DCMAKE_BUILD_TYPE=Debug $OPENRCT2_CMAKE_OPTS .. -G "MinGW Makefiles" # Remember to set any other build flags +make +``` + +This will generate a `openrct2` binary in the `build` directory. To run you have two options: `make install` or running it locally. + +### make install +`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). + +### Running it from the build directory +Alternatively you can install the required resources manually so can launch openrct2 from the project directory. +You need a functional `data` directory next to the current working directory when you start `openrct2`. + +An easy way to generate such a data directory is by leveraging `make install`. Type the following in the `build` directory: +``` +DESTDIR=. make install +``` +Alternatively you can install these assets yourself. The following needs to satisfied: + * `$build/data/` has to have contents of `$repo/data/` + * `$build/data/g2.dat` needs to exist. Build it using `make g2` and then copy it into `data`. + * `$build/data/object` has to have the extracted contents from https://github.com/OpenRCT2/objects/releases + * (optional) `$build/data/title` has to have extracted contents from https://github.com/OpenRCT2/title-sequences/releases + +`$XDG_CONFIG_HOME/OpenRCT2/` (or `~/.config/OpenRCT2/` in its absence) has to have `config.ini` with `game_path` set to an RCT install. `openrct2` will ask you for this directory when it first starts. + +Keep in mind you can symlink stuff and that filesystems are case sensitive! + +Alternatively you can specify the data directory like this: +``` +./openrct2 --openrct-data-path=../data +``` +OR + +Just symlink the `data` directory in the current `build` directory, which is the easiest approach for development +``` +ln -s ../data data +``` + +That should work, but it might require a little debugging. \ No newline at end of file