wscript (1515B)
1 #! /usr/bin/env python 2 # encoding: utf-8 3 # Chris Pickel, 2011 4 5 VERSION='0.0.1' 6 APPNAME='mac_app_test' 7 8 top = '.' 9 out = 'build' 10 11 def options(opt): 12 opt.load('compiler_c') 13 try: 14 # you must include the xcode generator in your waf file if you want to use it 15 opt.load('xcode') 16 except ImportError: 17 pass 18 19 def configure(conf): 20 conf.load('compiler_c') 21 if not conf.env.ARCH_ST: 22 conf.fatal('This example is for macs only') 23 conf.env.FRAMEWORK_COCOA = 'Cocoa' 24 conf.env.ARCH_COCOA = ['x86_64', 'arm64'] 25 26 def build(bld): 27 bld.program( 28 features = 'c cprogram', 29 target = 'MacApp', 30 source = 'sources/main.m', 31 mac_app = True, 32 mac_plist = 'Info.plist', 33 mac_files = bld.path.ant_glob('resources/**'), 34 mac_files_root = 'resources', 35 use = 'COCOA', 36 install_path = '${PREFIX}', 37 ) 38 39 return 40 # obscure iphone stuff 41 42 bld.env.LIPO = '/usr/bin/lipo' 43 ARCH = {'arm6':'arm6', 'cocoa': ['i386', 'x64']} 44 for arch, val in ARCH.items(): 45 bld.env.ARCH = val 46 bld(source='sources/dump_sbpl.c', target='%s/dump_sbpl' % arch, features='c cprogram') 47 48 bld(rule='touch ${TGT} # ${LIPO} -create ${SRC} -output ${TGT}', 49 shell = True, 50 target = 'dump_sbpl.app/dump_sbpl', 51 source = ['%s/dump_sbpl' % x for x in ARCH.keys()] 52 ) 53 54 from waflib import TaskGen 55 @TaskGen.extension('.m') 56 def m_hook(self, node): 57 """Alias .m files to be compiled the same as .c files, gcc will do the right thing.""" 58 return self.create_compiled_task('c', node) 59 60 # -*- indent-tabs-mode: t -*-