Skip to content

Commit

Permalink
fix for formatting issue
Browse files Browse the repository at this point in the history
  • Loading branch information
kalwalt committed Nov 26, 2024
1 parent 426e58a commit 32f89b5
Showing 1 changed file with 88 additions and 88 deletions.
176 changes: 88 additions & 88 deletions tools/makem.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@ const EMSCRIPTEN_ROOT = process.env.EMSCRIPTEN;
const WEBARKITLIB_ROOT = process.env.WEBARKITLIB_ROOT || "../emscripten/WebARKitLib";

if (!EMSCRIPTEN_ROOT) {
console.log("\nWarning: EMSCRIPTEN environment variable not found.");
console.log(
'If you get a "command not found" error,\ndo `source <path to emsdk>/emsdk_env.sh` and try again.',
);
console.log("\nWarning: EMSCRIPTEN environment variable not found.");
console.log(
'If you get a "command not found" error,\ndo `source <path to emsdk>/emsdk_env.sh` and try again.',
);
}

const EMCC = EMSCRIPTEN_ROOT ? path.resolve(EMSCRIPTEN_ROOT, "emcc") : "emcc";
Expand All @@ -39,7 +39,7 @@ let MAIN_SOURCES = [
];

MAIN_SOURCES = MAIN_SOURCES.map(function (src) {
return path.resolve(SOURCE_PATH, src);
return path.resolve(SOURCE_PATH, src);
}).join(" ");

// prettier-ignore
Expand All @@ -51,48 +51,48 @@ let ar_sources = [
});

const ar2_sources = [
"handle.c",
"imageSet.c",
"jpeg.c",
"marker.c",
"featureMap.c",
"featureSet.c",
"selectTemplate.c",
"surface.c",
"tracking.c",
"tracking2d.c",
"matching.c",
"matching2.c",
"template.c",
"searchPoint.c",
"coord.c",
"util.c",
"handle.c",
"imageSet.c",
"jpeg.c",
"marker.c",
"featureMap.c",
"featureSet.c",
"selectTemplate.c",
"surface.c",
"tracking.c",
"tracking2d.c",
"matching.c",
"matching2.c",
"template.c",
"searchPoint.c",
"coord.c",
"util.c",
].map(function (src) {
return path.resolve(__dirname, WEBARKITLIB_ROOT + "/lib/SRC/AR2/", src);
return path.resolve(__dirname, WEBARKITLIB_ROOT + "/lib/SRC/AR2/", src);
});

const kpm_sources = [
"KPM/kpmHandle.cpp",
"KPM/kpmRefDataSet.cpp",
"KPM/kpmMatching.cpp",
"KPM/kpmResult.cpp",
"KPM/kpmUtil.cpp",
"KPM/kpmFopen.c",
"KPM/FreakMatcher/detectors/DoG_scale_invariant_detector.cpp",
"KPM/FreakMatcher/detectors/gaussian_scale_space_pyramid.cpp",
"KPM/FreakMatcher/detectors/gradients.cpp",
//"KPM/FreakMatcher/detectors/harris.cpp",
"KPM/FreakMatcher/detectors/orientation_assignment.cpp",
"KPM/FreakMatcher/detectors/pyramid.cpp",
"KPM/FreakMatcher/facade/visual_database_facade.cpp",
"KPM/FreakMatcher/matchers/hough_similarity_voting.cpp",
"KPM/FreakMatcher/matchers/freak.cpp",
"KPM/FreakMatcher/framework/date_time.cpp",
"KPM/FreakMatcher/framework/image.cpp",
"KPM/FreakMatcher/framework/logger.cpp",
"KPM/FreakMatcher/framework/timers.cpp",
"KPM/kpmHandle.cpp",
"KPM/kpmRefDataSet.cpp",
"KPM/kpmMatching.cpp",
"KPM/kpmResult.cpp",
"KPM/kpmUtil.cpp",
"KPM/kpmFopen.c",
"KPM/FreakMatcher/detectors/DoG_scale_invariant_detector.cpp",
"KPM/FreakMatcher/detectors/gaussian_scale_space_pyramid.cpp",
"KPM/FreakMatcher/detectors/gradients.cpp",
//"KPM/FreakMatcher/detectors/harris.cpp",
"KPM/FreakMatcher/detectors/orientation_assignment.cpp",
"KPM/FreakMatcher/detectors/pyramid.cpp",
"KPM/FreakMatcher/facade/visual_database_facade.cpp",
"KPM/FreakMatcher/matchers/hough_similarity_voting.cpp",
"KPM/FreakMatcher/matchers/freak.cpp",
"KPM/FreakMatcher/framework/date_time.cpp",
"KPM/FreakMatcher/framework/image.cpp",
"KPM/FreakMatcher/framework/logger.cpp",
"KPM/FreakMatcher/framework/timers.cpp",
].map(function (src) {
return path.resolve(__dirname, WEBARKITLIB_ROOT + "/lib/SRC/", src);
return path.resolve(__dirname, WEBARKITLIB_ROOT + "/lib/SRC/", src);
});

// prettier-ignore
Expand Down Expand Up @@ -137,40 +137,40 @@ DEBUG_FLAGS += " -s ALLOW_MEMORY_GROWTH=1";
DEBUG_FLAGS += " -s DEMANGLE_SUPPORT=1 ";

var INCLUDES = [
path.resolve(__dirname, WEBARKITLIB_ROOT + "/include"),
OUTPUT_PATH,
SOURCE_PATH,
path.resolve(__dirname, WEBARKITLIB_ROOT + "/lib/SRC/KPM/FreakMatcher"),
path.resolve(__dirname, WEBARKITLIB_ROOT + "/include"),
OUTPUT_PATH,
SOURCE_PATH,
path.resolve(__dirname, WEBARKITLIB_ROOT + "/lib/SRC/KPM/FreakMatcher"),
]
.map(function (s) {
return "-I" + s;
return "-I" + s;
})
.join(" ");

function format(str) {
for (let f = 1; f < arguments.length; f++) {
str = str.replace(/{\w*}/, arguments[f]);
}
return str;
for (let f = 1; f < arguments.length; f++) {
str = str.replace(/{\w*}/, arguments[f]);
}
return str;
}

function clean_builds() {
try {
const stats = fs.statSync(OUTPUT_PATH);
} catch (e) {
fs.mkdirSync(OUTPUT_PATH);
}

try {
const files = fs.readdirSync(OUTPUT_PATH);
if (files.length > 0)
for (let i = 0; i < files.length; i++) {
const filePath = OUTPUT_PATH + "/" + files[i];
if (fs.statSync(filePath).isFile()) fs.unlinkSync(filePath);
}
} catch (e) {
return console.log(e);
}
try {
const stats = fs.statSync(OUTPUT_PATH);
} catch (e) {
fs.mkdirSync(OUTPUT_PATH);
}

try {
const files = fs.readdirSync(OUTPUT_PATH);
if (files.length > 0)
for (let i = 0; i < files.length; i++) {
const filePath = OUTPUT_PATH + "/" + files[i];
if (fs.statSync(filePath).isFile()) fs.unlinkSync(filePath);
}
} catch (e) {
return console.log(e);
}
}

const compile_arlib = format(
Expand Down Expand Up @@ -278,38 +278,38 @@ const compile_wasm_td = format(
*/

function onExec(error, stdout, stderr) {
if (stdout) console.log("stdout: " + stdout);
if (stderr) console.log("stderr: " + stderr);
if (error !== null) {
console.log("exec error: " + error.code);
process.exit(error.code);
} else {
runJob();
}
if (stdout) console.log("stdout: " + stdout);
if (stderr) console.log("stderr: " + stderr);
if (error !== null) {
console.log("exec error: " + error.code);
process.exit(error.code);
} else {
runJob();
}
}

const jobs = [];

function runJob() {
if (!jobs.length) {
console.log("Jobs completed");
return;
}
if (!jobs.length) {
console.log("Jobs completed");
return;
}

const cmd = jobs.shift();
const cmd = jobs.shift();

if (typeof cmd === "function") {
cmd();
runJob();
return;
}
if (typeof cmd === "function") {
cmd();
runJob();
return;
}

console.log("\nRunning command: " + cmd + "\n");
exec(cmd, onExec);
console.log("\nRunning command: " + cmd + "\n");
exec(cmd, onExec);
}

function addJob(job) {
jobs.push(job);
jobs.push(job);
}

addJob(clean_builds);
Expand Down

0 comments on commit 32f89b5

Please sign in to comment.