2006-07-31 22:24:21 +00:00
|
|
|
import os
|
2006-08-08 23:20:16 +00:00
|
|
|
import sys
|
2006-07-31 22:24:21 +00:00
|
|
|
|
2006-07-31 00:03:35 +00:00
|
|
|
# XXX path separator fixed right now
|
|
|
|
opts = Options()
|
2006-08-04 17:32:08 +00:00
|
|
|
opts.AddOptions(
|
2008-05-27 05:29:00 +00:00
|
|
|
BoolOption('DEBUG', 'Build with debugging information', 1),
|
|
|
|
#BoolOption('PSS_STYLE', 'Path separator style', 1),
|
2006-08-08 23:20:16 +00:00
|
|
|
BoolOption('LSB_FIRST', 'Least significant byte first?', None),
|
2008-05-27 05:29:00 +00:00
|
|
|
BoolOption('FRAMESKIP', 'Enable frameskipping', 0),
|
|
|
|
BoolOption('OPENGL', 'Enable OpenGL support (SDL only)', 1)
|
2006-08-04 17:32:08 +00:00
|
|
|
)
|
2006-07-31 00:03:35 +00:00
|
|
|
|
2008-05-27 05:29:00 +00:00
|
|
|
env = Environment(options = opts)
|
2006-07-31 00:03:35 +00:00
|
|
|
|
2008-05-27 05:29:00 +00:00
|
|
|
if os.environ.has_key('PLATFORM'):
|
|
|
|
env.Replace(PLATFORM = os.environ['PLATFORM'])
|
2006-07-31 22:24:21 +00:00
|
|
|
if os.environ.has_key('CC'):
|
|
|
|
env.Replace(CC = os.environ['CC'])
|
2006-08-01 01:15:30 +00:00
|
|
|
if os.environ.has_key('CXX'):
|
|
|
|
env.Replace(CXX = os.environ['CXX'])
|
2008-05-27 05:29:00 +00:00
|
|
|
if os.environ.has_key('WINDRES'):
|
|
|
|
env.Append(WINDRES = os.environ['WINDRES'])
|
2006-07-31 22:24:21 +00:00
|
|
|
if os.environ.has_key('CFLAGS'):
|
|
|
|
env.Append(CCFLAGS = os.environ['CFLAGS'])
|
|
|
|
if os.environ.has_key('LDFLAGS'):
|
|
|
|
env.Append(LINKFLAGS = os.environ['LDFLAGS'])
|
2006-07-31 20:07:15 +00:00
|
|
|
|
2006-07-31 00:03:35 +00:00
|
|
|
print "platform: ", env['PLATFORM']
|
|
|
|
|
2006-07-31 22:24:21 +00:00
|
|
|
# special flags for cygwin
|
|
|
|
# we have to do this here so that the function and lib checks will go through
|
|
|
|
# mingw
|
2006-07-31 00:03:35 +00:00
|
|
|
if env['PLATFORM'] == 'cygwin':
|
2006-07-31 22:24:21 +00:00
|
|
|
env.Append(CCFLAGS = " -mno-cygwin")
|
|
|
|
env.Append(LINKFLAGS = " -mno-cygwin")
|
2006-08-22 06:27:18 +00:00
|
|
|
env['LIBS'] = ['wsock32'];
|
2006-07-29 05:46:15 +00:00
|
|
|
|
|
|
|
conf = Configure(env)
|
2008-05-27 05:29:00 +00:00
|
|
|
if env['PLATFORM'] == 'win32':
|
|
|
|
conf.env.Append(CPPPATH = [".", "drivers/win/", "drivers/common/", "drivers/", "drivers/win/zlib", "drivers/win/directx"])
|
2008-05-31 02:58:43 +00:00
|
|
|
conf.env.Append(CPPDEFINES = ["PSS_STYLE=2", "WIN32", "_USE_SHARED_MEMORY_", "NETWORK", "FCEUDEF_DEBUGGER", "NOMINMAX", "NEED_MINGW_HACKS", "_WIN32_IE=0x0600"])
|
2008-06-01 15:38:36 +00:00
|
|
|
conf.env.Append(LIBS = ["rpcrt4", "comctl32", "vfw32", "winmm", "ws2_32", "comdlg32", "ole32", "gdi32", "htmlhelp"])
|
2008-05-27 05:29:00 +00:00
|
|
|
if env.has_key('DEBUG'):
|
|
|
|
if env['DEBUG']:
|
|
|
|
conf.env.Append(CCFLAGS = " -g")
|
|
|
|
conf.env.Append(CPPDEFINES = ["_DEBUG"])
|
2008-05-31 02:58:43 +00:00
|
|
|
conf.env.Append(CCFLAGS = " -O3 -Wall")
|
2008-05-27 05:29:00 +00:00
|
|
|
else: # Should we do this?
|
|
|
|
conf.env.Append(CCFLAGS = " -O3 -fomit-frame-pointer")
|
|
|
|
else:
|
|
|
|
if not conf.CheckLib('SDL'):
|
|
|
|
print 'Did not find libSDL or SDL.lib, exiting!'
|
|
|
|
Exit(1)
|
|
|
|
if not conf.CheckLib('z', autoadd=1):
|
|
|
|
print 'Did not find libz or z.lib, exiting!'
|
|
|
|
Exit(1)
|
|
|
|
if conf.CheckFunc('asprintf'):
|
|
|
|
conf.env.Append(CCFLAGS = " -DHAVE_ASPRINTF")
|
|
|
|
if env['OPENGL'] and conf.CheckLibWithHeader('GL', 'GL/gl.h', 'c++', autoadd=1):
|
|
|
|
conf.env.Append(CCFLAGS = " -DOPENGL")
|
|
|
|
# parse SDL cflags/libs
|
|
|
|
env.ParseConfig('sdl-config --cflags --libs')
|
|
|
|
conf.env.Append(CPPDEFINES = " PSS_STYLE=1")
|
2006-07-29 05:46:15 +00:00
|
|
|
|
|
|
|
env = conf.Finish()
|
2006-07-31 22:24:21 +00:00
|
|
|
|
2006-08-08 23:20:16 +00:00
|
|
|
# option specified
|
|
|
|
if env.has_key('LSB_FIRST'):
|
|
|
|
if env['LSB_FIRST']:
|
2008-05-27 05:29:00 +00:00
|
|
|
env.Append(CPPDEFINES = ['LSB_FIRST'])
|
2006-08-08 23:20:16 +00:00
|
|
|
# option not specified, check host system
|
2008-05-27 05:29:00 +00:00
|
|
|
elif sys.byteorder == 'little' or env['PLATFORM'] == 'win32':
|
|
|
|
env.Append(CPPDEFINES = ['LSB_FIRST'])
|
2006-08-08 23:20:16 +00:00
|
|
|
|
|
|
|
if env['FRAMESKIP']:
|
2008-05-27 05:29:00 +00:00
|
|
|
env.Append(CPPDEFINES = ['FRAMESKIP'])
|
2006-08-08 23:20:16 +00:00
|
|
|
|
2008-05-27 05:29:00 +00:00
|
|
|
print "CPPDEFINES:",env['CPPDEFINES']
|
|
|
|
print "CCFLAGS:",env['CCFLAGS']
|
|
|
|
#print "LIBS:",env['LIBS']
|
2006-07-29 05:46:15 +00:00
|
|
|
Export('env')
|
|
|
|
|
|
|
|
SConscript(['src/SConscript'])
|