wscript 1.5 KB

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