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


TypeScript CMakeCache.get方法代码示例

本文整理汇总了TypeScript中@cmt/cache.CMakeCache.get方法的典型用法代码示例。如果您正苦于以下问题:TypeScript CMakeCache.get方法的具体用法?TypeScript CMakeCache.get怎么用?TypeScript CMakeCache.get使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在@cmt/cache.CMakeCache的用法示例。


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

示例1: searchForCompilerPathInCache

function searchForCompilerPathInCache(cache: CMakeCache): string|null {
  const languages = ['CXX', 'C', 'CUDA'];
  for (const lang of languages) {
    const entry = cache.get(`CMAKE_${lang}_COMPILER`);
    if (!entry) {
      continue;
    }
    return entry.value as string;
  }
  return null;
}
开发者ID:vector-of-bool,项目名称:vscode-cmake-tools,代码行数:11,代码来源:debugger.ts

示例2: async

    const checkTestKey = async (testKey: [string, string], testCache: CMakeCache) => {
      const [key, expected] = testKey;

      // Get cache entry for given test key
      const cacheEntry = testCache.get(key) as api.CacheEntry;

      // Check type and value of the retrieved cache entry
      expect(cacheEntry.type).to.eq(api.CacheEntryType.String, `[variant:${key}] unexpected cache entry type`);
      expect(cacheEntry.key).to.eql(key, `[variant:${key}] unexpected cache entry key name`);
      expect(cacheEntry.as<string>()).to.eql(expected, `[variant:${key}] incorrect substitution`);
      expect(typeof cacheEntry.value).to.eq('string', `[variant:${key}] unexpected cache entry value type`);
    };
开发者ID:vector-of-bool,项目名称:vscode-cmake-tools,代码行数:12,代码来源:variable-substitution.test.ts

示例3: getDebugConfigurationFromCache

export async function getDebugConfigurationFromCache(cache: CMakeCache, target: ExecutableTarget, platform: string):
    Promise<Configuration|null> {
  const entry = cache.get('CMAKE_LINKER');
  if (entry !== null) {
    const linker = entry.value as string;
    const is_msvc_linker = linker.endsWith('link.exe');
    if (is_msvc_linker) {
      return createMSVCDebugConfiguration(target);
    }
  }

  const compiler_path = searchForCompilerPathInCache(cache);
  if (compiler_path === null) {
    throw Error('No compiler found in cache file.');  // MSVC should be already found by CMAKE_LINKER
  }

  const clang_compiler_regex = /(clang[\+]{0,2})+(?!-cl)/gi;
  // Look for lldb-mi
  let clang_debugger_path = compiler_path.replace(clang_compiler_regex, 'lldb-mi');
  if ((clang_debugger_path.search(new RegExp('lldb-mi')) != -1) && await checkDebugger(clang_debugger_path)) {
    return createLLDBDebugConfiguration(clang_debugger_path, target);
  } else {
    // Look for gdb
    clang_debugger_path = compiler_path.replace(clang_compiler_regex, 'gdb');
    if ((clang_debugger_path.search(new RegExp('gdb')) != -1) && await checkDebugger(clang_debugger_path)) {
      return createGDBDebugConfiguration(clang_debugger_path, target);
    } else {
      // Look for lldb
      clang_debugger_path = compiler_path.replace(clang_compiler_regex, 'lldb');
      if ((clang_debugger_path.search(new RegExp('lldb')) != -1) && await checkDebugger(clang_debugger_path)) {
        return createLLDBDebugConfiguration(clang_debugger_path, target);
      }
    }
  }

  const debugger_name = platform == 'darwin' ? 'lldb' : 'gdb';
  const description = DEBUG_GEN[debugger_name];
  const gcc_compiler_regex = /([cg]\+\+|g?cc)+/gi;
  const gdb_debugger_path = compiler_path.replace(gcc_compiler_regex, description.miMode);
  if (gdb_debugger_path.search(new RegExp(description.miMode)) != -1) {
    return description.createConfig(gdb_debugger_path, target);
  }

  const is_msvc_compiler = compiler_path.endsWith('cl.exe');
  if (is_msvc_compiler) {
    return createMSVCDebugConfiguration(target);
  }

  log.warning(`Unable to automatically determine debugger corresponding to compiler: ${compiler_path}`);
  return null;
}
开发者ID:vector-of-bool,项目名称:vscode-cmake-tools,代码行数:51,代码来源:debugger.ts


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