This page began as the Few-Frills How-To for building on Windows 10, but now we are trying to fill it in with more details. Please help give us feedback on what needs to be improved.
Quick summary:
- Development Tools
- Git client (one of SourceTree, Git Kraken, SmartGit, or Git for Windows)
- CMake
- Visual Studio
- Build/Install Libraries
- Build OpenSpace
- Notes
Development Tools
Git Client
The source code for OpenSpace is distributed via GitHub, and so you will need a Git client to obtain a copy of the source code. OpenSpace uses git submodules, so a client which can handle these gracefully is preferred. These include:
- SourceTree
- SmartGit
- Git GUI (a part of the basic git download or Visual Studio)
Visual Studio 2019
Visual Studio 2019 is the standard Interactive Development Environment (IDE) for Windows. The “community” version is a free download. When you install it, be sure to select “Custom” configuration and select the C++ compiler – it is not included by default. You can also select a git client here (“Git GUI”). Installation could take a while (like an hour or so, depending on the machine). We are following the development of the C++ language quite closely, so there are more and more features that are no longer supported in Visual Studio 2017
CMake
- Download and run the CMake installer
- If you are upgrading from version 3.4 or earlier, uninstall first. We require CMake 3.12 or newer.
Build/Install Libraries
Advice on directory structure
Building OpenSpace will be easier if you follow a few guidelines about where you put the source code and where you build OpenSpace the the libraries it needs. OpenSpace depends on several other software components, which are loaded as git submodules when you do a recursive clone. These are all in the ext/
subdirectory. One of these is a library called Ghoul, and Ghoul has it’s own submodules, in ext/Ghoul/ext/
.
Build OpenSpace
Get via Git
Checkout OpenSpace recursively using SourceTree, SmartGit, or the command line. The command line git command is: git clone --recursive https://github.com/OpenSpace/OpenSpace
Build OpenSpace
- Open CMake and set “Where is the source code:” to the directory you just cloned from github, for example
develop/OpenSpace
. - Set “Where to build the binaries:” to the build subdirectory, for example:
develop\OpenSpace\build
- Set CMake variables to enable or disable specific modules. The default settings are fine, but make sure that the following are enabled:
OPENSPACE_MODULE_CEFWEBGUI
OPENSPACE_MODULE_WEBBROWSER
OPENSPACE_MODULE_WEBGUI
- Check the
Qt5_DIR
path variable value. It may be necessary to manually set this to the location of your Qt5 installation (mentioned in general build wiki). For example, the path might look something like: C:/Qt/5.12.2/msvc2017_64/lib/cmake/Qt5. - Press the
Configure
button in CMake. Expect errors, which you will then correct:- The first time you press
Configure
you are asked to select a “generator” for the project. Select “Visual Studio 15 2017 Win64” (the Win64 is the important part) - Configure again, as needed, until you resolve all the errors (except anything that says “this warning is for project developers”)
- You can start over by pulling down “File->Delete Cache”.
- The first time you press
- Press the
Generate
button. This creates the Visual Studio Solution (.sln
) file and supporting Project (.vcxproj
) files. - The generated solution file can be opened via
Open Project
. Otherwise, navigate to the build directory and open the main Solution file, calledOpenSpace.sln
- Select either the “Launcher” or the “OpenSpace” project as a startup project via right click in the “Solution Explorer” and build them
- You can start either application from within Visual Studio or by navigating to OpenSpace/bin/openspace
Copy Qt5 dll files to executable directory
Copy the following three dll files from your Qt5 installation (e.g. Qt/5.xx/msvc2017_64/bin/) to the bin directory where OpenSpace.exe is generated (e.g. bin/Release/): Qt5Core.dll, Qt5Gui.dll, Qt5Widgets.dll. Also copy the entire plugins/platforms/ directory from the Qt5 installation (e.g. Qt/5.xx/msvc2017_64/plugins/platforms/ to bin/.
Compiling Boost
Some of the optional modules have Boost as a dependency, which will need to be compiled separately. See boost.org for a complete compilation instructions.
- Download the newest version of the source from here. For example: https://dl.bintray.com/boostorg/release/1.74.0/source/boost_1_74_0.7z
- Unpack the boost folder to its final destination
- Start the Visual Studio x64 native tools command prompt and navigate to the folder
- In the boost folder, run
bootstrap.bat
and wait - Run the
b2
command - Add the boost folder as the
BOOST_ROOT
environment variable
Notes
CMake
- Create your build directory to store the configuration files anywhere outside the source files. It’s not required to be named
build
but that’s common. You can keep it in the top level of your repository. - Unlike the Mac & Linux platforms, the Windows Debug version will run much slower than its Release counterpart due to additional tests by the standard library. The
RelWithDebInfo
build option will enable optimizations but also makes debugging inside of Visual Studio possible. - When in doubt File -> Delete Cache and start again.
- To execute cmake from visual studio command line, cmake args must be passed with -D
: cd develop/OpenSpace mkdir build & pushd build cmake -DCMAKE_BUILD_TYPE=Release -G "Visual Studio 15 2017 Win64" .. popd cmake --build build --config Release
Git
- You might find it easier to use SSH instead of HTTPS, especially if you’re using Two-Factor Authentication with GitHub.
- If you use the command line interface for
git
, remember that OpenSpace has many submodules. You’ll want togit clone --recursive
and/or use thegit submodule
commands. Thesubmodule
commands will need to be run in both the main repository andext/ghoul
.
Visual Studio
- When switching between
Release
andDebug
configuration in Visual Studio, there has been cases where some targets aren’t getting rebuilt properly. Therefore, highlighttinyxml2static
andVRPN
in the solution, right click and selectRebuild Selection
after changing build configuration.
FAQ
If Windows is complaining that it cannot find the VCOMP120.dll
, download https://www.microsoft.com/en-us/download/details.aspx?id=40784 the Visual Studio 2013 Redistributable. On Windows 10, this is not installed by default anymore.