|
| 1 | +Compiling Shockolate |
| 2 | +==================== |
| 3 | + |
| 4 | +Prerequisites: |
| 5 | +* CMake 3.11 |
| 6 | +* SDL2 2.0.9 |
| 7 | +* SDL2_mixer 2.0.4 (optional, for sound) |
| 8 | +* FluidSynth (optional) |
| 9 | + |
| 10 | +The following CMake options are supported in the build process: |
| 11 | +* `ENABLE_SOUND` - enable sound support (requires SDL2_mixer) |
| 12 | +* `ENABLE_FLUIDSYNTH` - enable FluidSynth MIDI support (ON/LITE/OFF, default is embedded LITE) |
| 13 | +* `ENABLE_OPENGL` - enable OpenGL support (ON/OFF, default ON) |
| 14 | + |
| 15 | +## Linux |
| 16 | + |
| 17 | +Here example for Ubuntu. Since Shockolate requires decent multimedia libraries, you need add multimedia repository: |
| 18 | + |
| 19 | +``` |
| 20 | +sudo add-apt-repository -y ppa:savoury1/multimedia |
| 21 | +sudo apt-get -q update |
| 22 | +sudo apt-get install -y cmake libglu1-mesa-dev libgl1-mesa-dev libsdl2-dev libsdl2-mixer-dev |
| 23 | +``` |
| 24 | + |
| 25 | +Now you ready for building. |
| 26 | + |
| 27 | +``` |
| 28 | +mkdir systemshock_build |
| 29 | +cd systemshock_build |
| 30 | +cmake -DCMAKE_BUILD_TYPE=Release -DENABLE_OPENGL=ON -DENABLE_SOUND=ON <path to Shockolate sources> |
| 31 | +make -j2 |
| 32 | +cp -r <path to Shockolate sources>/shaders . ; mkdir res |
| 33 | +``` |
| 34 | + |
| 35 | +After compilation you'll see systemshock executable in `systemshock_build` directory. |
| 36 | + |
| 37 | +## macOS |
| 38 | + |
| 39 | +Install dependencies via `brew`: |
| 40 | + |
| 41 | +``` |
| 42 | +brew install sdl2 |
| 43 | +brew install sdl2_mixer |
| 44 | +``` |
| 45 | + |
| 46 | +Now you ready for building. |
| 47 | + |
| 48 | +``` |
| 49 | +mkdir systemshock_build |
| 50 | +cd systemshock_build |
| 51 | +cmake -DCMAKE_BUILD_TYPE=Release -DENABLE_OPENGL=ON -DENABLE_SOUND=ON <path to Shockolate sources> |
| 52 | +make -j2 |
| 53 | +cp -r <path to Shockolate sources>/shaders . ; mkdir res |
| 54 | +``` |
| 55 | + |
| 56 | +After compilation you'll see systemshock executable in `systemshock_build` directory. |
| 57 | + |
| 58 | +## Windows |
| 59 | + |
| 60 | +### 64 bit |
| 61 | +Currently on Windows only MINGW environment is supported. We recommended [MSYS2](https://www.msys2.org/) for that. |
| 62 | +Install MSYS2 and launch MYS2 MinGW 64-bit shell. Install/update required tools: |
| 63 | + |
| 64 | +``` |
| 65 | +pacman -Syu --noconfirm # Close shell and open again |
| 66 | +pacman -Syu --noconfirm # Second run |
| 67 | +pacman -Sy --noconfirm mingw-w64-x86_64-toolchain mingw-w64-x86_64-cmake mingw-w64-x86_64-ninja |
| 68 | +``` |
| 69 | + |
| 70 | +Install dependencies: |
| 71 | + |
| 72 | +``` |
| 73 | +pacman -Sy --noconfirm mingw-w64-x86_64-glew mingw-w64-x86_64-SDL2 mingw-w64-x86_64-SDL2_mixer |
| 74 | +``` |
| 75 | + |
| 76 | +Now you ready to go. Let's assume that sources resides in `C:\project\systemshock`, then inside MinGW shell it would be |
| 77 | +`/c/project/systemshock` |
| 78 | + |
| 79 | +``` |
| 80 | +mkdir systemshock_build |
| 81 | +cd systemshock_build |
| 82 | +cmake -G 'Ninja' -DCMAKE_BUILD_TYPE=Release -DPKG_CONFIG_EXECUTABLE=/mingw64/bin/pkg-config.exe -DCMAKE_C_COMPILER=x86_64-w64-mingw32-gcc.exe -DCMAKE_CXX_COMPILER=x86_64-w64-mingw32-g++.exe -DENABLE_SOUND=ON -DENABLE_OPENGL=ON /c/project/systemshock |
| 83 | +cmake --build . -j 2 |
| 84 | +cp -r /c/project/systemshock/shader . ; mkdir res |
| 85 | +``` |
| 86 | + |
| 87 | +After compilation you'll see systemshock.exe executable in `systemshock_build` directory. |
| 88 | + |
| 89 | +Importunately, currently MinGW build requires some DLLs from environment, there quick hack for it: |
| 90 | + |
| 91 | +``` |
| 92 | +cp /mingw64/bin/{libFLAC*,libglib-*,libgmodule-*,libmodplug*,libmpg123*,libportaudio-2,libreadline*,libsndfile*,libogg-*,libtermcap-0,libintl-*,libiconv-*,libopus-0,libpcre-*,libopusfile-0,libvorbis-0,libvorbisenc-2,libvorbisfile-*,libspeex-*}.dll . |
| 93 | +``` |
| 94 | + |
| 95 | +### 32 bit |
| 96 | + |
| 97 | +There no big differences comparing to 64 bit. Launch MYS2 MinGW 32-bit shell and paste these commands: |
| 98 | + |
| 99 | +``` |
| 100 | +pacman -Syu --noconfirm # Close shell and open again |
| 101 | +pacman -Syu --noconfirm # Second run |
| 102 | +pacman -Sy --noconfirm mingw-w64-i686-toolchain mingw-w64-i686-cmake mingw-w64-i686-ninja |
| 103 | +pacman -Sy --noconfirm mingw-w64-i686-glew mingw-w64-i686-SDL2 mingw-w64-i686-SDL2_mixer |
| 104 | +mkdir systemshock_build |
| 105 | +cd systemshock_build |
| 106 | +cmake -G 'Ninja' -DCMAKE_BUILD_TYPE=Release -DPKG_CONFIG_EXECUTABLE=/mingw32/bin/pkg-config.exe -DCMAKE_C_COMPILER=i686-w64-mingw32-gcc.exe -DCMAKE_CXX_COMPILER=i686-w64-mingw32-g++.exe -DENABLE_SOUND=ON -DENABLE_OPENGL=ON /c/project/systemshock |
| 107 | +cmake --build . -j 2 |
| 108 | +cp -r /c/project/systemshock/shader . ; mkdir res |
| 109 | +``` |
0 commit comments