修复Windows第三库编译问题
This commit is contained in:
@ -44,6 +44,8 @@ const spawnOption = {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
function P(path) { return path.replace(/\\/g, "/"); }
|
||||||
|
|
||||||
function checkFile(...items) {
|
function checkFile(...items) {
|
||||||
return fs.existsSync(path.resolve(...items));
|
return fs.existsSync(path.resolve(...items));
|
||||||
}
|
}
|
||||||
@ -153,9 +155,13 @@ async function main() {
|
|||||||
"-DMNN_BUILD_CONVERTER=OFF",
|
"-DMNN_BUILD_CONVERTER=OFF",
|
||||||
"-DMNN_WIN_RUNTIME_MT=ON",
|
"-DMNN_WIN_RUNTIME_MT=ON",
|
||||||
], (root) => [
|
], (root) => [
|
||||||
`set(MNN_INCLUDE_DIR ${JSON.stringify(path.join(root, "include"))})`,
|
`set(MNN_INCLUDE_DIR ${JSON.stringify(P(path.join(root, "include")))})`,
|
||||||
`set(MNN_LIB_DIR ${JSON.stringify(path.join(root, "lib"))})`,
|
`set(MNN_LIB_DIR ${JSON.stringify(P(path.join(root, "lib")))})`,
|
||||||
`set(MNN_LIBS MNN)`,
|
`if(WIN32)`
|
||||||
|
` set(MNN_LIBS \${MNN_LIB_DIRMNN}/MNN.lib)`,
|
||||||
|
`else()`
|
||||||
|
` set(MNN_LIBS \${MNN_LIB_DIRMNN}/libMNN.a)`,
|
||||||
|
`endif()`
|
||||||
].join("\n"));
|
].join("\n"));
|
||||||
//OpenCV
|
//OpenCV
|
||||||
if (buildOptions.withOpenCV) cmakeBuildFromSource("OpenCV", "https://github.com/opencv/opencv.git", "4.11.0", null, [
|
if (buildOptions.withOpenCV) cmakeBuildFromSource("OpenCV", "https://github.com/opencv/opencv.git", "4.11.0", null, [
|
||||||
@ -229,9 +235,13 @@ async function main() {
|
|||||||
fs.cpSync(path.join(savedir, dirname), path.join(THIRDPARTY_DIR, "ONNXRuntime"), { recursive: true });
|
fs.cpSync(path.join(savedir, dirname), path.join(THIRDPARTY_DIR, "ONNXRuntime"), { recursive: true });
|
||||||
});
|
});
|
||||||
fs.writeFileSync(path.join(THIRDPARTY_DIR, "ONNXRuntime/config.cmake"), [
|
fs.writeFileSync(path.join(THIRDPARTY_DIR, "ONNXRuntime/config.cmake"), [
|
||||||
`set(ONNXRuntime_INCLUDE_DIR ${JSON.stringify(path.join(THIRDPARTY_DIR, "ONNXRuntime/include"))})`,
|
`set(ONNXRuntime_INCLUDE_DIR ${JSON.stringify(P(path.join(THIRDPARTY_DIR, "ONNXRuntime/include")))})`,
|
||||||
`set(ONNXRuntime_LIB_DIR ${JSON.stringify(path.join(THIRDPARTY_DIR, "ONNXRuntime/lib"))})`,
|
`set(ONNXRuntime_LIB_DIR ${JSON.stringify(P(path.join(THIRDPARTY_DIR, "ONNXRuntime/lib")))})`,
|
||||||
`set(ONNXRuntime_LIBS onnxruntime)`,
|
`if(WIN32)`,
|
||||||
|
` set(ONNXRuntime_LIBS \${ONNXRuntime_LIB_DIR}/onnxruntime.lib)`,
|
||||||
|
`else()`,
|
||||||
|
` set(ONNXRuntime_LIBS \${ONNXRuntime_LIB_DIR}/libonnxruntime.a)`,
|
||||||
|
`endif()`,
|
||||||
].join("\n"));
|
].join("\n"));
|
||||||
}
|
}
|
||||||
// if (buildOptions.withONNX) cmakeBuildFromSource("ONNXRuntime", "https://github.com/csukuangfj/onnxruntime-build.git", "main", (name, repo, branch) => {
|
// if (buildOptions.withONNX) cmakeBuildFromSource("ONNXRuntime", "https://github.com/csukuangfj/onnxruntime-build.git", "main", (name, repo, branch) => {
|
||||||
|
Reference in New Issue
Block a user