waf

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

wscript (2930B)


      1 #! /usr/bin/env python
      2 # encoding: utf-8
      3 
      4 from waflib import Task, TaskGen
      5 top = '.'
      6 out = 'build'
      7 APPNAME = 'TestProject'
      8 VERSION = '1.0'
      9 
     10 """
     11 To create the xcode project files:
     12   waf configure xcode6
     13 
     14 To configure and build using Waf:
     15   waf configure build
     16 
     17 This demo will create an XCode project containing
     18 an App bundle target, a dynamic library target,
     19 a static library target and an executable target.
     20 The generated XCode project can then be opened
     21 and XCode can then build those targets.
     22 Tested with XCode 8.
     23 
     24 """
     25 
     26 def options(opt):
     27 	opt.load('compiler_cxx xcode6')
     28 
     29 def configure(conf):
     30 
     31 	# Use environment variables to set default project configuration
     32 	# settings
     33 	conf.env.FRAMEWORK_VERSION = '1.0'
     34 	conf.env.ARCHS = 'x86_64'
     35 	conf.env.INSTALL_PATH = '/my/install/path'
     36 
     37 	# The xcode6 tool will also pick up any c config files generated by
     38 	# the c_config tool, and it'll be added to your project's include path
     39 	conf.load('c_config')
     40 	conf.define('NUMBER', 10)
     41 	conf.write_config_header('config.h')
     42 
     43 	# This must be called at the end of configure()
     44 	conf.load('compiler_cxx xcode6')
     45 
     46 	conf.env.append_value('CXXFLAGS', ['-O2'])
     47 
     48 	conf.check(cxxflags='-std=c++11', uselib_store='STD11', mandatory=False)
     49 
     50 def build(bld):
     51 
     52 	# Make .framework targets
     53 	tg = bld.framework(
     54 		includes='include',
     55 
     56 		# Source files
     57 		source=bld.path.ant_glob('src/MyLib/*.cpp'),
     58 
     59 		# If you don't want the source files to appear in a default
     60 		# 'Source' folder, you can define your own folder structure
     61 		# using a dictionary, where the key is the desired name of the folder
     62 		# and the value are the files.
     63 		group_files={
     64 			'Source files': bld.path.ant_glob('src/MyLib/*.cpp|*.m|*.mm'),
     65 			'Include': bld.path.ant_glob(incl=['include/MyLib/*.h'], dir=True),
     66 			'Help': ['src/sample.txt']
     67 		},
     68 
     69 		# If you want to ship your header files with your .framework, then
     70 		# specify them using the 'export_headers' param
     71 		export_headers=bld.path.ant_glob(incl=['include/MyLib/*.h', 'include/MyLib/SupportLib/*.h']),
     72 		target='MyLib',
     73 
     74 		# The 'install' param will set the INSTALL_PATH for the
     75 		# binary, and will also trigger XCode to copy the target to that
     76 		# path
     77 		install='~/Library/Frameworks'
     78 	)
     79 
     80 	# Make .a static library targets
     81 	bld.stlib(
     82 		source=bld.path.ant_glob('src/MyLib/*.cpp'),
     83                 includes = 'include',
     84 		target='MyStaticLib',
     85 	)
     86 
     87 	# Make standard executable target
     88 	bld.program(
     89 		source=['src/test.cpp'],
     90 		includes='include',
     91 		target='MyExe',
     92 		use='MyDynLib STD11'
     93 	)
     94 
     95 	# Make .dylib shared libraries
     96 	bld.shlib(
     97 		source=bld.path.ant_glob('src/MyLib/*.cpp'),
     98 		includes='include',
     99 		target='MyDynLib',
    100 	)
    101 
    102 	# Make an app bundle target
    103 	tg2 = bld.app(
    104 		source=bld.path.ant_glob('src/*.cpp'),
    105 		includes='include',
    106 		target='MyApp',
    107 		use='MyLib',
    108 		uselib='SDL2',
    109 		cxxflags='-DSOME_DEFINE',
    110 		framework='Cocoa',
    111 		# Override default setting in a target
    112 		settings={"Debug": {"CONFIG_NAME": 'Debug'}}
    113 	)