-
Notifications
You must be signed in to change notification settings - Fork 2
/
CMakeLists.txt
92 lines (67 loc) · 3.11 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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
cmake_minimum_required (VERSION 3.14)
project (GPGPU CUDA CXX)
option(PROF "Reference build" NO)
include(FetchContent)
FetchContent_Declare(
CLI11
URL https://github.com/CLIUtils/CLI11/archive/v1.9.1.tar.gz
)
FetchContent_Declare(
spdlog
URL https://github.com/gabime/spdlog/archive/v1.9.2.tar.gz
)
FetchContent_MakeAvailable(spdlog)
FetchContent_MakeAvailable(CLI11)
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${PROJECT_SOURCE_DIR} )
# find_package(PNG REQUIRED)
find_package(TBB REQUIRED)
find_package(benchmark REQUIRED)
#set(CMAKE_CUDA_ARCHITECTURES "75")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -W -Wall")
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -O3")
include_directories(${PROJECT_SOURCE_DIR}/includes)
add_subdirectory(src)
add_library(utilsimage)
target_compile_features(utilsimage PUBLIC cxx_std_14)
target_sources(utilsimage PRIVATE src/helpers_images.cpp)
##### CPU
add_library(detector_cpu)
target_compile_features(detector_cpu PUBLIC cxx_std_14)
target_link_libraries(detector_cpu PRIVATE spdlog::spdlog utilsimage blurring_cpu openclose_cpu threshold_cpu bbox_cpu)
target_sources(detector_cpu PRIVATE src/cpu/detect_obj_cpu.cpp src/struct_utils.cpp)
##### GPU
add_library(detector_gpu)
target_compile_features(detector_gpu PUBLIC cxx_std_14)
target_link_libraries(detector_gpu PRIVATE spdlog::spdlog utilsimage threshold_gpu bbox_gpu
gray_gpu helpers_gpu blurr_gpu diff_gpu openclose_gpu)
target_sources(detector_gpu PRIVATE src/gpu/detect_obj_gpu.cu)
set_target_properties(detector_gpu PROPERTIES CUDA_SEPARABLE_COMPILATION ON)
# add_library(gpu_test_functions)
# target_compile_features(gpu_test_functions PUBLIC cxx_std_14)
# target_link_libraries(gpu_test_functions PRIVATE utilsimage)
# target_sources(gpu_test_functions PRIVATE src/test_gpu/gpu_functions.hpp src/test_gpu/gpu_functions.cu)
# set_target_properties(gpu_test_functions PROPERTIES CUDA_SEPARABLE_COMPILATION ON)
##### MAIN
# <<<<<<< HEAD
# add_executable(main_gpu_test src/test_gpu/main_gpu_test.cpp)
# target_compile_features(main_gpu_test PUBLIC cxx_std_17)
# target_link_libraries(main_gpu_test PRIVATE gpu_test_functions)
# add_executable(main_cpu src/main_cpu.cpp)
# =======
add_executable(main_cpu src/cpu/main_cpu.cpp)
target_compile_features(main_cpu PUBLIC cxx_std_17)
target_include_directories(main_cpu PRIVATE "includes")
target_link_libraries(main_cpu CLI11::CLI11 spdlog::spdlog detector_cpu utilsimage)
add_executable(main_gpu src/gpu/main_gpu.cpp)
target_compile_features(main_gpu PUBLIC cxx_std_17)
target_include_directories(main_gpu PRIVATE "includes")
target_link_libraries(main_gpu CLI11::CLI11 spdlog::spdlog detector_gpu utilsimage)
##### BENCH
add_executable(bench_cpu src/bench/bench_cpu.cpp)
target_compile_features(bench_cpu PUBLIC cxx_std_17)
target_include_directories(bench_cpu PRIVATE "includes")
target_link_libraries(bench_cpu benchmark::benchmark detector_cpu utilsimage)
add_executable(bench_gpu src/bench/bench_gpu.cpp)
target_compile_features(bench_gpu PUBLIC cxx_std_17)
target_include_directories(bench_gpu PRIVATE "includes")
target_link_libraries(bench_gpu benchmark::benchmark detector_gpu utilsimage)