Skip to content

Latest commit

 

History

History
116 lines (83 loc) · 6.9 KB

windows_msvc.md

File metadata and controls

116 lines (83 loc) · 6.9 KB

Procedure for Microsoft Windows users

Setting up the build environment

You will need to download and install the following manually. Those who already have the latest stable versions of these programs can skip this:

  • Visual Studio Buildtools

    • With the "Visual C++ Buildtools" workload.

    NOTE: If you are searching for an IDE for development you can get an overview here. We've also written some instructions for developing with different IDEs.

  • Python 3

    • With the "pip" option enabled. We use pip to install other dependencies.
    • With the "Precompile standard library" option enabled.
    • With the "Download debug binaries (...)" option enabled.
    • If in doubt, run the installer again and choose "Modify".
    • 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.
  • CMake

Python Modules

Open a command prompt at <Python 3 installation directory>/Scripts

pip install cython numpy lz4 toml pillow pygments pyreadline3 mako

Note: Make sure the Python 3 instance you're installing these scripts for is the one you call python in CMD Note: Also ensure that python and python3 both point to the correct and the same version of Python 3

vcpkg packages

Set up vcpkg. Open a command prompt at <vcpkg directory>

vcpkg install dirent eigen3 fontconfig freetype harfbuzz libepoxy libogg libpng opus opusfile qtbase qtdeclarative qtmultimedia toml11

Note: The qt6 port in vcpkg has been split into multiple packages, build times are acceptable now. If you want, you can still use the prebuilt version instead. If you do so, include -DCMAKE_PREFIX_PATH=<QT6 directory> in the cmake configure command.

Note: If you are planning to build the 64-bit version of openage, you are going to need 64-bit libraries. Add command line option --triplet x64-windows to the above command or add the environment variable VCPKG_DEFAULT_TRIPLET=x64-windows to build x64 libraries. See here

Building openage

Note that openage doesn't support completely out-of-source-tree builds yet. We will, however, use a separate build directory to build the binaries.

Note: You will also need to set up the dependencies for Nyan, which is mainly flex

Open a command prompt at <openage directory>:

 mkdir build
 cd build
 cmake -DCMAKE_TOOLCHAIN_FILE=<vcpkg directory>\scripts\buildsystems\vcpkg.cmake ..
 cmake --build . --config RelWithDebInfo -- /nologo /m /v:m

Note: If you want to build the x64 version, please add -G "Visual Studio 17 2022" -A x64 (for VS2022) to the first cmake command.

Note: If you want to download and build Nyan automatically add -DDOWNLOAD_NYAN=YES -DFLEX_EXECUTABLE=<path to win_flex.exe> to the first cmake command.

Running openage (in devmode)

While this is straightforward on other platforms, there is still stuff to do to run openage on Windows:

  • Install the DejaVu Book Font.

    • Download and extract the latest dejavu-fonts-ttf tarball/zip file.
    • Select all ttf\DejaVuSerif*.ttf files, right click and click Install for all users.

    Note: This will require administrator rights.

    • Set the FONTCONFIG_PATH environment variable to <vcpkg directory>\installed\<relevant config>\tools\fontconfig\fonts\.
    • Copy fontconfig\57-dejavu-serif.conf to %FONTCONFIG_PATH%\conf.d.
  • [Optional] Set the AGE2DIR environment variable to the AoE 2 installation directory.

  • Set QML2_IMPORT_PATH to <vcpkg directory>\installed\<relevant config>\qml or for prebuilt Qt <qt directory>\<qt-version>\<compiler-version>\qml

  • openage needs these DLL files to run:

    • openage.dll (Usually in <openage directory>\build\libopenage\<config built>.)
    • nyan.dll (The location depends on the procedure chosen to get nyan.)
    • DLLs from vcpkg-installed dependencies. Normally, these DLLs should be copied to <openage directory>\build\libopenage\<config built> during the build process. If they are not, you can find them in <vcpkg directory>\installed\<relevant config>\bin.
      • If prebuilt QT6 was installed, the original location of QT6 DLLs is <QT6 directory>\bin.
  • Now, to run the openage:

    • Open a CMD window in <openage directory>\build\ and run python -m openage main
    • Execute<openage directory>\build\run.exe every time after that and enjoy!

Packaging

  • Install NSIS.
  • Depending on the way you installed Qt (vcpkg/pre-built) you need to edit the following line in <openage-repo-dir>\buildsystem\templates\ForwardVariables.cmake.in:
	# Use windeploy for packaging qt-prebuilt, standard value '1' for windeploy, '0' for vcpkg
	set(use_windeployqt 1)

Open a command prompt at <openage directory>\build (or use the one from the building step):

cpack -C RelWithDebInfo

The installer (openage-<version>-<arch>.exe) will be generated in the same directory.

Hint: Append -V to the cpack command for verbose output (it takes time to package all dependencies).

Hint: you can set with the environment variable TARGET_PLATFORM (e.g. amd64, x86).