1# Copyright (c) 2005 Alexey Pakhunov.
2# Copyright (c) 2011 Juraj Ivancic
3#
4# Use, modification and distribution is subject to the Boost Software
5# License Version 1.0. (See accompanying file LICENSE_1_0.txt or
6# http://www.boost.org/LICENSE_1_0.txt)
7
8#  Support for Microsoft message compiler tool.
9#  Notes:
10#  - there's just message compiler tool, there's no tool for
11#    extracting message strings from sources
12#  - This file allows to use Microsoft message compiler
13#    with any toolset. In msvc.jam, there's more specific
14#    message compiling action.
15
16import bjam
17
18from b2.tools import common, rc
19from b2.build import generators, type
20from b2.build.toolset import flags
21from b2.build.feature import feature
22from b2.manager import get_manager
23
24def init():
25    pass
26
27type.register('MC', ['mc'])
28
29
30# Command line options
31feature('mc-input-encoding', ['ansi', 'unicode'], ['free'])
32feature('mc-output-encoding', ['unicode', 'ansi'], ['free'])
33feature('mc-set-customer-bit', ['no', 'yes'], ['free'])
34
35flags('mc.compile', 'MCFLAGS', ['<mc-input-encoding>ansi'], ['-a'])
36flags('mc.compile', 'MCFLAGS', ['<mc-input-encoding>unicode'], ['-u'])
37flags('mc.compile', 'MCFLAGS', ['<mc-output-encoding>ansi'], ['-A'])
38flags('mc.compile', 'MCFLAGS', ['<mc-output-encoding>unicode'], ['-U'])
39flags('mc.compile', 'MCFLAGS', ['<mc-set-customer-bit>no'], [])
40flags('mc.compile', 'MCFLAGS', ['<mc-set-customer-bit>yes'], ['-c'])
41
42generators.register_standard('mc.compile', ['MC'], ['H', 'RC'])
43
44get_manager().engine().register_action(
45    'mc.compile',
46    'mc $(MCFLAGS) -h "$(<[1]:DW)" -r "$(<[2]:DW)" "$(>:W)"')
47