Skip to content

Compiling on Visual Studio 2022 Win64

Steven A White edited this page May 11, 2022 · 4 revisions

Building on Windows requires installation of the following packages

Package URL
Visual Studio 2022 Community
CMake 3.20 https://github.com/Kitware/CMake/releases/download/v3.16.5/cmake-3.16.5-win64-x64.msi

Installing Visual Studio

When installing visual studio select expert installation and install cpp and cli support. Instructions from Microsoft can be found here

Installing CMake

Once Visual Studio is installed simply run the MSI installer for CMake 3.16 or higher and select the INSTALL CMAKE in System Path to ensure it can be run from the command line.

Building Dependencies

It is suggested to gather all your deps in a UNIX style sysroot creating a biogears toolchain. Download the packages from the Build Instructions page and place them in a directory like c:\src

Building eigen

Eigen uses CMake as a build system and is a header only library so installation is very straight forward. If you haven't built Eigen before be warned it comes with a large test suite which can take some time in configuration. I suggest setting BUILD_TESTING=OFF before running CMake for the first time, however this can sometimes cause issues in the configuration step. If it does simple enable testing on the first run and disable on a second pass.

Variable Value Note
BUILD_TESTING OFF Disables all Eigen unit test
EIGEN_TEST_NOQT ON Disables testing Eigen using a QT Harness"
CMAKE_INSTALL_PREFIX C:/biogears/external Destination of libs after installation

Open a x64 Native Tools Command Prompt browse to your eigen source code to enter the following prompt line by line

  cd <Eigen Source Code>
  mkdir build
  cd build
  cmake .. -G "Visual Studio 17 2022" -A x64 -DCMAKE_INSTALL_PREFIX=C:/biogears/external
  cmake .. -G "Visual Studio 17 2022" -A x64 -DBUILD_TESTING=OFF -DEIGEN_TEST_NOQT=ON 
  cmake --build . --config Release 
  cmake --build . --config Release --target install

Building xerces-c

Also a CMake project fairly easy to build.

Variable Value Note
CMAKE_DEBUG_POSTFIX _d String to append to debug variant of any log
CMAKE_INSTALL_PREFIX C:/biogears/external Destination of libs after installation
  cd <Source Code>
  mkdir build
  cd build
  cmake .. -G "Visual Studio 17 2022" -A x64 -DCMAKE_DEBUG_POSTFIX=_d -DCMAKE_INSTALL_PREFIX=C:/biogears/external
  cmake --build . --config Release 
  cmake --build . --config Release --target install
  cmake --build . --config Debug 
  cmake --build . --config Debug --target install

Installing dirent.h

CMake one more time.

Variable Value Note
CMAKE_INSTALL_PREFIX C:/biogears/external Destination of libs after installation
  cd <Source Code>
  mkdir build
  cd build
  cmake .. -G "Visual Studio 17 2022" -A x64 -DCMAKE_INSTALL_PREFIX=C:/biogears/external
  cmake --build . --config Release 
  cmake --build . --config Release --target install

Installing XSD

XSD is shipped as a binary solution. To simplify the install

  • copy xsd-4.0.0-i686-windows/bin to C:/biogears/external
  • copy xsd-4.0.0-i686-windows/libxsd/xsd C:/biogears/external/include

Building Biogears Core Biogears is a source based distribution. You can pull it from github. Assuming you want to store your source tree in C:/biogears

Using Biogears Core Scenario Driver Pull the code from github.

cd C:/biogears/
git clone https://github.com/BioGearsEngine/core.git core
cd core
mkdir build
cd build
cmake -G "Visual Studio 17 2022" -A x64  -DCMAKE_INSTALL_PREFIX=C:/biogears/usr  -DCMAKE_PREFIX_PATH=C:/biogears/external  -DBiogears_BUILD_HOWTOS=ON ..
cmake --build . --config Release --target  bg-cli