diff --git a/README.md b/README.md index f92c19a..96e5bdc 100644 --- a/README.md +++ b/README.md @@ -1 +1,14 @@ ## AI工具箱 + + +### 代码编译 + +注意:在Windows下编译时,需要打开Visual Studio命令行 + +``` +# 编译第三方库 +node thirdpart/install.js --with-onnx --with-mnn --with-opencv +# 编译主库 +cmake -B build -G Ninja . -DCMAKE_BUILD_TYPE=Release +cmake --build build --config Release +``` \ No newline at end of file diff --git a/thirdpart/install.js b/thirdpart/install.js index 9bb8c46..5262dce 100644 --- a/thirdpart/install.js +++ b/thirdpart/install.js @@ -157,11 +157,11 @@ async function main() { ], (root) => [ `set(MNN_INCLUDE_DIR ${JSON.stringify(P(path.join(root, "include")))})`, `set(MNN_LIB_DIR ${JSON.stringify(P(path.join(root, "lib")))})`, - `if(WIN32)` - ` set(MNN_LIBS \${MNN_LIB_DIRMNN}/MNN.lib)`, - `else()` - ` set(MNN_LIBS \${MNN_LIB_DIRMNN}/libMNN.a)`, - `endif()` + `if(WIN32)`, + ` set(MNN_LIBS \${MNN_LIB_DIR}/MNN.lib)`, + `else()`, + ` set(MNN_LIBS \${MNN_LIB_DIR}/libMNN.a)`, + `endif()`, ].join("\n")); //OpenCV if (buildOptions.withOpenCV) cmakeBuildFromSource("OpenCV", "https://github.com/opencv/opencv.git", "4.11.0", null, [ @@ -180,12 +180,12 @@ async function main() { ], (root) => [ `set(OpenCV_STATIC ON)`, os.platform() == "win32" ? - `include(${JSON.stringify(path.join(root, "OpenCVConfig.cmake"))})` : - `include(${JSON.stringify(path.join(root, "lib/cmake/opencv4/OpenCVConfig.cmake"))})`, + `include(${JSON.stringify(P(path.join(root, "OpenCVConfig.cmake")))})` : + `include(${JSON.stringify(P(path.join(root, "lib/cmake/opencv4/OpenCVConfig.cmake")))})`, `set(OpenCV_INCLUDE_DIR \${OpenCV_INCLUDE_DIRS})`, os.platform() == "win32" ? "set(OpenCV_LIB_DIR ${OpenCV_LIB_PATH})" : - `set(OpenCV_LIB_DIR ${JSON.stringify(path.join(root, "lib"))})`, + `set(OpenCV_LIB_DIR ${JSON.stringify(P(path.join(root, "lib")))})`, // `set(OpenCV_LIBS OpenCV_LIBS)`, ].join("\n")) //ONNXRuntime