Repository navigation
SparCraft Windows Standalone Compilation
It is quite easy to use SparCraft as library for creating standalone Windows executables.
To use SparCraft, you must include its headers. Make sure your project includes the SparCraft/source directory, and from within your program use the following:
#include "SparCraft.h"
To compile SparCraft as a standalone Windows exe, you must have the following:
- Visual Studio 2012 (or newer)
- Required Compilation Libraries
SparCraft uses the BWAPI library to obtain StarCraft data. As a convenience, SparCraft include a stripped-down version of BWAPI called bwapidata which contains only the data necessary for SparCraft to function as a standalone exe. If you do not have BWAPI installed, you can use bwapidata in its place.
An annoying part of any Visual Studio project is the platform toolset. By default, SparCraft is set to use the v90 (Visual Studio 2008) platform toolset, so that it is compatible with BWAPI 3.7.4 and all related bots. The v90 toolset requires installing Visual Studio 2008, since VS2012 does not include v90 out of the box. If you have v90 compatibility already set up, then you can compile right away, however you will not have access to any C++11 functionality, which is unavailable in v90.
The good news is, I have included with SparCraft a stripped down version of BWAPI called bwapidata which does NOT rely on the v90 toolset. You can simply switch all SparCraft projects to the v110 toolset and compile them as-is with no problems, with access to C++11 features. However, remember that the v110 version of SparCraft is NOT compatible with BWAPI-based bots.
To build SparCraft.lib:
- Install Visual Studio 2012 (or newer)
- Install the Required Compilation Libraries
- Set BWAPI_DIR environment variable to bwapidata folder (if not using BWAPI)
- Launch Visual Studio 2012 (or newer)
- Open
SparCraft/VisualStudio/SparCraft.sln - Click "Do Not Upgrade"
- Switch all 3 projects to v110 Platform Toolset (optional if you have v90 support in VS)
- Change Configuration to Release (if it isn't already)
- Build
bwapidataproject (createsBWAPI.lib) - Build
SparCraftproject (createsSparCraft.lib)
To build and run the main SparCraft.exe:
- Build
SparCraft_main(createsSparCraft.exe) - Run
SparCraft/VisualStudio/Release/SparCraft.exe CONFIGFILEfrom a terminal