DCMTK主要依赖iconv做字符集支持(DICOM字符集,如中文、日文等),详见DCMTK官方说明。
iconv基于GPL公开源代码,是GNU项目的一部分,在各种Unix-like操作系统下很容易编译和使用,对Windows平台下的支持有限。最新版的iconv(目前是libiconv-1.14.tar.gz)已不再提供Visual C++的编译文件,最后一个支持VC编译的iconv版本是libiconv-1.11.1.tar.gz,本文编译以该版本进行。
目的:编译64bit iconv,以提供编译64bit DCMTK所需要的三方库支持。
1、下载libiconv-1.11.1.tar.gz并解压(下载地址:http://ftp.gnu.org/pub/gnu/libiconv/);
2、从Visual Studio x64 Win64 命令提示符(2010)进入解压后的根目录(可以根据自己的需要选择不同命令提示符进入);
3、输入命令:nmake -f Makefile.msvc NO_NLS=1 MFLAGS=-MD;
具体编译参数见根目录下Makefile.msvc 文件。解释如下:
#### Start of system configuration section. ####
# Flags that can be set on the nmake command line:
# DLL=1 for compiling a .dll with a stub .lib (default is a static .lib) --------------是否生成DLL
# Note that this works only with MFLAGS=-MD.
# MFLAGS={-ML|-MT|-MD} for defining the compilation model----------------------此选项较重要,编译选项
# MFLAGS=-ML (the default) Single-threaded, statically linked - libc.lib
# MFLAGS=-MT Multi-threaded, statically linked - libcmt.lib
# MFLAGS=-MD Multi-threaded, dynamically linked - msvcrt.lib
# DEBUG=1 for compiling with debugging information-------------------------------1编译为Debug版本,默认Release
# NO_NLS=1 do not use Native Language Support
# PREFIX=Some\Directory Base directory for installation------------------------安装目录,提取头文件和生成的Lib文件到该目录
# IIPREFIX=Some\\Directory Same thing with doubled backslashes
# Note that nmake command line flags are automatically passed to subdirectory
# Makefiles. Therefore we don't need to pass them explicitly to subdirectory
# Makefiles, but the subdirectory Makefiles need to have the same defaults.
4、nmake -f Makefile.msvc NO_NLS=1 MFLAGS=-MD PREFIX=C:\iconv64-MD-release install
完成后在C:\iconv64-MD-release文件夹下会找到需要的文件。