Ok, SConstruct hopefully up to date. [Aerdan]
This commit is contained in:
@@ -2,28 +2,62 @@
|
||||
# Run 'scons' in this directory to build.
|
||||
# Run 'scons -c' in this directory to cleanup.
|
||||
|
||||
# Source file list
|
||||
source_files = Split("""
|
||||
chips/sfxproc.asm
|
||||
chips/fxemu2.asm
|
||||
env = Environment ()
|
||||
platform = env['PLATFORM']
|
||||
|
||||
parsegen_tool = env.Program(target= 'parsegen', source = 'parsegen.cpp')
|
||||
|
||||
def parsegen_emitter(target,source,env):
|
||||
env.Depends(target,parsegen_tool)
|
||||
return (target,source)
|
||||
|
||||
if platform == 'posix':
|
||||
psrbld = Builder(action ='./parsegen -D__LINUX__ cfgparse.c',
|
||||
emitter = parsegen_emitter,
|
||||
suffix = '.c', src_suffix = '.psr')
|
||||
|
||||
env['BUILDERS']['PARSEGEN'] = psrbld
|
||||
|
||||
objfix_tool = env.Program(target= 'objfix.exe', source= 'objfix.c')
|
||||
|
||||
def objfix_emitter(target,source,env):
|
||||
env.Depends(target,objfix_tool)
|
||||
return (target,source)
|
||||
|
||||
objbld = Builder(action = 'objfix $TARGET',
|
||||
emitter = objfix_emitter,
|
||||
suffix = '.obj', src_suffix = '.obj')
|
||||
|
||||
env['BUILDERS']['OBJFIX'] = objbld
|
||||
|
||||
chipssrc = Split('''
|
||||
chips/c4emu.c
|
||||
chips/dsp1emu.c
|
||||
chips/dsp1proc.asm
|
||||
chips/dsp2proc.asm
|
||||
chips/dsp4emu.c
|
||||
chips/dsp4proc.asm
|
||||
chips/fxemu2.asm
|
||||
chips/fxemu2b.asm
|
||||
chips/fxemu2c.asm
|
||||
chips/fxtable.asm
|
||||
chips/sa1proc.asm
|
||||
chips/sa1regs.asm
|
||||
chips/dsp1emu.c
|
||||
chips/st10proc.asm
|
||||
chips/seta10.c
|
||||
chips/dsp2proc.asm
|
||||
chips/sdd1emu.c
|
||||
chips/c4emu.c
|
||||
chips/seta10.c
|
||||
chips/sfxproc.asm
|
||||
chips/st10proc.asm
|
||||
''')
|
||||
netsrc = Split('''
|
||||
net/ztcp.c
|
||||
''')
|
||||
cpusrc = Split('''
|
||||
cpu/addrni.asm
|
||||
cpu/dma.asm
|
||||
cpu/dsp.asm
|
||||
cpu/dspproc.asm
|
||||
cpu/execute.asm
|
||||
cpu/executec.c
|
||||
cpu/irq.asm
|
||||
cpu/memory.asm
|
||||
cpu/memtable.c
|
||||
@@ -32,6 +66,8 @@ source_files = Split("""
|
||||
cpu/table.asm
|
||||
cpu/tableb.asm
|
||||
cpu/tablec.asm
|
||||
''')
|
||||
dossrc = Split('''
|
||||
dos/debug.asm
|
||||
dos/joy.asm
|
||||
dos/modemrtn.asm
|
||||
@@ -40,12 +76,18 @@ source_files = Split("""
|
||||
dos/sw.asm
|
||||
dos/gppro.asm
|
||||
dos/vesa12.asm
|
||||
''')
|
||||
effectssrc = Split('''
|
||||
effects/burn.c
|
||||
effects/water.c
|
||||
effects/smoke.c
|
||||
''')
|
||||
guisrc = Split('''
|
||||
gui/gui.asm
|
||||
gui/guifuncs.c
|
||||
gui/guifuncs.c
|
||||
gui/menu.asm
|
||||
''')
|
||||
videosrc = Split('''
|
||||
video/makev16b.asm
|
||||
video/makev16t.asm
|
||||
video/makevid.asm
|
||||
@@ -72,12 +114,12 @@ source_files = Split("""
|
||||
video/hq3x32.asm
|
||||
video/hq4x16.asm
|
||||
video/hq4x32.asm
|
||||
''')
|
||||
zipsrc = Split('''
|
||||
zip/unzip.c
|
||||
zip/zpng.c
|
||||
cfgload.c
|
||||
endmem.asm
|
||||
init.asm
|
||||
initc.c
|
||||
''')
|
||||
jmasrc = Split('''
|
||||
jma/7zlzma.cpp
|
||||
jma/crc32.cpp
|
||||
jma/iiostrm.cpp
|
||||
@@ -86,7 +128,14 @@ source_files = Split("""
|
||||
jma/lzma.cpp
|
||||
jma/lzmadec.cpp
|
||||
jma/winout.cpp
|
||||
jma/zsnesjma.cpp
|
||||
jma/jma.cpp
|
||||
''')
|
||||
basesrc = Split('''
|
||||
cfgparse.psr
|
||||
cfgload.c
|
||||
endmem.asm
|
||||
init.asm
|
||||
initc.c
|
||||
uic.c
|
||||
patch.c
|
||||
ui.asm
|
||||
@@ -95,29 +144,34 @@ source_files = Split("""
|
||||
zmovie.c
|
||||
zstate.c
|
||||
zloader.c
|
||||
""")
|
||||
''')
|
||||
|
||||
linux_source_files = Split("""
|
||||
linuxsrc = Split('''
|
||||
linux/copyvwin.asm
|
||||
linux/sdlintrf.asm
|
||||
linux/sdllink.c
|
||||
linux/sw_draw.c
|
||||
linux/zipxw.c
|
||||
linux/zfilew.c
|
||||
""")
|
||||
''')
|
||||
winsrc = Split('''
|
||||
win/copyvwin.asm
|
||||
win/winintrf.asm
|
||||
win/winlink.cpp
|
||||
win/zfilew.c
|
||||
win/zipxw.c
|
||||
''')
|
||||
|
||||
zsnes = Environment ()
|
||||
|
||||
platform = zsnes['PLATFORM']
|
||||
platform = env['PLATFORM']
|
||||
|
||||
# Setup environment for nasm
|
||||
zsnes.Replace (AS = 'nasm')
|
||||
zsnes.Replace (ASFLAGS = '-f elf ')
|
||||
env.Replace (AS = 'nasm')
|
||||
env.Replace (ASFLAGS = '-f elf ')
|
||||
|
||||
#sdl_config = Builder (action = 'sdl-config --include')
|
||||
|
||||
# Run config tests.
|
||||
conf = Configure (zsnes)
|
||||
conf = Configure (env)
|
||||
|
||||
# Must have SDL to compile
|
||||
if not conf.CheckLib ('SDL', 'SDL_Init'):
|
||||
@@ -137,15 +191,125 @@ if not conf.TryCompile ('db __NASM_VER__', '.asm'):
|
||||
print 'NASM not found! Please install NASM and try again.'
|
||||
Exit (1)
|
||||
|
||||
zsnes = conf.Finish ()
|
||||
env = conf.Finish ()
|
||||
|
||||
# Perform any platform-specific initialization
|
||||
if platform == 'posix':
|
||||
source_files = source_files + linux_source_files
|
||||
zsnes.Append (CCFLAGS = '-D__LINUX__')
|
||||
zsnes.Append (ASFLAGS = '-DELF -D__LINUX__')
|
||||
zsnes.Append (CCFLAGS = '-I.')
|
||||
zsnes.Append (CCFLAGS = '-I/usr/include/SDL')
|
||||
src = chipssrc + netsrc + cpusrc + dossrc + effectssrc + guisrc + videosrc + zipsrc + jmasrc + linuxsrc
|
||||
env.Append (CCFLAGS = '-D__LINUX__')
|
||||
env.Append (ASFLAGS = '-DELF -D__LINUX__')
|
||||
env.Append (CCFLAGS = '-I.')
|
||||
env.Append (CCFLAGS = '-I/usr/include/SDL')
|
||||
|
||||
#Build ZSNESL
|
||||
env.Program('zsnes',src)
|
||||
Exit(0)
|
||||
|
||||
if platform == 'win32':
|
||||
if env['CC'] == 'cl':
|
||||
def freeMSVCHack(env, vclibs):
|
||||
# SCons automatically finds full versions of msvc via the registry, so
|
||||
# if it can't find 'cl', it may be because we're trying to use the
|
||||
# free version
|
||||
def isMicrosoftSDKDir(dir):
|
||||
return os.path.exists(dir+os.sep+'Include'+os.sep+'Windows.h') and os.path.exists(dir+os.sep+'Lib'+os.sep+'WinMM.lib')
|
||||
|
||||
def findMicrosoftSDK():
|
||||
import SCons.Platform.win32
|
||||
import SCons.Util
|
||||
import re
|
||||
if not SCons.Util.can_read_reg:
|
||||
return None
|
||||
HLM = SCons.Util.HKEY_LOCAL_MACHINE
|
||||
K = r'Software\Microsoft\.NETFramework\AssemblyFolders\PSDK Assemblies'
|
||||
try:
|
||||
k = SCons.Util.RegOpenKeyEx(HLM, K)
|
||||
p = SCons.Util.RegQueryValueEx(k,'')[0]
|
||||
# this should have \include at the end, so chop that off
|
||||
p = re.sub(r'(?i)\\+Include\\*$','',p)
|
||||
if isMicrosoftSDKDir(p): return p
|
||||
except SCons.Util.RegError:
|
||||
pass
|
||||
|
||||
K = r'SOFTWARE\Microsoft\MicrosoftSDK\InstalledSDKs'
|
||||
try:
|
||||
k = SCons.Util.RegOpenKeyEx(HLM, K)
|
||||
i=0
|
||||
while 1:
|
||||
p = SCons.Util.RegEnumKey(k,i)
|
||||
i+=1
|
||||
subk = SCons.Util.RegOpenKeyEx(k, p)
|
||||
try:
|
||||
p = SCons.Util.RegQueryValueEx(subk,'Install Dir')[0]
|
||||
# trim trailing backslashes
|
||||
p = re.sub(r'\\*$','',p)
|
||||
if isMicrosoftSDKDir(p): return p
|
||||
except SCons.Util.RegError:
|
||||
pass
|
||||
except SCons.Util.RegError:
|
||||
pass
|
||||
|
||||
return None
|
||||
|
||||
# End of local defs. Actual freeMSVCHack begins here
|
||||
if not env['MSVS'].get('VCINSTALLDIR'):
|
||||
if os.environ.get('VCToolkitInstallDir'):
|
||||
vcdir=os.environ['VCToolkitInstallDir']
|
||||
env.PrependENVPath('INCLUDE', vcdir+os.sep+'Include')
|
||||
env.PrependENVPath('LIB', vcdir+os.sep+'Lib')
|
||||
env.PrependENVPath('PATH', vcdir+os.sep+'Bin')
|
||||
env['MSVS']['VERSION'] = '7.1'
|
||||
env['MSVS']['VERSIONS'] = ['7.1']
|
||||
if not env['MSVS'].get('PLATFORMSDKDIR'):
|
||||
sdkdir = findMicrosoftSDK()
|
||||
if sdkdir:
|
||||
env.PrependENVPath('INCLUDE', sdkdir+os.sep+'Include')
|
||||
env.PrependENVPath('LIB', sdkdir+os.sep+'Lib')
|
||||
env.PrependENVPath('PATH', sdkdir+os.sep+'Bin')
|
||||
env['MSVS']['PLATFORMSDKDIR']=sdkdir
|
||||
# FREE MSVC7 only allows
|
||||
# /ML(libc) /MT(libcmt) or /MLd(libcd)
|
||||
# Full IDE versions also have
|
||||
# /MD(msvcrtd) /MTd(libcmtd) and /MDd(msvcrtd)
|
||||
# So if you want to debug with the freever, the only option is
|
||||
# the single-threaded lib, /MLd
|
||||
vclibs['Debug']='/MLd'
|
||||
vclibs['Release']='/MT'
|
||||
|
||||
# MSVC SETUP
|
||||
# MDd is for multithreaded debug dll CRT (msvcrtd)
|
||||
# MD is for multithreaded dll CRT (msvcrt)
|
||||
# These are just my preferences
|
||||
vclibs = {'Debug':'/MDd','Release':'/MD'}
|
||||
freeMSVCHack(env, vclibs)
|
||||
|
||||
env.Append(CCFLAGS=[vclibs[variant]])
|
||||
if debug:
|
||||
env.Append(CCFLAGS=Split('/Zi /Fd${TARGET}.pdb'))
|
||||
env.Append(LINKFLAGS = ['/DEBUG'])
|
||||
# env.Clean('.', '${TARGET}.pdb')
|
||||
# Need to clean .pdbs somehow! The above line doesn't work!
|
||||
else:
|
||||
env.Append(CCFLAGS=Split('/Og /Ot /Ob1 /Op /G6'))
|
||||
|
||||
env.Append(CCFLAGS=Split('/EHsc /J /W3 /Gd'))
|
||||
env.Append(CPPDEFINES=Split('WIN32 _WINDOWS'))
|
||||
src = chipssrc + netsrc + cpusrc + dossrc + effectssrc + guisrc + videosrc + zipsrc + jmasrc + winsrc
|
||||
env.Append (CCFLAGS = '-D__WIN32__')
|
||||
env.Append (ASFLAGS = '-f win32')
|
||||
|
||||
#Build ZSNESW
|
||||
env.Program('zsnesw.exe',src)
|
||||
else:
|
||||
if debug:
|
||||
env.Append (CCFLAGS = '-g -D__WIN32__')
|
||||
env.Append (CCFLAGS = '-D__WIN32__')
|
||||
env.Append (ASFLAGS = '-f win32 -O0')
|
||||
else:
|
||||
env.Append (CCFLAGS = '-D__WIN32__')
|
||||
env.Append (CCFLAGS = '-f win32')
|
||||
|
||||
#Build ZSNESW
|
||||
env.Program('zsnesw.exe',src)
|
||||
Exit(0)
|
||||
|
||||
# Build the program.
|
||||
zsnes.Program ('zsnes', source_files)
|
||||
|
||||
Reference in New Issue
Block a user