當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。