Building on MSVC - beyond-all-reason/RecoilEngine GitHub Wiki
Clone
git clone --recursive https://github.com/beyond-all-reason/RecoilEngine RecoilEngine
If you cloned before without --recursive, you can apply --recursive with
cd RecoilEngine
git submodule update --init --recursive
MSVC - x64
Once RecoilEngine is cloned.
cd RecoilEngine
git clone https://github.com/beyond-all-reason/vclibs64 vclibs64
- Dont change path name of vclibs64 or cmake won´t find the libs
VCPkg (optional?)
./vcpkg install jsoncpp
./vcpkg install minizip
Warning: the above mentioned commands are powershell only
the main command for setting up vcpkg for handing env vars within cmake for downloadable libraries is:
cmake -B ../RecoilEngine -S . -DCMAKE_TOOLCHAIN_FILE=../vcpkg/scripts/buildsystems/vcpkg.cmake
Inside the ./RecoilEngine folder
Dependencies
- MSVC 2022 community edition, tested, works with almost no issues. Download and install here: https://visualstudio.microsoft.com/vs/community/
- CMake Any recent version should suffice, this one for example https://github.com/Kitware/CMake/releases/tag/v3.23.4
Windows Environmental variables
Env variables can be used to avoid copying potentially large maps and games folders into the same folder as the build sizes grow with prod.
The easiest way is using the debug launcher found at https://github.com/beyond-all-reason/bar_debug_launcher
or you can add to environmental variables in Windows settings (or [advanced] use script to set them up each time the engine is launched) In Powershell cmd
set SPRING_DATADIR=<place to where your content root is>set SPRING_WRITEDIR=<place to where your content root is>
E.g. your RecoilEngine maps are at E:\RecoilEngine\maps, <place to where your content root is> should be E:\RecoilEngine
Note set is only needed if you launch from script, Windows environment variables dialog needs no set
Building
- Launch cmake with
cmake-gui . - Set source code to the cloned RecoilEngine repository.
- Pick the build dir separate from the main RecoilEngine dir (for example
RecoilEngine/build-msvc) - In the CMAKELIST file in RecoilEngine change (
AI_TYPES = ALL) to (AI_TYPES = NATIVE). - Ensure that
MINGWLIBSpoints to the cloned vclibs64 repository (it should already be set correct if vclibs64 was cloned to RecoilEngine). - Under Tools, press Configure, choose MSVC 2022 / x64 when asked, then press Generate.
- Go to the build directory and open the project file Spring.sln.
- Find engine-legacy in the the projects list and set it to be the Startup Project
- Build the project in MSVC
- Copy *.dll from vclibs64/dll into the builddir (Debug/Release/etc)
- Copy unitsync.dll from somewhere or just create an empty file in the builddir (Debug/Release/etc)*
- If you did not set the SPRING_DATADIR and SPRING_WRITEDIR env variables, copy maps, games, base and fonts from an existing spring install into builddir.
- Launch the engine right from the debugger (MSVC environment variables (as set from the debugger menu) are broken, use some .bat script to set env variables (in case not set globally) and launch spring.exe