目前可下载的JMagick版本是6.0.4,而这版本的binary distribution是为ImageMagic 6.0编驿的。非常不幸,在ImageMagic的网站只6.2可下载,只好自己compile了。
在compile的过程中,发现它带的make file有问题,不能顺利完成编驿的操作,例如:。
- 没有生成Magick_MagickInfo.obj
- 没有生成Magick_MagickInfo.h
- Magick_ImageInfo.c中的其中一个function的定义与生成的.h不匹配
以下列出修改后的make file,方便日后使用。
注:
- 所使用的C++ compiler是vs.net 2003的c++ compiler,即vc7。安装路径是c:\Program Files\Microsoft Visual Studio .NET 2003
- 所使用的jdk版本是1.5,安装路径是c:\Program Files\Java\jdk1.5.0_01,由于compile时需要include jdk的jni.h,而且完成后要自动copy到目的目录,发现copy时因为路径中有空格,需以引号括着,但以引号括着时,compile在expand compiler flags时又会出错,因此只能改以短路径名(c:\progra~1\...)代替
- 输出的dll可以放到%system32%或%JRE_LIB\ext\x86
- 输出的jar可以放到classpath中的任何位置
#
# -- See update notes below -->
#
# This makefile only compiles the C files and the generated
# jni stub and headrer files and produces a DLL.
#
# The java compilation, generation of the JAR file and the JNI stubs
# still have to be done on Unix using the regularly supplied make
# file.
#
# Hint: To be placed in /srm/magick and invoked from there,
# nmake -f Makefile.VC++
#
# TODO: Complete generation of JMagick in the NT Environment.
#
# Author: IT
# Date: Oct 2000
# $Id: Makefile.all,v 1.2 2003/04/26 07:23:51 ttey Exp $
#
# -- Updated for Win32 instance, EMXOREN Apr 09, 2002 -->
# -- For runtime convenience copy '*.dll', '*.jar' as necessary.
# -- Copy the 'jmagick.dll' to MAGICK_HOME (e.g. 'MAGICBIN' below).
# -- Copy the 'jmagick.jar' to JRE's 'lib/ext'.
# -- Just always rebuilt ALL, it's fast and somewhat fixed anyway!
# -- Run 'javac', 'jar', 'javah' respectively prior to 'cl', 'link'.
# -- Disabled warnings as it was kind of noisy.
# -- Setup VC++ environment "path" for 'cl', 'link' and 'lib'.
# -- Created manually 'obj\magick', 'lib' place holders.
# -- Created manually 'classes', 'generated', 'docs' place holders.
# changed by Sava Slijepcevic
CPP=cl.exe
LINK32=link.exe
CPPINC=c:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\Include
CPPLIB=c:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\Lib
OUTDIR=..\lib
INTDIR=..\obj\magick
SRCDIR=..\src\magick
GENDIR=..\generated
CLSDIR=..\classes
DOCDIR=..\docs
JDKDIR=c:\progra~1\Java\jdk1.5.0_01
JREDIR=c:\progra~1\Java\jre1.5.0_01
JAVALIB=d:\java\lib
JREEXT=$(JREDIR)\lib\ext\x86
JNIINC=$(JDKDIR)\include
#MAGICKDIR=C:\gs\ImageMagick-5.5.6-Q16
MAGICKDIR=c:\progra~1\ImageMagick-6.2.3-Q16
MAGICKINC=$(MAGICKDIR)
MAGICKLIB=$(MAGICKDIR)\lib\CORE_RL_magick_.lib
MAGICKBIN=$(MAGICKDIR)
MAGICKINCDIR=$(MAGICKDIR)\include
# Debugging, no optimizing and stack checks are required.
# It hangs otherwise (re: IT) !?
CPP_FLAGS= \
/nologo /MTd /w /GX /Od /Ge /Fo"$(INTDIR)\\" /c \
/D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" \
/D "JMAGICK_EXPORTS" /D "_VISUALC_" /I "$(CPPINC)" \
/I "$(JNIINC)" /I "$(JNIINC)/win32" /I "$(MAGICKINC)" \
/I "$(GENDIR)" /I "$(SRCDIR)" /I "$(MAGICKINCDIR)"
LINK32_FLAGS= \
$(MAGICKLIB) \
/nologo /dll /incremental:no /machine:I386 \
/libpath:"$(CPPLIB)" \
/out:"$(OUTDIR)\jmagick.dll" \
/implib:"$(OUTDIR)\jmagick.lib"
LINK32_OBJS= \
"$(INTDIR)\jmagick.obj" \
"$(INTDIR)\magick_Magick.obj" \
"$(INTDIR)\magick_MontageInfo.obj" \
"$(INTDIR)\magick_DrawInfo.obj" \
"$(INTDIR)\magick_ImageInfo.obj" \
"$(INTDIR)\magick_MagickImage.obj" \
"$(INTDIR)\magick_PixelPacket.obj" \
"$(INTDIR)\magick_QuantizeInfo.obj"
LINK32_OBJSD="$(INTDIR)\jmagick.obj" \
"$(INTDIR)\Magick_DrawInfo.obj" \
"$(INTDIR)\Magick_ImageInfo.obj" \
"$(INTDIR)\Magick_MagickImage.obj" \
"$(INTDIR)\Magick_MagickInfo.obj" \
"$(INTDIR)\Magick_MontageInfo.obj" \
"$(INTDIR)\Magick_Magick.obj" \
"$(INTDIR)\Magick_PixelPacket.obj" \
"$(INTDIR)\Magick_QuantizeInfo.obj"
ALL : CLEAN CLASSES DOCS HEADERS \
"$(OUTDIR)\jmagick.dll" "$(MAGICKBIN))\jmagick.dll"
jmagick.obj: "$(SRCDIR)\jmagick.c"
$(CPP) $(CPP_PROJ) $?
magick_DrawInfo.obj: "$(SRCDIR)\magick_DrawInfo.c"
$(CPP) $(CPP_PROJ) $?
magick_ImageInfo.obj: "$(SRCDIR)\magick_ImageInfo.c"
$(CPP) $(CPP_PROJ) $?
magick_Magick.obj: "$(SRCDIR)\magick_Magick.c"
$(CPP) $(CPP_PROJ) $?
magick_MagickImage.obj: "$(SRCDIR)\magick_MagickImage.c"
$(CPP) $(CPP_PROJ) $?
magick_MagickInfo.obj: "$(SRCDIR)\magick_MagickInfo.c"
$(CPP) $(CPP_PROJ) $?
magick_MontageInfo.obj: "$(SRCDIR)\magick_MontageInfo.c"
$(CPP) $(CPP_PROJ) $?
magick_PixelPacket.obj: "$(SRCDIR)\magick_PixelPacket.c"
$(CPP) $(CPP_PROJ) $?
magick_QuantizeInfo.obj: "$(SRCDIR)\magick_QuantizeInfo.c"
$(CPP) $(CPP_PROJ) $?
"$(MAGICKBIN))\jmagick.dll" : "$(OUTDIR)\jmagick.dll"
copy $(?) $(JREEXT)
"$(OUTDIR)\jmagick.dll" : $(LINK32_OBJS)
$(LINK32) $(LINK32_FLAGS) $(LINK32_OBJSD)
{$(SRCDIR)}.c{$(INTDIR)}.obj::
$(CPP) $(CPP_FLAGS) $<
CLEAN :
-@erase "$(INTDIR)\jmagick.obj"
-@erase "$(INTDIR)\magick_Magick.obj"
-@erase "$(INTDIR)\magick_MontageInfo.obj"
-@erase "$(INTDIR)\magick_DrawInfo.obj"
-@erase "$(INTDIR)\magick_ImageInfo.obj"
-@erase "$(INTDIR)\magick_MagickImage.obj"
-@erase "$(INTDIR)\magick_PixelPacket.obj"
-@erase "$(INTDIR)\magick_QuantizeInfo.obj"
-@erase "$(OUTDIR)\jmagick.dll"
-@erase "$(OUTDIR)\jmagick.exp"
-@erase "$(OUTDIR)\jmagick.lib"
# The following items are always rebuilt
HEADERS : $(GENDIR)
javah -d $(GENDIR) -classpath $(CLSDIR) -jni magick.Magick
javah -d $(GENDIR) -classpath $(CLSDIR) -jni magick.DrawInfo
javah -d $(GENDIR) -classpath $(CLSDIR) -jni magick.ImageInfo
javah -d $(GENDIR) -classpath $(CLSDIR) -jni magick.MagickImage
javah -d $(GENDIR) -classpath $(CLSDIR) -jni magick.MontageInfo
javah -d $(GENDIR) -classpath $(CLSDIR) -jni magick.PixelPacket
javah -d $(GENDIR) -classpath $(CLSDIR) -jni magick.QuantizeInfo
javah -d $(GENDIR) -classpath $(CLSDIR) -jni magick.MagickInfo
CLASSES : $(SRCDIR)\*.java $(SRCDIR)\util\*.java
javac -d $(CLSDIR) -classpath $(SRCDIR) -sourcepath $(SRCDIR) $(?)
jar -cvf $(OUTDIR)/jmagick.jar -C $(CLSDIR) magick
copy $(OUTDIR)\jmagick.jar $(JAVALIB)
DOCS : $(DOCDIR)
javadoc -author -version -d $(DOCDIR) \
-sourcepath $(SRCDIR)/.. magick magick.util