Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 56a0e36

Browse files
authoredJan 19, 2024
Merge pull request #126 from kipr/30.2DoxygenUpdate
30.2 doxygen update
2 parents c07b486 + e11fe06 commit 56a0e36

File tree

1,962 files changed

+106303
-15489
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

1,962 files changed

+106303
-15489
lines changed
 

‎apps/compiler/api-routes/compile.js

+4
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,10 @@ router.post('/', function(request, response, next) {
8181
} else if (language.toLowerCase() === 'python') {
8282
compilation_environment = require('../compilation-environments/python/python.js');
8383
}
84+
else if (language.toLowerCase() === 'c++') {
85+
compilation_environment = require('../compilation-environments/c++/g++.js');
86+
}
87+
8488
return compilation_environment.compile(project_resource, function(error, stdout, stderr) {
8589
var result;
8690
result = {
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
var Config, Path, exec;
2+
3+
exec = require('child_process').exec;
4+
5+
Path = require('path');
6+
7+
Config = require_harrogate_module('config.js');
8+
9+
const fs = require("fs");
10+
11+
module.exports = {
12+
compile: function (project_resource, cb) {
13+
project_resource.src_directory.is_valid().then(function (valid) {
14+
if (!valid) {
15+
throw new ServerError(404, 'Project ' + project_resource.name + ' does not contain any source files');
16+
}
17+
return project_resource.src_directory.get_children();
18+
}).then(function (src_files) {
19+
var gpp_cmd, i, len, src;
20+
gpp_cmd = "g++ -I\"" + project_resource.include_directory.path + "\" -I\"" + Config.ext_deps.include_path + "\" -Wall ";
21+
for (i = 0, len = src_files.length; i < len; i++) {
22+
src = src_files[i];
23+
if (Path.basename(src.path).charAt(0) !== '.') {
24+
gpp_cmd += '"' + src.path + "\" ";
25+
}
26+
}
27+
gpp_cmd += "-L\"" + Config.ext_deps.lib_path + "\" -lkipr -lm -o \"" + project_resource.binary.path + "\" -lz -lpthread ";
28+
29+
// extra support for extra compiler args
30+
if (fs.existsSync(project_resource.data_directory.path + "/config.json")) {
31+
try {
32+
options = JSON.parse(fs.readFileSync(project_resource.data_directory.path + "/config.json", { encoding: 'ascii', flag: 'r' }));
33+
34+
if ("compilerArgs" in options) {
35+
options["compilerArgs"].forEach(element => {
36+
gpp_cmd += element + " ";
37+
});
38+
}
39+
}
40+
catch (e) {
41+
console.log("failed because of");
42+
console.log(e);
43+
}
44+
}
45+
46+
exec(gpp_cmd, cb);
47+
})["catch"](function (e) {
48+
cb(e);
49+
}).done();
50+
}
51+
};

0 commit comments

Comments
 (0)
Please sign in to comment.