|
|
(29 intermediate revisions by the same user not shown) |
Line 1: |
Line 1: |
− | = Prerequisites =
| + | #REDIRECT [[How to build VCMI (Windows/Cmake)]] |
− | * HoMM 3 (can be bought at [http://www.gog.com/en/gamecard/heroes_of_might_and_magic_3_complete_edition/ gog.com])
| |
− |
| |
− | | |
− | * CMake [http://www.cmake.org/files/v3.0/cmake-3.0.0-win32-x86.exe download]
| |
− | * Git or git GUI, for example, SourceTree [http://www.sourcetreeapp.com/download download]
| |
− |
| |
− | | |
− | * Qt5 bundle [http://download.qt-project.org/official_releases/online_installers/qt-opensource-windows-x86-1.6.0-4-online.exe download]
| |
− | * Boost libraries [http://sourceforge.net/projects/boost/files/boost-binaries/1.56.0/boost_1_56_0-msvc-12.0-32.exe/download download]
| |
− | | |
− | * Libraries pack ([http://1drv.ms/1uZfkgj download]), which contains
| |
− | ** [http://www.ffmpeg.org/download.html FFmpeg]
| |
− | ** SDL libraries
| |
− | *** [http://www.libsdl.org/ SDL2]
| |
− | *** [https://www.libsdl.org/projects/SDL_image/ SDL2_image]
| |
− | *** [https://www.libsdl.org/projects/SDL_mixer/ SDL2_mixer]
| |
− | *** [https://www.libsdl.org/projects/SDL_ttf/ SDL2_ttf]
| |
− | ** [http://zlib.net/ ZLib]
| |
− | | |
− | == Create initial directory ==
| |
− | Create a directory for VCMI development, eg. C:\VCMI
| |
− | We will call this directory as '''[VCMIBUILD_DIR]'''
| |
− | | |
− | It is recommended to avoid non-ascii characters in the path to your VCMI development folder. The folder should not be write-protected by system.
| |
− | | |
− | Good location:
| |
− | * C:\VCMI
| |
− | Bad locations:
| |
− | * C:\Users\Michał\VCMI (non-ascii character)
| |
− | * C:\Program Files (x86)\VCMI (write protection)
| |
− | | |
− | = Preparing place =
| |
− | == Clone VCMI ==
| |
− | * open SourceTree
| |
− | * File -> Clone
| |
− | * select '''https://github.com/vcmi/vcmi/''' as source
| |
− | * select '''[VCMIBUILD_DIR]/vcmi/source''' as destination
| |
− | * click '''Clone'''
| |
− | | |
− | == Install Boost bundle ==
| |
− | * Run installer
| |
− | * Select '''[VCMIBUILD_DIR]/boost''' as destination folder
| |
− | * Install
| |
− | | |
− | == Install Qt bundle ==
| |
− | * Run installer
| |
− | * Select latest Qt for MSVC 2013 (12)
| |
− | * Select '''[VCMIBUILD_DIR]/qt''' as destination folder
| |
− | * Install
| |
− | | |
− | == Unpack libraries ==
| |
− | * Download libraries pack and unpack it in '''[VCMIBUILD_DIR]/depends''' folder
| |
− | | |
− | So, you should get
| |
− | *[VCMIBUILD_DIR]
| |
− | **depends
| |
− | ***bin
| |
− | ***include
| |
− | ***lib
| |
− | ***share
| |
− | | |
− | = Compiling =
| |
− | == Create toolchain file ==
| |
− | Create [VCMIBUILD_DIR]/toolchain.txt
| |
− | <pre>
| |
− | SET(CMAKE_SYSTEM_NAME Windows)
| |
− | SWT(VCMIBUILD_DIR [ENTER YOUR VCMIBUILD_DIR PATH])
| |
− | | |
− | SET(CMAKE_C_COMPILER ${VCMIBUILD_DIR}/Qt/Tools/mingw482_32/bin/gcc.exe)
| |
− | SET(CMAKE_CXX_COMPILER ${VCMIBUILD_DIR}/Qt/Tools/mingw482_32/bin/g++.exe)
| |
− | | |
− | SET(ENV{BOOST_ROOT} ${VCMIBUILD_DIR}/boost)
| |
− | | |
− | SET(CMAKE_FIND_ROOT_PATH ${VCMIBUILD_DIR}/depends)
| |
− | list(APPEND CMAKE_PREFIX_PATH ${CMAKE_FIND_ROOT_PATH})
| |
− | list(APPEND CMAKE_PREFIX_PATH ${VCMIBUILD_DIR}/Qt/5.3/mingw482_32)
| |
− | | |
− | SET(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM BOTH)
| |
− | SET(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY BOTH)
| |
− | SET(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE BOTH)
| |
− | </pre>
| |
− | | |
− | == Compile boost ==
| |
− | * Unpack boost archive
| |
− | * Execute
| |
− | <pre>
| |
− | bootstrap.bat gcc
| |
− | b2 toolset=gcc --without-python --stage
| |
− | </pre>
| |
− | * copy '''stage/lib''' to '''[VCMIBUILD_DIR]/boost/lib'''
| |
− | * copy '''boost''' dir to '''[VCMIBUILD_DIR]/boost/boost'''
| |
− | So, you should get
| |
− | *[VCMIBUILD_DIR]
| |
− | **boost
| |
− | ***boost
| |
− | ***lib
| |
− | | |
− | == Compile VCMI ==
| |
− | * Open CMake-gui
| |
− | * Select '''[VCMIBUILD_DIR]/vcmi/source''' as source directory
| |
− | * Select '''[VCMIBUILD_DIR]/vcmi/binary''' as binary directory
| |
− | * click "Configure"
| |
− | * Select "MinGW makefiles" in combobox
| |
− | * Select "Specify toolchain file for crosscompiling"
| |
− | * Select toolchain file
| |
− | * Set variables:
| |
− | ** CMAKE_INSTALL_PREFIX = '''[VCMIBUILD_DIR]/vcmi/result'''
| |
− | ** ENABLE_PCH = OFF (because of cc1plus.exe crash)
| |
− | * click '''Configure'''
| |
− | * click '''Generate'''
| |
− | * go to '''[VCMIBUILD_DIR]/vcmi/binary''' directory
| |
− | * execute '''mingw32-make'''
| |
− | * execute '''mingw32-make install'''
| |
− | * Grab VCMI in '''[VCMIBUILD_DIR]/vcmi/result''' folder!
| |
− | | |
− | = Appendix A. Libraries compilation =
| |
− | == How to compile ZLib yourself ==
| |
− | * Unpack archive to temp folder, for example, '''[VCMIBUILD_DIR]/zlib/src'''
| |
− | * Open CMake-gui
| |
− | * Select '''[VCMIBUILD_DIR]/zlib/src''' as source directory
| |
− | * Select '''[VCMIBUILD_DIR]/zlib/bin''' as binary directory
| |
− | * click "Configure"
| |
− | * Select "MinGW makefiles" in combobox
| |
− | * Select "Specify toolchain file for crosscompiling"
| |
− | * Select toolchain file
| |
− | * Set variables:
| |
− | ** INSTALL_BIN_DIR = '''[VCMIBUILD_DIR]/depends/bin'''
| |
− | ** INSTALL_INC_DIR = '''[VCMIBUILD_DIR]/depends/include'''
| |
− | ** INSTALL_LIB_DIR = '''[VCMIBUILD_DIR]/depends/lib'''
| |
− | ** INSTALL_MAN_DIR = '''[VCMIBUILD_DIR]/depends/share/man'''
| |
− | ** INSTALL_PKGCONFIG_DIR = '''[VCMIBUILD_DIR]/depends/share/pkgconfig'''
| |
− | * click '''Configure'''
| |
− | * click '''Generate'''
| |
− | * go to '''[VCMIBUILD_DIR]/zlib/bin''' directory
| |
− | * execute '''mingw32-make'''
| |
− | * execute '''mingw32-make install'''
| |
− | | |
− | == How to compile FFmpeg yourself ==
| |
− | * Download Msys ([http://sourceforge.net/projects/mingwbuilds/files/external-binary-packages/msys%2B7za%2Bwget%2Bsvn%2Bgit%2Bmercurial%2Bcvs-rev13.7z/download link]) and unpack it to '''[VCMIBUILD_DIR]/msys'''
| |
− | * Download Yasm ([http://yasm.tortall.net/Download.html link]) and unpack it to '''[VCMIBUILD_DIR]/msys/bin'''
| |
− | * Download FFmpeg source tarball and unpack it to temp folder, for example, '''[VCMIBUILD_DIR]/ffmpeg/source'''
| |
− | * Open '''[VCMIBUILD_DIR]/msys/msys.bat'''
| |
− | * Go to '''/c/[VCMIBUILD_DIR]/ffmpeg/source''' folder
| |
− | <pre>./configure --disable-doc --enable-shared --prefix=/c/[VCMIBUILD_DIR]/depends
| |
− | make
| |
− | make install</pre>
| |