Integrate the standalone memcard manager into the main build.

Use 10.5 SDK header files in an attempt to keep us honest and
10.5 compatible. I'd do the same with system libraries, but
the linker gives strange errors when I try that. We also link
against third party libraries from Macports that haven't had
any magic 10.5 compat dust sprinkled over them, so maybe it
isn't very important anyway.

Move the OS X variable section in SConstruct upwards a bit to
have the settings apply to more of the config tests. SCons'
ParseConfig causes problems for the -arch tuples, though, so
the SDL check still isn't quite as comprehensive as it should
be.

Put the XCode project out of its misery.


git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@5693 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
Soren Jorvang 2010-06-14 18:07:29 +00:00
parent 857f1f4d38
commit b560d2456e
9 changed files with 59 additions and 7763 deletions

View File

@ -2,22 +2,24 @@
Import('env')
import sys
if not env['HAVE_WX']:
Return()
wxenv = env.Clone()
files = [
]
libs = [
'memcard',
'common',
]
if wxenv['HAVE_WX']:
files += [
'Externals/MemcardManager/src/mcmMain.cpp',
'Externals/MemcardManager/src/MCMdebug.cpp',
'Source/Core/DolphinWX/Src/MemcardManager.cpp',
'Source/Core/DolphinWX/Src/MemoryCards/GCMemcard.cpp',
'Source/Core/DolphinWX/Src/WxUtils.cpp',
'src/mcmMain.cpp',
'src/MCMdebug.cpp',
]
LIBS = libs

View File

@ -1,248 +0,0 @@
# -*- python -*-
import os
import sys
import platform
# Home made tests
sys.path.append('SconsTests')
import wxconfig
import utils
# Some features need at least SCons 1.2
EnsureSConsVersion(1, 2)
warnings = [
'all',
'write-strings',
'shadow',
'pointer-arith',
'packed',
'no-conversion',
]
compileFlags = [
'-fno-exceptions',
'-fno-strict-aliasing',
'-msse2',
]
if sys.platform != 'win32':
compileFlags += [ '-fvisibility=hidden' ]
cppDefines = [
( '_FILE_OFFSET_BITS', 64),
'_LARGEFILE_SOURCE',
'GCC_HASCLASSVISIBILITY',
]
basedir = os.getcwd()+ '/'
include_paths = [
basedir + 'Source/Core/Common/Src',
basedir + 'Source/PluginSpecs',
basedir + 'Source/Core/DolphinWX/Src',
basedir + 'Externals/MemcardManager/src',
]
dirs = [
basedir + 'Source/Core/Common/Src',
basedir + '.'
]
builders = {}
if sys.platform == 'darwin':
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))
builders['Plist'] = Builder(action = createPlist)
# Handle command line options
vars = Variables('args.cache')
vars.AddVariables(
BoolVariable('verbose', 'Set for compilation line', False),
BoolVariable('lint', 'Set for lint build (extra warnings)', False),
EnumVariable('flavor', 'Choose a build flavor', 'release',
allowed_values = ('release','devel','debug','fastlog','prof'),
ignorecase = 2
),
PathVariable('wxconfig', 'Path to the wxconfig', None),
('CC', 'The c compiler', 'gcc'),
('CXX', 'The c++ compiler', 'g++'),
)
if sys.platform == 'win32':
env = Environment(
CPPPATH = include_paths,
RPATH = [],
LIBS = [],
LIBPATH = [],
tools = [ 'mingw' ],
variables = vars,
ENV = os.environ,
BUILDERS = builders,
)
else:
env = Environment(
CPPPATH = include_paths,
RPATH = [],
LIBS = [],
LIBPATH = [],
variables = vars,
ENV = {
'PATH' : os.environ['PATH'],
'HOME' : os.environ['HOME']
},
BUILDERS = builders,
)
# Save the given command line options
vars.Save('args.cache', env)
# Verbose compile
if not env['verbose']:
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"
# Build flavour
flavour = env['flavor']
if (flavour == 'debug'):
compileFlags.append('-ggdb')
cppDefines.append('_DEBUG') #enables LOGGING
# FIXME: this disable wx debugging how do we make it work?
cppDefines.append('NDEBUG')
elif (flavour == 'devel'):
compileFlags.append('-ggdb')
elif (flavour == 'fastlog'):
compileFlags.append('-O3')
cppDefines.append('DEBUGFAST')
elif (flavour == 'prof'):
compileFlags.append('-O3')
compileFlags.append('-ggdb')
elif (flavour == 'release'):
compileFlags.append('-O3')
# More warnings
if env['lint']:
warnings.append('error')
# Should check for the availability of these (in GCC 4.3 or newer)
if sys.platform != 'darwin':
warnings.append('no-array-bounds')
warnings.append('no-unused-result')
# wxWidgets causes too many warnings with these
#warnings.append('unreachable-code')
#warnings.append('float-equal')
# Add the warnings to the compile flags
compileFlags += [ '-W' + warning for warning in warnings ]
env['CCFLAGS'] = compileFlags
if sys.platform == 'win32':
env['CXXFLAGS'] = compileFlags
else:
env['CXXFLAGS'] = compileFlags + [ '-fvisibility-inlines-hidden' ]
env['CPPDEFINES'] = cppDefines
# Configuration tests section
tests = {'CheckWXConfig' : wxconfig.CheckWXConfig,
'CheckPKGConfig' : utils.CheckPKGConfig,
'CheckPKG' : utils.CheckPKG,
}
# Object files
env['build_dir'] = os.path.join(basedir, 'Build',
platform.system() + '-' + 'MemCardManager' + os.sep)
conf = env.Configure(custom_tests = tests,
config_h="Source/Core/Common/Src/Config.h")
if not conf.CheckPKGConfig('0.15.0'):
print "Can't find pkg-config, some tests will fail"
# OS X specifics
if sys.platform == 'darwin':
env['HAVE_X11'] = 0
compileFlags.append('-mmacosx-version-min=10.5')
conf.Define('MAP_32BIT', 0)
else:
env['HAVE_X11'] = conf.CheckPKG('x11')
# Handling wx flags CCFLAGS should be created before
wxmods = ['adv', 'core', 'base']
env['USE_WX'] = 0
env['HAVE_WX'] = conf.CheckWXConfig('2.8', wxmods, 0)
conf.Define('HAVE_WX', env['HAVE_WX'])
conf.Define('USE_WX', env['USE_WX'])
conf.Define('HAVE_X11', env['HAVE_X11'])
# Profile
env['USE_OPROFILE'] = 0
if (flavour == 'prof'):
proflibs = [ '/usr/lib/oprofile', '/usr/local/lib/oprofile' ]
env['LIBPATH'].append(proflibs)
env['RPATH'].append(proflibs)
if conf.CheckPKG('opagent'):
env['USE_OPROFILE'] = 1
else:
print "Can't build prof without oprofile, disabling"
conf.Define('USE_OPROFILE', env['USE_OPROFILE'])
# After all configuration tests are done
conf.Finish()
if env['HAVE_WX']:
wxconfig.ParseWXConfig(env)
else:
print "WX not found or disabled, not building GUI"
# Install paths
extra=''
if flavour == 'debug':
extra = '-debug'
elif flavour == 'prof':
extra = '-prof'
# TODO: support global install
env['prefix'] = os.path.join(env['base_dir'] + 'Binary',
'MemCardManager' + extra + os.sep)
# TODO: add bin
env['binary_dir'] = env['prefix']
# Static libs goes here
env['local_libs'] = env['build_dir'] + os.sep + 'libs' + os.sep
env['LIBPATH'].append(env['local_libs'])
# Print a nice progress indication when not compiling
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))
Export('env')
for subdir in dirs:
SConscript(
subdir + os.sep + 'SConscript',
variant_dir = env[ 'build_dir' ] + subdir + os.sep,
duplicate=0
)

View File

@ -1,10 +0,0 @@
#!/bin/sh
# lazy way to build linux memcard manager
mv ../../SConstruct ../../dolphin_SConstruct
cp SConstruct ../../SConstruct
cp SConscript ../../SConscript
cd ../../
scons
rm SConstruct
rm SConscript
mv dolphin_SConstruct SConstruct

View File

@ -1,10 +0,0 @@
#!/bin/sh
# lazy way to clean linux memcard manager
mv ../../SConstruct ../../dolphin_SConstruct
cp SConstruct ../../SConstruct
cp SConscript ../../SConscript
cd ../../
scons -c
rm SConstruct
rm SConscript
mv dolphin_SConstruct SConstruct

View File

@ -34,7 +34,7 @@ cppDefines = [
'GCC_HASCLASSVISIBILITY',
]
basedir = os.getcwd()+ '/'
basedir = os.getcwd() + '/'
include_paths = [
basedir + 'Source/Core/Common/Src',
@ -50,12 +50,14 @@ include_paths = [
basedir + 'Source/Core/InputUICommon/Src',
basedir + 'Source/Core/AudioCommon/Src',
basedir + 'Source/Core/DebuggerUICommon/Src',
basedir + 'Source/Core/DolphinWX/Src',
basedir + 'Source/Core/DSPCore/Src',
]
dirs = [
'Externals/Bochs_disasm',
'Externals/Lua',
'Externals/MemcardManager',
'Externals/WiiUseSrc/Src',
'Source/Core/Common/Src',
'Source/Core/Core/Src',
@ -126,31 +128,24 @@ vars.AddVariables(
('CXX', 'The c++ compiler', 'g++'),
)
env = Environment(
CPPPATH = include_paths,
RPATH = [],
LIBS = [],
LIBPATH = [],
BUILDERS = builders,
variables = vars,
)
if sys.platform == 'win32':
env = Environment(
CPPPATH = include_paths,
RPATH = [],
LIBS = [],
LIBPATH = [],
tools = [ 'mingw' ],
variables = vars,
ENV = os.environ,
BUILDERS = builders,
)
env['tools'] = ['mingw']
env['ENV'] = os.environ
else:
env = Environment(
CPPPATH = include_paths,
RPATH = [],
LIBS = [],
LIBPATH = [],
variables = vars,
ENV = {
'PATH' : os.environ['PATH'],
'HOME' : os.environ['HOME'],
'PKG_CONFIG_PATH' : os.environ.get('PKG_CONFIG_PATH')
},
BUILDERS = builders,
)
env['ENV'] = {
'PATH' : os.environ['PATH'],
'HOME' : os.environ['HOME'],
'PKG_CONFIG_PATH' : os.environ.get('PKG_CONFIG_PATH')
}
# Save the given command line options
vars.Save('args.cache', env)
@ -215,7 +210,6 @@ if env['pgo']=='use':
compileFlags.append('-fprofile-use')
env['LINKFLAGS']='-fprofile-use'
# Configuration tests section
tests = {'CheckWXConfig' : wxconfig.CheckWXConfig,
'CheckPKGConfig' : utils.CheckPKGConfig,
@ -277,6 +271,21 @@ if not conf.CheckSDL('1.0.0'):
print "SDL is required"
Exit(1)
# OS X specifics
if sys.platform == 'darwin':
compileFlags += ['-mmacosx-version-min=10.5']
#compileFlags += ['-isysroot', '/Developer/SDKs/MacOSX10.5.sdk']
conf.Define('MAP_32BIT', 0)
env['CC'] = "gcc-4.2"
env['CFLAGS'] = ['-x', 'objective-c']
env['CXX'] = "g++-4.2"
env['CXXFLAGS'] = ['-x', 'objective-c++']
env['CCFLAGS'] += ['-arch' , 'x86_64' , '-arch' , 'i386']
env['LINKFLAGS'] += ['-arch', 'x86_64' , '-arch' , 'i386']
env['FRAMEWORKS'] += ['CoreFoundation', 'CoreServices']
env['FRAMEWORKS'] += ['IOBluetooth', 'IOKit', 'OpenGL']
env['FRAMEWORKS'] += ['AudioUnit', 'CoreAudio']
# Bluetooth for wiimote support
env['HAVE_BLUEZ'] = conf.CheckPKG('bluez')
@ -332,26 +341,6 @@ if not env['SHARED_SFML']:
env['CPPPATH'] += [ basedir + 'Externals/SFML/include' ]
dirs += ['Externals/SFML/src']
# OS X specifics
if sys.platform == 'darwin':
compileFlags.append('-mmacosx-version-min=10.5')
env['HAVE_XRANDR'] = 0
env['HAVE_X11'] = 0
env['CC'] = "gcc-4.2"
env['CFLAGS'] = ['-x', 'objective-c']
env['CXX'] = "g++-4.2"
env['CXXFLAGS'] = ['-x', 'objective-c++']
env['CCFLAGS'] += ['-arch' , 'x86_64' , '-arch' , 'i386']
env['LINKFLAGS'] += ['-arch' , 'x86_64' , '-arch' , 'i386']
conf.Define('MAP_32BIT', 0)
env['FRAMEWORKS'] += ['CoreFoundation', 'CoreServices']
env['FRAMEWORKS'] += ['IOBluetooth', 'IOKit', 'OpenGL']
env['FRAMEWORKS'] += ['AudioUnit', 'CoreAudio']
else:
env['HAVE_X11'] = conf.CheckPKG('x11')
env['HAVE_XRANDR'] = env['HAVE_X11'] and conf.CheckPKG('xrandr')
env['LINKFLAGS'] += ['-pthread']
wxmods = ['aui', 'adv', 'core', 'base']
if env['wxgl'] or sys.platform == 'win32' or sys.platform == 'darwin':
env['USE_WX'] = 1
@ -391,7 +380,12 @@ if not sys.platform == 'win32':
print "Must have GLEW to build"
Exit(1)
env['HAVE_X11'] = 0
env['HAVE_XRANDR'] = 0
if not sys.platform == 'win32' and not sys.platform == 'darwin':
env['HAVE_X11'] = conf.CheckPKG('x11')
env['HAVE_XRANDR'] = env['HAVE_X11'] and conf.CheckPKG('xrandr')
env['LINKFLAGS'] += ['-pthread']
if not conf.CheckPKG('GL'):
print "Must have OpenGL to build"
Exit(1)

View File

@ -32,7 +32,7 @@ def CheckFink(context):
prefix = prog.rsplit(os.sep, 2)[0]
context.env.Append(LIBPATH = [prefix + os.sep +'lib'],
CPPPATH = [prefix + os.sep +'include'])
context.Message( 'Adding fink lib and include path')
context.Message( 'Adding fink lib and include path ')
else:
ret = 0
@ -47,7 +47,7 @@ def CheckMacports(context):
prefix = prog.rsplit(os.sep, 2)[0]
context.env.Append(LIBPATH = [prefix + os.sep + 'lib'],
CPPPATH = [prefix + os.sep + 'include'])
context.Message( 'Adding port lib and include path')
context.Message( 'Adding port lib and include path ')
else:
ret = 0

View File

@ -16,6 +16,13 @@ libs = [
]
if wxenv['HAVE_WX']:
memcardfiles = [
'MemcardManager.cpp',
'MemoryCards/GCMemcard.cpp',
'WxUtils.cpp',
]
files += memcardfiles
files += [
'AboutDolphin.cpp',
'ARCodeAddEdit.cpp',
@ -30,12 +37,8 @@ if wxenv['HAVE_WX']:
'HotkeyDlg.cpp',
'ISOFile.cpp',
'ISOProperties.cpp',
'MemcardManager.cpp',
'MemoryCards/GCMemcard.cpp',
'PatchAddEdit.cpp',
'CheatsWindow.cpp',
'stdafx.cpp',
'WxUtils.cpp',
'MemoryCards/WiiSaveCrypted.cpp',
'NetPlay.cpp',
'NetPlayClient.cpp',
@ -53,6 +56,9 @@ else:
'cmdline.c',
]
if sys.platform == 'win32':
files += [ "stdafx.cpp" ]
if sys.platform == 'darwin':
files += [ 'cocoaApp.m', ]
@ -86,5 +92,6 @@ if wxenv['HAVE_X11']:
if wxenv['HAVE_WX']:
wxenv.Program(exeGUI, files + [ 'Main.cpp' ])
wxenv.StaticLibrary(env['local_libs'] + 'memcard', memcardfiles)
else:
wxenv.Program(exeNoGUI, files + [ 'MainNoGUI.cpp' ])

File diff suppressed because it is too large Load Diff