-
Notifications
You must be signed in to change notification settings - Fork 43
/
Copy pathCMakeLists.txt
47 lines (38 loc) · 1.64 KB
/
CMakeLists.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
cmake_minimum_required(VERSION 3.4.3)
project(openvino_practice CXX)
find_package(InferenceEngine REQUIRED)
find_package(OpenCV REQUIRED)
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib)
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib)
add_subdirectory(3rdparty/gtest)
add_definitions(-DDATA_FOLDER="${PROJECT_SOURCE_DIR}/data")
file(GLOB modules "modules/*")
foreach(module ${modules})
get_filename_component(module_name ${module} NAME)
string(REGEX REPLACE "[0-9]+_" "" module_name ${module_name})
# Build library
file(GLOB SOURCES "${module}/src/*.cpp")
if (SOURCES)
add_library(module_${module_name} STATIC ${SOURCES})
target_include_directories(module_${module_name} PUBLIC "${module}/include")
target_link_libraries(module_${module_name} PUBLIC ${OpenCV_LIBRARIES} ${InferenceEngine_LIBRARIES})
endif()
# Compile test
file(GLOB TEST_SOURCES "${module}/test/*.cpp")
if (TEST_SOURCES)
add_executable(test_${module_name} "${TEST_SOURCES}")
target_include_directories(test_${module_name} PRIVATE "${PROJECT_SOURCE_DIR}/3rdparty/")
target_link_libraries(test_${module_name} PRIVATE gtest module_${module_name})
if (UNIX)
target_link_libraries(test_${module_name} PRIVATE pthread)
endif()
endif()
file(GLOB PYTEST_FILE "${module}/test_${module_name}.py")
if (PYTEST_FILE)
execute_process(
COMMAND ${CMAKE_COMMAND} -E copy
${PYTEST_FILE}
${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/test_${module_name})
endif()
endforeach()