Build instructions for Windows

Information in here might be outdated, please inform us under this comment about any changes that need to be made to this instructions, so we can update it accordingly.

With WSL2 you can go directly to Ubuntu build instruction instead of this. Because Ubuntu is currently the most stable platform to build your project.

  1. First you will need
    i. CMake (to generate build files)
    ii. A C/C++ compiler (Visual C++ for now. GNU GCC and other options will be expanded according to user feedbacks). For Lightweight development in Visual Studio Code you’ll need Cmake, python and C/C++ plugin. It is probably the most easiest way to get IDE working for openage. It is much easier to switch between Python and C++ compared to Visual Studio.
    iii. Python (3.6.x-3.7.x).
  2. Now you’ll need necessary components for building openage with C++.
    For C++ you’ll need:
    dirent, eigen3, fontconfig, freetype, harfbuzz, libepoxy, libogg, libpng, opus, opusfile, qt5-base, qt5-declarative, qt5-quickcontrols, sdl2, sdl2-image.
    You can use vcpkg for that and it makes the process fairly easier to get location to the necessary libraries and include files. (You can suggest other options if want to. Post will be updated accordingly like said.)
    i. This can be done by using vcpkg. vcpkg should be fairly straightforward to build.
    ii. After setting vcpkg up then simply run: vcpkg install dirent eigen3 fontconfig freetype harfbuzz libepoxy libogg libpng opus opusfile qt5-base qt5-declarative qt5-quickcontrols sdl2 sdl2-image
    iii. You’ll also win flex-bison and can be downloaded from here.
    iv. Additional notes:
    a. In vcpkg try to set directory like d:/vcpkg or d:/dependencies/vcpkg, etc. Make sure not to give a space. Otherwise you’ll run into annoying issues.
  3. You’ll also need python dependencies as well and this might(often) gets complex for Windows users. So pay extra caution.
    When installing on Python:
    Select the “pip” option enabled. We use pip to install other dependencies,
    i. “Precompile standard library” option enabled.
    ii. With the “Download debug binaries (…)” option enabled, If in doubt, run the installer again and choose “Modify”.
    iii. You are going to need the 64-bit version of python if you are planning to build the 64-bit version of openage, and vice versa.
    iv. After everything complete go to <your python directory>/Scripts and open command line there or just run command line if you set the PATH to python directory. Install python packages using following command pip install cython numpy pillow pygments pyreadline Jinja2
    v. Additional notes:
    a. If you have multiple versions of Python installed then check your pre-existing Python version and the version you are about to install will start conflict. If you messed up your python uninstall and install all versions of Python and check the PATH in environment variables in system settings.
  4. First fork the repo from here to your Github account.
  5. Clone the repo using the following comman command code git clone https://github.com/<your username>/openage.git
  6. Make a new folder there called build. Can be done mkdir build command while you are in the command prompt in the openage directory. Type another command cd build to go in the build folder.
  7. Now type command cmake -DDOWNLOAD_NYAN=YES -DFLEX_EXECUTABLE="<path to win_flex.exe directory>\win_flex.exe" -DCMAKE_TOOLCHAIN_FILE="<path to vcpkg directory>\scripts\buildsystems\vcpkg.cmake" ..
    This process downloads nyan automatically. But you can download and build nyan on your own way if want to. You can also add variable like to use the corresponding Visual Studio version like -G "Visual Studio 15 2017 Win64" or for 2019 -G "Visual Studio 16 2019" -A "x64" .
  8. You can use setup CMake in several ways.
  • Use terminal command cmake --build . --config RelWithDebInfo -- /nologo /m /v:m to build the project finally and everything should go fine.
  • Use cmake-gui. Set CMAKE_INSTALL_PREFIX to your repository folder then press configure. Everytime you configure settings you may face several errors. You can solve your problem easily through this process. Here is an example of working repository:

    In future simple cmake --build . command should do the building job easily or simply build from your projects.

This process isn’t documenting other important stuffs like getting output files working. Those steps are still WIP. This process is fairly simple in other platforms for now but not in Windows unfortunately. So beware and recommend test stuffs around yourself. Here it’s giving a semi-working steps to somehow getting things working:

  1. Install the DejaVu Book Font.
  2. Download and extract the latest dejavu-fonts-ttf tarball/zip file.
  3. Copy ttf/DejaVuSerif*.ttf font files to %WINDIR%/Fonts .
  4. Set the FONTCONFIG_PATH environment variable to <vcpkg directory>\installed\<relevant config>\tools\fontconfig\fonts\ .
  5. Copy fontconfig/57-dejavu-serif.conf to %FONTCONFIG_PATH%/conf.d .
  6. [Optional] Set the AGE2DIR environment variable to the AoE 2 installation directory.
  7. Set QML2_IMPORT_PATH to <vcpkg directory>\installed\<relevant config>\qml or for prebuilt Qt <qt directory>\<qt-version>\<compiler-version>\qml
  8. Append the following to the environment PATH :
  9. <openage directory>\build\libopenage\<config built> (for openage.dll )
  10. Path to nyan.dll (depends on the procedure chosen to get nyan)
  11. <vcpkg directory>\installed\<relevant config>\bin
  12. <QT5 directory>\bin (if prebuilt QT5 was installed)
  13. Now, execute <openage directory>/run.exe and enjoy!

Additional information you’ll find directly in the repository:
https://github.com/SFTtech/openage/blob/master/doc/build_instructions/windows_msvc.md
https://github.com/SFTtech/openage/blob/master/doc/building.md