Skip to content

Commit f550389

Browse files
committed
enable precompiled headers with g++
The original author of gch.py didn't understand how str.strip worked
1 parent b0b5a0c commit f550389

File tree

2 files changed

+6
-5
lines changed

2 files changed

+6
-5
lines changed

SConstruct

+1-3
Original file line numberDiff line numberDiff line change
@@ -751,11 +751,9 @@ if nix:
751751
env.Append( CPPDEFINES=["USE_GDBSERVER"] )
752752

753753
# pre-compiled headers
754-
if False and 'Gch' in dir( env ):
754+
if 'Gch' in dir( env ):
755755
print( "using precompiled headers" )
756756
env['Gch'] = env.Gch( [ "pch.h" ] )[0]
757-
#Depends( "pch.o" , "pch.h.gch" )
758-
#SideEffect( "dummyGCHSideEffect" , "pch.h.gch" )
759757

760758
if usev8:
761759
env.Append( CPPPATH=["../v8/include/"] )

gch.py

+5-2
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,9 @@
3737
def gen_suffix(env, sources):
3838
return sources[0].get_suffix() + env['GCHSUFFIX']
3939

40+
def header_path(node):
41+
path = node.path
42+
return path[:-4] # strip final '.gch'
4043

4144
GchShBuilder = SCons.Builder.Builder(action = GchShAction,
4245
source_scanner = SCons.Scanner.C.CScanner(),
@@ -54,7 +57,7 @@ def static_pch_emitter(target,source,env):
5457
deps = scanner(source[0], env, path)
5558

5659
if env.has_key('Gch') and env['Gch']:
57-
if env['Gch'].path.strip('.gch') in [x.path for x in deps]:
60+
if header_path(env['Gch']) in [x.path for x in deps]:
5861
env.Depends(target, env['Gch'])
5962

6063
return (target, source)
@@ -67,7 +70,7 @@ def shared_pch_emitter(target,source,env):
6770
deps = scanner(source[0], env, path)
6871

6972
if env.has_key('GchSh') and env['GchSh']:
70-
if env['GchSh'].path.strip('.gch') in [x.path for x in deps]:
73+
if header_path(env['GchSh']) in [x.path for x in deps]:
7174
env.Depends(target, env['GchSh'])
7275
return (target, source)
7376

0 commit comments

Comments
 (0)