blob: a876fb88e0babe836203a4cdecfcfc12a667d3e4 [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
Alexander Afanasyevf2890632013-01-02 13:40:02 -08008from waflib import Logs
9from waflib import Node
Alexander Afanasyev8811b352013-01-02 12:51:15 -080010
11"""
12A simple tool to integrate zeroc ICE into your build system.
13
14 def configure(conf):
15 conf.load('compiler_cxx cxx ice_cxx')
16
17 def build(bld):
18 bld(
19 features = 'cxx cxxprogram'
20 source = 'main.cpp file1.ice',
21 include = '.',
22 target = 'executable')
23
24"""
25
26class ice_cxx(Task):
27 run_str = '${SLICE2CPP} --header-ext ice.h --source-ext ice.cc --output-dir ${SRC[0].parent.get_bld().abspath()} ${SRC[0].abspath()}'
28 color = 'BLUE'
29 ext_out = ['.ice.h', '.ice.cc']
30
31@extension('.ice')
32def process_protoc(self, node):
33 cpp_node = node.change_ext('.ice.cc')
34 hpp_node = node.change_ext('.ice.h')
35 self.create_task('ice_cxx', node, [cpp_node, hpp_node])
36 self.source.append(cpp_node)
37
38 use = getattr(self, 'use', '')
39 if not 'ICE' in use:
40 self.use = self.to_list(use) + ['ICE']
41
42ICE_PATHS = ['/usr', '/usr/local', '/opt/local', '/sw']
43
44def options(opt):
45 opt.add_option('--ice',action='store',dest='ICE_PATH',help='''path to ZeroC installation''')
46
47
48def configure(conf):
49 # conf.check_cfg(package="", uselib_store="PROTOBUF", args=['--cflags', '--libs'])
50 if conf.options.ICE_PATH:
51 conf.find_program('slice2cpp', var='SLICE2CPP', path_list="%s/bin" % conf.options.ICE_PATH, mandatory=True)
52 else:
53 conf.find_program('slice2cpp', var='SLICE2CPP', path_list=["%s/bin" % path for path in ICE_PATHS], mandatory=True)
54
Alexander Afanasyevf2890632013-01-02 13:40:02 -080055 ICE_PATH = conf.env.SLICE2CPP[:-14]
56
57 conf.env['LIB_ICE'] = ["Ice", "ZeroCIce", "IceUtil"]
58 conf.env['INCLUDES_ICE']= '%s/include' % ICE_PATH
59 conf.env['LIBPATH_ICE'] = '%s/lib' % ICE_PATH
Alexander Afanasyev8811b352013-01-02 12:51:15 -080060