-
Notifications
You must be signed in to change notification settings - Fork 19
/
CMakeLists.txt
39 lines (29 loc) · 1.21 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
cmake_minimum_required(VERSION 3.0)
project(SegmentAnything-OnnxRunner)
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
if (MSVC)
# Set the MSVC input code encoding format to utf-8
set(CMAKE_C_FLAGS /source-charset:utf-8)
endif()
message(STATUS "Project: SegmentAnything-OnnxRunner")
message(STATUS "Root Path: ${CMAKE_SOURCE_DIR}")
include(cmake/platform.cmake) # checking platform
# link third-party library onnxruntime-win-x64-1.14.1 and opencv4
set(ONNXRUNTIME_DIR ${CMAKE_SOURCE_DIR}/third_party/onnxruntime-win-x64-1.14.1)
message(STATUS "ONNXRUNTIME_DIR Path: ${ONNXRUNTIME_DIR}")
include_directories(${ONNXRUNTIME_DIR}/include)
link_directories("${ONNXRUNTIME_DIR}/lib")
set(ONNXRUNTIME_LIB onnxruntime onnxruntime_providers_shared)
set(OPENCV_DIR ${CMAKE_SOURCE_DIR}/third_party/opencv480/build)
message(STATUS "OPENCV_DIR Path: ${OPENCV_DIR}")
include_directories(${OpenCV_INCLUDE_DIRS})
include_directories(${OPENCV_DIR}/include)
link_directories("${OPENCV_DIR}/x64/vc16/lib")
set(OpenCV_LIB opencv_world480)
# compile own file
file(GLOB SRC_LIST
${CMAKE_SOURCE_DIR}/src/*.cpp
)
add_executable(main ${SRC_LIST})
target_link_libraries(main ${OpenCV_LIB} ${ONNXRUNTIME_LIB} ${OpenCV_LIBS})