-
Notifications
You must be signed in to change notification settings - Fork 97
/
CMakeLists.txt
112 lines (81 loc) · 2.9 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
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
cmake_minimum_required(VERSION 3.10.0)
# Set path where samples will be installed
set(CMAKE_INSTALL_PREFIX ${CMAKE_SOURCE_DIR} CACHE PATH "Path to where the samples will be installed")
project(NvAR_SDK CXX)
set(CMAKE_CONFIGURATION_TYPES "Release")
# Require C++11 and disable non-standard extensions
set(CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/cmake" ${CMAKE_MODULE_PATH})
if(MSVC)
set(CMAKE_CXX_STANDARD 14)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)
set(SDK_INCLUDES_PATH ${CMAKE_CURRENT_SOURCE_DIR}/nvar/include)
# Add target for nvARPose
add_library(nvARPose INTERFACE)
target_include_directories(nvARPose INTERFACE ${SDK_INCLUDES_PATH})
# Add target for NVCVImage
add_library(NVCVImage INTERFACE)
target_include_directories(NVCVImage INTERFACE ${SDK_INCLUDES_PATH})
else()
set(CMAKE_CXX_STANDARD 14)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -pthread")
# Add target for ARSDK
add_library(nvARPose INTERFACE)
# found in different locations depending on type of package
find_path(ARSDK_INCLUDES
NAMES nvAR.h
PATHS
/usr/local/ARSDK/include
/usr/include/x86_64-linux-gnu
/usr/include
${CMAKE_CURRENT_SOURCE_DIR}/nvar/include
REQUIRED
)
target_include_directories(nvARPose INTERFACE ${ARSDK_INCLUDES})
find_library(ARSDK_LIB
NAMES libnvARPose.so
PATHS
/usr/local/ARSDK/lib
/usr/lib/x86_64-linux-gnu
/usr/lib64
/usr/lib
${CMAKE_CURRENT_SOURCE_DIR}/bin
REQUIRED
NO_DEFAULT_PATH)
target_link_libraries(nvARPose INTERFACE "${ARSDK_LIB}")
message(STATUS "ARSDK_LIB: ${ARSDK_LIB}")
# Add target for NVCVImage
add_library(NVCVImage INTERFACE)
# found in different locations depending on type of package
find_path(NVCVImage_INCLUDES
NAMES nvCVImage.h
PATHS
/usr/local/ARSDK/include
/usr/include/x86_64-linux-gnu
/usr/include
${CMAKE_CURRENT_SOURCE_DIR}/nvar/include
REQUIRED
)
target_include_directories(NVCVImage INTERFACE ${NVCVImage_INCLUDES})
find_library(NVCVImage_LIB
NAMES libNVCVImage.so
PATHS
/usr/local/ARSDK/lib
/usr/lib/x86_64-linux-gnu
/usr/lib64
/usr/lib
${CMAKE_CURRENT_SOURCE_DIR}/bin
REQUIRED
NO_DEFAULT_PATH)
target_link_libraries(NVCVImage INTERFACE "${NVCVImage_LIB}")
message(STATUS "NVCVImage_LIB: ${NVCVImage_LIB}")
message(STATUS "NVCVImage_INCLUDES_PATH: ${NVCVImage_INCLUDES}")
endif()
add_definitions(-DNOMINMAX -DWIN32_LEAN_AND_MEAN)
# Set common build path for all targets
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR})
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR})
set(ENABLE_SAMPLES TRUE)
add_subdirectory(samples)