PolyGun/docs/INSTALL.MD

8.6 KiB

Building PolyGun

CMakeLists.txt documentation

CMakeLists.txt has following variables which can be customized to your needs (however if your configuration is pretty standard then everything should be detected automatically and nothing has to be set):

  • BUILD_FLAG_SUPPRESS_WARNING_MODE, if true compiling with highest warning mode will be omitted.
  • BUILD_CLIENT, if true client will be added to resulting executable. Please note that this will require all libraries which client depends on to be installed.
  • BUILD_SERVER, if true server will be added to resulting executable. If building multi-configuration executable (i.e. client and server) then server can be started from command line using server argument, example: ./polygun server. If BUILD_SERVER is only configuration enabled then executable name will be changed to polygun_server.
  • RENDERER_GL, if true rendering with OpenGL support. This option is only valid if BUILD_CLIENT is enabled. By default enabled on every platform except Apple operating systems (i.e. macOS and iOS).
  • WINDOW_WIN32, if true window creation using Win32 API will be enabled. It's Windows only and enabled there by default.
  • HAVE_STRSIGNAL, if true strsignal from C library will be used, otherwise PolyGun will provide it's own implementation. Note that you shouldn't have to set this manually because it's automatically detected.
  • XCB_INCLUDE_DIRS, only valid if WINDOW_XCB was set to TRUE, it's path to XCB headers.
  • XCB_LIBRARIES, only valid if WINDOW_XCB was set to TRUE, it's path to XCB libraries separated by ;
  • WAYLAND_INCLUDE_DIR, only valid if WINDOW_WAYLAND was set to TRUE, it's path to Wayland headers.
  • WAYLAND_LIBRARIES, only valid if WINDOW_WAYLAND was set to TRUE, it's path to Wayland libraries separated by ;
  • OPENGL_INCLUDE_DIR, path to OpenGL headers. It should point to folder which contains GL directory. You shouldn't have to set this because usually OpenGL is provided with C++ compiler.
  • OPENGL_LIBRARIES, path to OpenGL libraries separated by ;. Similar to OpenGL headers you shouldn't have to set this manually.
  • GLM_LIBRARIES, path to GLM headers. This should point to folder with glm directory.
  • OPENAL_INCLUDE_DIR, path to OpenAL headers. This should point to AL folder.
  • OPENAL_LIBRARY, path to OpenAL library, either static or shared.
  • OGG_INCLUDE_DIR, path to libogg headers. This should point to folder with ogg directory.
  • OGG_LIBRARY, path to libogg library, either static or shared.
  • VORBIS_INCLUDE_DIR, path to libvorbis headers. This should point to folder with vorbis directory.
  • VORBIS_LIBRARY, path to libvorbis library, either static or shared.
  • PNG_INCLUDE_DIRS, path to libpng headers. This should point to folder with png.h file.
  • PNG_LIBRARIES, path to libpng library, either static or shared.
  • ZLIB_INCLUDE_DIRS, path to zlib headers. This should point to folder with deflate.h file.
  • ZLIB_LIBRARIES, path to zlib library, either static or shared.

Required libraries

For BUILD_CLIENT:

  • OpenGL, rendering via OpenGL api. [Required if RENDERER_GL is set to TRUE]
  • XCB, window creation using X11. [Required if WINDOW_XCB is set to TRUE]
  • GLM, vector and matrix maths. [Required]
  • OpenAL or OpenAL Soft, playing sounds [Required].
  • libogg, loading Ogg files. [Required]
  • libvorbis, decoding Vorbis encoded audio. libvorbisenc and libvorbisfile aren't needed. [Required]
  • libpng, loading PNG images. [Required]
  • zlib, libpng dependency. [Required]
  • Threads compatible with STL (for example pthreads or Windows threads). [Required]

For BUILD_SERVER:

  • Threads compatible with STL (for example pthreads or Windows threads). [Required]
  • AngelScript, server side scripting [Required]

If we forgot to mention some library then please create issue.

Building

GNU/Linux, Alpine Linux

  1. Install required tools if you don't have them (you can use Clang instead of g++ or Ninja instead of GNU Make if you like):
    • for Debian based distributions use: sudo apt install g++ make cmake git or sudo apt install clang ninja-build cmake git.
    • for Fedora use: sudo dnf install gcc-c++ make cmake git or sudo dnf install clang ninja-build cmake git.
    • for openSUSE use: sudo zypper install --no-recommends g++ make cmake git or sudo zypper install --no-recommends clang ninja cmake git.
    • for Alpine Linux use: sudo apk add g++ make cmake git or sudo apk add clang ninja-build cmake git.
  2. Clone repository with following command: git clone http://git.cubesoftware.xyz:20524/kacperks/PolyGun.git. You can add --depth=1 argument to reduce used disk space via not downloading entire git history.
  3. Enter directory with downloaded PolyGun repository using cd PolyGun.
  4. Install required libraries. Libraries may vary depending on what build configuration you will use. This tutorial assumes full build.
    • for Debian based distributions use: sudo apt install libxcb-dev libglm-dev libopenal-dev libvorbis-dev libpng-dev. libogg-dev and libzlib-dev will be installed automatically because they are dependencies of libvorbis-dev and libpng-dev respectively.
    • for Fedora use: sudo dnf install libxcb-devel glm-devel openal-soft-devel libogg-devel libvorbis-devel libpng-devel. libz-devel will be installed automatically because it's dependency of libpng-devel.
    • for openSUSE use: sudo zypper install libx11-xcb-dev glm-devel libopenal-dev libogg libvorbis libpng. zlib will be installed automatically because it's dependency of libpng
    • for Alpine Linux use: sudo apk add libxcb-dev glm-dev openal-soft-dev libvorbis-dev libpng-dev. libogg-dev and zlib-dev will be installed automatically because they are dependencies of libvorbis-dev and libpng-dev respectively.
    • (distribution agnositic) download and extract latest AngelScript source package to external/angelscript inside of repository root.
  5. Make build directory using mkdir build.
  6. Enter build directory using cd build.
  7. Generate build files using cmake .. or cmake .. -G Ninja if you are using Ninja build system. You may want to add additional arguments to CMake, see CMakeLists.txt documentation section.
  8. Build project using make -j$(nproc) or ninja depending on your selected build system.

Windows with MSYS2

  1. Install all the required libs through pacman. (see MSYS2 dependencies below)
  2. Download and extract latest AngelScript source package to external/angelscript inside of repository root.
  3. Clone master na go into the root dir.
  4. Open MSYS2 MinGW64 terminal.
  5. cmake . -G"MSYS Makefiles" -DBUILD_CLIENT=ON -DBUILD_SERVER=ON -DRENDERER_GL=ON
  6. make -j[how many processors]
  7. Make sure to add C:\msys64\mingw64\bin (or wherever your MSYS2 is installed) to PATH if you're getting missing dll errors.

MSYS2 dependencies install commands

pacman -S mingw-w64-x86_64-glm
pacman -S mingw-w64-x86_64-openal
pacman -S mingw-w64-x86_64-libogg
pacman -S mingw-w64-x86_64-libvorbis
pacman -S mingw-w64-x86_64-libpng
pacman -S mingw-w64-x86_64-zlib

If we forgot to mention some library then please create issue.

Windows with Cygwin

  1. Download Cygwin installer from here and run it.
  2. Follow installation util package selection screen
  3. Select following programs (these are for 64-bit Windows, however you use any other architecture): cmake, make, git, mingw64-x86_64-gcc-core, mingw64-x86_64-gcc-g++
  4. Select following libraries (same as above, these are for 64-bit Windows): mingw64-x86_64-glm, mingw64-x86_64-libogg, mingw64-x86_64-libvorbis, mingw64-x86_64-libpng, mingw64-x86_64-openal
  5. Open Cygwin terminal and change into desired directory
  6. Clone repository with following command: git clone http://git.cubesoftware.xyz:20524/PolyGun/PolyGun.git. You can add --depth=1 argument to reduce used disk space via not downloading entire git history.
  7. Download and extract latest AngelScript source package to external/angelscript inside of repository root.
  8. Enter directory with downloaded PolyGun repository using cd PolyGun.
  9. Make build directory using mkdir build.
  10. Enter build directory using cd build.
  11. Generate build files using cmake ... You may want to add additional arguments to CMake, see CMakeLists.txt documentation section.
  12. Build project using make -j$(nproc).