当前位置: 首页>>代码示例>>Python>>正文


Python shared.path_from_root函数代码示例

本文整理汇总了Python中shared.path_from_root函数的典型用法代码示例。如果您正苦于以下问题:Python path_from_root函数的具体用法?Python path_from_root怎么用?Python path_from_root使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了path_from_root函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: build_libc

 def build_libc(lib_filename, files):
     o_s = []
     prev_cxx = os.environ.get("EMMAKEN_CXX")
     if prev_cxx:
         os.environ["EMMAKEN_CXX"] = ""
     musl_internal_includes = shared.path_from_root("system", "lib", "libc", "musl", "src", "internal")
     for src in files:
         o = in_temp(os.path.basename(src) + ".o")
         execute(
             [
                 shared.PYTHON,
                 shared.EMCC,
                 shared.path_from_root("system", "lib", src),
                 "-o",
                 o,
                 "-I",
                 musl_internal_includes,
             ]
             + lib_opts,
             stdout=stdout,
             stderr=stderr,
         )
         o_s.append(o)
     if prev_cxx:
         os.environ["EMMAKEN_CXX"] = prev_cxx
     shared.Building.link(o_s, in_temp(lib_filename))
     return in_temp(lib_filename)
开发者ID:prixeus,项目名称:emscripten,代码行数:27,代码来源:system_libs.py

示例2: create_wasm_compiler_rt

 def create_wasm_compiler_rt(libname):
   srcdir = shared.path_from_root('system', 'lib', 'compiler-rt', 'lib', 'builtins')
   filenames = ['addtf3.c', 'ashlti3.c', 'ashrti3.c', 'comparetf2.c', 'divtf3.c', 'divti3.c', 'udivmodti4.c',
                'extenddftf2.c', 'extendsftf2.c',
                'fixdfti.c', 'fixsfti.c', 'fixtfdi.c', 'fixtfsi.c', 'fixtfti.c',
                'fixunsdfti.c', 'fixunssfti.c', 'fixunstfdi.c', 'fixunstfsi.c', 'fixunstfti.c',
                'floatditf.c', 'floatsitf.c', 'floattidf.c', 'floattisf.c',
                'floatunditf.c', 'floatunsitf.c', 'floatuntidf.c', 'floatuntisf.c', 'lshrti3.c',
                'modti3.c', 'multf3.c', 'multi3.c', 'subtf3.c', 'udivti3.c', 'umodti3.c', 'ashrdi3.c',
                'ashldi3.c', 'fixdfdi.c', 'floatdidf.c', 'lshrdi3.c', 'moddi3.c',
                'trunctfdf2.c', 'trunctfsf2.c', 'umoddi3.c', 'fixunsdfdi.c', 'muldi3.c',
                'divdi3.c', 'divmoddi4.c', 'udivdi3.c', 'udivmoddi4.c']
   files = (os.path.join(srcdir, f) for f in filenames)
   o_s = []
   commands = []
   for src in files:
     o = in_temp(os.path.basename(src) + '.o')
     # Use clang directly instead of emcc. Since emcc's intermediate format (produced by -S) is LLVM IR, there's no way to
     # get emcc to output wasm .s files, which is what we archive in compiler_rt.
     commands.append([shared.CLANG_CC, '--target=wasm32', '-S', shared.path_from_root('system', 'lib', src), '-O2', '-o', o] + shared.EMSDK_OPTS)
     o_s.append(o)
   run_commands(commands)
   lib = in_temp(libname)
   run_commands([[shared.LLVM_AR, 'cr', '-format=gnu', lib] + o_s])
   return lib
开发者ID:ProgArt,项目名称:WebAssembly_emscripten,代码行数:25,代码来源:system_libs.py

示例3: create_wasm_libc

  def create_wasm_libc(libname):
    # in asm.js we just use Math.sin etc., which is good for code size. But wasm doesn't have such builtins, so
    # we need to bundle in more code
    # we also build in musl versions of things that we have hand-optimized asm.js for
    files = ([shared.path_from_root('system', 'lib', 'libc', 'musl', 'src', 'math', x) for x in ('cos.c', 'cosf.c', 'cosl.c', 'sin.c', 'sinf.c', 'sinl.c', 'tan.c', 'tanf.c', 'tanl.c', 'acos.c', 'acosf.c', 'acosl.c', 'asin.c', 'asinf.c', 'asinl.c', 'atan.c', 'atanf.c', 'atanl.c', 'atan2.c', 'atan2f.c', 'atan2l.c', 'exp.c', 'expf.c', 'expl.c', 'log.c', 'logf.c', 'logl.c', 'pow.c', 'powf.c', 'powl.c')] +
             [shared.path_from_root('system', 'lib', 'libc', 'musl', 'src', 'string', x) for x in ('memcpy.c', 'memset.c', 'memmove.c')])

    return build_libc(libname, files, ['-O2'])
开发者ID:ProgArt,项目名称:WebAssembly_emscripten,代码行数:8,代码来源:system_libs.py

示例4: create_dlmalloc_split

 def create_dlmalloc_split(libname):
   dlmalloc_o = in_temp('dl' + libname)
   check_call([shared.PYTHON, shared.EMCC, shared.path_from_root('system', 'lib', 'dlmalloc.c'), '-o', dlmalloc_o, '-O2', '-DMSPACES', '-DONLY_MSPACES'])
   split_malloc_o = in_temp('sm' + libname)
   check_call([shared.PYTHON, shared.EMCC, shared.path_from_root('system', 'lib', 'split_malloc.cpp'), '-o', split_malloc_o, '-O2'])
   lib = in_temp(libname)
   shared.Building.link([dlmalloc_o, split_malloc_o], lib)
   return lib
开发者ID:AmesianX,项目名称:emscripten,代码行数:8,代码来源:system_libs.py

示例5: create_load_wasm_worker

def create_load_wasm_worker():
  emscripten.logging.debug('building load-wasm-worker')
  output = emscripten.Cache.get_path('load-wasm-worker.js')
  emscripten.try_delete(output)
  check_call([PYTHON, emscripten.EMCC, emscripten.path_from_root('third_party', 'wasm-polyfill', 'src', 'unpack.cpp'),
                      emscripten.path_from_root('tools', 'optimizer', 'parser.cpp'),
                      '-o', output] + \
                      '-O3 -std=c++11 --memory-init-file 0 --llvm-lto 1 -s TOTAL_MEMORY=67108864 -s WASM=0'.split(' '))
  assert os.path.exists(output)
  open(output, 'a').write(open(emscripten.path_from_root('third_party', 'wasm-polyfill', 'src', 'load-wasm-worker.js')).read())
  return output
开发者ID:4ian,项目名称:emscripten,代码行数:11,代码来源:wasmator.py

示例6: build_libc

 def build_libc(lib_filename, files):
   o_s = []
   prev_cxx = os.environ.get('EMMAKEN_CXX')
   if prev_cxx: os.environ['EMMAKEN_CXX'] = ''
   musl_internal_includes = ['-I', shared.path_from_root('system', 'lib', 'libc', 'musl', 'src', 'internal'), '-I', shared.path_from_root('system', 'lib', 'libc', 'musl', 'arch', 'js')]
   for src in files:
     o = in_temp(os.path.basename(src) + '.o')
     execute([shared.PYTHON, shared.EMCC, shared.path_from_root('system', 'lib', src), '-o', o] + musl_internal_includes + lib_opts, stdout=stdout, stderr=stderr)
     o_s.append(o)
   if prev_cxx: os.environ['EMMAKEN_CXX'] = prev_cxx
   shared.Building.link(o_s, in_temp(lib_filename))
   return in_temp(lib_filename)
开发者ID:AdrienCog,项目名称:emscripten,代码行数:12,代码来源:system_libs.py

示例7: create_pack_asmjs

def create_pack_asmjs():
  emscripten.logging.debug('building pack-asmjs')
  output = emscripten.Cache.get_path('pack-asmjs.js')
  emscripten.try_delete(output)
  check_call([PYTHON, emscripten.EMCC, emscripten.path_from_root('third_party', 'wasm-polyfill', 'src', 'pack-asmjs.cpp'),
                      emscripten.path_from_root('third_party', 'wasm-polyfill', 'src', 'unpack.cpp'),
                      emscripten.path_from_root('tools', 'optimizer', 'parser.cpp'),
                      '-o', output] + \
                      '-O3 -std=c++11 -DCHECKED_OUTPUT_SIZE --memory-init-file 0 --llvm-lto 1 -s TOTAL_MEMORY=67108864 -s WASM=0 -s INVOKE_RUN=0'.split(' ') + \
                     ['-I' + emscripten.path_from_root('tools', 'optimizer')])
  assert os.path.exists(output)
  open(output, 'a').write(open(emscripten.path_from_root('third_party', 'wasm-polyfill', 'src', 'pack-asmjs.js')).read())
  return output
开发者ID:4ian,项目名称:emscripten,代码行数:13,代码来源:wasmator.py

示例8: build_libc

 def build_libc(lib_filename, files, lib_opts):
   o_s = []
   musl_internal_includes = ['-I', shared.path_from_root('system', 'lib', 'libc', 'musl', 'src', 'internal'), '-I', shared.path_from_root('system', 'lib', 'libc', 'musl', 'arch', 'js')]
   commands = []
   # Hide several musl warnings that produce a lot of spam to unit test build server logs.
   # TODO: When updating musl the next time, feel free to recheck which of their warnings might have been fixed, and which ones of these could be cleaned up.
   c_opts = ['-Wno-dangling-else', '-Wno-unknown-pragmas', '-Wno-shift-op-parentheses', '-Wno-string-plus-int', '-Wno-logical-op-parentheses', '-Wno-bitwise-op-parentheses', '-Wno-visibility']
   for src in files:
     o = in_temp(os.path.basename(src) + '.o')
     commands.append([shared.PYTHON, shared.EMCC, shared.path_from_root('system', 'lib', src), '-o', o] + musl_internal_includes + default_opts + c_opts + lib_opts)
     o_s.append(o)
   run_commands(commands)
   shared.Building.link(o_s, in_temp(lib_filename))
   return in_temp(lib_filename)
开发者ID:imvu,项目名称:emscripten,代码行数:14,代码来源:system_libs.py

示例9: create_compiler_rt

  def create_compiler_rt(libname):
    srcdir = shared.path_from_root('system', 'lib', 'compiler-rt')
    filenames = ['divdc3.c', 'divsc3.c', 'muldc3.c', 'mulsc3.c']
    files = (os.path.join(srcdir, f) for f in filenames)

    o_s = []
    commands = []
    for src in files:
      o = in_temp(os.path.basename(src) + '.o')
      commands.append([shared.PYTHON, shared.EMCC, shared.path_from_root('system', 'lib', src), '-O2', '-o', o])
      o_s.append(o)
    run_commands(commands)
    shared.Building.link(o_s, in_temp(libname))
    return in_temp(libname)
开发者ID:AmesianX,项目名称:emscripten,代码行数:14,代码来源:system_libs.py

示例10: create_libc

 def create_libc(libname):
   logging.debug(' building libc for cache')
   libc_files = [
   ]
   musl_srcdir = shared.path_from_root('system', 'lib', 'libc', 'musl', 'src')
   blacklist = set(
     ['ipc', 'passwd', 'thread', 'signal', 'sched', 'ipc', 'time', 'linux', 'aio', 'exit', 'legacy', 'mq', 'process', 'search', 'setjmp', 'env', 'ldso', 'conf'] + # musl modules
     ['memcpy.c', 'memset.c', 'memmove.c', 'getaddrinfo.c', 'getnameinfo.c', 'inet_addr.c', 'res_query.c', 'gai_strerror.c', 'proto.c', 'gethostbyaddr.c', 'gethostbyaddr_r.c', 'gethostbyname.c', 'gethostbyname2_r.c', 'gethostbyname_r.c', 'gethostbyname2.c', 'usleep.c', 'alarm.c', 'syscall.c'] + # individual files
     ['abs.c', 'cos.c', 'cosf.c', 'cosl.c', 'sin.c', 'sinf.c', 'sinl.c', 'tan.c', 'tanf.c', 'tanl.c', 'acos.c', 'acosf.c', 'acosl.c', 'asin.c', 'asinf.c', 'asinl.c', 'atan.c', 'atanf.c', 'atanl.c', 'atan2.c', 'atan2f.c', 'atan2l.c', 'exp.c', 'expf.c', 'expl.c', 'log.c', 'logf.c', 'logl.c', 'sqrt.c', 'sqrtf.c', 'sqrtl.c', 'fabs.c', 'fabsf.c', 'fabsl.c', 'ceil.c', 'ceilf.c', 'ceill.c', 'floor.c', 'floorf.c', 'floorl.c', 'pow.c', 'powf.c', 'powl.c', 'round.c', 'roundf.c'] # individual math files
   )
   # TODO: consider using more math code from musl, doing so makes box2d faster
   for dirpath, dirnames, filenames in os.walk(musl_srcdir):
     for f in filenames:
       if f.endswith('.c'):
         if f in blacklist: continue
         dir_parts = os.path.split(dirpath)
         cancel = False
         for part in dir_parts:
           if part in blacklist:
             cancel = True
             break
         if not cancel:
           libc_files.append(os.path.join(musl_srcdir, dirpath, f))
   args = ['-Os']
   if shared.Settings.USE_PTHREADS:
     args += ['-s', 'USE_PTHREADS=1']
     assert '-mt' in libname
   else:
     assert '-mt' not in libname
   return build_libc(libname, libc_files, args)
开发者ID:AmesianX,项目名称:emscripten,代码行数:30,代码来源:system_libs.py

示例11: create_gl

 def create_gl():
   prev_cxx = os.environ.get('EMMAKEN_CXX')
   if prev_cxx: os.environ['EMMAKEN_CXX'] = ''
   o = in_temp('gl.o')
   check_call([shared.PYTHON, shared.EMCC, shared.path_from_root('system', 'lib', 'gl.c'), '-o', o])
   if prev_cxx: os.environ['EMMAKEN_CXX'] = prev_cxx
   return o
开发者ID:Acidburn0zzz,项目名称:emscripten,代码行数:7,代码来源:system_libs.py

示例12: create_optimizer

 def create_optimizer():
   shared.logging.debug('building native optimizer: ' + name)
   output = shared.Cache.get_path(name)
   shared.try_delete(output)
   for compiler in [shared.CLANG, 'g++', 'clang++']: # try our clang first, otherwise hope for a system compiler in the path
     shared.logging.debug('  using ' + compiler)
     try:
       subprocess.Popen([compiler,
                         shared.path_from_root('tools', 'optimizer', 'parser.cpp'),
                         shared.path_from_root('tools', 'optimizer', 'simple_ast.cpp'),
                         shared.path_from_root('tools', 'optimizer', 'optimizer.cpp'),
                         '-O3', '-std=c++11', '-fno-exceptions', '-fno-rtti', '-o', output] + args).communicate()
     except OSError:
       if compiler == shared.CLANG: raise # otherwise, OSError is likely due to g++ or clang++ not being in the path
     if os.path.exists(output): return output
   raise NativeOptimizerCreationException()
开发者ID:kidanger,项目名称:emscripten,代码行数:16,代码来源:js_optimizer.py

示例13: build_libcxx

 def build_libcxx(src_dirname, lib_filename, files):
   o_s = []
   for src in files:
     o = in_temp(src + '.o')
     srcfile = shared.path_from_root(src_dirname, src)
     execute([shared.PYTHON, shared.EMXX, srcfile, '-o', o, '-std=c++11'] + lib_opts, stdout=stdout, stderr=stderr)
     o_s.append(o)
   shared.Building.link(o_s, in_temp(lib_filename))
   return in_temp(lib_filename)
开发者ID:AdrienCog,项目名称:emscripten,代码行数:9,代码来源:system_libs.py

示例14: create_gl

 def create_gl():
     prev_cxx = os.environ.get("EMMAKEN_CXX")
     if prev_cxx:
         os.environ["EMMAKEN_CXX"] = ""
     o = in_temp("gl.o")
     execute([shared.PYTHON, shared.EMCC, shared.path_from_root("system", "lib", "gl.c"), "-o", o])
     if prev_cxx:
         os.environ["EMMAKEN_CXX"] = prev_cxx
     return o
开发者ID:prixeus,项目名称:emscripten,代码行数:9,代码来源:system_libs.py

示例15: build_libcxx

 def build_libcxx(src_dirname, lib_filename, files, lib_opts):
   o_s = []
   commands = []
   for src in files:
     o = in_temp(src + '.o')
     srcfile = shared.path_from_root(src_dirname, src)
     commands.append([shared.PYTHON, shared.EMXX, srcfile, '-o', o, '-std=c++11'] + default_opts + lib_opts)
     o_s.append(o)
   run_commands(commands)
   shared.Building.link(o_s, in_temp(lib_filename))
   return in_temp(lib_filename)
开发者ID:Acidburn0zzz,项目名称:emscripten,代码行数:11,代码来源:system_libs.py


注:本文中的shared.path_from_root函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。