-
Notifications
You must be signed in to change notification settings - Fork 26
Building
Building the project is relatively simple. Firstly, you need to make sure you have boost and SFML 2.0 installed and built properly - they are included with the project as submodules that reference working versions, if you want to can init and update the submodules to get the code (or `git clone --recursive`).
Note that the executable must be placed in the same folder as config.xml - the program gets resource paths based off of that location. If the executable is run from any other location, the program will error out. (You can also adjust the program's working directory and run it from anywhere)
THe project uses CMake to generate makefiles or project files of your choice. Most compilers can use the default settings - it will assume you have SFML, Boost, and json-parser installed to the lib folder as expected. You can override each path as shown in the configuration options below.
Pass these to the commandline:
- `DCMAKE_BUILD_TYPE=Release` or `DCMAKE_BUILD_TYPE=Debug` - controls whether the build is for release mode or debug mode.
- `-DSTATIC_BUILD=1` - link statically to libraries like SFML and Boost instead of dynamically.
- `-DJSONLIB=path` set an alternate path for json-parser
- `-DBOOSTLIB=path` set an alternate path for Boost
- `-DSFMLLIB=path` set an alternate path for SFML
- `cmake -G "MinGW Makefiles" -DCMAKE_CXX_FLAGS="-std=c++11" .`
- `mingw32-make` or `make`
On Windows, we recommend that you use clang++ in combination with MinGW (the "experimental" version for MinGW works on Windows). The generator you have to use is "MinGW Makefiles", but works with clang.
- `cmake -G "MinGW Makefiles" -DCMAKE_CXX_COMPILER=clang++ -DCMAKE_C_COMPILER=clang -DCMAKE_CXX_FLAGS="-std=c++11" -DSTATIC_BUILD=1 .`
- `make` or `mingw32-make`
The ChessPlusPlus project uses C++11 heavily, and unfortunately no version of Visual Studio fully supports all of the features we use. We considered supporting it at first, but it would just be too limiting. When Microsoft catches up, cmake already has support for building MSVC project files for you (and it will be the default if you have Visual Studio installed on Windows).
Click here for information on compiling with other compilers and platforms.