User:Gblues: Difference between revisions

From OpenMW Wiki
Jump to navigation Jump to search
 
(18 intermediate revisions by the same user not shown)
Line 5: Line 5:
== Important Note ==
== Important Note ==


I developed these steps using Windows 10 and Visual Studio 2015. There isn't a compatible release of QT4 for this platform, which means only the game itself--not the launcher, Construction Set, or wizard--can be built with these steps. The steps below will remove any QT dependencies.
It's a good idea to install and set up an official release, which will create config files in your user profile that your development build will use.
 
It's a good idea to set up an official release, which will create config files in your user profile that your development build will use.


== Prerequisites ==
== Prerequisites ==


1. Visual Studio (I used Visual Studio 2015 for this guide)
# Visual Studio (I used Visual Studio 2015 for this guide)
2. The latest version of [https://cmake.org/download/ CMake] (3.5.2 as of this writing)
# The latest version of [https://cmake.org/download/ CMake] (3.5.2 as of this writing)
3. The latest version of [https://git-scm.com/download/win git]
# The latest version of [https://git-scm.com/download/win git]
4. The latest version of [http://www.7-zip.org/ 7-Zip]
# The latest version of [http://www.7-zip.org/ 7-Zip]
5. You'll need about 15GB of disk space. I'm not sure on RAM, but generally it's good to have a lot. 8GB is probably OK. My system has 16GB.
# You'll need about 15GB of disk space. I'm not sure on RAM, but generally it's good to have a lot. 8GB is probably OK. My system has 16GB.
6. Know your CPU architecture. I'm assuming 64-bit in this guide.
# Know your CPU architecture. I'm assuming 64-bit in this guide.


== Path structure ==
== Path structure ==
Line 39: Line 37:


== Libraries (Binary) ==
== Libraries (Binary) ==
=== QT ===
You will want to install the latest version of QT5.
# Go to [https://www.qt.io/download-qt-for-application-development the QT download page] and choose the "open-source" package.
# Download the '''online''' installer
# Skip the registration
# Choose the latest QT5 version (5.9.2 as of this writing).
# Install to the recommended directory (C:\Qt), although it's fine to use a different drive letter.
# Set up the following environment variable:
#* QTDIR => C:\Qt




Line 56: Line 66:


OpenMW uses [https://ffmpeg.zeranoe.com/builds/ Zeranoe's FFmpeg builds] for Windows.
OpenMW uses [https://ffmpeg.zeranoe.com/builds/ Zeranoe's FFmpeg builds] for Windows.
The environment variable has changed a few times, so set all of the above in case you need to switch among branches.


# Download the newest "shared" and "dev" archives.
# Download the newest "shared" and "dev" archives.
Line 62: Line 74:
# Copy the contents of the "dev" archive into the ffmpeg directory you just created.
# Copy the contents of the "dev" archive into the ffmpeg directory you just created.
# Copy the contents of the "shared" archive into the ffmpeg directory. You'll get a bunch of conflicts, just say "yes to all" to overwrite.
# Copy the contents of the "shared" archive into the ffmpeg directory. You'll get a bunch of conflicts, just say "yes to all" to overwrite.
# Set up the following environment variable:
# Set up the following environment variables:
#* FFMPEG_DIR => C:\OpenMW\deps\ffmpeg
#* FFMPEG_DIR => C:\OpenMW\deps\ffmpeg
#* FFMPEG_SDK => C:\OpenMW\deps\ffmpeg
#* FFMPEG_HOME => C:\OpenMW\deps\ffmpeg


=== OpenAL ===
=== OpenAL ===
Line 76: Line 90:
=== SDL2 ===
=== SDL2 ===


The SDL detection scripts in OpenMW aren't compatible with the way SDL 2.0.4 is packaged, so you have to fudge things a little.
The Windows SDL2 package has to be massaged a bit so that CMake will detect it properly, because the default directory scheme is different from every other platform.


# [https://www.libsdl.org/download-2.0.php Download] the VC development libraries.
# [https://www.libsdl.org/download-2.0.php Download] the VC development libraries.
# Unzip the archive.
# Unzip the archive to a temporary location.
# Copy the SDL2-2.0.4 to C:\OpenMW\deps
# Create the directory structure:
# Go to C:\OpenMW\deps\SDL2-2.0.4\lib\x64\ and copy all the files to the parent directory (C:\OpenMW\deps\SDL2-2.0.4\lib).
#* C:\OpenMW\deps\SDL2
#** bin\
#** include\
#*** SDL2\
#** lib\
# Copy from the temporary location (indicated by TMP below) as follows (replace <arch> with "x86" for 32-bit or "x64" for 64-bit):
#* TMP\lib\<arch>\SDL2.dll to C:\OpenMW\deps\SDL2\bin
#* TMP\lib\<arch>\*.lib to C:\OpenMW\deps\SDL2\lib
#* TMP\include\* to C:\OpenMW\deps\SDL2\include
# Set the following environment variable:
# Set the following environment variable:
#* SDL2DIR => C:\OpenMW\deps\SDL2-2.0.4
#* SDL2DIR => C:\OpenMW\deps\SDL2


== Libraries (Source) ==
== Libraries (Source) ==
Line 114: Line 136:
## Uncheck the following options:
## Uncheck the following options:
##* BUILD_BULLET2_DEMOS
##* BUILD_BULLET2_DEMOS
##* BUILD_BULLET3
##* BUILD_CPU_DEMOS
##* BUILD_CPU_DEMOS
##* BUILD_EXTRAS
##* BUILD_EXTRAS
Line 136: Line 159:
#* BULLET_ROOT => C:\OpenMW\deps\bullet
#* BULLET_ROOT => C:\OpenMW\deps\bullet


=== FreeType ===
=== FreeType, GIFLIB, GLUT, libCURL, libJPEG, libPNG, libTIFF, minizip, and zlib ===
 
These are various open-source libraries you will need to build. Fortunately, there's a package created to build them painlessly. Unfortunately, you still have to do a lot of legwork. First step: acquire and unpack the sources.
 
* FreeType: use git to clone: git://git.sv.nongnu.org/freetype/freetype2.git
* GIFLIB: https://sourceforge.net/projects/giflib/files/giflib-5.1.4.tar.bz2/download
* GLUT: use git to clone: https://github.com/markkilgard/glut.git
* libCURL: https://curl.haxx.se/download/curl-7.49.0.zip
* libJPEG: http://www.ijg.org/files/jpegsr9b.zip
* libPNG: ftp://ftp.simplesystems.org/pub/libpng/png/src/libpng16/lpng1622.zip
* libTIFF: http://download.osgeo.org/libtiff/tiff-4.0.8.zip
* minizip: use git to clone: http://github.com/nmoinvaz/minizip.git
* zlib: http://zlib.net/zlib128.zip


# Create the following directories:
For the libraries that come in an archive, you'll want to unzip the archives:
#* C:\OpenMW\deps\freetype
 
#* C:\OpenMW\deps\build\freetype
* If you're using 7-zip: right-click > 7-Zip > "Extract to <dir>".
# Get the source:
* Tip for GIFLIB: Use Right-click > 7-Zip > "Extract here" to extract the *.tar.bz2 to a *.tar file, and then use the "Extract to <dir>" option on the tar file.
## Open a command prompt.
 
## Change to C:\OpenMW\deps\src\
To build, do the following:
## <code>git clone git://git.sv.nongnu.org/freetype/freetype2.git</code>
 
# Create the following directory:
#* C:\OpenMW\deps\build\osg-3rdparty-cmake
# Get the osg-3rdparty-cmake repository:
## Open a command prompt
## Change to C:\OpenMW\deps\src
## <code>git clone https://github.com/bjornblissing/osg-3rdparty-cmake.git</code>
# Use CMake to generate the Visual Studio projects:
# Use CMake to generate the Visual Studio projects:
## Open CMake-GUI
## Open CMake-gui
## For the source path, enter: C:/OpenMW/deps/src/freetype2
## For the source path, enter: C:/OpenMW/deps/src/osg-3rdparty-cmake
## For the build path, enter: C:/OpenMW/deps/build/freetype
## For the build path, enter: C:/OpenMW/deps/build/osg-3rdparty-cmake
## Click "Configure"
## Click "Configure", choose your version of Visual Studio/architecture (e.g. "Visual Studio 14 2015 Win64") and click Finish.
## Set CMAKE_INSTALL_PREFIX to C:/OpenMW/deps/freetype
## Set CMAKE_INSTALL_PREFIX to C:/OpenMW/deps/osg-3rdparty-cmake (this setting seems to get ignored)
## Click "Configure" again, then click Generate
## Point each _SOURCE_DIR setting to the base directory of the source for the corresponding package.
# Build and install Freetype:
## Click "Configure," it should complete with no errors (if you get an error, you probably didn't drill down far enough).
## Open C:\OpenMW\deps\build\freetype\freetype.sln in Visual Studio
## Click "Generate"
# Build and install the 3rd-party libraries:
## Go to C:\OpenMW\deps\build\osg-3rdparty-cmake and open OpenscenegraphThirdParty.sln in Visual Studio
## Choose "Debug" in the Solution Configuration drop-down.
## Choose "Debug" in the Solution Configuration drop-down.
## In Solution Explorer, right-click "ALL_BUILD" and choose "Build"
## In Solution Explorer, right-click "ALL_BUILD" and choose "Build"
## In Solution Explorer, right-click "INSTALL" and choose "Build"
## In Solution Explorer, right-click "INSTALL" and choose "Build"
## Choose "Release" in the Solution Configuration drop-down.
## Right-click "ALL_BUILD" and choose "Clean"
## Right-click "ALL_BUILD" and choose "Clean"
## Repeat steps 3-4
## Choose "Release" in the Solution Configuration drop-down, then repeat steps 3-4
# Set the following environment variables:
## Go to C:\OpenMW\deps\build\osg-3rdparty-cmake and copy the "3rdparty" directory to C:\OpenMW\deps
#* FREETYPE_HOME => C:\OpenMW\deps\freetype
## Go to C:\OpenMW\deps\3rdparty\ and rename the folder named nnn-x64 (nnn will be a 3-digit number, i.e. 140 for VS2015 on W10) to x64.
# Set the following environment variables
#* OSG_3RDPARTY_DIR => C:\OpenMW\deps\3rdparty
#* FREETYPE_HOME => C:\OpenMW\deps\3rdparty\x64


=== MyGUI ===
=== MyGUI ===
The Debug/ and Release/ folders created in the build section will come in handy later when you're trying to run OpenMW.


# Create the following directories:
# Create the following directories:
Line 189: Line 233:
## In Solution Explorer, right-click "INSTALL" and choose "Build"
## In Solution Explorer, right-click "INSTALL" and choose "Build"
## Right-click "ALL_BUILD" and choose "Clean"
## Right-click "ALL_BUILD" and choose "Clean"
## Repeat steps 3-4
## Choose "Release" in the Solution Configuration drop-down, then repeat steps 3-4
# Set the following environment variable:
# Set the following environment variable:
#* MYGUI_HOME => C:\OpenMW\deps\mygui
#* MYGUI_HOME => C:\OpenMW\deps\mygui
Line 209: Line 253:
## Uncheck BUILD_OSG_APPLICATIONS
## Uncheck BUILD_OSG_APPLICATIONS
## Set CMAKE_INSTALL_PREFIX to C:/OpenMW/deps/osg
## Set CMAKE_INSTALL_PREFIX to C:/OpenMW/deps/osg
## Set FFMPEG_ROOT to C:/OpenMW/deps/ffmpeg
## Click "Add Entry" and fill it out as follows:
##* Name: CMAKE_DEBUG_POSTFIX
##* Type: String
##* Value: d
##* Description: leave blank
## Click "Configure"
## Click "Configure"
## Set SDL2_INCLUDE_DIR to C:/OpenMW/deps/SDL2-2.0.4/include
## Click "Configure" again.
##* At this point, make sure the SDL2 options are all set (don't worry about the SDL ones), and make sure the FFMPEG library/includes were found (FFMPEG_LIBAVRESAMPLE won't be found, and that's OK).
## Click "Generate"
## Click "Generate"
# Build and install OpenSceneGraph
# Build and install OpenSceneGraph
Line 220: Line 265:
## In Solution Explorer, right-click "ALL_BUILD" and choose "Build"
## In Solution Explorer, right-click "ALL_BUILD" and choose "Build"
## In Solution Explorer, right-click "INSTALL" and choose "Build"
## In Solution Explorer, right-click "INSTALL" and choose "Build"
## Choose "Release" in the Solution Configuration drop-down.
## Go to C:\OpenMW\deps\osg\ and rename the bin directory to "Debug"
## Back in Visual Studio, choose "Release" in the Solution Configuration drop-down.
## Right-click "ALL_BUILD" and choose "Clean"
## Right-click "ALL_BUILD" and choose "Clean"
## Repeat steps 3-4
## Repeat steps 3-4
## Go to C:\OpenMW\deps\osg\ and rename the bin directory to "Release"
## Still in C:\OpenMW\deps\osg, create a new bin directory, and then copy/paste the contents of the Debug and Release folders into it.
# Set the following environment variable:
# Set the following environment variable:
#* OSGDIR => C:\OpenMW\deps\osg
#* OSGDIR => C:\OpenMW\deps\osg
Line 269: Line 317:
# Go to C:\OpenMW\deps\ffmpeg\bin\ and copy *.dll to C:\OpenMW\out
# Go to C:\OpenMW\deps\ffmpeg\bin\ and copy *.dll to C:\OpenMW\out
# Go to C:\OpenMW\deps\SDL2-2.0.4\lib and copy SDL2.dll to C:\OpenMW\out
# Go to C:\OpenMW\deps\SDL2-2.0.4\lib and copy SDL2.dll to C:\OpenMW\out
# Go to C:\OpenMW\deps\3rdParty\x64\bin and copy the appropriate DLLs:
#* For a Debug build, grab the DLLs that end with 'd', i.e. 'libcurld.dll'
#* For a Release build, grab the DLLs that do '''not''' have the 'd' suffix.


The moment of truth! Double-click openmw.exe, and if everything worked, Morrowind will start!
The moment of truth! Double-click openmw.exe, and if everything worked, Morrowind will start!

Latest revision as of 06:40, 30 October 2017

Building OpenMW on Windows

I've suffered through the pain of setting up a Windows build environment so you (hopefully) don't have to.

Important Note

It's a good idea to install and set up an official release, which will create config files in your user profile that your development build will use.

Prerequisites

  1. Visual Studio (I used Visual Studio 2015 for this guide)
  2. The latest version of CMake (3.5.2 as of this writing)
  3. The latest version of git
  4. The latest version of 7-Zip
  5. You'll need about 15GB of disk space. I'm not sure on RAM, but generally it's good to have a lot. 8GB is probably OK. My system has 16GB.
  6. Know your CPU architecture. I'm assuming 64-bit in this guide.

Path structure

This guide is prescriptive, rather than descriptive. Feel free to use your own organizational structure if you choose.

Create the following folder structure:

C:\
|- OpenMW\
   |- deps\
   |  |- src\
   |  +- build\
   |- src\
   |- build\
   +- out\


This is where things get dicey, because you have to do a lot of legwork and, in most cases, build the dependent libraries yourself. Fun! Let's start with the binary libraries.

Libraries (Binary)

QT

You will want to install the latest version of QT5.

  1. Go to the QT download page and choose the "open-source" package.
  2. Download the online installer
  3. Skip the registration
  4. Choose the latest QT5 version (5.9.2 as of this writing).
  5. Install to the recommended directory (C:\Qt), although it's fine to use a different drive letter.
  6. Set up the following environment variable:
    • QTDIR => C:\Qt


Boost

On Windows, you want to get the pre-built binaries that match up with your version of Visual Studio:

  1. Go to the parent boost-binaries page.
  2. Drill into the newest non-beta version (currently 1.61.0).
  3. Download the *.exe that corresponds to your architecture and MSVC version (e.g. boost_1_61_0-msvc-14.0-64.exe for VS 2015 64-bit).
  4. Run the *.exe you downloaded, and enter "C:\OpenMW\deps\boost" as the destination directory.
  5. Set up the following environment variables:
    • BOOST_ROOT => C:\OpenMW\deps\boost
    • BOOST_LIBRARYDIR => C:\OpenMW\deps\boost\lib64-msvc-14.0

FFMPEG

OpenMW uses Zeranoe's FFmpeg builds for Windows.

The environment variable has changed a few times, so set all of the above in case you need to switch among branches.

  1. Download the newest "shared" and "dev" archives.
  2. Unzip each archive into their own directory.
  3. Create the directory "C:\OpenMW\deps\ffmpeg".
  4. Copy the contents of the "dev" archive into the ffmpeg directory you just created.
  5. Copy the contents of the "shared" archive into the ffmpeg directory. You'll get a bunch of conflicts, just say "yes to all" to overwrite.
  6. Set up the following environment variables:
    • FFMPEG_DIR => C:\OpenMW\deps\ffmpeg
    • FFMPEG_SDK => C:\OpenMW\deps\ffmpeg
    • FFMPEG_HOME => C:\OpenMW\deps\ffmpeg

OpenAL

This is probably the easiest dependency to set up.

  1. Download OpenAL11CoreSDK.exe from here
  2. Install it to C:\OpenMW\deps\openal
  3. Set up the following environment variable:
    • OPENALDIR => C:\OpenmMW\deps\openal

SDL2

The Windows SDL2 package has to be massaged a bit so that CMake will detect it properly, because the default directory scheme is different from every other platform.

  1. Download the VC development libraries.
  2. Unzip the archive to a temporary location.
  3. Create the directory structure:
    • C:\OpenMW\deps\SDL2
      • bin\
      • include\
        • SDL2\
      • lib\
  4. Copy from the temporary location (indicated by TMP below) as follows (replace <arch> with "x86" for 32-bit or "x64" for 64-bit):
    • TMP\lib\<arch>\SDL2.dll to C:\OpenMW\deps\SDL2\bin
    • TMP\lib\<arch>\*.lib to C:\OpenMW\deps\SDL2\lib
    • TMP\include\* to C:\OpenMW\deps\SDL2\include
  5. Set the following environment variable:
    • SDL2DIR => C:\OpenMW\deps\SDL2

Libraries (Source)

These libraries have to be built from source. In all of these, you will follow a basic pattern:

  • Get the source
  • Configure/generate Visual Studio project files with CMake
  • Build & install the library
  • Set environment variables

It's important to avoid using any Visual Studio project files that may come with the source distribution.

Also important: close and re-open CMake each time you set an environment variable.

Bullet3

  1. Create the following directories:
    • C:\OpenMW\deps\build\bullet
    • C:\OpenMW\deps\bullet
  2. Clone the git repository:
    1. Open a command prompt.
    2. Change to C:\OpenMW\deps\src
    3. git clone https://github.com/bulletphysics/bullet3.git
  3. Use CMake to generate the Visual Studio projects:
    1. Launch CMake-GUI
    2. For the source path, enter: C:/OpenMW/deps/src/bullet3
    3. For the build path, enter: C:/OpenMW/deps/build/bullet
    4. Click "Configure", choose your version of Visual Studio/architecture (e.g. "Visual Studio 14 2015 Win64") and click Finish.
    5. Uncheck the following options:
      • BUILD_BULLET2_DEMOS
      • BUILD_BULLET3
      • BUILD_CPU_DEMOS
      • BUILD_EXTRAS
      • BUILD_OPENGL3_DEMOS
      • BUILD_UNIT_TESTS
    6. Set CMAKE_INSTALL_PREFIX to "C:/OpenMW/deps/bullet"
    7. Set the following options:
      • INSTALL_LIBS
      • USE_MSVC_RUNTIME_LIBRARY_DLL
    8. Click "Configure", which will get rid of most the red settings.
    9. Click "Configure" one more time. This gets rid of the remaining red.
    10. Click "Generate"
  4. Build and install Bullet:
    1. Open C:\OpenMW\deps\build\bullet\BULLET_PHYSICS.sln in Visual Studio.
    2. Choose "Debug" in the Solution Configuration drop-down.
    3. In Solution Explorer, right-click "ALL_BUILD" and choose "Build"
    4. In Solution Explorer, right-click "INSTALL" and choose "Build"
    5. Choose "Release" in the Solution Configuration drop-down.
    6. Right-click "ALL_BUILD" and choose "Clean"
    7. Repeat steps 3-4
  5. Set the following environment variable:
    • BULLET_ROOT => C:\OpenMW\deps\bullet

FreeType, GIFLIB, GLUT, libCURL, libJPEG, libPNG, libTIFF, minizip, and zlib

These are various open-source libraries you will need to build. Fortunately, there's a package created to build them painlessly. Unfortunately, you still have to do a lot of legwork. First step: acquire and unpack the sources.

For the libraries that come in an archive, you'll want to unzip the archives:

  • If you're using 7-zip: right-click > 7-Zip > "Extract to <dir>".
  • Tip for GIFLIB: Use Right-click > 7-Zip > "Extract here" to extract the *.tar.bz2 to a *.tar file, and then use the "Extract to <dir>" option on the tar file.

To build, do the following:

  1. Create the following directory:
    • C:\OpenMW\deps\build\osg-3rdparty-cmake
  2. Get the osg-3rdparty-cmake repository:
    1. Open a command prompt
    2. Change to C:\OpenMW\deps\src
    3. git clone https://github.com/bjornblissing/osg-3rdparty-cmake.git
  3. Use CMake to generate the Visual Studio projects:
    1. Open CMake-gui
    2. For the source path, enter: C:/OpenMW/deps/src/osg-3rdparty-cmake
    3. For the build path, enter: C:/OpenMW/deps/build/osg-3rdparty-cmake
    4. Click "Configure", choose your version of Visual Studio/architecture (e.g. "Visual Studio 14 2015 Win64") and click Finish.
    5. Set CMAKE_INSTALL_PREFIX to C:/OpenMW/deps/osg-3rdparty-cmake (this setting seems to get ignored)
    6. Point each _SOURCE_DIR setting to the base directory of the source for the corresponding package.
    7. Click "Configure," it should complete with no errors (if you get an error, you probably didn't drill down far enough).
    8. Click "Generate"
  4. Build and install the 3rd-party libraries:
    1. Go to C:\OpenMW\deps\build\osg-3rdparty-cmake and open OpenscenegraphThirdParty.sln in Visual Studio
    2. Choose "Debug" in the Solution Configuration drop-down.
    3. In Solution Explorer, right-click "ALL_BUILD" and choose "Build"
    4. In Solution Explorer, right-click "INSTALL" and choose "Build"
    5. Right-click "ALL_BUILD" and choose "Clean"
    6. Choose "Release" in the Solution Configuration drop-down, then repeat steps 3-4
    7. Go to C:\OpenMW\deps\build\osg-3rdparty-cmake and copy the "3rdparty" directory to C:\OpenMW\deps
    8. Go to C:\OpenMW\deps\3rdparty\ and rename the folder named nnn-x64 (nnn will be a 3-digit number, i.e. 140 for VS2015 on W10) to x64.
  5. Set the following environment variables
    • OSG_3RDPARTY_DIR => C:\OpenMW\deps\3rdparty
    • FREETYPE_HOME => C:\OpenMW\deps\3rdparty\x64

MyGUI

  1. Create the following directories:
    • C:\OpenMW\deps\mygui
    • C:\OpenMW\deps\build\mygui
  2. Get the source:
    1. Open a command prompt
    2. Change to C:\OpenMW\deps\src
    3. git clone https://github.com/MyGUI/mygui.git
  3. Use CMake to generate the Visual Studio projects:
    1. Open CMake-GUI
    2. For the source path, enter: C:/OpenMW/deps/src/mygui
    3. For the build path, enter: C:/OpenMW/deps/build/mygui
    4. Set CMAKE_INSTALL_PREFIX to C:/OpenMW/deps/mygui/sdk
    5. Uncheck all of the MYGUI_BUILD options.
    6. Change MYGUI_RENDERSYSTEM to 1.
    7. Click "Configure". All of the red should go away (except MYGUI_CREATE_PACKAGE).
    8. Click "Configure" again.
    9. Click "Generate"
  4. Build and install MyGUI
    1. Open C:\OpenMW\deps\build\mygui\MYGUI.sln in Visual Studio
    2. Choose "Debug" in the Solution Configuration drop-down.
    3. In Solution Explorer, right-click "ALL_BUILD" and choose "Build"
    4. In Solution Explorer, right-click "INSTALL" and choose "Build"
    5. Right-click "ALL_BUILD" and choose "Clean"
    6. Choose "Release" in the Solution Configuration drop-down, then repeat steps 3-4
  5. Set the following environment variable:
    • MYGUI_HOME => C:\OpenMW\deps\mygui

OpenSceneGraph (OSG)

  1. Create the following directories:
    • C:\OpenMW\deps\osg
    • C:\OpenMW\deps\build\osg
  2. Get the source:
    1. Open a command prompt
    2. Change to C:\OpenMW\deps\src
    3. git clone https://github.com/openmw/osg.git
  3. Use CMake to generate the Visual Studio projects:
    1. Open CMake-GUI
    2. For the source path, enter: C:/OpenMW/deps/src/osg
    3. For the build path, enter: C:/OpenMW/deps/build/osg
    4. Click "Configure", choose your version of Visual Studio/architecture (e.g. "Visual Studio 14 2015 Win64") and click Finish.
    5. Uncheck BUILD_OSG_APPLICATIONS
    6. Set CMAKE_INSTALL_PREFIX to C:/OpenMW/deps/osg
    7. Click "Add Entry" and fill it out as follows:
      • Name: CMAKE_DEBUG_POSTFIX
      • Type: String
      • Value: d
      • Description: leave blank
    8. Click "Configure"
    9. Click "Generate"
  4. Build and install OpenSceneGraph
    1. Open C:\OpenMW\deps\build\osg\OpenSceneGraph.sln in Visual Studio.
    2. Choose "Debug" in the Solution Configuration drop-down.
    3. In Solution Explorer, right-click "ALL_BUILD" and choose "Build"
    4. In Solution Explorer, right-click "INSTALL" and choose "Build"
    5. Go to C:\OpenMW\deps\osg\ and rename the bin directory to "Debug"
    6. Back in Visual Studio, choose "Release" in the Solution Configuration drop-down.
    7. Right-click "ALL_BUILD" and choose "Clean"
    8. Repeat steps 3-4
    9. Go to C:\OpenMW\deps\osg\ and rename the bin directory to "Release"
    10. Still in C:\OpenMW\deps\osg, create a new bin directory, and then copy/paste the contents of the Debug and Release folders into it.
  5. Set the following environment variable:
    • OSGDIR => C:\OpenMW\deps\osg

Building OpenMW

Before you start

You should download and run an official release at least once to ensure that it's properly detected your Morrowind installation files. This is because you won't have the wizard to use.

You've got your dependencies sorted, now here's how to build OpenMW itself.

  1. Get the source
    1. Open a command prompt.
    2. Change to C:\OpenMW
    3. git clone https://github.com/openmw/openmw.git src
  2. Configure and generate Visual Studio projects with CMake
    1. Open CMake-GUI
    2. For the source path, enter: C:/OpenMW/src
    3. For the build path, enter: C:/OpenMW/build
    4. Click "Configure", choose your version of Visual Studio/architecture (e.g. "Visual Studio 14 2015 Win64") and click Finish. YOu'll get an error, ignore it.
    5. Uncheck the following options:
      • BUILD_LAUNCHER
      • BUILD_OPENCS
      • BUILD_WIZARD
    6. Set CMAKE_INSTALL_PREFIX to C:/OpenMW/out
    7. Click "Configure" again. You'll get another error, keep ignoring it.
    8. Set MYGUI_INCLUDE_DIRS to C:/OpenMW/deps/mygui/sdk/include/MYGUI
    9. Click "Configure". No errors, but a few new red items.
    10. Click "Configure" one last time.
    11. Click "Generate"

Now, at this point things get janky, because the "INSTALL" project scripts don't work (at least, in VS 2015 they don't). So you have to do a lot of manual legwork.

  1. Open C:/OpenMW/build/OpenMW.sln in Visual Studio
  2. Choose the build you want (Debug or Release) in the Solutions Configuration drop-down.
    • If you plan on simply playing Morrowind, you want to choose "Release."
  3. Right-click "ALL_BUILD" and choose Build.
  4. Right-click on "INSTALL" and click Build. You'll get a ton of errors.
  5. Go to C:\OpenMW\build\Release\ and copy all the executables to C:\OpenMW\out.
  6. Go to C:\OpenMW\build\ and copy the "resources" folder to C:\OpenMW\out.
  7. Go to C:\OpenMW\deps\osg\ and grab the appropriate DLLs and copy to C:\OpenMW\out:
    • For a Debug build, you want the contents of the Debug/ folder.
    • For a Release build, you want the contents of the Release/ folder.
  8. Go to C:\OpenMW\deps\mygui\sdk\bin\Release\ and copy MyGUIEngine.dll to C:\OpenMW\out
  9. Go to C:\OpenMW\deps\ffmpeg\bin\ and copy *.dll to C:\OpenMW\out
  10. Go to C:\OpenMW\deps\SDL2-2.0.4\lib and copy SDL2.dll to C:\OpenMW\out
  11. Go to C:\OpenMW\deps\3rdParty\x64\bin and copy the appropriate DLLs:
    • For a Debug build, grab the DLLs that end with 'd', i.e. 'libcurld.dll'
    • For a Release build, grab the DLLs that do not have the 'd' suffix.

The moment of truth! Double-click openmw.exe, and if everything worked, Morrowind will start!