support -o with precompiled headers; fixes #2320

This commit is contained in:
Alon Zakai 2014-04-29 14:45:40 -07:00
Родитель 9e8d324014
Коммит d5cf59ac87
2 изменённых файлов: 8 добавлений и 1 удалений

4
emcc
Просмотреть файл

@ -1366,7 +1366,9 @@ try:
for header in input_files:
assert header.endswith(HEADER_ENDINGS), 'if you have one header input, we assume you want to precompile headers, and cannot have source files or other inputs as well: ' + str(input_files) + ' : ' + header
args = newargs + shared.EMSDK_CXX_OPTS + input_files
logging.debug("running (for precompiled headers: " + call + ' ' + ' '.join(args))
if specified_target:
args += ['-o', specified_target]
logging.debug("running (for precompiled headers): " + call + ' ' + ' '.join(args))
execute([call] + args) # let compiler frontend print directly, so colors are saved (PIPE kills that)
sys.exit(1)

Просмотреть файл

@ -2380,6 +2380,11 @@ int main() {
err = Popen([PYTHON, EMCC, 'src.cpp', '-include', 'header.h', '-Xclang', '-print-stats'], stderr=PIPE).communicate()
assert '*** PCH/Modules Loaded:\nModule: header.h.gch' not in err[1], err[1]
# with specified target via -o
try_delete('header.h.gch')
Popen([PYTHON, EMCC, '-xc++-header', 'header.h', '-o', 'my.gch']).communicate()
assert os.path.exists('my.gch')
def test_warn_unaligned(self):
if os.environ.get('EMCC_FAST_COMPILER') == '0': return self.skip('need fastcomp')
open('src.cpp', 'w').write(r'''