diff options
-rw-r--r-- | SConstruct | 21 | ||||
-rw-r--r-- | site_scons/site_tools/gch.py | 112 |
2 files changed, 1 insertions, 132 deletions
diff --git a/SConstruct b/SConstruct index 694c6a60ced..a5ef72f4bc3 100644 --- a/SConstruct +++ b/SConstruct @@ -268,7 +268,6 @@ add_option( "llvm-symbolizer", "name of (or path to) the LLVM symbolizer", 1, Fa add_option( "durableDefaultOn" , "have durable default to on" , 0 , True ) add_option( "durableDefaultOff" , "have durable default to off" , 0 , True ) -add_option( "pch" , "use precompiled headers to speed up the build (experimental)" , 0 , True , "usePCH" ) add_option( "distcc" , "use distcc for distributing builds" , 0 , False ) # debugging/profiling help @@ -522,8 +521,6 @@ usev8 = (jsEngine != 'none') v8version = jsEngine[3:] if jsEngine.startswith('v8-') else 'none' v8suffix = '' if v8version == '3.12' else '-' + v8version -usePCH = has_option( "usePCH" ) - # The Scons 'default' tool enables a lot of tools that we don't actually need to enable. # On platforms like Solaris, it actually does the wrong thing by enabling the sunstudio # toolchain first. As such it is simpler and more efficient to manually load the precise @@ -543,7 +540,7 @@ def decide_platform_tools(): else: return ["default"] -tools = decide_platform_tools() + ["gch", "jsheader", "mergelib", "mongo_unittest", "textfile"] +tools = decide_platform_tools() + ["jsheader", "mergelib", "mongo_unittest", "textfile"] # We defer building the env until we have determined whether we want certain values. Some values # in the env actually have semantics for 'None' that differ from being absent, so it is better @@ -1411,22 +1408,6 @@ def doConfigure(myenv): wiredtiger = False conf.Finish() - # Enable PCH if we are on using gcc or clang and the 'Gch' tool is enabled. Otherwise, - # remove any pre-compiled header since the compiler may try to use it if it exists. - if usePCH and (using_gcc() or using_clang()): - if 'Gch' in dir( myenv ): - if using_clang(): - # clang++ uses pch.h.pch rather than pch.h.gch - myenv['GCHSUFFIX'] = '.pch' - # clang++ only uses pch from command line - myenv.Prepend( CXXFLAGS=['-include pch.h'] ) - myenv['Gch'] = myenv.Gch( "$BUILD_DIR/mongo/pch.h$GCHSUFFIX", - "src/mongo/pch.h" )[0] - myenv['GchSh'] = myenv[ 'Gch' ] - elif os.path.exists( myenv.File("$BUILD_DIR/mongo/pch.h$GCHSUFFIX").abspath ): - print( "removing precompiled headers" ) - os.unlink( myenv.File("$BUILD_DIR/mongo/pch.h.$GCHSUFFIX").abspath ) - def AddFlagIfSupported(env, tool, extension, flag, **mutation): def CheckFlagTest(context, tool, extension, flag): test_body = "" diff --git a/site_scons/site_tools/gch.py b/site_scons/site_tools/gch.py deleted file mode 100644 index 8db5403ffcc..00000000000 --- a/site_scons/site_tools/gch.py +++ /dev/null @@ -1,112 +0,0 @@ -# $Id$ -# -# 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. - -# $Revision$ -# $LastChangedRevision$ -# $LastChangedDate$ -# $LastChangedBy$ - -import SCons.Action -import SCons.Builder -import SCons.Scanner.C -import SCons.Util -import SCons.Script - -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'] - -def header_path(env, node): - assert len(node.sources) == 1 - path = node.sources[0].path - return path - -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 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.has_key('Gch') and env['Gch']: - if header_path(env, env['Gch']) in [x.path for x in deps]: - 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.has_key('GchSh') and env['GchSh']: - if header_path(env, env['GchSh']) in [x.path for x in deps]: - 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 -o $TARGET -x c++-header -c $CXXFLAGS $_CCCOMCOM $SOURCE' - env['GCHSHCOM'] = '$CXX -o $TARGET -x c++-header -c $SHCXXFLAGS $_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++') |