def run_wandbox_make(main_filepath, code, includes, implements, options): with Wandbox() as w: w.compiler('bash') woptions = create_option_list(options) if options.stdin: w.stdin(options.stdin) implements[os.path.basename(main_filepath)] = code colist = create_compiler_raw_option_list(options) colist.extend(expand_wandbox_options(w, options.compiler, woptions)) rolist = [] if options.runtime_option_raw: for opt in options.runtime_option_raw: rolist.extend(opt.split()) makefile = '#!/bin/make\n# generate makefile by iuwandbox.py\n' cxx = get_compiler_exec(options.compiler) if cxx is None: print('failed: invalid compiler...') sys.exit(1) makefile += '\nCXX=/opt/wandbox/' + options.compiler + '/bin/' + cxx makefile += '\nCXXFLAGS+=' for opt in colist: makefile += opt + ' ' makefile += '\nOBJS=' for filename in implements.keys(): makefile += os.path.splitext(filename)[0] + '.o ' makefile += '\n\ prog: $(OBJS)\n\ \t$(CXX) -o $@ $^ $(CXXFLAGS) $(LDFLAGS)\n\ ' implements['Makefile'] = makefile bashscript = 'make -j 4\n' bashscript += './prog ' for opt in rolist: bashscript += opt + ' ' bashscript += '\n' w.code(bashscript) if options.save: w.permanent_link(options.save) if options.verbose: w.dump() add_files(w, implements) add_files(w, includes) return run_wandbox_impl(w, options)
def run_wandbox_cxx(code, includes, implements, options): with Wandbox() as w: w.compiler(options.compiler) woptions = ','.join(create_option_list(options)) w.options(woptions) if options.stdin: w.stdin(options.stdin) colist = create_compiler_raw_option_list(options) if workaround: if options.compiler in ['clang-3.2']: colist.append('-ftemplate-depth=1024') # if options.compiler in ['clang-3.4']: # colist.append('-DIUTEST_HAS_HDR_CXXABI=0') # if options.compiler in ['clang-3.3', 'clang-3.2', 'clang-3.1', 'clang-3.0']: # colist.append('-Qunused-arguments') if 'boost-nothing' in woptions: if options.compiler in ['clang-3.4', 'clang-3.3']: colist.append('-fno-exceptions') colist.append('-fno-rtti') # if 'gcc' in options.compiler: # colist.append('-flarge-source-files') if colist: co = '\n'.join(colist) co = co.replace('\\n', '\n') w.compiler_options(co) if options.runtime_option_raw: rolist = [] for opt in options.runtime_option_raw: rolist.extend(opt.split()) ro = '\n'.join(rolist) ro = ro.replace('\\n', '\n') w.runtime_options(ro) if options.save: w.permanent_link(options.save) for filename in implements.keys(): w.add_compiler_options(filename) if options.verbose: w.dump() w.code(code) add_files(w, implements) add_files(w, includes) return run_wandbox_impl(w, options)
#!/usr/bin/env python # # wandbox-listup-compiler.py # import json from wandbox import Wandbox if __name__ == '__main__': w = Wandbox() r = w.get_compiler_list() for d in r: print('{0}: {1}'.format(d['language'], d['name']))