1#!/usr/local/bin/python3.8 2 3# Copyright 2003, 2004, 2005 Vladimir Prus 4# Distributed under the Boost Software License, Version 1.0. 5# (See accompanying file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt) 6 7# Attempt to declare a generator for creating OBJ from RC files. That generator 8# should be considered together with standard CPP->OBJ generators and 9# successfully create the target. Since we do not have a RC compiler everywhere, 10# we fake the action. The resulting OBJ will be unusable, but it must be 11# created. 12 13import BoostBuild 14 15t = BoostBuild.Tester() 16 17t.write("jamroot.jam", """ 18import rcc ; 19""") 20 21t.write("rcc.jam", """ 22import type ; 23import generators ; 24import print ; 25 26# Use 'RCC' to avoid conflicts with definitions in the standard rc.jam and 27# msvc.jam 28type.register RCC : rcc ; 29 30rule resource-compile ( targets * : sources * : properties * ) 31{ 32 print.output $(targets[1]) ; 33 print.text "rc-object" ; 34} 35 36generators.register-standard rcc.resource-compile : RCC : OBJ ; 37""") 38 39t.write("rcc.py", """ 40import b2.build.type as type 41import b2.build.generators as generators 42 43from b2.manager import get_manager 44 45# Use 'RCC' to avoid conflicts with definitions in the standard rc.jam and 46# msvc.jam 47type.register('RCC', ['rcc']) 48 49generators.register_standard("rcc.resource-compile", ["RCC"], ["OBJ"]) 50 51get_manager().engine().register_action( 52 "rcc.resource-compile", 53 '@($(STDOUT):E=rc-object) > "$(<)"') 54""") 55 56t.write("jamfile.jam", """ 57obj r : r.rcc ; 58""") 59 60t.write("r.rcc", """ 61""") 62 63t.run_build_system() 64t.expect_content("bin/r.obj", "rc-object") 65 66t.cleanup() 67