5 "This hook is called when the class cpp/cc task generator encounters a '.rc' file: X{.rc -> [.res|.rc.o]}"
9 from Utils
import quote_whitespace
10 from TaskGen
import extension
14 winrc_str
= '${WINRC} ${_CPPDEFFLAGS} ${_CCDEFFLAGS} ${WINRCFLAGS} ${_CPPINCFLAGS} ${_CCINCFLAGS} ${WINRC_TGT_F} ${TGT} ${WINRC_SRC_F} ${SRC}'
17 def rc_file(self
, node
):
19 if self
.env
['WINRC_TGT_F'] == '/fo': obj_ext
= '.res'
21 rctask
= self
.create_task('winrc', node
, node
.change_ext(obj_ext
))
22 self
.compiled_tasks
.append(rctask
)
24 # create our action, for use with rc file
25 Task
.simple_task_type('winrc', winrc_str
, color
='BLUE', before
='cc cxx', shell
=False)
31 v
['WINRC_TGT_F'] = '-o'
32 v
['WINRC_SRC_F'] = '-i'
35 if v
['CC_NAME'] in ['gcc', 'cc', 'g++', 'c++']:
36 winrc
= conf
.find_program('windres', var
='WINRC', path_list
= v
['PATH'])
37 elif v
['CC_NAME'] == 'msvc':
38 winrc
= conf
.find_program('RC', var
='WINRC', path_list
= v
['PATH'])
39 v
['WINRC_TGT_F'] = '/fo'
42 conf
.fatal('winrc was not found!')