From 6813a75ab24d9795469b267db1841c7e69a69300 Mon Sep 17 00:00:00 2001 From: Soren Jorvang Date: Tue, 20 Jul 2010 02:45:31 +0000 Subject: [PATCH] Some pathnames are used both by SCons and cpp which can be a bit tricky. Should revisit and make the distinction more explicit. Put the Data and Sys directories under Resources in the OS X app bundle. Construct config.h (now lower-case to avoid confusion with other Config.h instances in the tree) in the root. One tiny step towards a read-only and cross-buildable source tree. Some minor bits of non-Linux Unix portability. git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@5921 8ced0084-cf51-0410-be5f-012b33b47a6e --- Externals/MemcardManager/SConscript | 2 +- SConstruct | 48 ++++++++----------- Source/Core/Common/Src/Common.h | 2 +- Source/Core/Common/Src/CommonPaths.h | 17 ++++--- Source/Core/Core/Src/ActionReplay.cpp | 5 -- Source/Core/DolphinWX/Src/SConscript | 10 ++-- Source/Core/InputCommon/Src/X11InputBase.h | 10 ++-- Source/DSPTool/Src/SConscript | 2 +- Source/Plugins/Plugin_DSP_HLE/Src/SConscript | 2 +- Source/Plugins/Plugin_DSP_LLE/Src/SConscript | 2 +- Source/Plugins/Plugin_VideoOGL/Src/SConscript | 2 +- .../Plugin_VideoSoftware/Src/SConscript | 2 +- Source/Plugins/Plugin_Wiimote/Src/SConscript | 2 +- .../Plugins/Plugin_WiimoteNew/Src/SConscript | 2 +- Source/UnitTests/SConscript | 2 +- 15 files changed, 50 insertions(+), 60 deletions(-) diff --git a/Externals/MemcardManager/SConscript b/Externals/MemcardManager/SConscript index 394437b8a9..afa8309ade 100644 --- a/Externals/MemcardManager/SConscript +++ b/Externals/MemcardManager/SConscript @@ -17,4 +17,4 @@ libs = [ exeGUI = env['binary_dir'] + 'MemcardManager' -env.Program(exeGUI, files, LIBS = env['LIBS'] + libs) +env.Program('#' + exeGUI, files, LIBS = env['LIBS'] + libs) diff --git a/SConstruct b/SConstruct index 76c1c932e2..92dec97abb 100644 --- a/SConstruct +++ b/SConstruct @@ -35,6 +35,7 @@ cppDefines = [ ] include_paths = [ + '#', '#Source/Core/Common/Src', '#Source/Core/DiscIO/Src', '#Source/PluginSpecs', @@ -132,25 +133,15 @@ if not sys.platform == 'win32' and not sys.platform == 'darwin': ) env = Environment( - CPPPATH = include_paths, - RPATH = [], - LIBS = [], - LIBPATH = [], BUILDERS = builders, + CPPPATH = include_paths, + ENV = os.environ, + LIBPATH = [], + LIBS = [], + RPATH = [], variables = vars, ) -if sys.platform == 'win32': - env['tools'] = ['mingw'] - env['ENV'] = os.environ -else: - env['CXXFLAGS'] = ['-fvisibility-inlines-hidden'] - 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) @@ -200,6 +191,7 @@ if env['lint']: compileFlags += [ ('-W' + warning) for warning in warnings ] env['CCFLAGS'] = compileFlags +env['CXXFLAGS'] = ['-fvisibility-inlines-hidden'] env['CPPDEFINES'] = cppDefines # Configuration tests section @@ -231,14 +223,14 @@ if sys.platform == 'linux2' and env['install'] == 'global': env['plugin_dir'] = env['prefix'] + 'lib/dolphin-emu/' env['data_dir'] = env['prefix'] + "share/dolphin-emu/" else: - env['prefix'] = os.path.join('#Binary', + env['prefix'] = os.path.join('Binary', platform.system() + '-' + platform.machine() + extra + os.sep) env['binary_dir'] = env['prefix'] env['plugin_dir'] = env['prefix'] + 'plugins/' env['data_dir'] = env['prefix'] if sys.platform == 'darwin': env['plugin_dir'] = env['prefix'] + 'Dolphin.app/Contents/PlugIns/' - env['data_dir'] = env['prefix'] + 'Dolphin.app/Contents/' + env['data_dir'] = env['prefix'] + 'Dolphin.app/Contents/Resources' shared = {} shared['glew'] = shared['lzo'] = shared['sdl'] = \ @@ -290,9 +282,11 @@ if sys.platform == 'darwin': env['LINKFLAGS'] += ['-FExternals/Cg'] shared['zlib'] = 1 -if not sys.platform == 'win32' and not sys.platform == 'darwin': - conf = env.Configure(custom_tests = tests, - config_h="Source/Core/Common/Src/Config.h") +elif sys.platform == 'win32': + env['tools'] = ['mingw'] + +else: + conf = env.Configure(custom_tests = tests, config_h="#config.h") if not conf.CheckPKGConfig('0.15.0'): print "Can't find pkg-config, some tests will fail" @@ -340,7 +334,7 @@ if not sys.platform == 'win32' and not sys.platform == 'darwin': env['HAVE_OPENAL'] = conf.CheckPKG('openal') conf.Define('HAVE_OPENAL', env['HAVE_OPENAL']) - env['HAVE_PORTAUDIO'] = conf.CheckPortaudio(1890) + env['HAVE_PORTAUDIO'] = conf.CheckPortaudio(1890) conf.Define('HAVE_PORTAUDIO', env['HAVE_PORTAUDIO']) env['HAVE_PULSEAUDIO'] = conf.CheckPKG('libpulse-simple') @@ -437,8 +431,8 @@ Progress(['-\r', '\\\r', '|\r', '/\r'], interval=5) # package will later install it to the prefix as it was defined before this. if env.has_key('destdir'): env['prefix'] = env['destdir'] + env['prefix'] - env['plugin_dir'] = env['destdir'] + env['plugin_dir'] env['binary_dir'] = env['destdir'] + env['binary_dir'] + env['plugin_dir'] = env['destdir'] + env['plugin_dir'] env['data_dir'] = env['destdir'] + env['data_dir'] # Die on unknown variables @@ -455,17 +449,17 @@ Export('env') for subdir in dirs: SConscript( subdir + os.sep + 'SConscript', - variant_dir = env[ 'build_dir' ] + subdir + os.sep, + variant_dir = env['build_dir'] + subdir + os.sep, duplicate=0 ) # Data install if sys.platform == 'darwin': - env.Install(env['data_dir'], 'Data/Sys') - env.Install(env['data_dir'], 'Data/User') + env.Install('#' + env['data_dir'], 'Data/Sys') + env.Install('#' + env['data_dir'], 'Data/User') else: - env.InstallAs(env['data_dir'] + 'sys', 'Data/Sys') - env.InstallAs(env['data_dir'] + 'user', 'Data/User') + env.InstallAs('#' + env['data_dir'] + 'sys', 'Data/Sys') + env.InstallAs('#' + env['data_dir'] + 'user', 'Data/User') env.Alias('install', env['prefix']) diff --git a/Source/Core/Common/Src/Common.h b/Source/Core/Common/Src/Common.h index 03e9f50aed..33bf755235 100644 --- a/Source/Core/Common/Src/Common.h +++ b/Source/Core/Common/Src/Common.h @@ -112,7 +112,7 @@ extern const char *netplay_dolphin_ver; #endif // end DEBUG/FAST #else -#include "Config.h" // SCons autoconfiguration defines +#include "config.h" // SCons autoconfiguration defines #endif #if defined __linux__ && HAVE_BLUEZ diff --git a/Source/Core/Common/Src/CommonPaths.h b/Source/Core/Common/Src/CommonPaths.h index 5adff7038e..fd3d1e0d3c 100644 --- a/Source/Core/Common/Src/CommonPaths.h +++ b/Source/Core/Common/Src/CommonPaths.h @@ -18,9 +18,8 @@ #ifndef _COMMON_PATHS_H_ #define _COMMON_PATHS_H_ -#ifdef __linux__ -#include "Config.h" -#endif +// Make sure we pick up USER_DIR if set in config.h +#include "Common.h" // Library suffix/prefix #ifdef _WIN32 @@ -29,7 +28,7 @@ #elif defined __APPLE__ #define PLUGIN_PREFIX "lib" #define PLUGIN_SUFFIX ".dylib" -#elif defined __linux__ +#else #define PLUGIN_PREFIX "lib" #define PLUGIN_SUFFIX ".so" #endif @@ -43,7 +42,7 @@ #define PLUGINS_DIR "Plugins" #elif defined __APPLE__ #define PLUGINS_DIR "Contents/PlugIns" -#elif defined __linux__ +#else #ifdef LIBS_DIR #define PLUGINS_DIR LIBS_DIR "dolphin-emu" #else @@ -60,9 +59,9 @@ // On OS X, USERDATA_DIR exists within the .app, but *always* reference // the copy in Application Support instead! (Copied on first run) // You can use the File::GetUserPath() util for this - #define USERDATA_DIR "Contents/User" + #define USERDATA_DIR "Contents/Resources/User" #define DOLPHIN_DATA_DIR "Library/Application Support/Dolphin" -#elif defined __linux__ +#else #define USERDATA_DIR "user" #ifdef USER_DIR #define DOLPHIN_DATA_DIR USER_DIR @@ -75,8 +74,8 @@ #ifdef _WIN32 #define SYSDATA_DIR "Sys" #elif defined __APPLE__ - #define SYSDATA_DIR "Contents/Sys" -#elif defined __linux__ + #define SYSDATA_DIR "Contents/Resources/Sys" +#else #ifdef DATA_DIR #define SYSDATA_DIR DATA_DIR "sys" #define SHARED_USER_DIR DATA_DIR USERDATA_DIR DIR_SEP diff --git a/Source/Core/Core/Src/ActionReplay.cpp b/Source/Core/Core/Src/ActionReplay.cpp index 664c19a961..4ab9ee62fc 100644 --- a/Source/Core/Core/Src/ActionReplay.cpp +++ b/Source/Core/Core/Src/ActionReplay.cpp @@ -422,11 +422,6 @@ bool RunCode(const ARCode &arcode) switch (addr.type) { - case 0x08: - LogInfo("Bad Normal Code type: 0x08"); - return false; - break; - case 0x00: if (false == NormalCode(addr, data)) return false; diff --git a/Source/Core/DolphinWX/Src/SConscript b/Source/Core/DolphinWX/Src/SConscript index 5cafa52c17..82950fe46c 100644 --- a/Source/Core/DolphinWX/Src/SConscript +++ b/Source/Core/DolphinWX/Src/SConscript @@ -58,15 +58,15 @@ elif sys.platform == 'darwin' and not env['HAVE_WX']: elif sys.platform == 'darwin' and env['HAVE_WX']: exeGUI = env['binary_dir'] + 'Dolphin.app/Contents/MacOS/Dolphin' - env.Install(env['binary_dir'] + 'Dolphin.app/Contents/' + + env.Install('#' + env['binary_dir'] + 'Dolphin.app/Contents/' + 'Library/Frameworks/Cg.framework', '#Externals/Cg/Cg.framework/Cg') - env.Install(env['binary_dir'] + 'Dolphin.app/Contents/Resources/', + env.Install('#' + env['binary_dir'] + 'Dolphin.app/Contents/Resources/', '#Source/Core/DolphinWX/resources/Dolphin.icns') env.Plist( - env['binary_dir'] + 'Dolphin.app/Contents/Info.plist', + '#' + env['binary_dir'] + 'Dolphin.app/Contents/Info.plist', Value(dict( CFBundleExecutable = 'Dolphin', CFBundleIconFile = 'Dolphin.icns', @@ -86,6 +86,6 @@ else: if env['HAVE_WX']: env.StaticLibrary(env['local_libs'] + 'memcard', memcardfiles) - env.Program(exeGUI, files, LIBS = env['LIBS'] + wxlibs + libs) + env.Program('#' + exeGUI, files, LIBS = env['LIBS'] + wxlibs + libs) else: - env.Program(exeNoGUI, files, LIBS = env['LIBS'] + libs) + env.Program('#' + exeNoGUI, files, LIBS = env['LIBS'] + libs) diff --git a/Source/Core/InputCommon/Src/X11InputBase.h b/Source/Core/InputCommon/Src/X11InputBase.h index 13c6717f86..7d0339d046 100644 --- a/Source/Core/InputCommon/Src/X11InputBase.h +++ b/Source/Core/InputCommon/Src/X11InputBase.h @@ -18,18 +18,20 @@ #ifndef XINPUTBASE_H #define XINPUTBASE_H +#include "Common.h" + #include #include -#include "Config.h" #if defined(HAVE_WX) && HAVE_WX #include #endif + namespace InputCommon { #if defined(HAVE_WX) && HAVE_WX -KeySym wxCharCodeWXToX(int id); -int wxKeyModWXToX(int modstate); + KeySym wxCharCodeWXToX(int id); + int wxKeyModWXToX(int modstate); #endif -void XKeyToString(unsigned int keycode, char *keyStr); + void XKeyToString(unsigned int keycode, char *keyStr); } #endif diff --git a/Source/DSPTool/Src/SConscript b/Source/DSPTool/Src/SConscript index bb128a89e0..b05391ceab 100644 --- a/Source/DSPTool/Src/SConscript +++ b/Source/DSPTool/Src/SConscript @@ -11,4 +11,4 @@ libs = [ 'common', ] -env.Program(env['binary_dir'] + 'dsptool', files, LIBS = libs) +env.Program('#' + env['binary_dir'] + 'dsptool', files, LIBS = libs) diff --git a/Source/Plugins/Plugin_DSP_HLE/Src/SConscript b/Source/Plugins/Plugin_DSP_HLE/Src/SConscript index 6d6b8c9439..223921d5c7 100644 --- a/Source/Plugins/Plugin_DSP_HLE/Src/SConscript +++ b/Source/Plugins/Plugin_DSP_HLE/Src/SConscript @@ -29,4 +29,4 @@ if env['HAVE_WX']: libs = [ 'common', 'audiocommon' ] -env.SharedLibrary(env['plugin_dir'] + name, files, LIBS = env['LIBS'] + libs) +env.SharedLibrary('#' + env['plugin_dir'] + name, files, LIBS = env['LIBS'] + libs) diff --git a/Source/Plugins/Plugin_DSP_LLE/Src/SConscript b/Source/Plugins/Plugin_DSP_LLE/Src/SConscript index b459171486..ee08ef2bdb 100644 --- a/Source/Plugins/Plugin_DSP_LLE/Src/SConscript +++ b/Source/Plugins/Plugin_DSP_LLE/Src/SConscript @@ -26,4 +26,4 @@ libs = [ 'dspcore', 'audiocommon', 'common' ] if env['HAVE_WX']: libs += [ 'debugger_ui_util' ] -env.SharedLibrary(env['plugin_dir'] + name, files, LIBS = env['LIBS'] + libs) +env.SharedLibrary('#' + env['plugin_dir'] + name, files, LIBS = env['LIBS'] + libs) diff --git a/Source/Plugins/Plugin_VideoOGL/Src/SConscript b/Source/Plugins/Plugin_VideoOGL/Src/SConscript index 1faf2d265c..bd3d8bb3bc 100644 --- a/Source/Plugins/Plugin_VideoOGL/Src/SConscript +++ b/Source/Plugins/Plugin_VideoOGL/Src/SConscript @@ -38,4 +38,4 @@ elif sys.platform == 'win32': elif not sys.platform == 'darwin' and env['HAVE_OPENCL']: libs += [ 'OpenCL' ] -env.SharedLibrary(env['plugin_dir'] + name, files, LIBS = env['LIBS'] + libs) +env.SharedLibrary('#' + env['plugin_dir'] + name, files, LIBS = env['LIBS'] + libs) diff --git a/Source/Plugins/Plugin_VideoSoftware/Src/SConscript b/Source/Plugins/Plugin_VideoSoftware/Src/SConscript index f633dfba27..0c439dc62a 100644 --- a/Source/Plugins/Plugin_VideoSoftware/Src/SConscript +++ b/Source/Plugins/Plugin_VideoSoftware/Src/SConscript @@ -40,4 +40,4 @@ if sys.platform == 'darwin' and not env['HAVE_WX']: elif sys.platform == 'win32': files += [ 'Win32.cpp' ] -env.SharedLibrary(env['plugin_dir'] + name, files, LIBS = env['LIBS'] + libs) +env.SharedLibrary('#' + env['plugin_dir'] + name, files, LIBS = env['LIBS'] + libs) diff --git a/Source/Plugins/Plugin_Wiimote/Src/SConscript b/Source/Plugins/Plugin_Wiimote/Src/SConscript index ab8754d4da..3d0b6b5fbe 100644 --- a/Source/Plugins/Plugin_Wiimote/Src/SConscript +++ b/Source/Plugins/Plugin_Wiimote/Src/SConscript @@ -33,4 +33,4 @@ if env['HAVE_WIIUSE']: libs += [ 'wiiuse' ] files += [ 'wiimote_real.cpp' ] -env.SharedLibrary(env['plugin_dir'] + name, files, LIBS = env['LIBS'] + libs) +env.SharedLibrary('#' + env['plugin_dir'] + name, files, LIBS = env['LIBS'] + libs) diff --git a/Source/Plugins/Plugin_WiimoteNew/Src/SConscript b/Source/Plugins/Plugin_WiimoteNew/Src/SConscript index 5df8597e90..f4ac1bcfed 100644 --- a/Source/Plugins/Plugin_WiimoteNew/Src/SConscript +++ b/Source/Plugins/Plugin_WiimoteNew/Src/SConscript @@ -31,4 +31,4 @@ if env['HAVE_WIIUSE']: files += [ 'WiimoteReal/WiimoteReal.cpp' ] libs += [ 'wiiuse' ] -env.SharedLibrary(env['plugin_dir'] + name, files, LIBS = env['LIBS'] + libs) +env.SharedLibrary('#' + env['plugin_dir'] + name, files, LIBS = env['LIBS'] + libs) diff --git a/Source/UnitTests/SConscript b/Source/UnitTests/SConscript index 4ab5982668..aa0123f775 100644 --- a/Source/UnitTests/SConscript +++ b/Source/UnitTests/SConscript @@ -12,4 +12,4 @@ libs = [ 'dspcore', 'common', ] -env.Program(env['binary_dir'] + 'tester', files, LIBS = libs) +env.Program('#' + env['binary_dir'] + 'tester', files, LIBS = libs)