2008-09-19 09:03:31 -06:00
|
|
|
# -*- python -*-
|
2008-09-20 11:31:54 -06:00
|
|
|
|
2008-07-12 11:40:22 -06:00
|
|
|
import os
|
2008-07-30 03:12:52 -06:00
|
|
|
import sys
|
2008-11-13 01:12:48 -07:00
|
|
|
import platform
|
2008-07-12 11:40:22 -06:00
|
|
|
|
2008-09-21 07:13:20 -06:00
|
|
|
# Home made tests
|
|
|
|
sys.path.append('SconsTests')
|
|
|
|
import wxconfig
|
2008-09-21 13:54:29 -06:00
|
|
|
import utils
|
2008-09-21 07:13:20 -06:00
|
|
|
|
2008-09-21 10:09:59 -06:00
|
|
|
# Some features needs at least scons 0.98
|
|
|
|
EnsureSConsVersion(0, 98)
|
2008-09-21 07:13:20 -06:00
|
|
|
|
2008-09-19 09:03:31 -06:00
|
|
|
# TODO: how do we use it in help?
|
|
|
|
name="Dolphin"
|
|
|
|
version="SVN"
|
|
|
|
description="A wii/gamecube emulator"
|
|
|
|
license="GPL v2"
|
2008-08-12 17:17:29 -06:00
|
|
|
|
2008-08-26 15:02:23 -06:00
|
|
|
warnings = [
|
2008-10-05 12:49:55 -06:00
|
|
|
'all',
|
|
|
|
'write-strings',
|
|
|
|
'shadow',
|
|
|
|
'pointer-arith',
|
|
|
|
'packed',
|
|
|
|
'no-conversion',
|
|
|
|
]
|
2008-08-26 15:02:23 -06:00
|
|
|
compileFlags = [
|
2008-10-05 12:49:55 -06:00
|
|
|
'-fno-exceptions',
|
|
|
|
'-fno-strict-aliasing',
|
|
|
|
'-msse2',
|
|
|
|
'-fvisibility=hidden',
|
|
|
|
#'-fomit-frame-pointer'
|
|
|
|
]
|
2008-09-18 04:04:03 -06:00
|
|
|
|
2008-09-19 09:03:31 -06:00
|
|
|
cppDefines = [
|
2008-10-05 12:49:55 -06:00
|
|
|
( '_FILE_OFFSET_BITS', 64),
|
|
|
|
'_LARGEFILE_SOURCE',
|
|
|
|
'GCC_HASCLASSVISIBILITY',
|
|
|
|
]
|
2008-09-19 09:03:31 -06:00
|
|
|
|
2008-08-26 15:02:23 -06:00
|
|
|
include_paths = [
|
2008-10-05 12:49:55 -06:00
|
|
|
'../../../Core/Common/Src',
|
|
|
|
'../../../Core/DiscIO/Src',
|
|
|
|
'../../../PluginSpecs',
|
|
|
|
'../../../',
|
|
|
|
'../../../Core/Core/Src',
|
|
|
|
'../../../Core/DebuggerWX/Src',
|
|
|
|
'../../../../Externals/Bochs_disasm',
|
|
|
|
'../../../../Externals/LZO',
|
2008-11-19 03:22:29 -07:00
|
|
|
'../../../../Externals/WiiUseSrc/Src',
|
2008-10-05 12:49:55 -06:00
|
|
|
'../../../Core/VideoCommon/Src',
|
|
|
|
]
|
2008-07-12 11:40:22 -06:00
|
|
|
|
2008-08-20 05:01:29 -06:00
|
|
|
dirs = [
|
2008-10-05 12:49:55 -06:00
|
|
|
'Externals/Bochs_disasm',
|
|
|
|
'Externals/LZO',
|
2008-12-05 06:46:19 -07:00
|
|
|
'Externals/WiiUseSrc/Src',
|
2008-11-19 03:22:29 -07:00
|
|
|
'Source/Core/Common/Src',
|
2008-10-05 12:49:55 -06:00
|
|
|
'Source/Core/Core/Src',
|
|
|
|
'Source/Core/DiscIO/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_DSP_NULL/Src',
|
|
|
|
'Source/Plugins/Plugin_PadSimple/Src',
|
|
|
|
'Source/Plugins/Plugin_nJoy_SDL/Src',
|
2008-12-17 03:30:44 -07:00
|
|
|
'Source/Plugins/Plugin_nJoy_Testing/Src',
|
2008-11-23 01:44:02 -07:00
|
|
|
'Source/Plugins/Plugin_Wiimote/Src',
|
2008-10-05 12:49:55 -06:00
|
|
|
'Source/Core/DolphinWX/Src',
|
2008-12-05 06:46:19 -07:00
|
|
|
'Source/Core/DebuggerWX/Src',
|
2008-10-05 12:49:55 -06:00
|
|
|
]
|
|
|
|
|
2008-08-12 17:17:29 -06:00
|
|
|
builders = {}
|
2008-08-26 15:02:23 -06:00
|
|
|
if sys.platform == 'darwin':
|
2008-10-05 12:49:55 -06:00
|
|
|
from plistlib import writePlist
|
|
|
|
def createPlist(target, source, env):
|
|
|
|
properties = {}
|
|
|
|
for srcNode in source:
|
|
|
|
properties.update(srcNode.value)
|
|
|
|
for dstNode in target:
|
|
|
|
writePlist(properties, str(dstNode))
|
2008-10-17 03:44:44 -06:00
|
|
|
builders['Plist'] = Builder(action = createPlist)
|
2008-12-05 06:46:19 -07:00
|
|
|
compileFlags += [ '-I/opt/local/include' ]
|
2008-08-12 17:17:29 -06:00
|
|
|
|
2008-07-12 11:40:22 -06:00
|
|
|
lib_paths = include_paths
|
|
|
|
|
2008-09-19 09:03:31 -06:00
|
|
|
# handle command line options
|
2008-09-21 09:55:27 -06:00
|
|
|
vars = Variables('args.cache')
|
2008-12-10 11:33:13 -07:00
|
|
|
|
2008-09-19 09:03:31 -06:00
|
|
|
vars.AddVariables(
|
2008-10-05 12:49:55 -06:00
|
|
|
BoolVariable('verbose', 'Set for compilation line', False),
|
2008-11-13 03:04:10 -07:00
|
|
|
BoolVariable('bundle', 'Set to create bundle', False),
|
2008-10-05 12:49:55 -06:00
|
|
|
BoolVariable('lint', 'Set for lint build (extra warnings)', False),
|
|
|
|
BoolVariable('nowx', 'Set For Building with no WX libs (WIP)', False),
|
2008-12-10 16:39:59 -07:00
|
|
|
BoolVariable('wxgl', 'Set For Building with WX GL libs (WIP)', False),
|
2008-12-13 16:19:56 -07:00
|
|
|
BoolVariable('sdlgl', 'Set For Building with SDL GL libs (WIP)', False),
|
2008-12-19 06:56:53 -07:00
|
|
|
BoolVariable('gltest', 'temp don\'t use (WIP)', False),
|
2008-10-05 12:49:55 -06:00
|
|
|
EnumVariable('flavor', 'Choose a build flavor', 'release',
|
2008-12-17 17:45:55 -07:00
|
|
|
allowed_values = ('release', 'devel', 'debug', 'fastlog'),
|
2008-10-05 12:49:55 -06:00
|
|
|
ignorecase = 2
|
2008-11-30 15:05:43 -07:00
|
|
|
),
|
2008-12-10 16:23:05 -07:00
|
|
|
EnumVariable('osx', 'Choose a backend (WIP)', '32cocoa',
|
|
|
|
allowed_values = ('32x11', '32cocoa', '64cocoa'),
|
2008-12-10 11:33:13 -07:00
|
|
|
ignorecase = 2
|
|
|
|
),
|
2008-12-09 16:47:18 -07:00
|
|
|
PathVariable('wxconfig', 'Path to the wxconfig', None),
|
2008-11-30 15:05:43 -07:00
|
|
|
('CC', 'The c compiler', 'gcc'),
|
|
|
|
('CXX', 'The c++ compiler', 'g++'),
|
2008-10-05 12:49:55 -06:00
|
|
|
)
|
2008-09-19 09:03:31 -06:00
|
|
|
|
2008-12-10 11:33:13 -07:00
|
|
|
|
2008-08-26 15:02:23 -06:00
|
|
|
env = Environment(
|
2008-10-05 12:49:55 -06:00
|
|
|
CPPPATH = include_paths,
|
|
|
|
LIBPATH = lib_paths,
|
|
|
|
variables = vars,
|
|
|
|
ENV = {
|
|
|
|
'PATH' : os.environ['PATH'],
|
|
|
|
'HOME' : os.environ['HOME']
|
|
|
|
},
|
|
|
|
BUILDERS = builders,
|
|
|
|
DESCRIPTION = description,
|
|
|
|
SUMMARY = description,
|
|
|
|
LICENSE = license,
|
|
|
|
NAME = name,
|
|
|
|
VERSION = version,
|
|
|
|
)
|
2008-07-12 11:40:22 -06:00
|
|
|
|
2008-09-21 13:54:29 -06:00
|
|
|
# save the given command line options
|
2008-09-21 09:55:27 -06:00
|
|
|
vars.Save('args.cache', env)
|
|
|
|
|
2008-09-19 09:03:31 -06:00
|
|
|
# verbose compile
|
2008-09-20 16:06:22 -06:00
|
|
|
if not env['verbose']:
|
2008-10-05 12:49:55 -06:00
|
|
|
env['CCCOMSTR'] = "Compiling $TARGET"
|
|
|
|
env['CXXCOMSTR'] = "Compiling $TARGET"
|
|
|
|
env['ARCOMSTR'] = "Archiving $TARGET"
|
|
|
|
env['LINKCOMSTR'] = "Linking $TARGET"
|
|
|
|
env['ASCOMSTR'] = "Assembling $TARGET"
|
|
|
|
env['ASPPCOMSTR'] = "Assembling $TARGET"
|
|
|
|
env['SHCCCOMSTR'] = "Compiling shared $TARGET"
|
|
|
|
env['SHCXXCOMSTR'] = "Compiling shared $TARGET"
|
|
|
|
env['SHLINKCOMSTR'] = "Linking shared $TARGET"
|
|
|
|
env['RANLIBCOMSTR'] = "Indexing $TARGET"
|
2008-09-21 13:54:29 -06:00
|
|
|
|
2008-10-20 11:32:15 -06:00
|
|
|
|
2008-09-20 16:06:22 -06:00
|
|
|
# build falvuor
|
2008-09-22 18:24:28 -06:00
|
|
|
flavour = ARGUMENTS.get('flavor')
|
2008-09-20 16:06:22 -06:00
|
|
|
if (flavour == 'debug'):
|
2008-10-05 12:49:55 -06:00
|
|
|
compileFlags.append('-g')
|
|
|
|
cppDefines.append('LOGGING')
|
2008-12-17 17:37:24 -07:00
|
|
|
cppDefines.append('_DEBUG')
|
2008-12-19 02:36:27 -07:00
|
|
|
# FIXME: this disable wx debugging how do we make it work?
|
|
|
|
cppDefines.append('NDEBUG')
|
|
|
|
|
2008-09-24 11:39:15 -06:00
|
|
|
elif (flavour == 'devel'):
|
2008-10-05 12:49:55 -06:00
|
|
|
compileFlags.append('-g')
|
2008-12-17 17:37:24 -07:00
|
|
|
cppDefines.append('DEBUGFAST')
|
|
|
|
elif (flavour == 'fastlog'):
|
|
|
|
compileFlags.append('-O3')
|
|
|
|
cppDefines.append('LOGGING')
|
2008-09-20 16:06:22 -06:00
|
|
|
else:
|
2008-10-05 12:49:55 -06:00
|
|
|
compileFlags.append('-O3')
|
2008-09-20 16:06:22 -06:00
|
|
|
|
|
|
|
# more warnings
|
|
|
|
if env['lint']:
|
2008-10-05 12:49:55 -06:00
|
|
|
warnings.append('error')
|
|
|
|
warnings.append('unreachable-code')
|
|
|
|
warnings.append('float-equal')
|
2008-09-20 16:06:22 -06:00
|
|
|
|
|
|
|
# add the warnings to the compile flags
|
|
|
|
compileFlags += [ '-W' + warning for warning in warnings ]
|
|
|
|
|
|
|
|
env['CCFLAGS'] = compileFlags
|
|
|
|
env['CXXFLAGS'] = compileFlags + [ '-fvisibility-inlines-hidden' ]
|
|
|
|
env['CPPDEFINES'] = cppDefines
|
|
|
|
|
2008-09-21 07:13:20 -06:00
|
|
|
|
|
|
|
# Configuration tests section
|
2008-09-24 11:39:15 -06:00
|
|
|
tests = {'CheckWXConfig' : wxconfig.CheckWXConfig,
|
|
|
|
'CheckPKGConfig' : utils.CheckPKGConfig,
|
|
|
|
'CheckPKG' : utils.CheckPKG,
|
|
|
|
'CheckSDL' : utils.CheckSDL}
|
2008-09-22 18:24:28 -06:00
|
|
|
|
2008-12-10 17:45:14 -07:00
|
|
|
build_dir = os.path.join('Build', platform.system() + '-' + platform.machine() + os.sep)
|
|
|
|
VariantDir(build_dir, '.', duplicate=0)
|
|
|
|
|
2008-12-05 06:46:19 -07:00
|
|
|
conf = env.Configure(custom_tests = tests,
|
|
|
|
config_h="Source/Core/Common/Src/Config.h")
|
2008-09-21 07:13:20 -06:00
|
|
|
|
2008-09-24 11:39:15 -06:00
|
|
|
if not conf.CheckPKGConfig('0.15.0'):
|
2008-12-05 06:46:19 -07:00
|
|
|
print "Can't find pkg-config, some tests will fail"
|
2008-09-24 11:39:15 -06:00
|
|
|
|
2008-12-05 06:46:19 -07:00
|
|
|
env['HAVE_SDL'] = conf.CheckSDL('1.0.0')
|
2008-09-24 11:39:15 -06:00
|
|
|
|
2008-12-05 06:46:19 -07:00
|
|
|
# Bluetooth for wii support
|
|
|
|
env['HAVE_BLUEZ'] = conf.CheckPKG('bluez')
|
2008-12-04 08:15:21 -07:00
|
|
|
|
2008-12-05 06:46:19 -07:00
|
|
|
# needed for sound
|
|
|
|
env['HAVE_AO'] = conf.CheckPKG('ao')
|
2008-09-24 11:39:15 -06:00
|
|
|
|
2008-12-05 06:46:19 -07:00
|
|
|
#osx 64 specifics
|
2008-12-10 11:33:13 -07:00
|
|
|
if sys.platform == 'darwin':
|
2008-12-10 16:23:05 -07:00
|
|
|
if env['osx'] == '64cocoa':
|
2008-12-10 16:39:59 -07:00
|
|
|
compileFlags += ['-arch' , 'x86_64' ]
|
|
|
|
conf.Define('MAP_32BIT', 0)
|
|
|
|
|
2008-12-10 16:23:05 -07:00
|
|
|
if not env['osx'] == '32x11':
|
2008-12-10 11:33:13 -07:00
|
|
|
env['HAVE_X11'] = 0
|
|
|
|
env['HAVE_COCOA'] = conf.CheckPKG('cocoa')
|
|
|
|
else:
|
|
|
|
env['HAVE_X11'] = conf.CheckPKG('x11')
|
|
|
|
env['HAVE_COCOA'] = 0
|
2008-12-13 16:19:56 -07:00
|
|
|
|
|
|
|
# handling wx flags CCFLAGS should be created before
|
|
|
|
wxmods = ['adv', 'core', 'base']
|
|
|
|
env['USE_WX'] = 0
|
|
|
|
if env['wxgl']:
|
|
|
|
wxmods.append('gl')
|
|
|
|
env['USE_WX'] = 1
|
|
|
|
env['HAVE_X11'] = 0
|
|
|
|
env['HAVE_COCOA'] = 0
|
|
|
|
|
|
|
|
env['HAVE_WX'] = conf.CheckWXConfig('2.8', wxmods, 0)
|
|
|
|
|
|
|
|
# SDL backend
|
|
|
|
env['USE_SDL'] = 0
|
|
|
|
|
|
|
|
if env['sdlgl']:
|
|
|
|
env['USE_SDL'] = 1
|
|
|
|
env['HAVE_X11'] = 0
|
|
|
|
env['HAVE_COCOA'] = 0
|
|
|
|
env['USE_WX'] = 0
|
|
|
|
|
2008-12-19 04:46:52 -07:00
|
|
|
env['GLTEST'] = 0
|
2008-12-19 06:56:53 -07:00
|
|
|
if env['gltest']:
|
2008-12-19 04:46:52 -07:00
|
|
|
env['GLTEST'] = 1
|
|
|
|
|
|
|
|
conf.Define('GLTEST', env['GLTEST'])
|
|
|
|
|
2008-12-05 06:46:19 -07:00
|
|
|
# Gui less build
|
|
|
|
if env['nowx']:
|
|
|
|
env['HAVE_WX'] = 0;
|
|
|
|
|
|
|
|
# Creating config.h defines
|
|
|
|
conf.Define('HAVE_SDL', env['HAVE_SDL'])
|
2008-12-13 16:19:56 -07:00
|
|
|
conf.Define('USE_SDL', env['USE_SDL'])
|
2008-12-05 06:46:19 -07:00
|
|
|
conf.Define('HAVE_BLUEZ', env['HAVE_BLUEZ'])
|
|
|
|
conf.Define('HAVE_AO', env['HAVE_AO'])
|
|
|
|
conf.Define('HAVE_WX', env['HAVE_WX'])
|
2008-12-10 16:39:59 -07:00
|
|
|
conf.Define('USE_WX', env['USE_WX'])
|
2008-12-06 15:28:32 -07:00
|
|
|
conf.Define('HAVE_X11', env['HAVE_X11'])
|
2008-12-10 11:33:13 -07:00
|
|
|
conf.Define('HAVE_COCOA', env['HAVE_COCOA'])
|
2008-09-21 07:13:20 -06:00
|
|
|
|
2008-09-22 18:07:51 -06:00
|
|
|
# After all configuration tests are done
|
2008-12-05 06:46:19 -07:00
|
|
|
conf.Finish()
|
2008-09-22 18:07:51 -06:00
|
|
|
|
2008-09-24 11:39:15 -06:00
|
|
|
#wx windows flags
|
2008-12-05 06:46:19 -07:00
|
|
|
if env['HAVE_WX']:
|
|
|
|
wxconfig.ParseWXConfig(env)
|
2008-12-06 16:32:10 -07:00
|
|
|
else:
|
|
|
|
print "WX not found or disabled, not building GUI"
|
2008-09-24 11:39:15 -06:00
|
|
|
|
2008-09-21 13:54:29 -06:00
|
|
|
# add methods from utils to env
|
|
|
|
env.AddMethod(utils.filterWarnings)
|
|
|
|
|
2008-11-13 01:12:48 -07:00
|
|
|
# Where do we run from
|
|
|
|
env['base_dir'] = os.getcwd()+ '/';
|
|
|
|
|
|
|
|
# install paths
|
|
|
|
# TODO: support global install
|
|
|
|
env['prefix'] = os.path.join(env['base_dir'] + 'Binary', platform.system() + '-' + platform.machine() + '/')
|
|
|
|
#TODO add lib
|
|
|
|
env['plugin_dir'] = env['prefix'] + 'Plugins/'
|
|
|
|
#TODO add bin
|
|
|
|
env['binary_dir'] = env['prefix']
|
2008-11-19 04:41:42 -07:00
|
|
|
#TODO add bin
|
2008-11-19 03:49:36 -07:00
|
|
|
env['libs_dir'] = env['prefix'] + 'Libs/'
|
2008-11-13 01:12:48 -07:00
|
|
|
#TODO where should this go?
|
|
|
|
env['data_dir'] = env['prefix']
|
2008-11-11 13:59:48 -07:00
|
|
|
|
2008-12-05 06:46:19 -07:00
|
|
|
env['RPATH'] = env['libs_dir']
|
|
|
|
|
2008-11-19 08:00:19 -07:00
|
|
|
env['LIBPATH'] += [ env['libs_dir'] ]
|
2008-12-05 06:46:19 -07:00
|
|
|
|
2008-07-12 11:40:22 -06:00
|
|
|
|
2008-11-13 03:04:10 -07:00
|
|
|
rev = utils.GenerateRevFile(env['flavor'],
|
|
|
|
"Source/Core/Common/Src/svnrev_template.h",
|
|
|
|
"Source/Core/Common/Src/svnrev.h")
|
2008-09-20 16:06:22 -06:00
|
|
|
# print a nice progress indication when not compiling
|
2008-09-22 18:24:28 -06:00
|
|
|
Progress(['-\r', '\\\r', '|\r', '/\r'], interval = 5)
|
2008-09-19 09:03:31 -06:00
|
|
|
|
|
|
|
# die on unknown variables
|
|
|
|
unknown = vars.UnknownVariables()
|
|
|
|
if unknown:
|
2008-10-05 12:49:55 -06:00
|
|
|
print "Unknown variables:", unknown.keys()
|
|
|
|
Exit(1)
|
2008-09-19 09:03:31 -06:00
|
|
|
|
2008-09-20 16:06:22 -06:00
|
|
|
# generate help
|
2008-09-19 09:03:31 -06:00
|
|
|
Help(vars.GenerateHelpText(env))
|
|
|
|
|
2008-12-05 06:46:19 -07:00
|
|
|
Export('env')
|
|
|
|
|
2008-08-26 15:02:23 -06:00
|
|
|
for subdir in dirs:
|
2008-10-05 12:49:55 -06:00
|
|
|
SConscript(
|
|
|
|
subdir + os.sep + 'SConscript',
|
2008-12-10 17:45:14 -07:00
|
|
|
variant_dir = build_dir + subdir + os.sep,
|
|
|
|
duplicate=0
|
2008-10-05 12:49:55 -06:00
|
|
|
)
|
2008-11-13 01:12:48 -07:00
|
|
|
|
|
|
|
# Data install
|
|
|
|
env.Install(env['data_dir'], 'Data/Sys')
|
|
|
|
env.Install(env['data_dir'], 'Data/User')
|
|
|
|
|
|
|
|
if sys.platform == 'darwin':
|
|
|
|
env.Install(env['binary_dir'] + 'Dolphin.app/Contents/Resources/',
|
2008-11-18 01:33:49 -07:00
|
|
|
'Source/Core/DolphinWX/resources/Dolphin.icns')
|
2008-11-13 03:04:10 -07:00
|
|
|
|
|
|
|
if env['bundle']:
|
|
|
|
# Make tar ball (TODO put inside normal dir)
|
|
|
|
tar_env = env.Clone()
|
|
|
|
tarball = tar_env.Tar('dolphin-'+rev +'.tar.bz2', env['prefix'])
|
|
|
|
tar_env.Append(TARFLAGS='-j',
|
|
|
|
TARCOMSTR="Creating release tarball")
|
|
|
|
|
|
|
|
|
|
|
|
#TODO clean all bundles
|
|
|
|
#env.Clean(all, 'dolphin-*'+ '.tar.bz2')
|
|
|
|
|
|
|
|
|