User:Gblues: Difference between revisions

From OpenMW Wiki
Jump to navigation Jump to search
Line 227: Line 227:
You've got your dependencies sorted, now here's how to build OpenMW itself.
You've got your dependencies sorted, now here's how to build OpenMW itself.


TODO: instructions
'''note''' these steps don't work yet. Still WIP.
 
# Get the source
## Open a command prompt.
## Change to C:\OpenMW
## <code>git clone https://github.com/openmw/openmw.git src</code>
# Configure and generate Visual Studio projects with CMake
## Open CMake-GUI
## For the source path, enter: C:/OpenMW/src
## For the build path, enter: C:/OpenMW/build
## 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.
## Uncheck the following options:
##* BUILD_LAUNCHER
##* BUILD_OPENCS
##* BUILD_WIZARD
## Set CMAKE_INSTALL_PREFIX to C:/OpenMW/out
## Click "Configure" again. You'll get another error, keep ignoring it.
## Set MYGUI_INCLUDE_DIRS to C:/OpenMW/deps/mygui/sdk/include/MYGUI
## Click "Configure", another error, keep ignoring.
## Set SDL2MAIN_LIBRARY to C:/OpenMW/deps/SDL2-2.0.4/lib/x64/SDL2main.lib
## Set SDL2_LIBRARY_PATH to C:/OpenMW/deps/SDL2-2.0.4/lib/x64/
## Click "Configure", this should complete with no errors, but still a few red items.
## Click "Configure" one last time.
## Click "Generate"

Revision as of 06:31, 16 May 2016

Building OpenMW on Windows

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

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)

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.

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 variable:

  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

I'll probably have to come back and edit this because I remember having to do some finagling to get CMake to properly detect SDL2, which may have been me "doing it wrong". But here's the gist:

1. Download the VC development libraries. 2. Unzip the archive. 3. Copy the SDL2-2.0.4 to C:\OpenMW\deps 4. Set the following environment variable:

  SDL2DIR => C:\OpenMW\deps\SDL2-2.0.4

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_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

  1. Create the following directories:
    • C:\OpenMW\deps\freetype
    • C:\OpenMW\deps\build\freetype
  2. Get the source:
    1. Open a command prompt.
    2. Change to C:\OpenMW\deps\src\
    3. git clone git://git.sv.nongnu.org/freetype/freetype2.git
  3. Use CMake to generate the Visual Studio projects:
    1. Open CMake-GUI
    2. For the source path, enter: C:/OpenMW/deps/src/freetype2
    3. For the build path, enter: C:/OpenMW/deps/build/freetype
    4. Click "Configure"
    5. Set CMAKE_INSTALL_PREFIX to C:/OpenMW/deps/freetype
    6. Click "Configure" again, then click Generate
  4. Build and install Freetype:
    1. Open C:\OpenMW\deps\build\freetype\freetype.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 variables:
    • FREETYPE_DIR => C:\OpenMW\deps\freetype
    • MYGUI_DEPENDENCIES_DIR => C:\OpenMW\deps\freetype

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. Click "Configure". You'll get an error, "Error in configuration process." Ignore it.
    5. Set CMAKE_INSTALL_PREFIX to C:/OpenMW/deps/mygui/sdk
    6. Uncheck all of the MYGUI_BUILD options.
    7. Change MYGUI_RENDERSYSTEM to 1.
    8. Click "Configure". All of the red should go away (except MYGUI_CREATE_PACKAGE).
      • If you get an error about freetype, you didn't set MYGUI_DEPENDENCIES_DIR correctly.
      • You can either fix the environment variable, or set MYGUI_DEPENDENCIES_DIR to C:\OpenMW\deps\freetype here.
    9. Click "Configure" again.
    10. 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. 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:
    • 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 "Configure" and the red should disappear.
    8. 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. 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:
    • OSGDIR => C:\OpenMW\deps\osg

Building OpenMW

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

note these steps don't work yet. Still WIP.

  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", another error, keep ignoring.
    10. Set SDL2MAIN_LIBRARY to C:/OpenMW/deps/SDL2-2.0.4/lib/x64/SDL2main.lib
    11. Set SDL2_LIBRARY_PATH to C:/OpenMW/deps/SDL2-2.0.4/lib/x64/
    12. Click "Configure", this should complete with no errors, but still a few red items.
    13. Click "Configure" one last time.
    14. Click "Generate"