Sophie

Sophie

distrib > Mandriva > 2009.1 > x86_64 > media > contrib-backports > by-pkgid > 5449138d6297d4beefc46ffe46a8c51a > files > 265

waf-1.5.11-1mdv2009.1.noarch.rpm

#! /usr/bin/env python
# encoding: utf-8
# Thomas Nagy, 2006 (ita)

"""
for some obscure reason, the precompiled header will not be taken if
all.h is in the same directory as main.cpp
we recommend to add the header to compile in a separate directory without any sources

Note: the #warning will come once when the .h is compiled, it will not come when the .cpp is compiled
"""

from TaskGen import feature, after
import Task, ccroot

@feature('cxx')
@after('apply_link')
def process_pch(self):
	if getattr(self, 'pch', ''):
		node = self.path.find_resource(self.pch)
		if not node:
			print ("not a valid header !")
			return
		self.create_task('gchx', node, node.change_ext('.gch'))

comp_line = '${CXX} ${CXXFLAGS} ${CPPFLAGS} ${_CXXINCFLAGS} ${_CXXDEFFLAGS} ${SRC} -o ${TGT}'
cls = Task.simple_task_type('gchx', comp_line, before='cc cxx')
cls.scan = ccroot.scan

def build(bld):
	bld(
		features = 'cxx cprogram',
		source = 'main.cpp',
		includes = '. subdir',
		target = 'test',
		pch = 'subdir/all.h')

def configure(conf):
	conf.check_tool('g++')

def set_options(opt):
	pass

VERSION='0.0.1'
APPNAME='pch_test'

srcdir = '.'
blddir = 'build'