vcmi(魔法門英雄無敵3 - 開源復刻版) 源碼編譯
阿新 • • 發佈:2017-12-03
min 2.4 spec include net combo python ddb path
vcmi源碼編譯 windows+cmake+mingw
##1 準備
- HoMM3 gog.com
- CMake 官網
- vcmi 源碼 下載
- QT5 with mingw 官網
- Boost 源碼1.55 下載
- MSYS2 官網
##2 安裝
###2.1 vcmi源碼 目標路徑 D:/vcmi/source/
###2.2 QT5 with mingw
, 設置環境變量
set PATH=D:\Qt\Qt5.4.1\5.4\mingw491_32\bin;D:\Qt\Qt5.4.1\Tools\mingw491_32\bin;%PATH%
###2.3 Boost 1.55
bootstrap.bat mingw
b2 toolset=gcc --without-python --stage
copy stage/lib to D:/vcmi/boost/lib
copy boost dir to D:/vcmi/boost/boost
###2.4 MSYS2
msys2-x86_64-20160205 該版本似乎有改動,導致MSYS2 shell配置錯誤,尚未解決。
D:/msys64/etc/pacman.conf 修改網絡代理配置 XferCommand = /usr/bin/curl -x http://yourproxy.yoursite.com:yourport -L -C - -f %u > %o -x 設置proxy,-L 支持自動重定向 運行MSYS2 shell, 執行pacman -Syu,關閉(更新MSYS2軟件庫到最新) 運行autorebase.bat(刷新MSYS2) 運行MSYS2 shell, 安裝所需庫: pacman -S mingw-w64-i686-SDL2 pacman -S mingw-w64-i686-SDL2_image pacman -S mingw-w64-i686-SDL2_mixer pacman -S mingw-w64-i686-SDL2_ttf pacman -S mingw-w64-i686-ffmpeg pacman -S mingw-w64-i686-zlib
###2.5 D:/vcmi/toolchain.txt新建
SET(CMAKE_SYSTEM_NAME Windows) SET(VCMIBUILD_DIR D:/vcmi) SET(CMAKE_C_COMPILER D:/Qt/Qt5.4.1/Tools/mingw491_32/bin/gcc.exe) SET(CMAKE_CXX_COMPILER D:/Qt/Qt5.4.1/Tools/mingw491_32/bin/g++.exe) SET(ENV{BOOST_ROOT} ${VCMIBUILD_DIR}/boost) SET(CMAKE_FIND_ROOT_PATH D:/msys64/mingw32) list(APPEND CMAKE_PREFIX_PATH ${CMAKE_FIND_ROOT_PATH}) list(APPEND CMAKE_PREFIX_PATH D:/Qt/Qt5.4.1/Tools/mingw491_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)
##3 編譯
Open CMake-gui
Select D:/vcmi/source as source directory
Select D:/vcmi/binary as binary directory
click "Configure"
Select "MinGW makefiles" in combobox
Select "Specify toolchain file for crosscompiling"
Select toolchain file (D:/vcmi/toolchain.txt)
Set variables:
CMAKE_INSTALL_PREFIX = D:/vcmi/result
ENABLE_PCH = OFF (because of cc1plus.exe crash)
click Configure
click Generate
go to D:/vcmi/binary directory
execute mingw32-make
execute mingw32-make install
##4 運行D:/vcmi/result/
就是最終生成文件.
copy to Homm3.
enjoy it!
https://gist.github.com/9468305/4ecaddbfd8b4d9cefe57
vcmi(魔法門英雄無敵3 - 開源復刻版) 源碼編譯