From 59974dfb5bfd2488eb31caf8df4a34565fb7c4e0 Mon Sep 17 00:00:00 2001 From: Maarten ter Huurne Date: Tue, 26 Aug 2008 22:28:42 +0000 Subject: [PATCH] Only use "-fPIC" for compiling objects that will be part of dynamic libs. Make SConscripts inherit the compile flags from the top level instead of overriding them. git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@329 8ced0084-cf51-0410-be5f-012b33b47a6e --- Externals/Bochs_disasm/SConscript | 15 +++--- SConstruct | 5 +- Source/Core/Common/Src/SConscript | 53 ++++++++++--------- Source/Core/DebuggerWX/src/SConscript | 18 +++++-- Source/Core/DolphinWX/src/SConscript | 22 ++++++-- Source/Core/VideoCommon/Src/SConscript | 20 +++---- Source/Plugins/Plugin_DSP_HLE/Src/SConscript | 38 +++++++------ Source/Plugins/Plugin_DSP_LLE/Src/SConscript | 39 ++++++++------ .../Plugins/Plugin_PadSimple/Src/SConscript | 12 +++-- Source/Plugins/Plugin_VideoOGL/Src/SConscript | 8 +-- Source/Plugins/Plugin_nJoy_SDL/Src/SConscript | 22 +++++--- 11 files changed, 154 insertions(+), 98 deletions(-) diff --git a/Externals/Bochs_disasm/SConscript b/Externals/Bochs_disasm/SConscript index 9890bb8d50..f0db9ff729 100644 --- a/Externals/Bochs_disasm/SConscript +++ b/Externals/Bochs_disasm/SConscript @@ -1,11 +1,12 @@ Import('env') -files = ["dis_decode.cpp", - "dis_groups.cpp", - "resolve.cpp", - "syntax.cpp", - "PowerPCDisasm.cpp", - ] +files = [ + "dis_decode.cpp", + "dis_groups.cpp", + "resolve.cpp", + "syntax.cpp", + "PowerPCDisasm.cpp", + ] -env_bochs = env.Copy(CXXFLAGS = " -fPIC ") +env_bochs = env.Copy() env_bochs.StaticLibrary("bdisasm", files) diff --git a/SConstruct b/SConstruct index 31bf13d603..c91f569f2d 100644 --- a/SConstruct +++ b/SConstruct @@ -19,7 +19,6 @@ compileFlags = [ '-g', '-O3', '-fno-strict-aliasing', - '-fPIC', '-msse2', '-D_FILE_OFFSET_BITS=64', '-D_LARGEFILE_SOURCE', @@ -72,8 +71,8 @@ lib_paths = include_paths env = Environment( CC = "gcc", CXX = "g++", - CCFLAGS = compileFlags, - CXXFLAGS = compileFlags, + CCFLAGS = ' '.join(compileFlags), + CXXFLAGS = ' '.join(compileFlags), CPPPATH = include_paths, LIBPATH = lib_paths, ENV = { diff --git a/Source/Core/Common/Src/SConscript b/Source/Core/Common/Src/SConscript index 29be81fbc9..c018d8bbcc 100644 --- a/Source/Core/Common/Src/SConscript +++ b/Source/Core/Common/Src/SConscript @@ -1,30 +1,31 @@ Import('env') -files = ["ABI.cpp", - "Common.cpp", - "ChunkFile.cpp", - "CPUDetect.cpp", - "DynamicLibrary.cpp", - "Hash.cpp", - "HTTP.cpp", - "IniFile.cpp", - "Logging.cpp", - "FileUtil.cpp", - "MappedFile.cpp", - "MathUtil.cpp", - "MemArena.cpp", - "MemoryUtil.cpp", - "Plugin.cpp", - "PortableSockets.cpp", - "StringUtil.cpp", - "TestFramework.cpp", - "Thunk.cpp", - "Timer.cpp", - "Thread.cpp", - "x64Emitter.cpp", - "x64Analyzer.cpp", - ] - +files = [ + "ABI.cpp", + "Common.cpp", + "ChunkFile.cpp", + "CPUDetect.cpp", + "DynamicLibrary.cpp", + "Hash.cpp", + "HTTP.cpp", + "IniFile.cpp", + "Logging.cpp", + "FileUtil.cpp", + "MappedFile.cpp", + "MathUtil.cpp", + "MemArena.cpp", + "MemoryUtil.cpp", + "Plugin.cpp", + "PortableSockets.cpp", + "StringUtil.cpp", + "TestFramework.cpp", + "Thunk.cpp", + "Timer.cpp", + "Thread.cpp", + "x64Emitter.cpp", + "x64Analyzer.cpp", + ] + env_common = env.Copy() -env_common.Append(CXXFLAGS = [ '-fPIC' ]) +env_common.Append(CXXFLAGS = ' ' + ' '.join([ '-fPIC' ])) env_common.StaticLibrary("common", files) diff --git a/Source/Core/DebuggerWX/src/SConscript b/Source/Core/DebuggerWX/src/SConscript index 139afb0a93..27935d8cc4 100644 --- a/Source/Core/DebuggerWX/src/SConscript +++ b/Source/Core/DebuggerWX/src/SConscript @@ -15,7 +15,17 @@ files = ["LogWindow.cpp", "RegisterView.cpp", "JitWindow.cpp", ] -wxenv = env.Copy(CXXFLAGS = "`wx-config --cppflags` -DUSE_XPM_BITMAPS -DwxNEEDS_CHARPP", - LINKFLAGS = "-L/usr/local/lib -pthread `wx-config --libs --debug`") - -wxenv.StaticLibrary("debwx", files, LIBS = ["common"]) +wxenv = env.Copy() +wxenv.Append( + CXXFLAGS = ' ' + ' '.join([ + '`wx-config --cppflags`', + '-DUSE_XPM_BITMAPS', + '-DwxNEEDS_CHARPP' + ]), + LINKFLAGS = ' ' + ' '.join([ + '-L/usr/local/lib', + '-pthread', + '`wx-config --libs --debug`' + ]) + ) +wxenv.StaticLibrary("debwx", files, LIBS = [ "common" ]) diff --git a/Source/Core/DolphinWX/src/SConscript b/Source/Core/DolphinWX/src/SConscript index e029e5aaee..725e7a9a73 100644 --- a/Source/Core/DolphinWX/src/SConscript +++ b/Source/Core/DolphinWX/src/SConscript @@ -17,14 +17,26 @@ files = ["BootManager.cpp", "stdafx.cpp", ] - -wxenv = env.Copy(CXXFLAGS = "`wx-config --cppflags` -DUSE_XPM_BITMAPS -DwxNEEDS_CHARPP `sdl-config --cflags`", - LINKFLAGS = "-L/usr/local/lib -pthread `wx-config --libs` `sdl-config --libs`") +wxenv = env.Copy() +wxenv.Append( + CXXFLAGS = ' ' + ' '.join([ + '`wx-config --cppflags`', + '-DUSE_XPM_BITMAPS', + '-DwxNEEDS_CHARPP', + '`sdl-config --cflags`', + ]), + LINKFLAGS = ' ' + ' '.join([ + '-L/usr/local/lib', + '-pthread', + '`wx-config --libs`', + '`sdl-config --libs`' + ]) + ) if sys.platform == 'darwin': icon = 'Dolphin' - version = "svn" - wxenv.Program("../../../../Binary/mac/Dolphin.app/Contents/MacOS/Dolphin", files, LIBS = ["debwx", "discio", "core", "bdisasm", "videocommon", "common" , "z"]) + version = 'svn' + wxenv.Program('../../../../Binary/mac/Dolphin.app/Contents/MacOS/Dolphin', files, LIBS = ["debwx", "discio", "core", "bdisasm", "videocommon", "common" , "z"]) wxenv.Plist("../../../../Binary/mac/Dolphin.app/Contents/Info.plist", Value(dict( CFAppleHelpAnchor = 'index', CFBundleExecutable = 'Dolphin', diff --git a/Source/Core/VideoCommon/Src/SConscript b/Source/Core/VideoCommon/Src/SConscript index caadfca091..2596e7db13 100644 --- a/Source/Core/VideoCommon/Src/SConscript +++ b/Source/Core/VideoCommon/Src/SConscript @@ -1,13 +1,15 @@ Import('env') -files = ["BPMemory.cpp", - "CPMemory.cpp", - "LookUpTables.cpp", - "TextureDecoder.cpp", - "XFMemory.cpp", - "XFBConvert.cpp", - "Fifo.cpp", - ] +files = [ + "BPMemory.cpp", + "CPMemory.cpp", + "LookUpTables.cpp", + "TextureDecoder.cpp", + "XFMemory.cpp", + "XFBConvert.cpp", + "Fifo.cpp", + ] -env_common = env.Copy(CXXFLAGS = " -fPIC ") +env_common = env.Copy() +env_common.Append(CXXFLAGS = ' ' + ' '.join([ '-fPIC' ])) env_common.StaticLibrary("videocommon", files) diff --git a/Source/Plugins/Plugin_DSP_HLE/Src/SConscript b/Source/Plugins/Plugin_DSP_HLE/Src/SConscript index ced5609cb2..66e648fcf6 100644 --- a/Source/Plugins/Plugin_DSP_HLE/Src/SConscript +++ b/Source/Plugins/Plugin_DSP_HLE/Src/SConscript @@ -1,22 +1,28 @@ Import('env') import sys -files = ["DSPHandler.cpp", - "MailHandler.cpp", - "main.cpp", - "Config.cpp", - "Globals.cpp", - "PCHW/AOSoundStream.cpp", - "PCHW/Mixer.cpp", - "UCodes/UCode_AX.cpp", - "UCodes/UCode_CARD.cpp", - "UCodes/UCode_InitAudioSystem.cpp", - "UCodes/UCode_Jac.cpp", - "UCodes/UCode_ROM.cpp", - "UCodes/UCodes.cpp", - "UCodes/UCode_Zelda.cpp", - ] -dspenv=env.Copy(LINKFLAGS = "`pkg-config --libs ao` ") +files = [ + "DSPHandler.cpp", + "MailHandler.cpp", + "main.cpp", + "Config.cpp", + "Globals.cpp", + "PCHW/AOSoundStream.cpp", + "PCHW/Mixer.cpp", + "UCodes/UCode_AX.cpp", + "UCodes/UCode_CARD.cpp", + "UCodes/UCode_InitAudioSystem.cpp", + "UCodes/UCode_Jac.cpp", + "UCodes/UCode_ROM.cpp", + "UCodes/UCodes.cpp", + "UCodes/UCode_Zelda.cpp", + ] + +dspenv = env.Copy() +dspenv.Append( + CXXFLAGS = ' ' + ' '.join([ '-fPIC', '`pkg-config --cflags ao`' ]), + LINKFLAGS = ' ' + ' '.join([ '`pkg-config --libs ao`' ]) + ) if sys.platform == 'darwin': dspenv.SharedLibrary("../../../../Binary/mac/Plugins/dsphle.so", files, LIBS = ["common"]) diff --git a/Source/Plugins/Plugin_DSP_LLE/Src/SConscript b/Source/Plugins/Plugin_DSP_LLE/Src/SConscript index fad557c1b6..3d1c43d439 100644 --- a/Source/Plugins/Plugin_DSP_LLE/Src/SConscript +++ b/Source/Plugins/Plugin_DSP_LLE/Src/SConscript @@ -1,18 +1,25 @@ Import('env') output = "../../../../Binary/linux/Plugins/dsplle.so" -files = ["AOSoundStream.cpp", - "disassemble.cpp", - "gdsp_aram.cpp", - "gdsp_ext_op.cpp", - "gdsp_interface.cpp", - "gdsp_interpreter.cpp", - "gdsp_memory.cpp", - "gdsp_opcodes.cpp", - "gdsp_registers.cpp", - "Globals.cpp", - "opcodes.cpp", - "Tools.cpp", - "main.cpp", - ] -env.Append(LINKFLAGS = " `pkg-config --libs ao`") -env.SharedLibrary(output, files, LIBS = ["common"]) + +files = [ + "AOSoundStream.cpp", + "disassemble.cpp", + "gdsp_aram.cpp", + "gdsp_ext_op.cpp", + "gdsp_interface.cpp", + "gdsp_interpreter.cpp", + "gdsp_memory.cpp", + "gdsp_opcodes.cpp", + "gdsp_registers.cpp", + "Globals.cpp", + "opcodes.cpp", + "Tools.cpp", + "main.cpp", + ] + +dspenv = env.Copy() +dspenv.Append( + CXXFLAGS = ' ' + ' '.join([ '-fPIC', '`pkg-config --cflags ao`' ]), + LINKFLAGS = ' ' + ' '.join([ '`pkg-config --libs ao`' ]) + ) +dspenv.SharedLibrary(output, files, LIBS = ["common"]) diff --git a/Source/Plugins/Plugin_PadSimple/Src/SConscript b/Source/Plugins/Plugin_PadSimple/Src/SConscript index ccd14f2ba0..b0c2bf3976 100644 --- a/Source/Plugins/Plugin_PadSimple/Src/SConscript +++ b/Source/Plugins/Plugin_PadSimple/Src/SConscript @@ -6,7 +6,13 @@ if sys.platform == 'darwin': else: output = "../../../../Binary/linux/Plugins/padsimple.so" -files = ["main.cpp", - ] -padenv=env.Copy(CXXFLAGS = " `pkg-config --cflags sdl`", LINKFLAGS = " `pkg-config --libs sdl`") +files = [ + "main.cpp", + ] + +padenv = env.Copy() +padenv.Append( + CXXFLAGS = ' ' + ' '.join([ '-fPIC', '`pkg-config --cflags sdl`' ]), + LINKFLAGS = ' ' + ' '.join([ '`pkg-config --libs sdl`' ]) + ) padenv.SharedLibrary(output, files, LIBS=["common"]) diff --git a/Source/Plugins/Plugin_VideoOGL/Src/SConscript b/Source/Plugins/Plugin_VideoOGL/Src/SConscript index e3a9d00de7..8803aa2c55 100644 --- a/Source/Plugins/Plugin_VideoOGL/Src/SConscript +++ b/Source/Plugins/Plugin_VideoOGL/Src/SConscript @@ -23,6 +23,7 @@ files = [ 'GUI/ConfigDlg.cpp', ] compileFlags = [ + '-fPIC', '`wx-config --cppflags`', ] linkFlags = [ @@ -58,9 +59,10 @@ if useSDL: compileFlags += [ '`sdl-config --cflags`', '-DUSE_SDL=1' ] linkFlags += [ '`sdl-config --libs`' ] -gfxenv = env.Copy( - CXXFLAGS = ' '.join(compileFlags), - LINKFLAGS = ' '.join(linkFlags), +gfxenv = env.Copy() +gfxenv.Append( + CXXFLAGS = ' ' + ' '.join(compileFlags), + LINKFLAGS = ' ' + ' '.join(linkFlags) ) gfxenv.SharedLibrary( '../../../../Binary/%s/Plugins/zeroogl.so' % platform, diff --git a/Source/Plugins/Plugin_nJoy_SDL/Src/SConscript b/Source/Plugins/Plugin_nJoy_SDL/Src/SConscript index 3799fa993d..654c657159 100644 --- a/Source/Plugins/Plugin_nJoy_SDL/Src/SConscript +++ b/Source/Plugins/Plugin_nJoy_SDL/Src/SConscript @@ -6,9 +6,19 @@ if sys.platform == 'darwin': else: output = "../../../../Binary/linux/Plugins/Plugin_nJoy_SDL.so" -files = [ "nJoy.cpp", - "GUI/AboutBox.cpp", - "GUI/ConfigBox.cpp", - ] -padenv=env.Copy(CXXFLAGS = " `wx-config --cppflags` `pkg-config --cflags sdl`", LINKFLAGS = "`wx-config --libs` `pkg-config --libs sdl` ") -padenv.SharedLibrary(output, files, LIBS=["common"]) +files = [ + "nJoy.cpp", + "GUI/AboutBox.cpp", + "GUI/ConfigBox.cpp", + ] + +padenv = env.Copy() +padenv.Append( + CXXFLAGS = ' ' + ' '.join([ + '-fPIC', '`wx-config --cppflags`', '`pkg-config --cflags sdl`' + ]), + LINKFLAGS = ' ' + ' '.join([ + '`wx-config --libs`', '`pkg-config --libs sdl`' + ]) + ) +padenv.SharedLibrary(output, files, LIBS = [ "common" ])