2008-09-19 15:03:31 +00:00
|
|
|
# -*- python -*-
|
2008-09-20 17:31:54 +00:00
|
|
|
|
2008-07-12 17:40:22 +00:00
|
|
|
import os
|
2008-07-30 09:12:52 +00:00
|
|
|
import sys
|
2008-07-12 17:40:22 +00:00
|
|
|
|
2008-09-19 15:03:31 +00:00
|
|
|
# TODO: how do we use it in help?
|
|
|
|
name="Dolphin"
|
|
|
|
version="SVN"
|
|
|
|
description="A wii/gamecube emulator"
|
|
|
|
license="GPL v2"
|
2008-08-12 23:17:29 +00:00
|
|
|
|
2008-08-26 21:02:23 +00:00
|
|
|
warnings = [
|
|
|
|
'all',
|
|
|
|
'write-strings',
|
|
|
|
'shadow',
|
|
|
|
'pointer-arith',
|
|
|
|
'packed',
|
|
|
|
'no-conversion',
|
|
|
|
]
|
|
|
|
compileFlags = [
|
2008-09-18 10:06:55 +00:00
|
|
|
'-fno-exceptions',
|
2008-08-26 21:02:23 +00:00
|
|
|
'-fno-strict-aliasing',
|
|
|
|
'-msse2',
|
2008-08-27 01:42:11 +00:00
|
|
|
'-fvisibility=hidden',
|
2008-09-19 15:03:31 +00:00
|
|
|
# '-fomit-frame-pointer'
|
2008-08-26 21:02:23 +00:00
|
|
|
]
|
2008-09-18 10:04:03 +00:00
|
|
|
|
2008-09-19 15:03:31 +00:00
|
|
|
cppDefines = [
|
|
|
|
( '_FILE_OFFSET_BITS', 64),
|
|
|
|
'_LARGEFILE_SOURCE',
|
|
|
|
'GCC_HASCLASSVISIBILITY',
|
|
|
|
]
|
|
|
|
|
|
|
|
|
2008-08-26 21:02:23 +00:00
|
|
|
if sys.platform == 'darwin':
|
|
|
|
compileFlags += [ '-I/opt/local/include' ]
|
2008-07-12 17:40:22 +00:00
|
|
|
|
2008-08-26 21:02:23 +00:00
|
|
|
include_paths = [
|
|
|
|
'../../../Core/Common/Src',
|
|
|
|
'../../../Core/DiscIO/Src',
|
|
|
|
'../../../PluginSpecs',
|
|
|
|
'../../../',
|
|
|
|
'../../../Core/Core/Src',
|
|
|
|
'../../../Core/DebuggerWX/src',
|
|
|
|
'../../../../Externals/Bochs_disasm',
|
2008-09-18 22:19:01 +00:00
|
|
|
'../../../../Externals/LZO',
|
2008-08-26 21:02:23 +00:00
|
|
|
'../../../Core/VideoCommon/Src',
|
|
|
|
]
|
2008-07-12 17:40:22 +00:00
|
|
|
|
2008-08-20 11:01:29 +00:00
|
|
|
dirs = [
|
2008-09-18 22:19:01 +00:00
|
|
|
'Source/Core/Common/Src',
|
|
|
|
'Externals/Bochs_disasm',
|
|
|
|
'Externals/LZO',
|
|
|
|
'Source/Core/Core/Src',
|
|
|
|
'Source/Core/DiscIO/Src',
|
|
|
|
'Source/Core/DebuggerWX/src',
|
|
|
|
'Source/Core/VideoCommon/Src',
|
|
|
|
'Source/Plugins/Plugin_VideoOGL/Src',
|
|
|
|
'Source/Plugins/Plugin_DSP_HLE/Src',
|
|
|
|
'Source/Plugins/Plugin_DSP_LLE/Src',
|
|
|
|
'Source/Plugins/Plugin_PadSimple/Src',
|
|
|
|
'Source/Plugins/Plugin_nJoy_SDL/Src',
|
|
|
|
'Source/Plugins/Plugin_Wiimote_Test/Src',
|
|
|
|
'Source/Core/DolphinWX/Src',
|
2008-08-20 11:01:29 +00:00
|
|
|
]
|
|
|
|
|
2008-08-12 23:17:29 +00:00
|
|
|
builders = {}
|
2008-08-26 21:02:23 +00:00
|
|
|
if sys.platform == 'darwin':
|
2008-08-12 23:17:29 +00:00
|
|
|
from plistlib import writePlist
|
2008-08-26 21:02:23 +00:00
|
|
|
def createPlist(target, source, env):
|
2008-08-12 23:17:29 +00:00
|
|
|
properties = {}
|
2008-08-26 21:02:23 +00:00
|
|
|
for srcNode in source:
|
|
|
|
properties.update(srcNode.value)
|
|
|
|
for dstNode in target:
|
|
|
|
writePlist(properties, str(dstNode))
|
|
|
|
builders['Plist'] = Builder(action = createPlist)
|
2008-08-12 23:17:29 +00:00
|
|
|
|
2008-07-12 17:40:22 +00:00
|
|
|
lib_paths = include_paths
|
|
|
|
|
2008-09-19 15:03:31 +00:00
|
|
|
# handle command line options
|
|
|
|
vars = Variables('custom.py')
|
|
|
|
vars.AddVariables(
|
|
|
|
BoolVariable('verbose', 'Set for compilation line', False),
|
|
|
|
BoolVariable('debug', 'Set for debug build', False),
|
|
|
|
BoolVariable('lint', 'Set for lint build (extra warnings)', False),
|
2008-09-20 17:31:54 +00:00
|
|
|
BoolVariable('nowx', 'Set For Building with no WX libs', False),
|
2008-09-19 15:03:31 +00:00
|
|
|
EnumVariable('flavor', 'Choose a build flavor', 'release',
|
|
|
|
allowed_values=('release', 'devel', 'debug'),
|
|
|
|
ignorecase=2)
|
|
|
|
|
|
|
|
)
|
|
|
|
|
|
|
|
# build falvuor
|
|
|
|
flavour = ARGUMENTS.get('flavor')
|
|
|
|
if (flavour == 'debug'):
|
2008-09-18 22:19:01 +00:00
|
|
|
compileFlags.append('-g')
|
2008-09-19 15:03:31 +00:00
|
|
|
cppDefines.append('LOGGING')
|
2008-09-18 09:49:58 +00:00
|
|
|
else:
|
2008-09-18 22:19:01 +00:00
|
|
|
compileFlags.append('-O3')
|
|
|
|
|
2008-09-19 15:03:31 +00:00
|
|
|
|
|
|
|
# more warnings
|
|
|
|
lint = ARGUMENTS.get('lint', False)
|
|
|
|
if bool(lint):
|
2008-09-18 22:19:01 +00:00
|
|
|
warnings.append('error')
|
2008-09-19 15:03:31 +00:00
|
|
|
warnings.append('unreachable-code')
|
|
|
|
warnings.append('float-equal')
|
|
|
|
|
2008-09-20 17:31:54 +00:00
|
|
|
nowx = ARGUMENTS.get('nowx', 0)
|
|
|
|
if int(nowx):
|
|
|
|
WxCppFlags = ''
|
|
|
|
WxLibFlags = ''
|
|
|
|
else:
|
|
|
|
WxCppFlags = os.popen('wx-config --cppflags').read()
|
|
|
|
if WxCppFlags[-1] == "\n":
|
|
|
|
WxCppFlags = WxCppFlags[:-1]
|
|
|
|
WxLibFlags = os.popen('wx-config --libs').read()
|
|
|
|
if WxLibFlags[-1] == "\n":
|
|
|
|
WxLibFlags = WxLibFlags[:-1]
|
2008-09-18 10:04:03 +00:00
|
|
|
|
|
|
|
compileFlags += [ '-W' + warning for warning in warnings ]
|
2008-09-18 09:49:58 +00:00
|
|
|
|
2008-08-26 21:02:23 +00:00
|
|
|
env = Environment(
|
2008-09-18 22:19:01 +00:00
|
|
|
CC = 'gcc',
|
|
|
|
CXX = 'g++',
|
2008-08-26 22:28:42 +00:00
|
|
|
CCFLAGS = ' '.join(compileFlags),
|
2008-08-27 11:52:28 +00:00
|
|
|
CXXFLAGS = ' '.join(compileFlags + [ '-fvisibility-inlines-hidden' ]),
|
2008-09-20 10:24:00 +00:00
|
|
|
CPPDEFINES = cppDefines,
|
2008-08-26 21:02:23 +00:00
|
|
|
CPPPATH = include_paths,
|
|
|
|
LIBPATH = lib_paths,
|
2008-09-20 17:31:54 +00:00
|
|
|
variables = vars,
|
|
|
|
WXCPPFLAGS = WxCppFlags,
|
|
|
|
WXLIBFLAGS = WxLibFlags,
|
2008-08-26 21:02:23 +00:00
|
|
|
ENV = {
|
|
|
|
'PATH' : os.environ['PATH'],
|
|
|
|
'HOME' : os.environ['HOME']
|
|
|
|
},
|
|
|
|
BUILDERS = builders,
|
2008-09-20 10:24:00 +00:00
|
|
|
DESCRIPTION = description,
|
|
|
|
SUMMARY = description,
|
|
|
|
LICENSE = license,
|
|
|
|
NAME = name,
|
|
|
|
VERSION = version,
|
2008-08-26 21:02:23 +00:00
|
|
|
)
|
2008-07-12 17:40:22 +00:00
|
|
|
|
2008-09-19 15:03:31 +00:00
|
|
|
# verbose compile
|
|
|
|
verbose = ARGUMENTS.get('verbose', False)
|
|
|
|
|
2008-09-20 10:21:33 +00:00
|
|
|
if not bool(verbose):
|
2008-09-19 15:03:31 +00:00
|
|
|
env['CCCOMSTR'] = "Compiling $TARGET"
|
|
|
|
env['CXXCOMSTR'] = "Compiling $TARGET"
|
2008-09-20 10:24:00 +00:00
|
|
|
env['ARCOMSTR'] = " ar $TARGET"
|
2008-09-19 15:03:31 +00:00
|
|
|
env['LINKCOMSTR'] = "Linking $TARGET"
|
|
|
|
|
|
|
|
|
2008-07-12 17:40:22 +00:00
|
|
|
Export('env')
|
|
|
|
|
2008-09-19 15:03:31 +00:00
|
|
|
Progress(['-\r', '\\\r', '|\r', '/\r'], interval=5)
|
|
|
|
|
|
|
|
# die on unknown variables
|
|
|
|
unknown = vars.UnknownVariables()
|
|
|
|
if unknown:
|
|
|
|
print "Unknown variables:", unknown.keys()
|
|
|
|
Exit(1)
|
|
|
|
|
|
|
|
#generate help
|
|
|
|
Help(vars.GenerateHelpText(env))
|
|
|
|
|
2008-08-26 21:02:23 +00:00
|
|
|
for subdir in dirs:
|
2008-07-12 17:40:22 +00:00
|
|
|
SConscript(
|
2008-08-26 21:02:23 +00:00
|
|
|
subdir + os.sep + 'SConscript',
|
2008-07-12 17:40:22 +00:00
|
|
|
duplicate = 0
|
|
|
|
)
|