当前位置: 首页>>代码示例>>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;未经允许,请勿转载。