Skip to content

Commit

Permalink
Cmake build with ninja (#4287)
Browse files Browse the repository at this point in the history
  • Loading branch information
partouf authored and mattgodbolt committed Jan 24, 2023
1 parent 209d662 commit 8ffef81
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 7 deletions.
2 changes: 1 addition & 1 deletion etc/config/compiler-explorer.amazon.properties
Expand Up @@ -37,7 +37,7 @@ alwaysResetLdPath=true
plogConverter=/opt/compiler-explorer/pvs-studio-latest/bin/plog-converter

cmake=/opt/compiler-explorer/cmake/bin/cmake
make=/usr/bin/make
useninja=false
ld=/usr/bin/ld
readelf=/usr/bin/readelf

Expand Down
2 changes: 1 addition & 1 deletion etc/config/compiler-explorer.defaults.properties
Expand Up @@ -45,7 +45,7 @@ remoteStorageServer=https://godbolt.org
compilationEnvTimeoutMs=300000

cmake=cmake
make=make
useninja=false
ld=ld
readelf=readelf

Expand Down
15 changes: 11 additions & 4 deletions lib/base-compiler.ts
Expand Up @@ -2034,7 +2034,14 @@ export class BaseCompiler implements ICompiler {
const toolchainparam = this.getCMakeExtToolchainParam();

const cmakeArgs = utils.splitArguments(key.backendOptions.cmakeArgs);
const fullArgs = [toolchainparam, ...this.getExtraCMakeArgs(key), ...cmakeArgs, '..'];
const partArgs: string[] = [toolchainparam, ...this.getExtraCMakeArgs(key), ...cmakeArgs, '..'];
let fullArgs: string[] = [];
const useNinja = this.env.ceProps('useninja');
if (useNinja) {
fullArgs = ['-GNinja'].concat(partArgs);
} else {
fullArgs = partArgs;
}

const cmakeStepResult = await this.doBuildstepAndAddToResult(
fullResult,
Expand All @@ -2056,9 +2063,9 @@ export class BaseCompiler implements ICompiler {

const makeStepResult = await this.doBuildstepAndAddToResult(
fullResult,
'make',
this.env.ceProps('make'),
[],
'build',
this.env.ceProps('cmake'),
['--build', '.'],
execParams,
);

Expand Down
2 changes: 1 addition & 1 deletion lib/compilers/cc65.ts
Expand Up @@ -126,7 +126,7 @@ export class Cc65Compiler extends BaseCompiler {

override async doBuildstepAndAddToResult(result: CompilationResult, name, command, args, execParams) {
const stepResult = await super.doBuildstepAndAddToResult(result, name, command, args, execParams);
if (name === 'make') {
if (name === 'build') {
const mapFile = path.join(execParams.customCwd, 'map.txt');
if (await utils.fileExists(mapFile)) {
const file_buffer = await fs.readFile(mapFile);
Expand Down

0 comments on commit 8ffef81

Please sign in to comment.