support multiple inputs to emcc -E
This commit is contained in:
Родитель
b57ccfef1a
Коммит
d1404ba742
13
emcc
13
emcc
|
@ -1067,9 +1067,9 @@ try:
|
|||
debug_level = 4
|
||||
|
||||
# Bitcode args generation code
|
||||
def get_bitcode_args(input_file):
|
||||
file_ending = filename_type_ending(input_file)
|
||||
args = [call] + newargs + [input_file]
|
||||
def get_bitcode_args(input_files):
|
||||
file_ending = filename_type_ending(input_files[0])
|
||||
args = [call] + newargs + input_files
|
||||
if file_ending.endswith(CXX_ENDINGS):
|
||||
args += shared.EMSDK_CXX_OPTS
|
||||
args = system_libs.process_args(args, shared.Settings)
|
||||
|
@ -1077,9 +1077,8 @@ try:
|
|||
|
||||
# -E preprocessor-only support
|
||||
if '-E' in newargs:
|
||||
assert len(input_files) == 1
|
||||
input_file = input_files[0][1]
|
||||
cmd = get_bitcode_args(input_file)
|
||||
input_files = map(lambda x: x[1], input_files)
|
||||
cmd = get_bitcode_args(input_files)
|
||||
logging.debug('just preprocessor ' + ' '.join(cmd))
|
||||
exit(subprocess.call(cmd))
|
||||
|
||||
|
@ -1090,7 +1089,7 @@ try:
|
|||
logging.debug('compiling source file: ' + input_file)
|
||||
output_file = get_bitcode_file(input_file)
|
||||
temp_files.append((i, output_file))
|
||||
args = get_bitcode_args(input_file) + ['-emit-llvm', '-c', '-o', output_file]
|
||||
args = get_bitcode_args([input_file]) + ['-emit-llvm', '-c', '-o', output_file]
|
||||
logging.debug("running: " + ' '.join(args))
|
||||
execute(args) # let compiler frontend print directly, so colors are saved (PIPE kills that)
|
||||
if not os.path.exists(output_file):
|
||||
|
|
|
@ -3517,8 +3517,12 @@ tiny: %d
|
|||
open('src.cpp', 'w').write(r'''#include <emscripten.h>
|
||||
EMSCRIPTEN_KEEPALIVE __EMSCRIPTEN_major__ __EMSCRIPTEN_minor__ __EMSCRIPTEN_tiny__ EMSCRIPTEN_KEEPALIVE
|
||||
''')
|
||||
out = Popen([PYTHON, EMCC, 'src.cpp', '-E'], stdout=PIPE).communicate()[0]
|
||||
def test(args=[]):
|
||||
print args
|
||||
out = Popen([PYTHON, EMCC, 'src.cpp', '-E'] + args, stdout=PIPE).communicate()[0]
|
||||
self.assertContained(r'''__attribute__((used)) %d %d %d __attribute__((used))''' % (EMSCRIPTEN_VERSION_MAJOR, EMSCRIPTEN_VERSION_MINOR, EMSCRIPTEN_VERSION_TINY), out)
|
||||
test()
|
||||
test(['--bind'])
|
||||
|
||||
def test_dashE_consistent(self): # issue #3365
|
||||
normal = Popen([PYTHON, EMXX, '-v', '-Wno-warn-absolute-paths', path_from_root('tests', 'hello_world.cpp'), '-c'], stdout=PIPE, stderr=PIPE).communicate()[1]
|
||||
|
|
Загрузка…
Ссылка в новой задаче