[pypy-commit] lang-gameboy default: add external compilation info branch for windows
timfel
noreply at buildbot.pypy.org
Thu Mar 21 16:34:33 CET 2013
Author: Tim Felgentreff <timfelgentreff at gmail.com>
Branch:
Changeset: r7:f85b5515ccef
Date: 2013-03-21 16:33 +0100
http://bitbucket.org/pypy/lang-gameboy/changeset/f85b5515ccef/
Log: add external compilation info branch for windows
diff --git a/rsdl/eci.py b/rsdl/eci.py
--- a/rsdl/eci.py
+++ b/rsdl/eci.py
@@ -2,6 +2,7 @@
from rpython.translator.platform import CompilationError
import py
import sys
+import os
def get_rsdl_compilation_info():
if sys.platform == 'darwin':
@@ -13,6 +14,31 @@
],
frameworks = ['SDL', 'Cocoa']
)
+ elif sys.platform == "win32":
+ try:
+ sdl_prefix = os.path.abspath(os.environ["SDL_PREFIX"])
+ except KeyError:
+ print "You need to provide the path to SDL using the SDL_PREFIX environment variable"
+ exit(1)
+
+ # XXX: SDL_main.h does a #define main SDL_main
+ # This causes a linker error with the VS C compiler
+ # The solution is to #undef main before we define our own
+ this_dir = os.path.dirname(__file__)
+ f = open(os.path.join(this_dir, "RSDL_undef_main.h"), "w")
+ print >> f, "#undef main"
+ f.close()
+
+ eci = ExternalCompilationInfo(
+ includes = ['SDL.h', 'RSDL_undef_main.h'],
+ include_dirs = [os.path.join(sdl_prefix, "include"), this_dir],
+ link_files = [
+ os.path.join(sdl_prefix, "lib", "x86", "SDLmain.lib"),
+ os.path.join(sdl_prefix, "lib", "x86", "SDL.lib")
+ ],
+ libraries = ["SDL"],
+ library_dirs = [os.path.join(sdl_prefix, "lib", "x86")],
+ )
else:
eci = ExternalCompilationInfo(
includes=['SDL.h'],
More information about the pypy-commit
mailing list