Skip to content

Commit

Permalink
Cmakes
Browse files Browse the repository at this point in the history
  • Loading branch information
NeiroYT committed Nov 28, 2024
1 parent a697ad1 commit 7055552
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 48 deletions.
18 changes: 0 additions & 18 deletions app/Accuracy/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,14 +1,3 @@
file(MAKE_DIRECTORY "${CMAKE_SOURCE_DIR}/3rdparty/opencv/build")

execute_process(
COMMAND ${CMAKE_COMMAND} -S "${CMAKE_SOURCE_DIR}/3rdparty/opencv" -B "${CMAKE_SOURCE_DIR}/3rdparty/opencv/build" -DCMAKE_C_COMPILER_LAUNCHER=${CMAKE_C_COMPILER_LAUNCHER} -DCMAKE_CXX_COMPILER_LAUNCHER=${CMAKE_CXX_COMPILER_LAUNCHER} -DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE} -DBUILD_PERF_TESTS=OFF -DBUILD_TESTS=OFF -DBUILD_opencv_apps=OFF
WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}/3rdparty/opencv/build"
)
execute_process(
COMMAND ${CMAKE_COMMAND} --build "${CMAKE_SOURCE_DIR}/3rdparty/opencv/build" --config "${CMAKE_BUILD_TYPE}"
WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}/3rdparty/opencv/build"
)

set(INCLUDE_HEADERS "${CMAKE_CURRENT_SOURCE_DIR}/acc.hpp")
set(SRC_FILES "${CMAKE_CURRENT_SOURCE_DIR}/acc.cpp")
add_library(ACCLib STATIC ${INCLUDE_HEADERS} ${SRC_FILES})
Expand All @@ -25,13 +14,6 @@ target_link_libraries( ACCLib gtest_main)
add_executable(Accuracy_Check accuracy_check.cpp)
target_link_libraries(Accuracy_Check ACCLib)

if (WIN32)
add_custom_command(TARGET Accuracy_Check POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy_directory
"${CMAKE_SOURCE_DIR}/3rdparty/opencv/build/bin/${CMAKE_BUILD_TYPE}"
"${CMAKE_BINARY_DIR}/app/ReaderImage/${CMAKE_BUILD_TYPE}/")
endif()

file(DOWNLOAD
"https://raw.githubusercontent.com/opencv/opencv/4.x/samples/data/lena.jpg"
"${CMAKE_CURRENT_BINARY_DIR}/image.jpg"
Expand Down
18 changes: 0 additions & 18 deletions app/AccuracyImgNet/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,14 +1,3 @@
file(MAKE_DIRECTORY "${CMAKE_SOURCE_DIR}/3rdparty/opencv/build")

execute_process(
COMMAND ${CMAKE_COMMAND} -S "${CMAKE_SOURCE_DIR}/3rdparty/opencv" -B "${CMAKE_SOURCE_DIR}/3rdparty/opencv/build" -DCMAKE_C_COMPILER_LAUNCHER=${CMAKE_C_COMPILER_LAUNCHER} -DCMAKE_CXX_COMPILER_LAUNCHER=${CMAKE_CXX_COMPILER_LAUNCHER} -DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE} -DBUILD_PERF_TESTS=OFF -DBUILD_TESTS=OFF -DBUILD_opencv_apps=OFF
WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}/3rdparty/opencv/build"
)
execute_process(
COMMAND ${CMAKE_COMMAND} --build "${CMAKE_SOURCE_DIR}/3rdparty/opencv/build" --config "${CMAKE_BUILD_TYPE}"
WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}/3rdparty/opencv/build"
)

add_executable(ACCImgNet accimgnet.cpp)

find_package( OpenCV REQUIRED PATHS "${CMAKE_SOURCE_DIR}/3rdparty/opencv/build" )
Expand All @@ -17,10 +6,3 @@ target_link_libraries( ACCImgNet ${OpenCV_LIBS} )
target_link_libraries( ACCImgNet TBB::tbb)
target_link_libraries( ACCImgNet layers_lib)
target_link_libraries( ACCImgNet gtest_main)

if (WIN32)
add_custom_command(TARGET ACCImgNet POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy_directory
"${CMAKE_SOURCE_DIR}/3rdparty/opencv/build/bin/${CMAKE_BUILD_TYPE}"
"${CMAKE_BINARY_DIR}/app/ACCImgNet/${CMAKE_BUILD_TYPE}/")
endif()
4 changes: 4 additions & 0 deletions app/AccuracyImgNet/accimgnet.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,10 @@ void check_accuracy(std::string neural_network_path, std::string dataset_path,
Tensor output;
InputLayer inlayer;
OutputLayer outlayer;
// ?? warning from linux
outlayer.setID(1);
inlayer.setID(0);
//
size_t k = 5;
for (size_t i = 0; i < imgs_size; i++) {
process_image(input,
Expand Down
7 changes: 0 additions & 7 deletions app/ReaderImage/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,6 @@ target_link_libraries( ReadLib TBB::tbb)
add_executable(Reader reader_img.cpp)
target_link_libraries(Reader ReadLib)

if (WIN32)
add_custom_command(TARGET Reader POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy_directory
"${CMAKE_SOURCE_DIR}/3rdparty/opencv/build/bin/${CMAKE_BUILD_TYPE}"
"${CMAKE_BINARY_DIR}/app/ReaderImage/${CMAKE_BUILD_TYPE}/")
endif()

file(DOWNLOAD
"https://raw.githubusercontent.com/opencv/opencv/4.x/samples/data/lena.jpg"
"${CMAKE_CURRENT_BINARY_DIR}/image.jpg"
Expand Down
16 changes: 11 additions & 5 deletions test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,20 @@ target_link_libraries(run_test PUBLIC reader_lib)

target_include_directories(run_test PRIVATE "${CMAKE_SOURCE_DIR}/app/ReaderImage")

if (NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE "Debug")
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 run_test POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy_directory
"${CMAKE_SOURCE_DIR}/3rdparty/opencv/build/bin/${CMAKE_BUILD_TYPE}/Debug/."
"${CMAKE_BINARY_DIR}/bin/")
add_custom_command(TARGET run_test POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy_directory
"${CMAKE_SOURCE_DIR}/3rdparty/opencv/build/bin/${CMAKE_BUILD_TYPE}/Release/."
"${CMAKE_SOURCE_DIR}/3rdparty/opencv/build/bin/${CMAKE_BUILD_TYPE}/."
"${CMAKE_BINARY_DIR}/bin/")
endif()

Expand Down

0 comments on commit 7055552

Please sign in to comment.