-
Notifications
You must be signed in to change notification settings - Fork 103
Building on MSVC
git clone --recursive https://github.com/beyond-all-reason/spring -b BAR105 spring
If you cloned before without --recursive, you can apply --recursive with
cd spring
git submodule update --init --recursive
Once spring is cloned.
cd spring
(if not already in the spring directory)
git clone https://github.com/beyond-all-reason/vclibs64 vclibs64
- Dont change path name of vclibs64 or cmake won´t find the libs
Also you need :
https://github.com/beyond-all-reason/BARbarIAn
./vcpkg install jsoncpp ./vcpkg install minizip
the main command for setting up vcpkg for handing env vars within cmake for downloadable libraries is :
cmake -B ../spring -S . -DCMAKE_TOOLCHAIN_FILE=../vcpkg/scripts/buildsystems/vcpkg.cmake
Inside the ./spring folder
This is for local initialization of vcpkg. Maybe someone could help me get the docker container running?
- 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
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 spring maps are at E:\spring\maps
, <place to where your content root is>
should be E:\spring
Note set
is only needed if you launch from script, Windows environment variables dialog needs no set
- Launch cmake with
cmake-gui .
- Set source code to the cloned spring repository.
- Pick the build dir separate from the main spring dir (for example
spring/build-msvc
) - In the CMAKELIST file in spring change (
AI_TYPES = ALL
) to (AI_TYPES = NATIVE
). - Ensure that
MINGWLIBS
points to the cloned vclibs64 repository (it should already be set correct if vclibs64 was cloned to spring). - 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 vclibs14/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