-
Notifications
You must be signed in to change notification settings - Fork 1.2k
/
Copy pathdocs.js
38 lines (33 loc) · 1.22 KB
/
docs.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
/******************************************************************************
*
* Copyright (c) 2017, the Perspective Authors.
*
* This file is part of the Perspective library, distributed under the terms of
* the Apache License 2.0. The full license can be found in the LICENSE file.
*
*/
const execSync = require("child_process").execSync;
const execute = cmd => execSync(cmd, {stdio: "inherit"});
function docker(image = "emsdk") {
console.log(`-- Creating ${image} docker image`);
let cmd = "docker run --rm -it";
if (process.env.PSP_CPU_COUNT) {
cmd += ` --cpus="${parseInt(process.env.PSP_CPU_COUNT)}.0"`;
}
cmd += ` -v $(pwd):/usr/src/app -w /usr/src/app/ perspective/${image}`;
return cmd;
}
let flags = " -DPSP_WASM_BUILD=0 -DPSP_CPP_BUILD=0 -DPSP_PYTHON_BUILD=1 -DPSP_BUILD_DOCS=1";
try {
let cmd = "cd docsbuild && cmake .. -DPSP_WASM_BUILD=0 -DPSP_CPP_BUILD=0 -DPSP_PYTHON_BUILD=0 -DPSP_BUILD_DOCS=1 && make -j${PSP_CPU_COUNT-8}";
if (process.env.PSP_DOCKER) {
execute(docker("docs") + " mkdir -p docsbuild");
execute(cmd);
} else {
execute("mkdir -p docsbuild");
execute(cmd);
}
} catch (e) {
console.log(e.message);
process.exit(1);
}