diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 79ec0968..1b5cb19a 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -14,7 +14,7 @@ jobs: - uses: actions/checkout@v4 - uses: DoozyX/clang-format-lint-action@v0.15 with: - source: '.' + source: './app ./include ./src ./test' build-linux: strategy: matrix: diff --git a/app/Graph/CMakeLists.txt b/app/Graph/CMakeLists.txt index 15f16e4d..7b583958 100644 --- a/app/Graph/CMakeLists.txt +++ b/app/Graph/CMakeLists.txt @@ -27,22 +27,26 @@ if (NOT CMAKE_BUILD_TYPE) endif() if (WIN32) + if ("${CMAKE_BUILD_TYPE}" STREQUAL "DEBUG") + set(CMAKE_BUILD_TYPE "Debug") + endif() + if ("${CMAKE_BUILD_TYPE}" STREQUAL "RELEASE") + set(CMAKE_BUILD_TYPE "Release") + endif() + + set(OPENCV_BIN_SOURCE "${OPENCV_BUILD_DIR}/bin") + if (MSVC) + set(OPENCV_BIN_SOURCE "${OPENCV_BUILD_DIR}/bin/$") + endif() + add_custom_command(TARGET Graph_Build POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy_directory - "${OPENCV_BUILD_DIR}/bin/." + "${OPENCV_BIN_SOURCE}" "${CMAKE_BINARY_DIR}/bin/") -endif() -if (WIN32) - if ("${CMAKE_BUILD_TYPE}" STREQUAL "DEBUG") - set(CMAKE_BUILD_TYPE "Debug") - endif() - if ("${CMAKE_BUILD_TYPE}" STREQUAL "RELEASE") - set(CMAKE_BUILD_TYPE "Release") - endif() add_custom_command(TARGET ACC POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy_directory - "${OPENCV_BUILD_DIR}/bin/." + "${OPENCV_BIN_SOURCE}" "${CMAKE_BINARY_DIR}/bin/") endif() diff --git a/app/Graph/acc_check.cpp b/app/Graph/acc_check.cpp index e367d516..15e33c86 100644 --- a/app/Graph/acc_check.cpp +++ b/app/Graph/acc_check.cpp @@ -5,7 +5,6 @@ #include #include -#include "build.cpp" #include "build.hpp" namespace fs = std::filesystem; diff --git a/app/Graph/build.cpp b/app/Graph/build.cpp index 25e92bb3..f8c911cd 100644 --- a/app/Graph/build.cpp +++ b/app/Graph/build.cpp @@ -4,6 +4,15 @@ using namespace it_lab_ai; +bool LayerFactory::onednn_ = false; + +std::unordered_map model_paths = { + {"alexnet_mnist", MODEL_PATH_H5}, + {"googlenet", MODEL_PATH_GOOGLENET_ONNX}, + {"resnet", MODEL_PATH_RESNET_ONNX}, + {"densenet", MODEL_PATH_DENSENET_ONNX}, + {"yolo", MODEL_PATH_YOLO11NET_ONNX}}; + Graph build_graph_linear(it_lab_ai::Tensor& input, it_lab_ai::Tensor& output, bool comments) { if (comments) { diff --git a/app/Graph/build.hpp b/app/Graph/build.hpp index 7d557ac8..c955394e 100644 --- a/app/Graph/build.hpp +++ b/app/Graph/build.hpp @@ -33,12 +33,7 @@ #include "layers/TransposeLayer.hpp" #include "layers_oneDNN/EWLayer.hpp" -std::unordered_map model_paths = { - {"alexnet_mnist", MODEL_PATH_H5}, - {"googlenet", MODEL_PATH_GOOGLENET_ONNX}, - {"resnet", MODEL_PATH_RESNET_ONNX}, - {"densenet", MODEL_PATH_DENSENET_ONNX}, - {"yolo", MODEL_PATH_YOLO11NET_ONNX}}; +extern std::unordered_map model_paths; struct ParseResult { std::vector> layers; @@ -94,6 +89,4 @@ class LayerFactory { } }; -bool LayerFactory::onednn_ = false; - } // namespace it_lab_ai diff --git a/app/Graph/graph_build.cpp b/app/Graph/graph_build.cpp index 28fffa47..e4a54e66 100644 --- a/app/Graph/graph_build.cpp +++ b/app/Graph/graph_build.cpp @@ -2,7 +2,6 @@ #include #include -#include "build.cpp" #include "build.hpp" namespace fs = std::filesystem; diff --git a/cmake/opencv_config.cmake b/cmake/opencv_config.cmake index e82aa137..7bab5129 100644 --- a/cmake/opencv_config.cmake +++ b/cmake/opencv_config.cmake @@ -1,6 +1,16 @@ set(OPENCV_BUILD_DIR "${CMAKE_BINARY_DIR}/3rdparty/opencv_build") file(MAKE_DIRECTORY "${OPENCV_BUILD_DIR}") +set(_opencv_bin_dir "${OPENCV_BUILD_DIR}/bin") +file(MAKE_DIRECTORY "${_opencv_bin_dir}") +if (WIN32) + foreach(_cfg Debug Release RelWithDebInfo MinSizeRel) + file(MAKE_DIRECTORY "${_opencv_bin_dir}/${_cfg}") + endforeach() +endif() + +unset(_opencv_bin_dir) + execute_process( COMMAND ${CMAKE_COMMAND} -S "${CMAKE_SOURCE_DIR}/3rdparty/opencv" diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index fc95325c..ef597856 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -20,9 +20,13 @@ if (NOT CMAKE_BUILD_TYPE) endif() if (WIN32) + set(OPENCV_BIN_SOURCE "${OPENCV_BUILD_DIR}/bin") + if (MSVC) + set(OPENCV_BIN_SOURCE "${OPENCV_BUILD_DIR}/bin/$") + endif() add_custom_command(TARGET run_test POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy_directory - "${OPENCV_BUILD_DIR}/bin/." + "${OPENCV_BIN_SOURCE}" "${CMAKE_BINARY_DIR}/bin/") endif()