首页 技术 正文
技术 2022年11月13日
0 收藏 454 点赞 2,553 浏览 1891 个字

vcmi源码编译 windows+cmake+mingw

##1 准备

  1. HoMM3 gog.com
  2. CMake 官网
  3. vcmi 源码 下载
  4. QT5 with mingw 官网
  5. Boost 源码1.55 下载
  6. 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

相关推荐
python开发_常用的python模块及安装方法
adodb:我们领导推荐的数据库连接组件bsddb3:BerkeleyDB的连接组件Cheetah-1.0:我比较喜欢这个版本的cheeta…
日期:2022-11-24 点赞:878 阅读:9,497
Educational Codeforces Round 11 C. Hard Process 二分
C. Hard Process题目连接:http://www.codeforces.com/contest/660/problem/CDes…
日期:2022-11-24 点赞:807 阅读:5,910
下载Ubuntn 17.04 内核源代码
zengkefu@server1:/usr/src$ uname -aLinux server1 4.10.0-19-generic #21…
日期:2022-11-24 点赞:569 阅读:6,744
可用Active Desktop Calendar V7.86 注册码序列号
可用Active Desktop Calendar V7.86 注册码序列号Name: www.greendown.cn Code: &nb…
日期:2022-11-24 点赞:733 阅读:6,498
Android调用系统相机、自定义相机、处理大图片
Android调用系统相机和自定义相机实例本博文主要是介绍了android上使用相机进行拍照并显示的两种方式,并且由于涉及到要把拍到的照片显…
日期:2022-11-24 点赞:512 阅读:8,135
Struts的使用
一、Struts2的获取  Struts的官方网站为:http://struts.apache.org/  下载完Struts2的jar包,…
日期:2022-11-24 点赞:671 阅读:5,298