diff --git a/README.md b/README.md index 9e5d9a95..07079be4 100644 --- a/README.md +++ b/README.md @@ -22,7 +22,8 @@ To build and run this project locally on Windows, follow these steps: ```bash mkdir build cd build - cmake .. + cmake .. -DCMAKE_BUILD_TYPE=Release + If you want to build in a debug, change the release to debug ``` *Note: Make sure you have CMake installed to build the project.* 4. **Build the project:** @@ -30,7 +31,6 @@ To build and run this project locally on Windows, follow these steps: ```bash cmake --build . --config Release ``` - If you want to build in a debug, change the release to debug 5. **Run the project** After building the project, you can find the executable file in the following path from the *build* folder ```bash diff --git a/app/Graph/CMakeLists.txt b/app/Graph/CMakeLists.txt index 6948dd48..04447535 100644 --- a/app/Graph/CMakeLists.txt +++ b/app/Graph/CMakeLists.txt @@ -31,18 +31,34 @@ target_link_libraries(Graph_Build BuildGraph) add_executable(ACC_MNIST acc_check_mnist.cpp) target_link_libraries(ACC_MNIST BuildGraph) +if (NOT CMAKE_BUILD_TYPE) + set(CMAKE_BUILD_TYPE "Debug") +endif() + if (WIN32) -add_custom_command(TARGET Graph_Build 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}/") + 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 Graph_Build POST_BUILD + COMMAND ${CMAKE_COMMAND} -E copy_directory + "${CMAKE_SOURCE_DIR}/3rdparty/opencv/build/bin/${CMAKE_BUILD_TYPE}/." + "${CMAKE_BINARY_DIR}/bin/") endif() if (WIN32) -add_custom_command(TARGET ACC_MNIST 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}/") + 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_MNIST POST_BUILD + COMMAND ${CMAKE_COMMAND} -E copy_directory + "${CMAKE_SOURCE_DIR}/3rdparty/opencv/build/bin/${CMAKE_BUILD_TYPE}/." + "${CMAKE_BINARY_DIR}/bin/") endif() file(DOWNLOAD