waf

FORK: waf with some random patches
git clone https://git.neptards.moe/neptards/waf.git
Log | Files | Refs | README

wscript (1412B)


      1 #! /usr/bin/env python
      2 # encoding: utf-8
      3 # Thomas Nagy, 2006 (ita)
      4 
      5 """
      6 Note: the #warning will come once when the .h is compiled, it should not not come when the .cpp is compiled when precompiled headers are enabled
      7 
      8 Compare:
      9    waf configure clean build
     10 and
     11    waf configure clean build --without-pch
     12 """
     13 
     14 VERSION='0.0.2'
     15 APPNAME='pch_test'
     16 
     17 top = '.'
     18 out = 'build'
     19 
     20 from waflib import Errors
     21 
     22 # to include <boost/asio.hpp> to slow down compilation of precompiled headers
     23 LOAD_BOOST = False
     24 
     25 def options(opt):
     26 	opt.load('compiler_cxx')
     27 	opt.load('pch')
     28 	if LOAD_BOOST:
     29 		opt.load('boost', mt=True)
     30 
     31 def configure(conf):
     32 	conf.load('compiler_cxx pch')
     33 	if LOAD_BOOST:
     34 		conf.load('boost')
     35 		conf.check_boost('thread system', mt=True)
     36 		#conf.env.append_value('LIB_BOOST', 'pthread') #?
     37 		conf.env.append_value('DEFINES_BOOST', ['HAS_MY_BOOST=1'])
     38 
     39 def build(bld):
     40 	# Simple way, when precompiled header is used in a single build task
     41 	bld.program(
     42 		target = 'test',
     43 		features = 'pch',
     44 		source = 'a.cpp b.cpp c.cpp main.cpp',
     45 		headers = 'a.h b.h c.h',
     46 		use = 'BOOST')
     47 
     48 	# More complex way, where precompiled header is reused by several build tasks
     49 	bld(features ='cxx pch',
     50 		name = 'base-with-pch',
     51 		target = 'pch-header',
     52 		headers = 'a.h b.h c.h',
     53 		source = 'a.cpp',
     54 		use = 'BOOST')
     55 
     56 	bld(features = 'cxx cxxprogram',
     57 		target = 'test1',
     58 		source = 'b.cpp c.cpp main.cpp',
     59 		use    = 'base-with-pch')