-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathCMakeLists.txt
72 lines (54 loc) · 2.58 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
cmake_minimum_required(VERSION 2.8)
project(demo)
set(CMAKE_BUILD_TYPE Release)
# set(CMAKE_BUILD_TYPE Debug)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -Wall -Ofast -Wfatal-errors")
#add python
FIND_PACKAGE(PythonInterp 3)
FIND_PACKAGE(PythonLibs 3)
#add wrapper
set(TRT_WRAPPER_DIR ${CMAKE_CURRENT_SOURCE_DIR}/tensorRTWrapper/code)
add_subdirectory(${TRT_WRAPPER_DIR})
include_directories(${TRT_WRAPPER_DIR}/include)
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/include)
set(SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/src)
#add opencv
FIND_PACKAGE(OpenCV REQUIRED)
include_directories(${OpenCV_INCLUDE_DIRS})
# message(${OpenCV_INCLUDE_DIRS})
link_directories(${OpenCV_LIBRARIES_DIRS})
# message(${OpenCV_LIBRARIES_DIRS})
# find and set Boost packages
set(Boost_USE_STATIC_LIBS ON)
set(Boost_USE_MULTITHREADED ON)
set(Boost_USE_STATIC_RUNTIME OFF)
find_package(Boost REQUIRED COMPONENTS system filesystem)
# Build our library
#add_library( yolotrt SHARED inference.cpp eval.cpp dataReader.cpp)
# Define the wrapper library that wraps our library
#add_library( yolotrt_ext SHARED inference_ext.cpp )
#target_link_libraries( yolotrt_ext ${Boost_LIBRARIES} yolotrt )
# don't prepend wrapper library name with lib
#set_target_properties( yolotrt_ext PROPERTIES PREFIX "" )
#build runYolov3
add_executable(runYolov3 ${SOURCE_DIR}/main_infer.cpp ${SOURCE_DIR}/inference.cpp ${SOURCE_DIR}/eval.cpp ${SOURCE_DIR}/dataReader.cpp ${SOURCE_DIR}/get_latest.cpp)
target_link_libraries(runYolov3 TrtNet ${OpenCV_LIBS})
# link boost libraries
if(Boost_FOUND)
include_directories(${Boost_INCLUDE_DIRS})
target_link_libraries(runYolov3 ${Boost_FILESYSTEM_LIBRARY} ${Boost_SYSTEM_LIBRARY})
endif()
install(TARGETS runYolov3 DESTINATION ${CMAKE_CURRENT_SOURCE_DIR}/install/)
#build createEngine
add_executable(createEngine ${SOURCE_DIR}/main.cpp ${SOURCE_DIR}/inference.cpp ${SOURCE_DIR}/eval.cpp ${SOURCE_DIR}/dataReader.cpp)
target_link_libraries(createEngine TrtNet ${OpenCV_LIBS})
install(TARGETS createEngine DESTINATION ${CMAKE_CURRENT_SOURCE_DIR}/install/)
# this is purely for testing (getting second latest file)
add_executable(getSecondLatest ${SOURCE_DIR}/main_gl.cpp ${SOURCE_DIR}/inference.cpp ${SOURCE_DIR}/eval.cpp ${SOURCE_DIR}/dataReader.cpp ${SOURCE_DIR}/get_latest.cpp)
target_link_libraries(getSecondLatest TrtNet ${OpenCV_LIBS})
# link boost libraries
if(Boost_FOUND)
include_directories(${Boost_INCLUDE_DIRS})
target_link_libraries(getSecondLatest ${Boost_FILESYSTEM_LIBRARY} ${Boost_SYSTEM_LIBRARY})
endif()
install(TARGETS getSecondLatest DESTINATION ${CMAKE_CURRENT_SOURCE_DIR}/install/)