blob: 54d9386bec7fc11d61729474529bbd09570ea787 [file] [log] [blame]
Alexander Afanasyev8811b352013-01-02 12:51:15 -08001# -*- Mode: python; py-indent-offset: 4; indent-tabs-mode: nil; coding: utf-8; -*-
2#!/usr/bin/env python
3# encoding: utf-8
4# Alexander Afanasyev, 2013
5
6from waflib.Task import Task
7from waflib.TaskGen import extension
8
9"""
10A simple tool to integrate zeroc ICE into your build system.
11
12 def configure(conf):
13 conf.load('compiler_cxx cxx ice_cxx')
14
15 def build(bld):
16 bld(
17 features = 'cxx cxxprogram'
18 source = 'main.cpp file1.ice',
19 include = '.',
20 target = 'executable')
21
22"""
23
24class ice_cxx(Task):
25 run_str = '${SLICE2CPP} --header-ext ice.h --source-ext ice.cc --output-dir ${SRC[0].parent.get_bld().abspath()} ${SRC[0].abspath()}'
26 color = 'BLUE'
27 ext_out = ['.ice.h', '.ice.cc']
28
29@extension('.ice')
30def process_protoc(self, node):
31 cpp_node = node.change_ext('.ice.cc')
32 hpp_node = node.change_ext('.ice.h')
33 self.create_task('ice_cxx', node, [cpp_node, hpp_node])
34 self.source.append(cpp_node)
35
36 use = getattr(self, 'use', '')
37 if not 'ICE' in use:
38 self.use = self.to_list(use) + ['ICE']
39
40ICE_PATHS = ['/usr', '/usr/local', '/opt/local', '/sw']
41
42def options(opt):
43 opt.add_option('--ice',action='store',dest='ICE_PATH',help='''path to ZeroC installation''')
44
45
46def configure(conf):
47 # conf.check_cfg(package="", uselib_store="PROTOBUF", args=['--cflags', '--libs'])
48 if conf.options.ICE_PATH:
49 conf.find_program('slice2cpp', var='SLICE2CPP', path_list="%s/bin" % conf.options.ICE_PATH, mandatory=True)
50 else:
51 conf.find_program('slice2cpp', var='SLICE2CPP', path_list=["%s/bin" % path for path in ICE_PATHS], mandatory=True)
52
53 conf.env['LIB_ICE'] = ["ZeroCIce", "IceUtil"]
54 # self.env['LIBPATH_ICE'] = ""
55 # self.env['CXXFLAGS_ICE'] = ""
56
57