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-21 13:13:20 +00:00
|
|
|
# Home made tests
|
|
|
|
sys.path.append('SconsTests')
|
|
|
|
import wxconfig
|
2008-09-21 19:54:29 +00:00
|
|
|
import utils
|
2008-09-21 13:13:20 +00:00
|
|
|
|
2008-09-21 16:09:59 +00:00
|
|
|
# Some features needs at least scons 0.98
|
|
|
|
EnsureSConsVersion(0, 98)
|
2008-09-21 13:13:20 +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 = [
|
2008-10-05 18:49:55 +00:00
|
|
|
'all',
|
|
|
|
'write-strings',
|
|
|
|
'shadow',
|
|
|
|
'pointer-arith',
|
|
|
|
'packed',
|
|
|
|
'no-conversion',
|
|
|
|
]
|
2008-08-26 21:02:23 +00:00
|
|
|
compileFlags = [
|
2008-10-05 18:49:55 +00:00
|
|
|
'-fno-exceptions',
|
|
|
|
'-fno-strict-aliasing',
|
|
|
|
'-msse2',
|
|
|
|
'-fvisibility=hidden',
|
|
|
|
#'-fomit-frame-pointer'
|
|
|
|
]
|
2008-09-18 10:04:03 +00:00
|
|
|
|
2008-09-19 15:03:31 +00:00
|
|
|
cppDefines = [
|
2008-10-05 18:49:55 +00:00
|
|
|
( '_FILE_OFFSET_BITS', 64),
|
|
|
|
'_LARGEFILE_SOURCE',
|
|
|
|
'GCC_HASCLASSVISIBILITY',
|
|
|
|
]
|
2008-09-19 15:03:31 +00:00
|
|
|
|
|
|
|
|
2008-08-26 21:02:23 +00:00
|
|
|
if sys.platform == 'darwin':
|
2008-10-05 18:49:55 +00:00
|
|
|
compileFlags += [ '-I/opt/local/include' ]
|
2008-07-12 17:40:22 +00:00
|
|
|
|
2008-08-26 21:02:23 +00:00
|
|
|
include_paths = [
|
2008-10-05 18:49:55 +00:00
|
|
|
'../../../Core/Common/Src',
|
|
|
|
'../../../Core/DiscIO/Src',
|
|
|
|
'../../../PluginSpecs',
|
|
|
|
'../../../',
|
|
|
|
'../../../Core/Core/Src',
|
|
|
|
'../../../Core/DebuggerWX/Src',
|
|
|
|
'../../../../Externals/Bochs_disasm',
|
|
|
|
'../../../../Externals/LZO',
|
|
|
|
'../../../Core/VideoCommon/Src',
|
|
|
|
]
|
2008-07-12 17:40:22 +00:00
|
|
|
|
2008-08-20 11:01:29 +00:00
|
|
|
dirs = [
|
2008-10-05 18:49:55 +00:00
|
|
|
'Source/Core/Common/Src',
|
|
|
|
'Externals/Bochs_disasm',
|
|
|
|
'Externals/LZO',
|
|
|
|
'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',
|
|
|
|
'Source/Plugins/Plugin_Wiimote_Test/Src',
|
|
|
|
'Source/Core/DolphinWX/Src',
|
|
|
|
]
|
|
|
|
|
2008-08-12 23:17:29 +00:00
|
|
|
builders = {}
|
2008-08-26 21:02:23 +00:00
|
|
|
if sys.platform == 'darwin':
|
2008-10-05 18:49:55 +00: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 09:44:44 +00:00
|
|
|
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
|
2008-09-21 15:55:27 +00:00
|
|
|
vars = Variables('args.cache')
|
2008-09-19 15:03:31 +00:00
|
|
|
vars.AddVariables(
|
2008-10-05 18:49:55 +00:00
|
|
|
BoolVariable('verbose', 'Set for compilation line', False),
|
|
|
|
BoolVariable('debug', 'Set for debug build', False),
|
|
|
|
BoolVariable('lint', 'Set for lint build (extra warnings)', False),
|
|
|
|
BoolVariable('nowx', 'Set For Building with no WX libs (WIP)', False),
|
2008-10-20 17:32:15 +00:00
|
|
|
BoolVariable('osx64', 'Set For Building for osx in 64 bits (WIP)', False),
|
2008-10-05 18:49:55 +00:00
|
|
|
EnumVariable('flavor', 'Choose a build flavor', 'release',
|
|
|
|
allowed_values = ('release', 'devel', 'debug'),
|
|
|
|
ignorecase = 2
|
|
|
|
)
|
|
|
|
)
|
2008-09-19 15:03:31 +00:00
|
|
|
|
2008-08-26 21:02:23 +00:00
|
|
|
env = Environment(
|
2008-10-05 18:49:55 +00:00
|
|
|
CC = 'gcc',
|
|
|
|
CXX = 'g++',
|
|
|
|
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 17:40:22 +00:00
|
|
|
|
2008-09-21 19:54:29 +00:00
|
|
|
# save the given command line options
|
2008-09-21 15:55:27 +00:00
|
|
|
vars.Save('args.cache', env)
|
|
|
|
|
2008-09-19 15:03:31 +00:00
|
|
|
# verbose compile
|
2008-09-20 22:06:22 +00:00
|
|
|
if not env['verbose']:
|
2008-10-05 18:49:55 +00: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 19:54:29 +00:00
|
|
|
|
2008-10-20 17:32:15 +00:00
|
|
|
|
2008-09-20 22:06:22 +00:00
|
|
|
# build falvuor
|
2008-09-23 00:24:28 +00:00
|
|
|
flavour = ARGUMENTS.get('flavor')
|
2008-09-20 22:06:22 +00:00
|
|
|
if (flavour == 'debug'):
|
2008-10-05 18:49:55 +00:00
|
|
|
compileFlags.append('-g')
|
|
|
|
cppDefines.append('LOGGING')
|
2008-09-24 17:39:15 +00:00
|
|
|
elif (flavour == 'devel'):
|
2008-10-05 18:49:55 +00:00
|
|
|
compileFlags.append('-g')
|
2008-09-20 22:06:22 +00:00
|
|
|
else:
|
2008-10-05 18:49:55 +00:00
|
|
|
compileFlags.append('-O3')
|
2008-09-20 22:06:22 +00:00
|
|
|
|
|
|
|
# more warnings
|
|
|
|
if env['lint']:
|
2008-10-05 18:49:55 +00:00
|
|
|
warnings.append('error')
|
|
|
|
warnings.append('unreachable-code')
|
|
|
|
warnings.append('float-equal')
|
2008-09-20 22:06:22 +00: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 13:13:20 +00:00
|
|
|
|
|
|
|
# Configuration tests section
|
2008-09-24 17:39:15 +00:00
|
|
|
tests = {'CheckWXConfig' : wxconfig.CheckWXConfig,
|
|
|
|
'CheckPKGConfig' : utils.CheckPKGConfig,
|
|
|
|
'CheckPKG' : utils.CheckPKG,
|
|
|
|
'CheckSDL' : utils.CheckSDL}
|
2008-09-23 00:24:28 +00:00
|
|
|
|
2008-09-21 13:13:20 +00:00
|
|
|
conf = env.Configure(custom_tests = tests)
|
|
|
|
|
2008-09-24 17:39:15 +00:00
|
|
|
if not conf.CheckPKGConfig('0.15.0'):
|
2008-10-05 18:49:55 +00:00
|
|
|
Exit(1)
|
2008-09-24 17:39:15 +00:00
|
|
|
|
2008-10-20 17:32:15 +00:00
|
|
|
if not env['osx64']:
|
|
|
|
if not conf.CheckSDL('1.0.0'):
|
|
|
|
Exit(1)
|
2008-09-24 17:39:15 +00:00
|
|
|
|
2008-10-24 15:48:36 +00:00
|
|
|
if not env['osx64']:
|
|
|
|
if not conf.CheckPKG('ao'):
|
|
|
|
Exit(1)
|
2008-09-24 17:39:15 +00:00
|
|
|
|
2008-09-20 22:06:22 +00:00
|
|
|
# handling wx flags CCFLAGS should be created before
|
|
|
|
if not env['nowx']:
|
2008-10-20 17:32:15 +00:00
|
|
|
if not env['osx64']:
|
|
|
|
if not conf.CheckWXConfig(
|
|
|
|
'2.8', ['gl', 'adv', 'core', 'base'], env['debug']
|
|
|
|
):
|
|
|
|
print 'gui build requires wxwidgets >= 2.8'
|
|
|
|
Exit(1)
|
2008-10-04 07:57:28 +00:00
|
|
|
if not env['nowx']:
|
2008-10-20 17:32:15 +00:00
|
|
|
if not env['osx64']:
|
|
|
|
dirs += ['Source/Core/DebuggerWX/Src',]
|
2008-09-21 13:13:20 +00:00
|
|
|
|
2008-09-23 00:07:51 +00:00
|
|
|
# After all configuration tests are done
|
|
|
|
env = conf.Finish()
|
|
|
|
|
2008-09-24 17:39:15 +00:00
|
|
|
#wx windows flags
|
|
|
|
if not env['nowx']:
|
2008-10-20 17:32:15 +00:00
|
|
|
if not env['osx64']:
|
|
|
|
wxconfig.ParseWXConfig(env)
|
|
|
|
compileFlags += ['-DUSE_WX',]
|
|
|
|
|
|
|
|
#osx 64bit need this
|
2008-10-24 15:48:36 +00:00
|
|
|
if env['osx64']:
|
|
|
|
compileFlags += ['-arch' , 'x86_64', '-DOSX64']
|
2008-09-24 17:39:15 +00:00
|
|
|
|
2008-09-20 22:06:22 +00:00
|
|
|
#get sdl stuff
|
2008-10-20 17:32:15 +00:00
|
|
|
if not env['osx64']:
|
|
|
|
env.ParseConfig('sdl-config --cflags --libs')
|
2008-09-20 22:06:22 +00:00
|
|
|
|
|
|
|
# lib ao (needed for sound plugins)
|
2008-10-24 15:48:36 +00:00
|
|
|
if not env['osx64']:
|
|
|
|
env.ParseConfig('pkg-config --cflags --libs ao')
|
2008-09-19 15:03:31 +00:00
|
|
|
|
2008-09-21 19:54:29 +00:00
|
|
|
# add methods from utils to env
|
|
|
|
env.AddMethod(utils.filterWarnings)
|
|
|
|
|
2008-07-12 17:40:22 +00:00
|
|
|
Export('env')
|
|
|
|
|
2008-10-05 18:49:55 +00:00
|
|
|
utils.GenerateRevFile(env['flavor'], "Source/Core/Common/Src/svnrev_template.h",
|
|
|
|
"Source/Core/Common/Src/svnrev.h")
|
2008-09-20 22:06:22 +00:00
|
|
|
# print a nice progress indication when not compiling
|
2008-09-23 00:24:28 +00:00
|
|
|
Progress(['-\r', '\\\r', '|\r', '/\r'], interval = 5)
|
2008-09-19 15:03:31 +00:00
|
|
|
|
|
|
|
# die on unknown variables
|
|
|
|
unknown = vars.UnknownVariables()
|
|
|
|
if unknown:
|
2008-10-05 18:49:55 +00:00
|
|
|
print "Unknown variables:", unknown.keys()
|
|
|
|
Exit(1)
|
2008-09-19 15:03:31 +00:00
|
|
|
|
2008-09-20 22:06:22 +00:00
|
|
|
# generate help
|
2008-09-19 15:03:31 +00:00
|
|
|
Help(vars.GenerateHelpText(env))
|
|
|
|
|
2008-08-26 21:02:23 +00:00
|
|
|
for subdir in dirs:
|
2008-10-05 18:49:55 +00:00
|
|
|
SConscript(
|
|
|
|
subdir + os.sep + 'SConscript',
|
|
|
|
duplicate = 0
|
|
|
|
)
|