-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathCMakeLists.txt
38 lines (35 loc) · 1.09 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
CMAKE_MINIMUM_REQUIRED(VERSION 3.0.0)
PROJECT(cpptorch VERSION 0.1.0)
SET(CMAKE_VERBOSE_MAKEFILE ON)
SET(CMAKE_CXX_STANDARD_REQUIRED ON)
SET(CMAKE_CXX_STANDARD 17)
SET(CMAKE_CXX_EXTENSIONS OFF)
FIND_PACKAGE(CUDA REQUIRED)
FIND_PACKAGE(Boost REQUIRED COMPONENTS filesystem system regex)
FIND_PACKAGE(OpenMP REQUIRED)
FIND_PACKAGE(OpenCV REQUIRED core imgcodecs imgproc highgui flann)
FIND_PACKAGE(Torch REQUIRED PATHS "/opt/libtorch/share/cmake/Torch")
FILE(GLOB_RECURSE SRC_FILES "${CMAKE_SOURCE_DIR}/src/*.cpp")
ADD_EXECUTABLE(${PROJECT_NAME} ${SRC_FILES})
TARGET_COMPILE_OPTIONS(${PROJECT_NAME}
PRIVATE ${TORCH_CXX_FLAGS}
PRIVATE "-DC10_USE_GLOG"
PRIVATE ${OpenMP_CXX_FLAGS}
)
TARGET_INCLUDE_DIRECTORIES(${PROJECT_NAME}
PRIVATE ${OpenCV_INCLUDE_DIRS}
PRIVATE ${CUDA_INCLUDE_DIRECTORIES}
PRIVATE ${Boost_INCLUDE_DIRS}
)
TARGET_LINK_OPTIONS(${PROJECT_NAME}
PRIVATE ${OpenMP_EXE_LINKER_FLAGS}
PRIVATE ${OpenMP_CXX_FLAGS}
)
TARGET_LINK_LIBRARIES(${PROJECT_NAME}
PRIVATE ${TORCH_LIBRARIES}
PRIVATE ${OpenCV_LIBRARIES}
PRIVATE ${Boost_LIBRARIES}
PRIVATE -lglog
PRIVATE -ltbb
PRIVATE -lstdc++fs
)