从官网https://www.freedesktop.org/wiki/Software/uchardet/
下载源码https://www.freedesktop.org/software/uchardet/releases/
=================================================================================
下载编译工具:Cmake 和 mingw64
https://cmake.org/download/下载 cmake-3.27.4-windows-x86_64.zip
https://github.com/niXman/mingw-builds-binaries/releases下载 x86_64-13.1.0-release-win32-seh-ucrt-rt_v11-rev1.7z
都是便携版,解压后,将bin路径加入系统环境变量path
C:\mingw64\bin
C:\cmake\bin
下面开始编译:
打开命令行进入源码目录:C:\uchardet-v0.0.8
执行一下命令:
mkdir build
cd build
cmake .. -G "MinGW Makefiles"
mingw32-make
================================================================================
默认编译出来需要依赖3个dll才能运行:
libstdc++-6.dll
libgcc_s_seh-1.dll
libwinpthread-1.dll
要改为无dll依赖的静态编译,请修改 C:\uchardet-v0.0.8\CMakeLists.txt
下面这行,改为OFF
option(BUILD_SHARED_LIBS "Build shared library and link executable to it."OFF)
默认编译出来有uchardet.exe 和 libuchardet.dll 两个文件
要合为一体 只编译一个 exe
前面区域加上一行:set(CMAKE_EXE_LINKER_FLAGS "-static")
================================================================================
参考资料:
https://github.com/tudelft3d/masbcpp/wiki/Building-on-Windows-with-CMake-and-MinGW
Follow these steps (tested on Windows 8.1):
download and execute the CMake Win32 Installer. Make sure to set the PATH variable during installation
download and install mingw-w64. The default options work
add the mingw-w64 programs to the system PATH variable (eg. append this string C:\Program Files (x86)\mingw-w64\i686-4.9.2-posix-dwarf-rt_v4-rev2\mingw32\bin)
download masbcpp using git or by downloading a zip archive and unzipping it
open a Windows PowerShell and navigate to the folder where you just put masbcpp
execute the following commands:
mkdir build
cd build
cmake .. -G "MinGW Makefiles"
mingw32-make
If all goes well you should now have the masbcpp programs compute_ma.exe and compute_normals.exe.