编译pygame的wince版本

预先准备的包参见前一篇文章。(包括需要copy的目录和文件)

1. 下载并编译SDL 1.2.13

2. 对Pygame的代码进行修改:去掉signal.h,long long.(去掉Longlong会对transform有影响,不过暂时用不到,不知道有没有更好的解决方案)

3. 将编译wince需要的文件copy到pygame/ce下

4. 修改SConstruct文件如下:
class CEBuildEnvironment(Environment):
	def __init__(self):
	    Environment.__init__(self, 	 
	        MSEVC_PLATFORM = 'POCKET PC 2003',
	        MSEVC_SUBPLATFORM = 'Win32 (WCE ARMV4)',
	        tools = ['mslink', 'msevc', 'zip'],
	        toolpath = '.'
	        )

class PythonCEBuildEnvironment(CEBuildEnvironment):
	def __init__(self):
	    CEBuildEnvironment.__init__(self)
	    self.Append(CPPDEFINES = ['WIN32'],
	                LIBS=["python25","SDL"],
	                CPPPATH=["include","../../SDL-1.2.13/include"],
	                LIBPATH=["lib","../../SDL-1.2.13/VisualCE/SDL/Pocket PC 2003 (ARMV4)/Debug"])

	def PythonExtension(self, target, sources, **kw):
	    self.SharedLibrary(target, sources, SHLIBSUFFIX='.pyd', **kw)

lines = """
base src/base.c $(SDL) $(DEBUG)
#cdrom src/cdrom.c $(SDL) $(DEBUG)
constants src/constants.c $(SDL) $(DEBUG)
display src/display.c $(SDL) $(DEBUG)
event src/event.c $(SDL) $(DEBUG)
fastevent src/fastevent.c src/fastevents.c $(SDL) $(DEBUG)
key src/key.c $(SDL) $(DEBUG)
mouse src/mouse.c $(SDL) $(DEBUG)
rect src/rect.c $(SDL) $(DEBUG)
rwobject src/rwobject.c $(SDL) $(DEBUG)
surface src/surface.c src/alphablit.c src/surface_fill.c $(SDL) $(DEBUG)
surflock src/surflock.c $(SDL) $(DEBUG)
time src/time.c $(SDL) $(DEBUG)
joystick src/joystick.c $(SDL) $(DEBUG)
draw src/draw.c $(SDL) $(DEBUG)
image src/image.c $(SDL) $(DEBUG)
overlay src/overlay.c $(SDL) $(DEBUG)
transform src/transform.c src/rotozoom.c src/scale2x.c $(SDL) $(DEBUG)
mask src/mask.c src/bitmask.c $(SDL) $(DEBUG)
bufferproxy src/bufferproxy.c $(SDL) $(DEBUG)
pixelarray src/pixelarray.c $(SDL) $(DEBUG)
"""
 
env = PythonCEBuildEnvironment()
for l in lines.splitlines():
    if l.startswith('#'): continue
    names = l.split(' ')
    fns = ['../' + x for x in names[1:-2]]
    env.PythonExtension("build/%s.pyd" % names[0], fns)


5. 执行scons.py

6. 将生成的pyd文件替换到windows版本的pygame中,然后去掉无用的.dll文件,将新的pygame复制到wince的python25/lib下,即可

你可能感兴趣的:(C++,c,windows,C#,WinCE)