-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
65 lines (53 loc) · 1.67 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
cmake_minimum_required(VERSION 3.10)
project(int8_calibrator_cpp)
# Set C++ standard
set(CMAKE_CXX_STANDARD 14)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
SET(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${CMAKE_CURRENT_SOURCE_DIR}/cmake)
# Find TensorRT
find_package(TensorRT REQUIRED)
message(STATUS "TensorRT Version: ${TensorRT_VERSION_STRING}")
message(STATUS "Find TensorRT include at ${TensorRT_INCLUDE_DIRS}")
message(STATUS "Find TensorRT libraries: ${TensorRT_LIBRARIES}")
# Find Threads
find_package(Threads)
# Find OpenCV
find_package(OpenCV REQUIRED)
# CUDA
find_package(CUDA REQUIRED)
message(STATUS "Find CUDA include at ${CUDA_INCLUDE_DIRS}")
message(STATUS "Find CUDA libraries: ${CUDA_LIBRARIES}")
include_directories(
${PROJECT_SOURCE_DIR}/include
${OpenCV_INCLUDE_DIRS}
${CUDA_INCLUDE_DIRS}
${TensorRT_INCLUDE_DIRS}
${TensorRT_SAMPLE_DIR}/common
)
link_directories(
${OpenCV_LIBS}
${CUDA_LIBRARIES}
${TensorRT_LIBRARIES}
)
# Define source files
file(GLOB My_Source_Files ${PROJECT_SOURCE_DIR}/src/*.cpp)
file(GLOB My_Include_Files ${PROJECT_SOURCE_DIR}/include/*.h)
# Add executable
add_executable(int8_calibrator_cpp ${My_Source_Files} ${My_Include_Files})
# Include directories
target_include_directories(int8_calibrator_cpp PUBLIC
${PROJECT_SOURCE_DIR}/include
${OpenCV_INCLUDE_DIRS}
${CUDA_INCLUDE_DIRS}
${TensorRT_INCLUDE_DIRS}
${TensorRT_SAMPLE_DIR}/common
)
# Link libraries
target_link_libraries(int8_calibrator_cpp PUBLIC
${OpenCV_LIBS}
${CUDA_LIBRARIES}
${CMAKE_THREAD_LIBS_INIT}
${TensorRT_LIBRARIES}
)
# Set C++ flags
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++14 -Wall -Ofast -Wfatal-errors")