In the SCons build, skip the generation of static libraries

and just operate on lists of object files instead.

This helps with LTO since LLVM/clang LTO is completely broken
by static libraries. It also helps identify symbol clashes
between components like the former plugins.

Many linkers also expect static libraries to form a strict DAG
which turns out be a difficult rule to uphold in practice,
especially since some of our platforms aren't picky about this.

LTO builds currently appears to crash at runtime because of
the static wx libs.


git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@7056 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
Soren Jorvang 2011-02-04 00:46:56 +00:00
parent e2b3716760
commit 6d70c14d12
28 changed files with 118 additions and 105 deletions

View File

@ -14,5 +14,7 @@ files = [
if sys.platform == 'win32':
files += [ "stdafx.cpp" ]
env.StaticLibrary(env['local_libs'] + "bdisasm", files)
env['CPPPATH'] += ['#Externals/Bochs_disasm']
#env['LIBS'] += env.StaticObject(files)
bochs = env.StaticObject(files)
env['LIBS'] += bochs

View File

@ -13,5 +13,5 @@ files = [
'clrun/genclgl.c',
]
env.StaticLibrary(env['local_libs'] + 'clrun', files)
env['CPPPATH'] += ['#Externals/CLRun/include']
env['LIBS'] += env.StaticObject(files)

View File

@ -4,16 +4,19 @@ Import('env')
import sys
if env.has_key('shared_glew') and env['shared_glew']:
env['LIBS'] += 'GLEW'
Return()
if sys.platform == 'darwin':
libs = ['GLEW']
libs = []
frames = ['AGL', 'OpenGL']
else:
libs = ['GLEW', 'GL', 'GLU']
libs = ['GL', 'GLU']
frames = []
glew = env.StaticObject('src/glew.c')
libs += glew
env.Program('glewinfo', 'src/glewinfo.c', LIBS = libs, FRAMEWORKS = frames)
env.Program('visualinfo', 'src/visualinfo.c', LIBS = libs, FRAMEWORKS = frames)
env.StaticLibrary(env['local_libs'] + 'GLEW', ['src/glew.c'])
env['CPPPATH'] += ['#Externals/GLew/include']
env['LIBS'] += glew

View File

@ -3,11 +3,8 @@
Import('env')
if env.has_key('shared_lzo') and env['shared_lzo']:
env['LIBS'] += 'lzo2'
Return()
files = [
"minilzo.c",
]
env.StaticLibrary(env['local_libs'] + "lzo2", files)
env['CPPPATH'] += ['#Externals/LZO']
env['LIBS'] += env.StaticObject('minilzo.c')

View File

@ -3,7 +3,11 @@
Import('env')
import sys
if sys.platform == 'darwin':
Return()
if env.has_key('shared_sdl') and env['shared_sdl']:
env['LIBS'] += 'SDL'
Return()
files = [
@ -38,5 +42,5 @@ else:
'src/joystick/dummy/SDL_sysjoystick.c',
]
env.StaticLibrary(env['local_libs'] + "SDL", files)
env['CPPPATH'] += ['#Externals/SDL', '#Externals/SDL/include']
env['LIBS'] += env.StaticObject(files)

View File

@ -3,6 +3,7 @@
Import('env')
if env.has_key('shared_sfml') and env['shared_sfml']:
env['LIBS'] += 'sfml-network'
Return()
files = [
@ -16,5 +17,5 @@ files = [
"SFML/Network/Unix/SocketHelper.cpp",
]
env.StaticLibrary(env['local_libs'] + "sfml-network", files)
env['CPPPATH'] += ['#Externals/SFML/include']
env['LIBS'] += env.StaticObject(files)

View File

@ -3,6 +3,7 @@
Import('env')
if env.has_key('shared_soil') and env['shared_soil']:
env['LIBS'] += 'SOIL'
Return()
files = [
@ -12,5 +13,5 @@ files = [
'stb_image_aug.c'
]
env.StaticLibrary(env['local_libs'] + "SOIL", files)
env['CPPPATH'] += ['#Externals/SOIL']
env['LIBS'] += env.StaticObject(files)

View File

@ -1,8 +1,13 @@
# -*- python -*-
Import('env')
import sys
if sys.platform == 'darwin':
Return()
if env.has_key('shared_zlib') and env['shared_zlib']:
env['LIBS'] += 'z'
Return()
files = [
@ -20,5 +25,5 @@ files = [
'zutil.c',
]
env.StaticLibrary(env['local_libs'] + "z", files)
env['CPPPATH'] += ['#Externals/zlib']
env['LIBS'] += env.StaticObject(files)

View File

@ -103,9 +103,6 @@ env['LIBS'] = []
env['build_dir'] = 'Build' + os.sep + platform.system() + \
'-' + platform.machine() + '-' + env['flavor']
# Static libs go here
env['local_libs'] = '#' + env['build_dir'] + os.sep + 'libs' + os.sep
# Default install path
if not env.has_key('install') or env['install'] == 'local':
env['prefix'] = 'Binary' + os.sep + platform.system() + \
@ -122,10 +119,6 @@ if sys.platform == 'darwin':
env['CCFLAGS'] += ['-Wextra-tokens', '-Wnewline-eof']
env['CCFLAGS'] += ['-march=core2', '-mdynamic-no-pic']
env['CCFLAGS'] += ['-Xarch_i386', '-msse3', '-Xarch_x86_64', '-mssse3']
env['CC'] = '/Developer/usr/bin/llvm-gcc'
env['CXX'] = '/Developer/usr/bin/llvm-g++'
#env['CC'] = 'clang'
#env['CXX'] = 'clang++'
env['CXXFLAGS'] += ['-x', 'objective-c++']
env['FRAMEWORKS'] += ['AppKit', 'Carbon', 'CoreFoundation', 'CoreServices']
env['FRAMEWORKS'] += ['AudioToolbox', 'AudioUnit', 'CoreAudio', 'WebKit']
@ -136,6 +129,15 @@ if sys.platform == 'darwin':
env['LINKFLAGS'] += ['-Wl,-pagezero_size,0x1000']
env['LINKFLAGS'] += ['-Wl,-search_paths_first']
if env['ENV'].has_key('CC'):
env['CC'] = env['ENV']['CC']
else:
env['CC'] = '/Developer/usr/bin/llvm-gcc'
if env['ENV'].has_key('CXX'):
env['CXX'] = env['ENV']['CXX']
else:
env['CXX'] = '/Developer/usr/bin/llvm-g++'
if env['nowx']:
env['HAVE_WX'] = 0
else:
@ -157,8 +159,6 @@ if sys.platform == 'darwin':
env['CPPPATH'] += ['#Externals']
env['FRAMEWORKPATH'] += ['Externals/Cg']
env['FRAMEWORKS'] += ['Cg']
env['shared_sdl'] = True
env['shared_zlib'] = True
env['data_dir'] = '#' + env['prefix'] + '/Dolphin.app/Contents/Resources'
@ -318,11 +318,6 @@ else:
env.Alias('install', env['prefix'])
# Local (static) libraries must be first in the search path for the build in
# order that they can override system libraries, but they must not be found
# during autoconfiguration as they will then be detected as system libraries.
env['LIBPATH'].insert(0, env['local_libs'])
dirs = [
'Externals/Bochs_disasm',
'Externals/CLRun',
@ -343,10 +338,10 @@ dirs = [
'Source/Core/InputCommon/Src',
'Source/Core/VideoCommon/Src',
'Source/Core/VideoUICommon/Src',
'Source/DSPTool/Src',
#'Source/DSPTool/Src',
'Source/Plugins/Plugin_VideoOGL/Src',
'Source/Plugins/Plugin_VideoSoftware/Src',
'Source/UnitTests',
#'Source/UnitTests',
]
# Now that platform configuration is done, propagate it to modules

View File

@ -26,4 +26,4 @@ else:
files += [ 'DSoundStream.cpp' ]
files += [ 'XAudio2Stream.cpp' ]
env.StaticLibrary(env['local_libs'] + 'audiocommon', files)
env['LIBS'] += env.StaticObject(files)

View File

@ -53,5 +53,5 @@ if sys.platform == 'win32':
files += [ "ExtendedTrace.cpp" ]
files += [ "stdafx.cpp" ]
env.StaticLibrary(env['local_libs'] + "common", files)
env['CPPPATH'] += ['.']
env['LIBS'] += env.StaticObject(files)

View File

@ -196,4 +196,4 @@ elif sys.platform == 'linux2' and env['HAVE_BLUEZ']:
else:
files += [ "HW/BBA-TAP/TAP_Unix.cpp", "HW/WiimoteReal/IODummy.cpp" ]
env.StaticLibrary(env['local_libs'] + 'core', files)
env['LIBS'] += env.StaticObject(files)

View File

@ -11,4 +11,4 @@ files = [
'MemoryView.cpp',
]
env.StaticLibrary(env['local_libs'] + 'debugger_ui_util', files)
env['LIBS'] += env.StaticObject(files)

View File

@ -20,4 +20,4 @@ files = [
"JitWindow.cpp",
]
env.StaticLibrary(env['local_libs'] + "debwx", files)
env['LIBS'] += env.StaticObject(files)

View File

@ -26,4 +26,4 @@ files = [
'WiiWad.cpp',
]
env.StaticLibrary(env['local_libs'] + 'discio', files)
env['LIBS'] += env.StaticObject(files)

View File

@ -6,15 +6,12 @@ import sys
from SconsTests import utils
files = ['BootManager.cpp']
ldflags = []
libs = []
frameworksflags = []
if not env['HAVE_WX']:
files += ['MainNoGUI.cpp']
else:
files += ['Main.cpp']
libfiles = [
files += [
'AboutDolphin.cpp',
'ARCodeAddEdit.cpp',
'GeckoCodeDiag.cpp',
@ -32,6 +29,7 @@ else:
'PatchAddEdit.cpp',
'PHackSettings.cpp',
'CheatsWindow.cpp',
'Main.cpp',
'MemcardManager.cpp',
'MemoryCards/GCMemcard.cpp',
'MemoryCards/WiiSaveCrypted.cpp',
@ -45,28 +43,18 @@ else:
'WxUtils.cpp',
]
env.StaticLibrary(env['local_libs'] + "dolphinwx", libfiles)
libs += ['debwx', 'debugger_ui_util', 'dolphinwx']
libs += ['core', 'common', 'discio', 'plugin_videoogl', 'plugin_videosoftware']
if env['HAVE_WX']:
libs += ['videouicommon']
libs += ['audiocommon', 'inputcommon', 'videocommon']
libs += ['GLEW', 'SOIL', 'bdisasm', 'lzo2', 'sfml-network', 'z']
if sys.platform == 'win32':
files += [ "stdafx.cpp" ]
files += ["stdafx.cpp"]
elif sys.platform == 'darwin':
ldflags += ['-Wl,-framework,QuickTime', '-Wl,-no_arch_warnings']
ldflags += ['-weak_framework', 'OpenCL']
frameworksflags += ['-Wl,-framework,QuickTime', '-Wl,-no_arch_warnings']
frameworksflags += ['-weak_framework', 'OpenCL']
exe = '#' + env['prefix'] + '/Dolphin.app/Contents/MacOS/Dolphin'
if env['HAVE_WX']:
libs += env['wxconfiglibs']
env['LIBS'] += env['wxconfiglibs']
else:
libs += [ 'iconv' ]
env['LIBS'] += ['iconv']
exe += 'NoGUI'
env.Install('#' + env['prefix'] + '/Dolphin.app/Contents/' +
@ -121,18 +109,15 @@ elif sys.platform == 'darwin':
CFBundleTypeRole = 'Viewer')]
)))
env.Command('dummy', '#' + env['prefix'],
"find $SOURCES -name .svn -exec rm -rf {} +")
else:
files += [ 'X11Utils.cpp' ]
libs += [ 'SDL', 'clrun' ]
if env['HAVE_WX']:
exe = env['binary_dir'] + '/dolphin-emu'
else:
exe = env['binary_dir'] + '/dolphin-emu-nogui'
files += ['X11Utils.cpp']
exe = env['binary_dir'] + '/dolphin-emu'
if not env['HAVE_WX']:
exe += '-nogui'
env.InstallAs(env['data_dir'] + '/sys', '#Data/Sys')
env.InstallAs(env['data_dir'] + '/user', '#Data/User')
linkflags = ldflags + env['LINKFLAGS']
env.Command('dummy', '#' + env['prefix'],
"find $SOURCES -name .svn -exec rm -rf {} +")
env.Program(exe, files, LIBS = libs + env['LIBS'], LINKFLAGS = linkflags)
env.Program(exe, files, FRAMEWORKSFLAGS = frameworksflags)

View File

@ -30,4 +30,4 @@ elif env['HAVE_X11']:
'ControllerInterface/Xlib/Xlib.cpp',
]
env.StaticLibrary(env['local_libs'] + "inputcommon", files)
env['LIBS'] += env.StaticObject(files)

View File

@ -44,4 +44,4 @@ files = [
'memcpy_amd.cpp',
]
env.StaticLibrary(env['local_libs'] + "videocommon", files)
env['LIBS'] += env.StaticObject(files)

View File

@ -10,4 +10,4 @@ files = [
'DebuggerPanel.cpp',
]
env.StaticLibrary(env['local_libs'] + 'videouicommon', files)
env['LIBS'] += env.StaticObject(files)

View File

@ -19,4 +19,4 @@ files = [
'GLUtil.cpp'
]
env.StaticLibrary(env['local_libs'] + 'plugin_videoogl', files)
env['LIBS'] += env.StaticObject(files)

View File

@ -20,61 +20,61 @@
#include "HW/Memmap.h"
// CP state
u8 *cached_arraybases[16];
static u8 *_cached_arraybases[16];
// STATE_TO_SAVE
u32 arraybases[16];
u32 arraystrides[16];
TMatrixIndexA MatrixIndexA;
TMatrixIndexB MatrixIndexB;
TVtxDesc g_VtxDesc;
VAT g_VtxAttr[8];
static u32 _arraybases[16];
static u32 _arraystrides[16];
static TMatrixIndexA _MatrixIndexA;
static TMatrixIndexB _MatrixIndexB;
static TVtxDesc _g_VtxDesc;
static VAT _g_VtxAttr[8];
void SWLoadCPReg(u32 sub_cmd, u32 value)
{
switch (sub_cmd & 0xF0)
{
case 0x30:
MatrixIndexA.Hex = value;
_MatrixIndexA.Hex = value;
break;
case 0x40:
MatrixIndexB.Hex = value;
_MatrixIndexB.Hex = value;
break;
case 0x50:
g_VtxDesc.Hex &= ~0x1FFFF; // keep the Upper bits
g_VtxDesc.Hex |= value;
_g_VtxDesc.Hex &= ~0x1FFFF; // keep the Upper bits
_g_VtxDesc.Hex |= value;
break;
case 0x60:
g_VtxDesc.Hex &= 0x1FFFF; // keep the lower 17Bits
g_VtxDesc.Hex |= (u64)value << 17;
_g_VtxDesc.Hex &= 0x1FFFF; // keep the lower 17Bits
_g_VtxDesc.Hex |= (u64)value << 17;
break;
case 0x70:
_assert_((sub_cmd & 0x0F) < 8);
g_VtxAttr[sub_cmd & 7].g0.Hex = value;
_g_VtxAttr[sub_cmd & 7].g0.Hex = value;
break;
case 0x80:
_assert_((sub_cmd & 0x0F) < 8);
g_VtxAttr[sub_cmd & 7].g1.Hex = value;
_g_VtxAttr[sub_cmd & 7].g1.Hex = value;
break;
case 0x90:
_assert_((sub_cmd & 0x0F) < 8);
g_VtxAttr[sub_cmd & 7].g2.Hex = value;
_g_VtxAttr[sub_cmd & 7].g2.Hex = value;
break;
// Pointers to vertex arrays in GC RAM
case 0xA0:
arraybases[sub_cmd & 0xF] = value;
cached_arraybases[sub_cmd & 0xF] = Memory::GetPointer(value);
_arraybases[sub_cmd & 0xF] = value;
_cached_arraybases[sub_cmd & 0xF] = Memory::GetPointer(value);
break;
case 0xB0:
arraystrides[sub_cmd & 0xF] = value & 0xFF;
_arraystrides[sub_cmd & 0xF] = value & 0xFF;
break;
}
}

View File

@ -25,7 +25,7 @@
#include "DebugUtil.h"
#include "HwRasterizer.h"
#include "SWCommandProcessor.h"
#include "SWGLUtil.h"
#include "../../Plugin_VideoOGL/Src/GLUtil.h"
#include "HW/Memmap.h"
#include "Core.h"

View File

@ -22,7 +22,7 @@
#include "BPMemLoader.h"
#include "HwRasterizer.h"
#include "SWGLUtil.h"
#include "../../Plugin_VideoOGL/Src/GLUtil.h"
#include "NativeVertexFormat.h"
#include "DebugUtil.h"

View File

@ -21,7 +21,7 @@
#include <map>
#include "BPMemLoader.h"
#include "SWGLUtil.h"
#include "../../Plugin_VideoOGL/Src/GLUtil.h"
struct OutputVertexData;

View File

@ -36,4 +36,4 @@ if env['HAVE_WX']:
if sys.platform == 'win32':
files += [ 'Win32.cpp' ]
env.StaticLibrary(env['local_libs'] + 'plugin_videosoftware', files)
env['LIBS'] += env.StaticObject(files)

View File

@ -21,9 +21,11 @@
#include "ConfigManager.h"
#include "Core.h"
#include "Host.h"
#include "VideoBackend.h"
#include "SWGLUtil.h"
#if 0
#if defined(_WIN32)
#include "Win32.h"
static HDC hDC = NULL; // Private GDI Device Context
@ -78,15 +80,41 @@ void OpenGL_SetWindowText(const char *text)
XStoreName(GLWin.dpy, GLWin.win, text);
#endif
}
#endif
namespace SW
{
// Draw messages on top of the screen
unsigned int VideoBackend::PeekMessages()
{
#ifdef _WIN32
// TODO: peekmessage
MSG msg;
while (PeekMessage(&msg, 0, 0, 0, PM_REMOVE))
{
if (msg.message == WM_QUIT)
return FALSE;
TranslateMessage(&msg);
DispatchMessage(&msg);
}
return TRUE;
#else
return false;
#endif
}
// Show the current FPS
void UpdateFPSDisplay(const char *text)
void VideoBackend::UpdateFPSDisplay(const char *text)
{
char temp[100];
snprintf(temp, sizeof temp, "%s | Software | %s", svn_rev_str, text);
snprintf(temp, sizeof temp, "%s | OpenGL | %s", svn_rev_str, text);
OpenGL_SetWindowText(temp);
}
}
#if 0
// Create rendering window.
// Call browser: Core.cpp:EmuThread() > main.cpp:Video_Initialize()
bool OpenGL_Create(int _twidth, int _theight)
@ -454,3 +482,4 @@ bool OpenGL_ReportFBOError(const char *function, const char *file, int line)
}
return true;
}
#endif

View File

@ -18,7 +18,7 @@
#include "Common.h"
#include "Core.h"
#include "SWGLUtil.h"
#include "../../Plugin_VideoOGL/Src/GLUtil.h"
#include "SWRenderer.h"
#include "SWStatistics.h"
#include "../../Plugin_VideoOGL/Src/RasterFont.h"

View File

@ -190,13 +190,4 @@ void VideoBackend::Video_AbortFrame(void)
{
}
void VideoBackend::UpdateFPSDisplay(const char*)
{
}
unsigned int VideoBackend::PeekMessages()
{
return 0;
}
}