Precompile some headers. Fix sconscript to prevent recompiling everything

This commit is contained in:
Simon Robertshaw 2012-08-13 15:43:57 +01:00
parent e6feb6f101
commit 074dcd0b42
20 changed files with 172 additions and 103639 deletions

View File

@ -45,16 +45,16 @@ AddOption('--beta',dest="beta",action='store_true',default=False,help="Beta buil
AddOption('--save-version',dest="save-version",default=False,help="Save version.")
AddOption('--minor-version',dest="minor-version",default=False,help="Minor version.")
AddOption('--build-number',dest="build-number",default=False,help="Build number.")
AddOption('--snapshot',dest="snapshot",default=False,help="Snapshot build.")
AddOption('--snapshot',dest="snapshot",action='store_true',default=False,help="Snapshot build.")
if((not GetOption('lin')) and (not GetOption('win')) and (not GetOption('macosx'))):
print "You must specify a platform to target"
raise SystemExit(1)
if(GetOption('win')):
env = Environment(tools = ['mingw'], ENV = os.environ)
env = Environment(tools = ['mingw', 'gch'], ENV = os.environ)
else:
env = Environment(ENV = os.environ)
env = Environment(tools = ['default', 'gch'], ENV = os.environ)
if GetOption("toolprefix"):
env['CC'] = GetOption("toolprefix")+env['CC']
@ -152,11 +152,13 @@ if GetOption('_64bit'):
if(GetOption('beta')):
env.Append(CPPDEFINES='BETA')
if(GetOption('snapshot')):
env.Append(CPPDEFINES=['SNAPSHOT_ID=' + GetOption('snapshot')])
if(not GetOption('snapshot') and not GetOption('beta') and not GetOption('release')):
env.Append(CPPDEFINES='SNAPSHOT_ID=0')
env.Append(CPPDEFINES='SNAPSHOT')
elif(GetOption('snapshot')):
env.Append(CPPDEFINES=['SNAPSHOT_ID=' + str(int(time.time()))])
env.Append(CPPDEFINES='SNAPSHOT')
else:
env.Append(CPPDEFINES=["SNAPSHOT_ID=" + str(int(time.time()))])
if(GetOption('save-version')):
env.Append(CPPDEFINES=['SAVE_VERSION=' + GetOption('major-version')])
@ -205,6 +207,10 @@ sources+=Glob("src/simulation/tools/*.cpp")
sources+=Glob("generated/ToolClasses.cpp")
sources+=Glob("generated/ElementClasses.cpp")
env['Gch'] = env.Gch('src/simulation/Tools.h.gch', 'src/simulation/Tools.h')[0]
env['Gch'] = env.Gch('src/simulation/Elements.h.gch', 'src/simulation/Elements.h')[0]
env['Gch'] = env.Gch('src/client/Client.h.gch', 'src/client/Client.h')[0]
env['Gch'] = env.Gch('src/simulation/SimulationData.h.gch', 'src/simulation/SimulationData.h')[0]
SetupSpawn(env)
@ -227,8 +233,8 @@ if(GetOption('win')):
env.Command(['generated/ElementClasses.cpp', 'generated/ElementClasses.h'], Glob('src/simulation/elements/*.cpp'), "python generator.py elements $TARGETS $SOURCES")
env.Command(['generated/ToolClasses.cpp', 'generated/ToolClasses.h'], Glob('src/simulation/tools/*.cpp'), "python generator.py tools $TARGETS $SOURCES")
env.Decider('MD5')
t=env.Program(target=programName, source=sources)
Decider('MD5')
Default(t)
#if(GetOption('release')):

View File

@ -1,7 +0,0 @@
#include "ElementClasses.h"
std::vector<Element> GetElements()
{
std::vector<Element> elements;
return elements;
}

51807
output.txt

File diff suppressed because it is too large Load Diff

0
scons
View File

View File

@ -0,0 +1,126 @@
#
# SCons builder for gcc's precompiled headers
# Copyright (C) 2006 Tim Blechmann
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; see the file COPYING. If not, write to
# the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
# Boston, MA 02111-1307, USA.
# 1.1
#
# 09-11-2011 Pedro Larroy: Fixed dependency emitter not working with variant dir
#
#
import SCons.Action
import SCons.Builder
import SCons.Scanner.C
import SCons.Util
import SCons.Script
import os
SCons.Script.EnsureSConsVersion(0,96,92)
GchAction = SCons.Action.Action('$GCHCOM', '$GCHCOMSTR')
GchShAction = SCons.Action.Action('$GCHSHCOM', '$GCHSHCOMSTR')
def gen_suffix(env, sources):
return sources[0].get_suffix() + env['GCHSUFFIX']
GchShBuilder = SCons.Builder.Builder(action = GchShAction,
source_scanner = SCons.Scanner.C.CScanner(),
suffix = gen_suffix)
GchBuilder = SCons.Builder.Builder(action = GchAction,
source_scanner = SCons.Scanner.C.CScanner(),
suffix = gen_suffix)
def header_path(node):
h_path = node.abspath
idx = h_path.rfind('.gch')
if idx != -1:
h_path = h_path[0:idx]
if not os.path.isfile(h_path):
raise SCons.Errors.StopError("can't find header file: {0}".format(h_path))
return h_path
else:
raise SCons.Errors.StopError("{0} file doesn't have .gch extension".format(h_path))
def static_pch_emitter(target,source,env):
SCons.Defaults.StaticObjectEmitter( target, source, env )
scanner = SCons.Scanner.C.CScanner()
path = scanner.path(env)
deps = scanner(source[0], env, path)
if env.get('Gch'):
h_path = header_path(env['Gch'])
if h_path in [x.abspath for x in deps]:
#print 'Found dep. on pch: ', target[0], ' -> ', env['Gch']
env.Depends(target, env['Gch'])
return (target, source)
def shared_pch_emitter(target,source,env):
SCons.Defaults.SharedObjectEmitter( target, source, env )
scanner = SCons.Scanner.C.CScanner()
path = scanner.path(env)
deps = scanner(source[0], env, path)
if env.get('GchSh'):
h_path = header_path(env['GchSh'])
if h_path in [x.abspath for x in deps]:
#print 'Found dep. on pch (shared): ', target[0], ' -> ', env['Gch']
env.Depends(target, env['GchSh'])
return (target, source)
def generate(env):
"""
Add builders and construction variables for the Gch builder.
"""
env.Append(BUILDERS = {
'gch': env.Builder(
action = GchAction,
target_factory = env.fs.File,
),
'gchsh': env.Builder(
action = GchShAction,
target_factory = env.fs.File,
),
})
try:
bld = env['BUILDERS']['Gch']
bldsh = env['BUILDERS']['GchSh']
except KeyError:
bld = GchBuilder
bldsh = GchShBuilder
env['BUILDERS']['Gch'] = bld
env['BUILDERS']['GchSh'] = bldsh
env['GCHCOM'] = '$CXX -Wall -o $TARGET -x c++-header -c $CXXFLAGS $CCFLAGS $_CCCOMCOM $SOURCE'
env['GCHSHCOM'] = '$CXX -o $TARGET -x c++-header -c $SHCXXFLAGS $CCFLAGS $_CCCOMCOM $SOURCE'
env['GCHSUFFIX'] = '.gch'
for suffix in SCons.Util.Split('.c .C .cc .cxx .cpp .c++'):
env['BUILDERS']['StaticObject'].add_emitter( suffix, static_pch_emitter )
env['BUILDERS']['SharedObject'].add_emitter( suffix, shared_pch_emitter )
def exists(env):
return env.Detect('g++')

Binary file not shown.

View File

@ -30,6 +30,7 @@
#include "interface/Label.h"
#include "interface/Keys.h"
#include "client/GameSave.h"
#include "simulation/SaveRenderer.h"
#include "client/Client.h"
#include "Misc.h"
@ -43,6 +44,7 @@
using namespace std;
#ifdef WIN
extern "C" IMAGE_DOS_HEADER __ImageBase;
#endif

View File

@ -8,11 +8,13 @@
#include <iostream>
#include <sstream>
#include <cmath>
#include <bzlib.h>
#include "Config.h"
#include "bson/BSON.h"
#include "GameSave.h"
#include "simulation/SimulationData.h"
#include "ElementClasses.h"
extern "C"
{
#include "hmap.h"

View File

@ -6,6 +6,7 @@
#include "GameController.h"
#include "GameModel.h"
#include "client/SaveInfo.h"
#include "client/GameSave.h"
#include "search/SearchController.h"
#include "render/RenderController.h"
#include "login/LoginController.h"

View File

@ -3,12 +3,14 @@
#include "GameView.h"
#include "simulation/Simulation.h"
#include "simulation/Air.h"
#include "simulation/Tools.h"
#include "graphics/Renderer.h"
#include "interface/Point.h"
#include "Brush.h"
#include "EllipseBrush.h"
#include "TriangleBrush.h"
#include "client/Client.h"
#include "client/GameSave.h"
#include "game/DecorationTool.h"
#include "GameModelException.h"
#include "QuickOptions.h"

View File

@ -15,6 +15,7 @@
#include "ToolButton.h"
#include "RenderPreset.h"
#include "Brush.h"
#include "simulation/Sample.h"
using namespace std;

View File

@ -7,6 +7,7 @@
#include <string>
#include "Tool.h"
#include "game/Brush.h"
#include "simulation/Simulation.h"

View File

@ -6,6 +6,7 @@
*/
#include "SaveRenderer.h"
#include "client/GameSave.h"
#include "graphics/Graphics.h"
#include "Simulation.h"
#include "graphics/Renderer.h"

View File

@ -8,6 +8,15 @@
#include "Gravity.h"
#include "elements/Element.h"
//#include "graphics/Renderer.h"
//#include "graphics/Graphics.h"
#include "Misc.h"
#include "Tools.h"
#include "game/Brush.h"
#include "client/GameSave.h"
#include "Sample.h"
//#include "StorageClasses.h"
#undef LUACONSOLE
//#include "cat/LuaScriptHelper.h"

View File

@ -12,26 +12,24 @@
#include <vector>
#include "Config.h"
#include "graphics/Renderer.h"
#include "graphics/Graphics.h"
//#include "Elements.h"
#include "Tools.h"
#include "Misc.h"
#include "game/Brush.h"
#include "Gravity.h"
#include "Elements.h"
#include "SimulationData.h"
#include "Sign.h"
#include "Particle.h"
#include "StorageClasses.h"
#include "Player.h"
#include "WallType.h"
#include "GOLMenu.h"
#include "MenuSection.h"
#include "client/GameSave.h"
#include "Sample.h"
#define CHANNELS ((int)(MAX_TEMP-73)/100+2)
class Element;
class SimTool;
class Brush;
struct SimulationSample;
struct matrix2d;
struct vector2d;
class Simulation;
class Renderer;
class Gravity;

View File

@ -7,6 +7,7 @@
#include "SimulationData.h"
//#include "ElementFunctions.h"
#include "ElementGraphics.h"
#include "Elements.h"
gol_menu * LoadGOLMenu(int & golMenuCount)
{

View File

@ -140,7 +140,7 @@
#define SIMULATIONDATA_H_
//#include "elements/NULLElement.h"
#include "Simulation.h"
//#include "Simulation.h"
/*class Simulation;
class Renderer;

View File

@ -9,6 +9,9 @@
#ifndef The_Powder_Toy_WallType_h
#define The_Powder_Toy_WallType_h
#include "graphics/Graphics.h"
class VideoBuffer;
struct wall_type
{
pixel colour;

7
tools
View File

@ -1,7 +0,0 @@
#include "ToolClasses.h"
std::vector<SimTool*> GetTools()
{
std::vector<SimTool*> tools;
return tools;
}

51799
turd.txt

File diff suppressed because one or more lines are too long