當前位置: 首頁>>代碼示例>>TypeScript>>正文


TypeScript CMakeTools.configure方法代碼示例

本文整理匯總了TypeScript中@cmt/cmake-tools.CMakeTools.configure方法的典型用法代碼示例。如果您正苦於以下問題:TypeScript CMakeTools.configure方法的具體用法?TypeScript CMakeTools.configure怎麽用?TypeScript CMakeTools.configure使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在@cmt/cmake-tools.CMakeTools的用法示例。


在下文中一共展示了CMakeTools.configure方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。

示例1: test

test('Copy compile_commands.json to a pre-determined path', async () => {
      expect(await fs.exists(compdb_cp_path), 'File shouldn\'t be there!').to.be.false;
      let retc = await cmt.configure();
      expect(retc).to.eq(0);
      expect(await fs.exists(compdb_cp_path), 'File still shouldn\'t be there').to.be.false;
      testEnv.config.updatePartial({copyCompileCommands: compdb_cp_path});
      retc = await cmt.configure();
      expect(retc).to.eq(0);
      expect(await fs.exists(compdb_cp_path), 'File wasn\'t copied').to.be.true;
    }).timeout(100000);
開發者ID:vector-of-bool,項目名稱:vscode-cmake-tools,代碼行數:10,代碼來源:configure-and-build.test.ts

示例2: test

  test('Passing env-vars to CMake but not to the compiler', async () => {
    // Set fake settings
    testEnv.config.updatePartial({
      configureEnvironment: {
        _CONFIGURE_ENV: '${workspaceRootFolderName}',
      },
    });

    // Configure
    expect(await cmt.configure()).to.be.eq(0, '[configureEnvironment] configure failed');
    expect(testEnv.projectFolder.buildDirectory.isCMakeCachePresent).to.eql(true, 'expected cache not present');
    const cache = await CMakeCache.fromPath(await cmt.cachePath);

    const cacheEntry = cache.get('configureEnvironment') as api.CacheEntry;
    expect(cacheEntry.type).to.eq(api.CacheEntryType.String, '[configureEnvironment] unexpected cache entry type');
    expect(cacheEntry.key).to.eq('configureEnvironment', '[configureEnvironment] unexpected cache entry key name');
    expect(cacheEntry.as<string>())
        .to.eq(path.basename(testEnv.projectFolder.location), '[configureEnvironment] substitution incorrect');
    expect(typeof cacheEntry.value).to.eq('string', '[configureEnvironment] unexpected cache entry value type');

    // Build
    expect(await cmt.build()).to.be.eq(0, '[configureEnvironment] build failed');
    const result = await testEnv.result.getResultAsJson();
    expect(result['configure-env']).to.eq('', '[configureEnvironment] env-var got passed to compiler');
  }).timeout(100000);
開發者ID:vector-of-bool,項目名稱:vscode-cmake-tools,代碼行數:25,代碼來源:environment.test.ts

示例3: test

  test('Check substitution for variant names', async () => {
    // Define test keys and expected values
    const testKeys = {buildType: 'debug-label', otherVariant: 'option1'};

    // Update configure settings
    const configSettings: {[key: string]: string} = {};
    await Promise.all(Object.keys(testKeys).map(async key => configSettings[key] = `\${variant:${key}}`));
    testEnv.config.updatePartial({configureSettings: configSettings});

    // Configure and retrieve generated cache
    expect(await cmt.configure()).to.be.eq(0, '[variant] configure failed');
    expect(testEnv.projectFolder.buildDirectory.isCMakeCachePresent).to.eql(true, '[variant] cache not found');
    const cache = await CMakeCache.fromPath(await cmt.cachePath);

    // Helper function for checking test keys in a cmake cache
    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`);
    };

    // Check test keys
    await Promise.all(objectPairs(testKeys).map(async testKey => checkTestKey(testKey, cache)));
  }).timeout(100000);
開發者ID:vector-of-bool,項目名稱:vscode-cmake-tools,代碼行數:31,代碼來源:variable-substitution.test.ts

示例4: test

  test('Check substitution within toolchain kits', async () => {
    // Configure
    expect(await cmt.configure()).to.be.eq(0, '[toolchain] configure failed');
    expect(testEnv.projectFolder.buildDirectory.isCMakeCachePresent).to.eql(true, 'expected cache not present');
    const cache = await CMakeCache.fromPath(await cmt.cachePath);

    const cacheEntry = cache.get('CMAKE_TOOLCHAIN_FILE') as api.CacheEntry;
    // tslint:disable-next-line:no-unused-expression
    expect(cacheEntry).to.not.be.null;
    expect(cacheEntry.key).to.eq('CMAKE_TOOLCHAIN_FILE', '[toolchain] unexpected cache entry key name');
    expect(platformNormalizePath(cacheEntry.as<string>()))
        .to.eq(platformNormalizePath(testEnv.projectFolder.location.concat('/test-toolchain.cmake')),
               '[toolchain] substitution incorrect');
  }).timeout(100000);
開發者ID:vector-of-bool,項目名稱:vscode-cmake-tools,代碼行數:14,代碼來源:toolchain.test.ts

示例5: test

  test('Check for environment variables being passed to configure', async () => {
    // Set fake settings
    // Configure
    expect(await cmt.configure()).to.be.eq(0, '[variantEnv] configure failed');
    expect(testEnv.projectFolder.buildDirectory.isCMakeCachePresent).to.eql(true, 'expected cache not present');
    const cache = await CMakeCache.fromPath(await cmt.cachePath);

    const cacheEntry_ = cache.get('variantEnv');
    expect(cacheEntry_).to.not.be.eq(null, '[variantEnv] Cache entry was not present');
    const cacheEntry = cacheEntry_!;
    expect(cacheEntry.type).to.eq(api.CacheEntryType.String, '[variantEnv] unexpected cache entry type');
    expect(cacheEntry.key).to.eq('variantEnv', '[variantEnv] unexpected cache entry key name');
    expect(typeof cacheEntry.value).to.eq('string', '[variantEnv] unexpected cache entry value type');
    expect(cacheEntry.as<string>())
        .to.eq('0cbfb6ae-f2ec-4017-8ded-89df8759c502', '[variantEnv] incorrect environment variable');
  }).timeout(100000);
開發者ID:vector-of-bool,項目名稱:vscode-cmake-tools,代碼行數:16,代碼來源:variant-envs.test.ts


注:本文中的@cmt/cmake-tools.CMakeTools.configure方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。