Skip to content

Compiling on Visual Studio 2017

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

Building on Windows requires installation of the following packages

Package URL
Visual Studio 2017 Community
CMake 3.16 https://cmake.org/files/v3.12/cmake-3.12.0-rc3-win64-x64.msi

Installing Visual Studio

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

Installing CMake

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

Building Dependecies

It is suggested to gather all your deps in a UNIX style sysroot creating a biogears toolchain. For these examples we will assume C:/biogears/external is the target location for this toolchain.

Building eigen

Eigen uses CMake as a build system and is a header only library so installation is very straight foward. If you haven't built Eigen before bewarned 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 configuraiton 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 15 2017" -DCMAKE_INSTALL_PREFIX=C:/biogears/external
  cmake .. -G "Visual Studio 15 2017" -DBUILD_TESTING=OFF -DEIGEN_TEST_NOQT=ON 
  cmake --build . --config Release 
  cmake --build . --config Release --target install

Building log4cpp

Log4CPP is also a cmake project. So it is simple to build and configure.

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 15 2017" -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

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 15 2017" -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 15 2017" -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

Dirent.h

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 D:/deveopment/biogears/
git clone https://github.com/BioGearsEngine/core.git core
cd core
mkdir build
cd build
cmake -G "Visual Studio 15 2017" -DCMAKE_INSTALL_PREFIX=D:/biogears/usr -DCMAKE_PREFIX_PATH=D:/biogears/external -DBiogears_BUILD_HOWTOS=ON ..
cmake --build . --config Release --target bg-cli