blob: 9a6c4bf4431ec18e87c7d8ed82b538bf787332b9 [file] [log] [blame]
Alexander Afanasyevb6392e32014-05-12 23:43:50 -07001# -*- Mode: python; py-indent-offset: 4; indent-tabs-mode: nil; coding: utf-8; -*-
2
3from waflib import Logs, Utils, Task, TaskGen
4
5top = '..'
6
7def configure(conf):
8
9 conf.find_program('ibtool', var='IBTOOL', mandatory=False)
10
11 conf.check_cxx(framework_name='Foundation', uselib_store='FOUNDATION',
12 compile_filename='test.mm')
13 conf.check_cxx(framework_name='AppKit', uselib_store='APPKIT',
14 compile_filename='test.mm')
15 conf.check_cxx(framework_name='Cocoa', uselib_store='COCOA',
16 compile_filename='test.mm')
17
18 conf.env.ARCH_OSX = 'x86_64'
19 conf.env.CXXFLAGS_OSX += ['-fobjc-arc', '-mmacosx-version-min=10.7']
20 conf.env.LINKFLAGS_OSX += ['-mmacosx-version-min=10.7']
21 conf.env.MACOSX_DEPLOYMENT_TARGET = '10.7'
22
23 conf.load('sparkle')
24
25def build(bld):
26 bld(
27 target = "../NFD Control Center",
28 features=['cxxprogram', 'cxx'],
29 includes = ".. .",
30 source = bld.path.ant_glob(['**/*.mm', 'MainMenu.xib']),
31
32 mac_app = True,
33 use = "OSX COCOA FOUNDATION APPKIT SPARKLE",
34
35 mac_plist = 'Info.plist',
36 mac_resources = [i.path_from(bld.path) for i in bld.path.ant_glob('Resources/**/*')],
37 mac_frameworks = "Frameworks/Sparkle.framework",
38 )
39
40from waflib import TaskGen
41@TaskGen.extension('.mm')
42def m_hook(self, node):
43 """Alias .mm files to be compiled the same as .cc files, gcc/clang will do the right thing."""
44 return self.create_compiled_task('cxx', node)
45
46@TaskGen.extension('.m')
47def m_hook(self, node):
48 """Alias .m files to be compiled the same as .c files, gcc/clang will do the right thing."""
49 return self.create_compiled_task('c', node)
50
51
52def bundle_name_for_output(name):
53 return "%s.app" % name
54 # k = name.rfind('.')
55 # if k >= 0:
56 # name = name[:k] + '.app'
57 # else:
58 # name = name + '.app'
59 # return name
60
61@TaskGen.extension('.xib')
62def xib(self,node):
63 out = node.change_ext('.nib')
64
65 name = self.path.get_bld().find_or_declare(bundle_name_for_output(self.target))
66 resources = name.find_or_declare(['Contents', 'Resources'])
67 resources.mkdir()
68 real_out = resources.make_node(out.name)
69
70 self.create_task('xib', node, real_out)
71 inst_to = getattr(self, 'install_path', '/Applications') + '/%s/Contents/Resources' % name
72 self.bld.install_as(inst_to + '/%s' % real_out.name, real_out)
73
74class xib(Task.Task):
75 color='PINK'
76 run_str = '${IBTOOL} --errors --warnings --notices --output-format human-readable-text --compile ${TGT} ${SRC}'