8.6 KiB
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 usingserver
argument, example:./polygun server
. IfBUILD_SERVER
is only configuration enabled then executable name will be changed topolygun_server
.RENDERER_GL
, if true rendering with OpenGL support. This option is only valid ifBUILD_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 truestrsignal
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 ifWINDOW_XCB
was set toTRUE
, it's path to XCB headers.XCB_LIBRARIES
, only valid ifWINDOW_XCB
was set toTRUE
, it's path to XCB libraries separated by;
WAYLAND_INCLUDE_DIR
, only valid ifWINDOW_WAYLAND
was set toTRUE
, it's path to Wayland headers.WAYLAND_LIBRARIES
, only valid ifWINDOW_WAYLAND
was set toTRUE
, it's path to Wayland libraries separated by;
OPENGL_INCLUDE_DIR
, path to OpenGL headers. It should point to folder which containsGL
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 withglm
directory.OPENAL_INCLUDE_DIR
, path to OpenAL headers. This should point toAL
folder.OPENAL_LIBRARY
, path to OpenAL library, either static or shared.OGG_INCLUDE_DIR
, path to libogg headers. This should point to folder withogg
directory.OGG_LIBRARY
, path to libogg library, either static or shared.VORBIS_INCLUDE_DIR
, path to libvorbis headers. This should point to folder withvorbis
directory.VORBIS_LIBRARY
, path to libvorbis library, either static or shared.PNG_INCLUDE_DIRS
, path to libpng headers. This should point to folder withpng.h
file.PNG_LIBRARIES
, path to libpng library, either static or shared.ZLIB_INCLUDE_DIRS
, path to zlib headers. This should point to folder withdeflate.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 toTRUE
] - XCB, window creation using X11. [Required if
WINDOW_XCB
is set toTRUE
] - 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
- 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
orsudo apt install clang ninja-build cmake git
. - for Fedora use:
sudo dnf install gcc-c++ make cmake git
orsudo dnf install clang ninja-build cmake git
. - for openSUSE use:
sudo zypper install --no-recommends g++ make cmake git
orsudo zypper install --no-recommends clang ninja cmake git
. - for Alpine Linux use:
sudo apk add g++ make cmake git
orsudo apk add clang ninja-build cmake git
.
- for Debian based distributions use:
- 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. - Enter directory with downloaded PolyGun repository using
cd PolyGun
. - 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
andlibzlib-dev
will be installed automatically because they are dependencies oflibvorbis-dev
andlibpng-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 oflibpng-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 oflibpng
- for Alpine Linux use:
sudo apk add libxcb-dev glm-dev openal-soft-dev libvorbis-dev libpng-dev
.libogg-dev
andzlib-dev
will be installed automatically because they are dependencies oflibvorbis-dev
andlibpng-dev
respectively. - (distribution agnositic) download and extract latest AngelScript source package to
external/angelscript
inside of repository root.
- for Debian based distributions use:
- Make build directory using
mkdir build
. - Enter build directory using
cd build
. - Generate build files using
cmake ..
orcmake .. -G Ninja
if you are using Ninja build system. You may want to add additional arguments to CMake, seeCMakeLists.txt
documentation section. - Build project using
make -j$(nproc)
orninja
depending on your selected build system.
Windows with MSYS2
- Install all the required libs through pacman. (see MSYS2 dependencies below)
- Download and extract latest AngelScript source package to
external/angelscript
inside of repository root. - Clone master na go into the root dir.
- Open MSYS2 MinGW64 terminal.
- cmake . -G"MSYS Makefiles" -DBUILD_CLIENT=ON -DBUILD_SERVER=ON -DRENDERER_GL=ON
- make -j[how many processors]
- 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
- Download Cygwin installer from here and run it.
- Follow installation util package selection screen
- 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++
- 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
- Open Cygwin terminal and change into desired directory
- 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. - Download and extract latest AngelScript source package to
external/angelscript
inside of repository root. - Enter directory with downloaded PolyGun repository using
cd PolyGun
. - Make build directory using
mkdir build
. - Enter build directory using
cd build
. - Generate build files using
cmake ..
. You may want to add additional arguments to CMake, seeCMakeLists.txt
documentation section. - Build project using
make -j$(nproc)
.